appclient.sh 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #!/bin/sh
  2. DIRNAME=`dirname "$0"`
  3. PROGNAME=`basename "$0"`
  4. GREP="grep"
  5. # Use the maximum available, or set MAX_FD != -1 to use that
  6. MAX_FD="maximum"
  7. # OS specific support (must be 'true' or 'false').
  8. cygwin=false;
  9. darwin=false;
  10. linux=false;
  11. case "`uname`" in
  12. CYGWIN*)
  13. cygwin=true
  14. ;;
  15. Darwin*)
  16. darwin=true
  17. ;;
  18. Linux)
  19. linux=true
  20. ;;
  21. esac
  22. # Read an optional running configuration file
  23. if [ "x$RUN_CONF" = "x" ]; then
  24. RUN_CONF="$DIRNAME/appclient.conf"
  25. fi
  26. if [ -r "$RUN_CONF" ]; then
  27. . "$RUN_CONF"
  28. fi
  29. # For Cygwin, ensure paths are in UNIX format before anything is touched
  30. if $cygwin ; then
  31. [ -n "$JBOSS_HOME" ] &&
  32. JBOSS_HOME=`cygpath --unix "$JBOSS_HOME"`
  33. [ -n "$JAVA_HOME" ] &&
  34. JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
  35. [ -n "$JAVAC_JAR" ] &&
  36. JAVAC_JAR=`cygpath --unix "$JAVAC_JAR"`
  37. fi
  38. # Setup JBOSS_HOME
  39. RESOLVED_JBOSS_HOME=`cd "$DIRNAME/.."; pwd`
  40. if [ "x$JBOSS_HOME" = "x" ]; then
  41. # get the full path (without any relative bits)
  42. JBOSS_HOME=$RESOLVED_JBOSS_HOME
  43. else
  44. SANITIZED_JBOSS_HOME=`cd "$JBOSS_HOME"; pwd`
  45. if [ "$RESOLVED_JBOSS_HOME" != "$SANITIZED_JBOSS_HOME" ]; then
  46. echo "WARNING JBOSS_HOME may be pointing to a different installation - unpredictable results may occur."
  47. echo ""
  48. fi
  49. fi
  50. export JBOSS_HOME
  51. # Setup the JVM
  52. if [ "x$JAVA" = "x" ]; then
  53. if [ "x$JAVA_HOME" != "x" ]; then
  54. JAVA="$JAVA_HOME/bin/java"
  55. else
  56. JAVA="java"
  57. fi
  58. fi
  59. # Check for -d32/-d64 in JAVA_OPTS
  60. JVM_OPTVERSION="-version"
  61. JVM_D64_OPTION=`echo $JAVA_OPTS | $GREP "\-d64"`
  62. JVM_D32_OPTION=`echo $JAVA_OPTS | $GREP "\-d32"`
  63. test "x$JVM_D64_OPTION" != "x" && JVM_OPTVERSION="-d64 $JVM_OPTVERSION"
  64. test "x$JVM_D32_OPTION" != "x" && JVM_OPTVERSION="-d32 $JVM_OPTVERSION"
  65. # If -server not set in JAVA_OPTS, set it, if supported
  66. SERVER_SET=`echo $JAVA_OPTS | $GREP "\-server"`
  67. if [ "x$SERVER_SET" = "x" ]; then
  68. # Check for SUN(tm) JVM w/ HotSpot support
  69. if [ "x$HAS_HOTSPOT" = "x" ]; then
  70. HAS_HOTSPOT=`"$JAVA" $JVM_OPTVERSION -version 2>&1 | $GREP -i HotSpot`
  71. fi
  72. # Check for OpenJDK JVM w/server support
  73. if [ "x$HAS_OPENJDK_" = "x" ]; then
  74. HAS_OPENJDK=`"$JAVA" $JVM_OPTVERSION 2>&1 | $GREP -i OpenJDK`
  75. fi
  76. # Enable -server if we have Hotspot or OpenJDK, unless we can't
  77. if [ "x$HAS_HOTSPOT" != "x" -o "x$HAS_OPENJDK" != "x" ]; then
  78. # MacOS does not support -server flag
  79. if [ "$darwin" != "true" ]; then
  80. JAVA_OPTS="-server $JAVA_OPTS"
  81. JVM_OPTVERSION="-server $JVM_OPTVERSION"
  82. fi
  83. fi
  84. else
  85. JVM_OPTVERSION="-server $JVM_OPTVERSION"
  86. fi
  87. if [ "x$JBOSS_MODULEPATH" = "x" ]; then
  88. JBOSS_MODULEPATH="$JBOSS_HOME/modules"
  89. fi
  90. # For Cygwin, switch paths to Windows format before running java
  91. if $cygwin; then
  92. JBOSS_HOME=`cygpath --path --windows "$JBOSS_HOME"`
  93. JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
  94. JBOSS_CLASSPATH=`cygpath --path --windows "$JBOSS_CLASSPATH"`
  95. JBOSS_ENDORSED_DIRS=`cygpath --path --windows "$JBOSS_ENDORSED_DIRS"`
  96. JBOSS_MODULEPATH=`cygpath --path --windows "$JBOSS_MODULEPATH"`
  97. fi
  98. CLASSPATH="$CLASSPATH:$JBOSS_HOME/jboss-modules.jar"
  99. # Execute the JVM in the foreground
  100. eval \"$JAVA\" $JAVA_OPTS \
  101. -cp "$CLASSPATH" \
  102. \"-Dorg.jboss.boot.log.file=$JBOSS_HOME/appclient/log/appclient.log\" \
  103. \"-Dlogging.configuration=file:$JBOSS_HOME/appclient/configuration/logging.properties\" \
  104. org.jboss.modules.Main \
  105. -mp \"${JBOSS_MODULEPATH}\" \
  106. -jaxpmodule javax.xml.jaxp-provider \
  107. org.jboss.as.appclient \
  108. -Djboss.home.dir=\"$JBOSS_HOME\" \
  109. -Djboss.server.base.dir=\"$JBOSS_HOME/appclient\" \
  110. '"$@"'
  111. JBOSS_STATUS=$?
  112. exit $JBOSS_STATUS