aboutsummaryrefslogtreecommitdiffstats
path: root/mdbc-server/src/main/shell
diff options
context:
space:
mode:
authorRob Daugherty <rd472p@att.com>2018-11-05 10:23:04 -0500
committerRob Daugherty <rd472p@att.com>2018-11-05 10:33:13 -0500
commit95d22d7491ea365fdc4525e44d484c73c33e16a1 (patch)
treea5fdb7de3f14b345db760463cec8cee130b5b116 /mdbc-server/src/main/shell
parent8dca3aebe55502ab35402da6ec7123bd3de7694d (diff)
Modularized mdbc build
The mdbc pom should inherit from oparent. The top-level pom should not build the jar directly. It should be a parent pom for mdbc submodules. The first submodule will be called mdbc-server. Note: the "mdbc" jar will now be called "mdbc-server". Change-Id: I4456e659b7494641e5b3cefd540eb62a149b79a4 Issue-ID: MUSIC-175 Signed-off-by: Rob Daugherty <rd472p@att.com>
Diffstat (limited to 'mdbc-server/src/main/shell')
-rwxr-xr-xmdbc-server/src/main/shell/mk_jboss_module57
-rwxr-xr-xmdbc-server/src/main/shell/run_h2_server27
2 files changed, 84 insertions, 0 deletions
diff --git a/mdbc-server/src/main/shell/mk_jboss_module b/mdbc-server/src/main/shell/mk_jboss_module
new file mode 100755
index 0000000..7bbb8d9
--- /dev/null
+++ b/mdbc-server/src/main/shell/mk_jboss_module
@@ -0,0 +1,57 @@
+#!/bin/bash
+#
+# mk_jboss_module -- This script builds a JBoss module for MDBC. It should be run directly
+# in the directory containing the MDBC code. It will build the MDBC jar file (under
+# target/mdbc-jboss-module.tar), and then construct a tar file containing MDBC and all of
+# its dependencies, as well as other files needed for a JBoss module.
+#
+# To install the module: untar the tar file on the server in the JBOSS_DIR/modules directory.
+#
+
+if [ ! -f pom.xml ]
+then
+ echo mk_jboss_module: Where is pom.xml?
+ exit 1
+fi
+
+mvn -Dmaven.test.skip=true package
+if [ $? != 0 ]
+then
+ echo mk_jboss_module: maven failed...
+ exit 1
+fi
+
+T=/tmp/mk_jboss_module$$
+T2=$T/org/onap/music/mdbc/main
+MODULE=$T2/module.xml
+TARGET=`pwd`/target/mdbc-jboss-module.tar
+JARS=$( mvn dependency:build-classpath | grep -v INFO | tr : '\012' )
+
+mkdir -p $T2
+cp $JARS $T2
+cp target/mdbc-0.0.1-SNAPSHOT.jar $T2
+JAR2=$( cd $T2; ls *.jar )
+
+cat > $MODULE <<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Note: This module includes a copy of the H2 database, rather than depending on the
+ com.h2database.h2 module included with JBoss, because I could not get that copy to work.
+-->
+<module xmlns="urn:jboss:module:1.1" name="org.onap.music.mdbc">
+ <resources>
+EOF
+for i in $JAR2; do echo " <resource-root path=\"$i\"/>"; done >> $MODULE
+cat >> $MODULE <<EOF
+ </resources>
+ <dependencies>
+ <module name="javax.api"/>
+ <module name="sun.jdk"/>
+ </dependencies>
+</module>
+EOF
+chmod 444 $T2/*.jar $MODULE
+
+mkdir -p target
+(cd $T; tar cf $TARGET com )
+rm -fr $T
diff --git a/mdbc-server/src/main/shell/run_h2_server b/mdbc-server/src/main/shell/run_h2_server
new file mode 100755
index 0000000..9b14e63
--- /dev/null
+++ b/mdbc-server/src/main/shell/run_h2_server
@@ -0,0 +1,27 @@
+#!/bin/bash
+#
+# run_h2_server -- This script starts the H2 DB server with all necessary jar files.
+# It should be run in the directory containing the MDBC code.
+#
+
+POM=pom-h2server.xml
+
+if [ ! -f $POM ]
+then
+ echo mk_jboss_module: Where is $POM?
+ exit 1
+fi
+
+mvn -f $POM -Dmaven.test.skip=true install
+if [ $? != 0 ]
+then
+ echo mk_jboss_module: maven failed...
+ exit 1
+fi
+
+export CLASSPATH=$( mvn -f $POM dependency:build-classpath | grep -v INFO )
+echo CLASSPATH is:
+echo $CLASSPATH | tr : '\012'
+
+cd /tmp
+java org.h2.tools.Server