Skip to content
Browse files

install script: added better option handling, injected axiom-home int…

…o init.d script, generate symlink in /usr/bin; removed redundant dependencies, changed shutdown channel logging to use debug threshold
  • Loading branch information...
1 parent 6e9cd5b commit 221ddcf079aebb55e0f1a7d948a47f05829700f6 @hyperthunk committed
Showing with 53 additions and 72 deletions.
  1. +2 −0 .gitignore
  2. +0 −8 TODO
  3. +0 −42 axiom-core/pom.xml
  4. +3 −3 axiom-core/src/main/java/org/axiom/service/ShutdownChannel.java
  5. +1 −1 axiom-server/pom.xml
  6. +46 −17 install.sh
  7. +1 −1 src/scripts/axiom-server.sh
View
2 .gitignore
@@ -1,5 +1,7 @@
.coverage
+NOTES
*.kpf
+*.bak
*.pyc
*.beam
*.o
View
8 TODO
@@ -10,12 +10,6 @@
- if they are (both easy to access/find in the runtime object graph
- if they can be serialized without much hassle - we should put this in for completeness
- otherwise it is a prioritization that doesn' need to take place in the first few weeks of Beta.
- - axiom-server
- * - add an 'axiom-server' child project and in it:
- * - create a default entry point so the jar is executable
- - wire the main method with commons-cli so that argument handling is well tested
- - have the main method work out the args and start a ControlChannel using a BootstrapRouteLoader
- - write an axiom mojo so you can run `mvn axiom:deploy axiom:run`
- add an 'axiom-client' project
- decide on how
- a jar and Main.java that just wrap around a jruby script is probably the most consistent approach
@@ -24,8 +18,6 @@
- misc
- move direct junit4 dependencies out of the poms
- get either the cobertura or emma plugins working (they currently seem to break the build)
- - get maven-assembly-plugin set up to create a proper (usable) bundle of jars and scripts
- set up profiles so you can build and package (for distribution) individual components
- - find somewhere to host binaries for downloading, perhaps sourceforge.
- start writing some documentation on github/wiki
View
42 axiom-core/pom.xml
@@ -41,51 +41,9 @@
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-jms</artifactId>
- <version>${camel.version}</version>
- </dependency>
- <!-- xbean is required for ActiveMQ broker configuration in the spring xml file -->
- <dependency>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-spring</artifactId>
- <version>3.2</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.ws.commons.schema</groupId>
- <artifactId>XmlSchema</artifactId>
- <version>1.3.2</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>activemq-core</artifactId>
- <version>${activemq.version}</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.camel</groupId>
<artifactId>camel-jetty</artifactId>
<version>${camel.version}</version>
- <scope>test</scope>
</dependency>
-
<!-- log4j specific jar is in here just for testing purposes -->
<dependency>
<groupId>log4j</groupId>
View
6 axiom-core/src/main/java/org/axiom/service/ShutdownChannel.java
@@ -65,10 +65,10 @@ public boolean isShutdown() {
*/
public boolean waitShutdown(final long timeout) {
try {
- log.info("Entering wait shutdown ({}ms timeout).", timeout);
+ log.debug("Entering wait shutdown ({}ms timeout).", timeout);
final boolean wasShutdown = latch.await(timeout, TimeUnit.MILLISECONDS);
if (!wasShutdown) {
- log.info("Wait Shutdown timed out after {}ms.", timeout);
+ log.debug("Wait Shutdown timed out after {}ms.", timeout);
}
return wasShutdown;
} catch (InterruptedException e) {
@@ -82,7 +82,7 @@ public boolean waitShutdown(final long timeout) {
*/
public void waitShutdown() {
try {
- log.info("Entering wait shutdown.");
+ log.debug("Entering wait shutdown.");
latch.await();
} catch (InterruptedException e) {
throw new LifecycleException(e.getLocalizedMessage(), e);
View
2 axiom-server/pom.xml
@@ -58,7 +58,7 @@
<dependency>
<groupId>org.axiom</groupId>
<artifactId>axiom-core</artifactId>
- <version>0.3.0</version>
+ <version>${axiom.version}</version>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
View
63 install.sh
@@ -44,28 +44,38 @@ ensure_dir() {
fi
}
-#x="--dest=/usr/local/axiom"
-#if [[ $x == *--dest=* ]]; then
-# x=${x:7}
-#fi
-#echo $x
+if [[ "$1" == *--help* ]]; then
+ echo "install.sh [Options]"
+ echo "--dest Destination folder (default = /opt/axiom)"
+ echo "--home Axiom Home folder (default = $INSTALL/.axiom)"
+ echo "--bin Location for the executable script (optional, default = /usr/bin)"
+ exit 1
+fi
INSTALL_DIR=/opt/axiom
-if [ "$1" ]; then
- INSTALL_DIR="$1"
-fi
-if ensure_dir $INSTALL_DIR; then
+AXIOM_HOME="$INSTALL_DIR/.axiom"
+EXECUTABLE_PATH=/usr/bin
+
+for arg in $@; do
+ if [[ $arg == *--dest=* ]]; then
+ INSTALL_DIR=${arg:7}
+ fi
+ if [[ $arg == *--home=* ]]; then
+ AXIOM_HOME=${arg:7}
+ fi
+ if [[ $arg == *--bin=* ]]; then
+ EXECUTABLE_PATH=${arg:6}
+ fi
+done
+
+if ensure_dir "$INSTALL_DIR"; then
echo "Installing axiom to $INSTALL_DIR."
else
echo "Cancelling installation."
exit 1 # TODO: use the correct exit code
fi
-AXIOM_HOME=~/.axiom
-if [ "$2" ]; then
- AXIOM_HOME="$2"
-fi
-if ensure_dir $AXIOM_HOME; then
+if ensure_dir "$AXIOM_HOME"; then
echo "Setting axiom home to $AXIOM_HOME."
else
echo "Cancelling installation."
@@ -83,17 +93,36 @@ cp config/log4j.properties "$AXIOM_HOME/endorsed/"
# link the app distribution to the home directory
ln -s "$INSTALL_DIR" "$AXIOM_HOME/dist"
+# make a symlink to the startup script in /usr/bin (or equiv)
+ln -s "$INSTALL_DIR/bin/axiom-server.sh" "$EXECUTABLE_PATH/axiom"
+
for d in 'lib' 'bin'; do
if cp -r "$d" "$INSTALL_DIR/"; then
echo "cp -r $d $INSTALL_DIR/"
+ else
+ echo "Failed to copy $d to $INSTALL_DIR/"
+ echo "Cancelling installation."
+ rm -drf "$INSTALL_DIR $AXIOM_HOME"
+ exit 1
fi
done
-echo "Installing init.d script to $INIT_DIR"
-#x=ensure_dir "$INIT_DIR"
+echo $AXIOM_HOME | sed 's/\//\\\//g' | awk '/.*/ { print $0 }' >> tmpfile
+home=`cat tmpfile`
+rm tmpfile
+
+# overwrite the original launch/init.d script with the actual home folder location
+echo "sed -E -i .bak s/AXIOM_HOME=%AXIOM_HOME%/AXIOM_HOME=$home/ $INSTALL_DIR/bin/axiom-server.sh"
+sed -E -i ".bak" "s/AXIOM_HOME=%AXIOM_HOME%/AXIOM_HOME=$home/" "$INSTALL_DIR/bin/axiom-server.sh"
+
+# TODO: find a way to do this that isn't platform specific
+# TODO: generate a launchd script (interpolating settings using sed?) for osx
+
+# echo "Installing init.d script to $INIT_DIR"
+# x=ensure_dir "$INIT_DIR"
if true; then
echo "Failed to install init.d script. This can be installed manually later on."
- echo "Installation complete. You can start the server by running $INSTALL_DIR/bin/startup.sh"
+ echo "Installation complete. You can start the server by running $INSTALL_DIR/bin/axiom-server.sh start"
else
echo "Installation complete. You can start the server by running '> $INIT_DIR start'"
fi
View
2 src/scripts/axiom-server.sh
@@ -38,7 +38,7 @@
# You may wish to modify these variables to suit your local configuration
# AXIOM_HOME Location of the Axiom Test Framework home folder
-AXIOM_HOME=~/.axiom
+AXIOM_HOME=%AXIOM_HOME%
#
# Set this AXIOM_HOME value if you want the Axiom Test Framework
# to use a location other than the default ~/.axiom as its home folder

0 comments on commit 221ddcf

Please sign in to comment.
Something went wrong with that request. Please try again.