[jboss-cvs] JBossAS SVN: r64576 - in trunk: bootstrap and 49 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Aug 14 11:48:45 EDT 2007
Author: adrian at jboss.org
Date: 2007-08-14 11:48:44 -0400 (Tue, 14 Aug 2007)
New Revision: 64576
Added:
trunk/bootstrap/
trunk/bootstrap/.classpath
trunk/bootstrap/.project
trunk/bootstrap/build.bat
trunk/bootstrap/build.sh
trunk/bootstrap/build.xml
trunk/bootstrap/src/
trunk/bootstrap/src/etc/
trunk/bootstrap/src/etc/default.mf
trunk/bootstrap/src/main/
trunk/bootstrap/src/main/org/
trunk/bootstrap/src/main/org/jboss/
trunk/bootstrap/src/main/org/jboss/bootstrap/
trunk/bootstrap/src/main/org/jboss/bootstrap/AbstractServerImpl.java
trunk/bootstrap/src/main/org/jboss/bootstrap/BaseServerConfig.java
trunk/bootstrap/src/main/org/jboss/bootstrap/SecurityActions.java
trunk/bootstrap/src/main/org/jboss/bootstrap/microcontainer/
trunk/bootstrap/src/main/org/jboss/bootstrap/microcontainer/ServerImpl.java
trunk/bootstrap/src/main/org/jboss/bootstrap/spi/
trunk/bootstrap/src/main/org/jboss/bootstrap/spi/Bootstrap.java
trunk/main/
trunk/main/.classpath
trunk/main/.project
trunk/main/build.bat
trunk/main/build.sh
trunk/main/build.xml
trunk/main/src/
trunk/main/src/bin/
trunk/main/src/bin/classpath.sh
trunk/main/src/bin/probe.bat
trunk/main/src/bin/probe.sh
trunk/main/src/bin/run.bat
trunk/main/src/bin/run.conf
trunk/main/src/bin/run.sh
trunk/main/src/etc/
trunk/main/src/etc/default.mf
trunk/main/src/etc/run.mf
trunk/main/src/main/
trunk/main/src/main/org/
trunk/main/src/main/org/jboss/
trunk/main/src/main/org/jboss/Main.java
trunk/main/src/main/org/jboss/Version.java
trunk/main/src/main/org/jboss/system/
trunk/main/src/main/org/jboss/system/JBossRMIClassLoader.java
trunk/main/src/main/org/jboss/system/NoAnnotationURLClassLoader.java
trunk/main/src/main/org/jboss/system/ORBSingleton.java
trunk/main/src/main/org/jboss/system/server/
trunk/main/src/main/org/jboss/system/server/Server.java
trunk/main/src/main/org/jboss/system/server/ServerConfig.java
trunk/main/src/main/org/jboss/system/server/ServerConfigUtil.java
trunk/main/src/main/org/jboss/system/server/ServerLoader.java
trunk/main/src/resources/
trunk/main/src/resources/log4j-debug.properties
trunk/main/src/resources/log4j-trace.properties
trunk/main/src/resources/log4j.properties
trunk/main/src/resources/org/
trunk/main/src/resources/org/jboss/
trunk/main/src/resources/org/jboss/version.properties
Removed:
trunk/system-jmx/src/main/org/jboss/system/server/ServerImpl.java
trunk/system/src/bin/
trunk/system/src/etc/run.mf
trunk/system/src/main/org/jboss/Main.java
trunk/system/src/main/org/jboss/Version.java
trunk/system/src/main/org/jboss/system/JBossRMIClassLoader.java
trunk/system/src/main/org/jboss/system/ORBSingleton.java
trunk/system/src/main/org/jboss/system/server/BaseServerConfig.java
trunk/system/src/main/org/jboss/system/server/NoAnnotationURLClassLoader.java
trunk/system/src/main/org/jboss/system/server/Server.java
trunk/system/src/main/org/jboss/system/server/ServerConfig.java
trunk/system/src/main/org/jboss/system/server/ServerConfigUtil.java
trunk/system/src/main/org/jboss/system/server/ServerLoader.java
trunk/system/src/main/org/jboss/system/server/profileservice/ServerImpl.java
Modified:
trunk/build/build-distr.xml
trunk/build/build-thirdparty.xml
trunk/build/build.xml
trunk/cluster/.classpath
trunk/cluster/build.xml
trunk/connector/.classpath
trunk/connector/build.xml
trunk/console/.classpath
trunk/console/build.xml
trunk/ejb3/.classpath
trunk/ejb3/build-test.xml
trunk/ejb3/build.xml
trunk/embedded/.classpath
trunk/embedded/build.xml
trunk/embedded/src/main/java/org/jboss/embedded/adapters/ServerConfig.java
trunk/iiop/.classpath
trunk/iiop/build.xml
trunk/jbossmq/.classpath
trunk/jbossmq/build.xml
trunk/management/.classpath
trunk/management/build.xml
trunk/server/.classpath
trunk/server/build.xml
trunk/server/src/etc/conf/default/bootstrap-beans.xml
trunk/server/src/etc/conf/default/bootstrap-repo-beans.xml
trunk/system-jmx/.classpath
trunk/system-jmx/build-test.xml
trunk/system-jmx/build.xml
trunk/system/.classpath
trunk/system/build-test.xml
trunk/system/build.xml
trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
trunk/system/src/resources/tests/bootstrap/default/deployer-beans.xml
trunk/system/src/resources/tests/bootstrap/defaulthotdeploy/deployer-beans.xml
trunk/system/src/tests/org/jboss/test/server/profileservice/MainTestCase.java
trunk/system/src/tests/org/jboss/test/server/profileservice/MainWithSimpleHotDeployTestCase.java
trunk/testsuite/.classpath
trunk/testsuite/build.xml
trunk/tomcat/.classpath
trunk/tomcat/build-test.xml
trunk/tomcat/build.xml
trunk/tools/etc/buildmagic/modules.ent
trunk/transaction/.classpath
trunk/transaction/build.xml
trunk/varia/.classpath
trunk/varia/build.xml
Log:
Make a start on rationalizing the bootstrap - still lots more to do
Added: trunk/bootstrap/.classpath
===================================================================
--- trunk/bootstrap/.classpath (rev 0)
+++ trunk/bootstrap/.classpath 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="lib" path="/thirdparty/gnu-getopt/lib/getopt.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/jbossxb/lib/jboss-xml-binding.jar" sourcepath="/thirdparty/jboss/jbossxb/lib/jboss-xml-binding-src.zip"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-container.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-container-sources.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-dependency.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-dependency-soruces.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-kernel.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-kernel.sources.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/common-core/lib/jboss-common-core.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/common-logging-jdk/lib/jboss-logging-jdk.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/common-logging-log4j/lib/jboss-logging-log4j.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/common-logging-spi/lib/jboss-logging-spi.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/oswego-concurrent/lib/concurrent.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/apache-xerces/lib/xercesImpl.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/main"/>
+ <classpathentry kind="output" path="output/eclipse-classes"/>
+</classpath>
Added: trunk/bootstrap/.project
===================================================================
--- trunk/bootstrap/.project (rev 0)
+++ trunk/bootstrap/.project 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>bootstrap</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/bootstrap/build.bat
===================================================================
--- trunk/bootstrap/build.bat (rev 0)
+++ trunk/bootstrap/build.bat 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,89 @@
+ at echo off
+REM ======================================================================
+REM
+REM This is the main entry point for the build system.
+REM
+REM Users should be sure to execute this file rather than 'ant' to ensure
+REM the correct version is being used with the correct configuration.
+REM
+REM ======================================================================
+REM
+REM $Id: build.bat 24242 2004-10-04 20:13:37Z andd $
+REM
+REM Authors:
+REM Jason Dillon <jason at planet57.com>
+REM Sacha Labourey <sacha.labourey at cogito-info.ch>
+REM
+
+REM ******************************************************
+REM Ignore the ANT_HOME variable: we want to use *our*
+REM ANT version and associated JARs.
+REM ******************************************************
+REM Ignore the users classpath, cause it might mess
+REM things up
+REM ******************************************************
+
+SETLOCAL
+
+set CLASSPATH=
+set ANT_HOME=
+set ANT_OPTS=-Djava.protocol.handler.pkgs=org.jboss.net.protocol -Dbuild.script=build.bat
+
+REM ******************************************************
+REM - "for" loops have been unrolled for compatibility
+REM with some WIN32 systems.
+REM ******************************************************
+
+set NAMES=tools;tools\ant;tools\apache\ant
+set SUBFOLDERS=..;..\..;..\..\..;..\..\..\..
+
+REM ******************************************************
+REM ******************************************************
+
+SET EXECUTED=FALSE
+for %%i in (%NAMES%) do call :subLoop %%i %1 %2 %3 %4 %5 %6
+
+goto :EOF
+
+
+REM ******************************************************
+REM ********* Search for names in the subfolders *********
+REM ******************************************************
+
+:subLoop
+for %%j in (%SUBFOLDERS%) do call :testIfExists %%j\%1\bin\ant.bat %2 %3 %4 %5 %6 %7
+
+goto :EOF
+
+
+REM ******************************************************
+REM ************ Test if ANT Batch file exists ***********
+REM ******************************************************
+
+:testIfExists
+if exist %1 call :BatchFound %1 %2 %3 %4 %5 %6 %7 %8
+
+goto :EOF
+
+
+REM ******************************************************
+REM ************** Batch file has been found *************
+REM ******************************************************
+
+:BatchFound
+if (%EXECUTED%)==(FALSE) call :ExecuteBatch %1 %2 %3 %4 %5 %6 %7 %8
+set EXECUTED=TRUE
+
+goto :EOF
+
+REM ******************************************************
+REM ************* Execute Batch file only once ***********
+REM ******************************************************
+
+:ExecuteBatch
+echo Calling %1 %2 %3 %4 %5 %6 %7 %8
+call %1 %2 %3 %4 %5 %6 %7 %8
+
+:end
+
+if "%NOPAUSE%" == "" pause
Property changes on: trunk/bootstrap/build.bat
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/bootstrap/build.sh
===================================================================
--- trunk/bootstrap/build.sh (rev 0)
+++ trunk/bootstrap/build.sh 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,172 @@
+#!/bin/sh
+### ====================================================================== ###
+## ##
+## This is the main entry point for the build system. ##
+## ##
+## Users should be sure to execute this file rather than 'ant' to ensure ##
+## the correct version is being used with the correct configuration. ##
+## ##
+### ====================================================================== ###
+
+# $Id: build.sh 24242 2004-10-04 20:13:37Z andd $
+
+PROGNAME=`basename $0`
+DIRNAME=`dirname $0`
+GREP="grep"
+ROOT="/"
+
+# Ignore user's ANT_HOME if it is set
+ANT_HOME=""
+
+# the default search path for ant
+ANT_SEARCH_PATH="\
+ tools
+ tools/ant \
+ tools/apache/ant \
+ ant"
+
+# the default build file name
+ANT_BUILD_FILE="build.xml"
+
+# the default arguments
+ANT_OPTIONS="-find $ANT_BUILD_FILE"
+
+# Use the maximum available, or set MAX_FD != -1 to use that
+MAX_FD="maximum"
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false;
+darwin=false;
+case "`uname`" in
+ CYGWIN*)
+ cygwin=true
+ ;;
+
+ Darwin*)
+ darwin=true
+ ;;
+esac
+
+#
+# Helper to complain.
+#
+die() {
+ echo "${PROGNAME}: $*"
+ exit 1
+}
+
+#
+# Helper to complain.
+#
+warn() {
+ echo "${PROGNAME}: $*"
+}
+
+#
+# Helper to source a file if it exists.
+#
+maybe_source() {
+ for file in $*; do
+ if [ -f "$file" ]; then
+ . $file
+ fi
+ done
+}
+
+search() {
+ search="$*"
+ for d in $search; do
+ ANT_HOME="`pwd`/$d"
+ ANT="$ANT_HOME/bin/ant"
+ if [ -x "$ANT" ]; then
+ # found one
+ echo $ANT_HOME
+ break
+ fi
+ done
+}
+
+#
+# Main function.
+#
+main() {
+ # if there is a build config file. then source it
+ maybe_source "$DIRNAME/build.conf" "$HOME/.build.conf"
+
+ # Increase the maximum file descriptors if we can
+ if [ $cygwin = "false" ]; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ]; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then
+ # use the system max
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ]; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query system maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+ fi
+
+ # try the search path
+ ANT_HOME=`search $ANT_SEARCH_PATH`
+
+ # try looking up to root
+ if [ "x$ANT_HOME" = "x" ]; then
+ target="build"
+ _cwd=`pwd`
+
+ while [ "x$ANT_HOME" = "x" ] && [ "$cwd" != "$ROOT" ]; do
+ cd ..
+ cwd=`pwd`
+ ANT_HOME=`search $ANT_SEARCH_PATH`
+ done
+
+ # make sure we get back
+ cd $_cwd
+
+ if [ "$cwd" != "$ROOT" ]; then
+ found="true"
+ fi
+
+ # complain if we did not find anything
+ if [ "$found" != "true" ]; then
+ die "Could not locate Ant; check \$ANT or \$ANT_HOME."
+ fi
+ fi
+
+ # make sure we have one
+ ANT=$ANT_HOME/bin/ant
+ if [ ! -x "$ANT" ]; then
+ die "Ant file is not executable: $ANT"
+ fi
+
+ # need to specify planet57/buildmagic protocol handler package
+ ANT_OPTS="-Djava.protocol.handler.pkgs=org.jboss.net.protocol"
+
+ # setup some build properties
+ ANT_OPTS="$ANT_OPTS -Dbuild.script=$0"
+
+ # change to the directory where the script lives so users are not forced
+ # to be in the same directory as build.xml
+ cd $DIRNAME
+
+ # export some stuff for ant
+ export ANT ANT_HOME ANT_OPTS
+
+ # execute in debug mode, or simply execute
+ if [ "x$ANT_DEBUG" != "x" ]; then
+ /bin/sh -x $ANT $ANT_OPTIONS "$@"
+ else
+ exec $ANT $ANT_OPTIONS "$@"
+ fi
+}
+
+##
+## Bootstrap
+##
+
+main "$@"
Property changes on: trunk/bootstrap/build.sh
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/bootstrap/build.xml
===================================================================
--- trunk/bootstrap/build.xml (rev 0)
+++ trunk/bootstrap/build.xml 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE project [
+ <!ENTITY buildmagic SYSTEM "../tools/etc/buildmagic/buildmagic.ent">
+ <!ENTITY libraries SYSTEM "../thirdparty/libraries.ent">
+ <!ENTITY modules SYSTEM "../tools/etc/buildmagic/modules.ent">
+ <!ENTITY targets SYSTEM "../tools/etc/buildmagic/targets.ent">
+]>
+
+<!-- ====================================================================== -->
+<!-- -->
+<!-- JBoss, the OpenSource J2EE webOS -->
+<!-- -->
+<!-- Distributable under LGPL license. -->
+<!-- See terms of license at http://www.gnu.org. -->
+<!-- -->
+<!-- ====================================================================== -->
+
+<!-- $Id: build.xml 63730 2007-06-28 17:24:29Z adrian at jboss.org $ -->
+
+<project default="main" name="JBoss/Bootstrap">
+
+ <!-- ================================================================== -->
+ <!-- Setup -->
+ <!-- ================================================================== -->
+
+ <!--
+ | Include the common Buildmagic elements.
+ |
+ | This defines several different targets, properties and paths.
+ | It also sets up the basic extention tasks amoung other things.
+ -->
+
+ &buildmagic;
+
+ <!--
+ | Include the normal targets.
+ -->
+ &targets;
+
+ <!-- ================================================================== -->
+ <!-- Configuration -->
+ <!-- ================================================================== -->
+
+ <!--
+ | Configure the build system.
+ |
+ | This target is invoked by the Buildmagic initialization logic and
+ | should contain module specific configuration elements.
+ -->
+
+ <target name="configure" unless="configure.disable">
+
+ <!-- =================== -->
+ <!-- Basic Configuration -->
+ <!-- =================== -->
+
+ <!-- Module name(s) & version -->
+ <property name="module.name" value="bootstrap"/>
+ <property name="module.Name" value="JBoss Bootstrap"/>
+ <property name="module.version" value="DEV"/>
+
+ <!-- ========= -->
+ <!-- Libraries -->
+ <!-- ========= -->
+
+ &libraries;
+
+ <!-- The combined library classpath -->
+ <path id="library.classpath">
+ <path refid="apache.xerces.classpath"/>
+ <path refid="jboss.jbossxb.classpath"/>
+ <path refid="jboss.microcontainer.classpath"/>
+ <path refid="jboss.common.core.classpath"/>
+ <path refid="jboss.common.logging.spi.classpath"/>
+ </path>
+
+ &modules;
+
+ <!-- The combined dependant module classpath -->
+ <path id="dependentmodule.classpath">
+ <path refid="jboss.main.classpath"/>
+ </path>
+
+ <!-- ===== -->
+ <!-- Tasks -->
+ <!-- ===== -->
+
+ <property name="jar.prefix" value="jboss-bootstrap"/>
+ <property name="javac.target" value="1.5"/>
+ <property name="javac.source" value="1.5"/>
+
+ <call target="_default:task-init"/>
+
+ </target>
+
+ <!-- ================================================================== -->
+ <!-- Compile -->
+ <!-- ================================================================== -->
+
+ <!--
+ | Compile everything.
+ |
+ | This target should depend on other compile-* targets for each
+ | different type of compile that needs to be performed, short of
+ | documentation compiles.
+ -->
+
+ <target name="compile"
+ description="Compile all source files."
+ depends="_default:compile-classes,
+ _default:compile-etc"/>
+
+ <!-- ================================================================== -->
+ <!-- Archives -->
+ <!-- ================================================================== -->
+
+ <!--
+ | Build all jar files.
+ -->
+ <target name="module-jars" >
+
+ <!-- -->
+ <jar jarfile="${build.lib}/jboss-bootstrap.jar" manifest="${build.etc}/default.mf">
+ <fileset dir="${build.classes}"/>
+ </jar>
+
+ </target>
+
+</project>
Added: trunk/bootstrap/src/etc/default.mf
===================================================================
--- trunk/bootstrap/src/etc/default.mf (rev 0)
+++ trunk/bootstrap/src/etc/default.mf 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Created-By: @java.vm.version@ (@java.vm.vendor@)
+Specification-Title: @specification.title@
+Specification-Version: @specification.version@
+Specification-Vendor: @specification.vendor@
+Implementation-Title: @implementation.title@
+Implementation-URL: @implementation.url@
+Implementation-Version: @implementation.version@
+Implementation-Vendor: @implementation.vendor@
+Implementation-Vendor-Id: @implementation.vendor.id@
Added: trunk/bootstrap/src/main/org/jboss/bootstrap/AbstractServerImpl.java
===================================================================
--- trunk/bootstrap/src/main/org/jboss/bootstrap/AbstractServerImpl.java (rev 0)
+++ trunk/bootstrap/src/main/org/jboss/bootstrap/AbstractServerImpl.java 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,786 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bootstrap;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.util.Date;
+import java.util.List;
+import java.util.Properties;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.logging.LogManager;
+
+import javax.management.Notification;
+import javax.management.NotificationBroadcasterSupport;
+import javax.management.NotificationEmitter;
+
+import org.jboss.Version;
+import org.jboss.bootstrap.spi.Bootstrap;
+import org.jboss.logging.Logger;
+import org.jboss.net.protocol.URLStreamHandlerFactory;
+import org.jboss.system.server.Server;
+import org.jboss.system.server.ServerConfig;
+import org.jboss.util.StopWatch;
+
+/**
+ * A Server implementation that uses the deployer-beans.xml and ProfileService
+ * to boot the server.
+ *
+ * @author Scott.Stark at jboss.org
+ * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
+ * @author adrian at jboss.org
+ * @version $Revision$
+ */
+public abstract class AbstractServerImpl extends NotificationBroadcasterSupport implements Server, NotificationEmitter
+{
+ /** Instance logger. */
+ protected Logger log;
+
+ /** Container for version information. */
+ private final Version version = Version.getInstance();
+
+ /** Package information for org.jboss */
+ private final Package jbossPackage = Package.getPackage("org.jboss");
+
+ /** The basic configuration for the server. */
+ private BaseServerConfig config;
+
+ /** When the server was started. */
+ private Date startDate;
+
+ /** Flag to indicate if we are started. */
+ private boolean started;
+ /** A flag indicating if start has been called */
+ private boolean isInStart;
+ /** A flag indicating if shutdown has been called */
+ private boolean isInShutdown;
+
+ /** The JVM shutdown hook */
+ private ShutdownHook shutdownHook;
+
+ /** The JBoss Life Thread */
+ private LifeThread lifeThread;
+
+ /** The bootstraps */
+ private List<Bootstrap> bootstraps = new CopyOnWriteArrayList<Bootstrap>();
+
+ /** The started bootstraps */
+ private List<Bootstrap> startedBootstraps = new CopyOnWriteArrayList<Bootstrap>();
+
+ /**
+ * No-arg constructor for ServerImpl
+ */
+ public AbstractServerImpl()
+ {
+ }
+
+ /**
+ * Add a bootstrap
+ *
+ * @param bootstrap the bootstrap
+ * @throws IllegalArgumentException for a null bootstrap
+ */
+ public void addBootstrap(Bootstrap bootstrap)
+ {
+ if (bootstrap == null)
+ throw new IllegalArgumentException("Null bootstrap");
+ bootstraps.add(bootstrap);
+ }
+
+ /**
+ * Remove a bootstrap
+ *
+ * @param bootstrap the bootstrap
+ * @throws IllegalArgumentException for a null bootstrap
+ */
+ public void removeBootstrap(Bootstrap bootstrap)
+ {
+ if (bootstrap == null)
+ throw new IllegalArgumentException("Null bootstrap");
+ bootstraps.add(bootstrap);
+ }
+
+ /**
+ * Initialize the Server instance.
+ *
+ * @param props - The configuration properties for the server.
+ *
+ * @throws IllegalStateException Already initialized.
+ * @throws Exception Failed to initialize.
+ */
+ public void init(final Properties props)
+ throws IllegalStateException, Exception
+ {
+ if (props == null)
+ throw new IllegalArgumentException("props is null");
+ if (config != null)
+ throw new IllegalStateException("already initialized");
+
+ ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
+
+ try
+ {
+ Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+ doInit(props);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(oldCL);
+ }
+ }
+
+ /**
+ * Initialize server configuration and jvm settings.
+ * @param props
+ * @throws Exception
+ */
+ private void doInit(final Properties props) throws Exception
+ {
+ // Create a new config object from the give properties
+ this.config = new BaseServerConfig(props);
+
+ // Set the VM temp directory to the server tmp dir
+ boolean overrideTmpDir = Boolean.getBoolean("jboss.server.temp.dir.overrideJavaTmpDir");
+ if (overrideTmpDir)
+ {
+ File serverTmpDir = config.getServerTempDir();
+ System.setProperty("java.io.tmpdir", serverTmpDir.getCanonicalPath());
+ }
+
+ /* Initialize the logging layer using the ServerImpl class. The server log
+ directory is initialized prior to this to ensure the jboss.server.log.dir
+ system property is set in case its used by the logging configs.
+ */
+ config.getServerLogDir();
+ log = Logger.getLogger(getClass());
+
+ // Setup URL handlers - do this before initializing the ServerConfig
+ initURLHandlers();
+ config.initURLs();
+
+ log.info("Starting JBoss (Microcontainer)...");
+
+ if (jbossPackage != null)
+ {
+ // Show what release this is...
+ log.info("Release ID: " +
+ jbossPackage.getImplementationTitle() + " " +
+ jbossPackage.getImplementationVersion());
+ }
+ else
+ {
+ log.warn("could not get package info to display release, either the " +
+ "jar manifest in jboss-system.jar has been mangled or you're " +
+ "running unit tests from ant outside of JBoss itself.");
+ }
+
+ log.debug("Using config: " + config);
+
+ // make sure our impl type is exposed
+ log.debug("Server type: " + getClass());
+
+ // Log the basic configuration elements
+ log.info("Home Dir: " + config.getHomeDir());
+ log.info("Home URL: " + config.getHomeURL());
+ log.info("Library URL: " + config.getLibraryURL());
+ log.info("Patch URL: " + config.getPatchURL());
+ log.info("Server Name: " + config.getServerName());
+ log.info("Server Home Dir: " + config.getServerHomeDir());
+ log.info("Server Home URL: " + config.getServerHomeURL());
+ log.info("Server Data Dir: " + config.getServerDataDir());
+ log.info("Server Temp Dir: " + config.getServerTempDir());
+ log.info("Server Config URL: " + config.getServerConfigURL());
+ log.info("Server Library URL: " + config.getServerLibraryURL());
+ log.info("Root Deployment Filename: " + config.getRootDeploymentFilename());
+ }
+
+ /**
+ * The <code>initURLHandlers</code> method calls
+ * internalInitURLHandlers. if requireJBossURLStreamHandlers is
+ * false, any exceptions are logged and ignored.
+ *
+ * TODO move to the common project alongside URLStreamHandlerFactory
+ */
+ private void initURLHandlers()
+ {
+ if (config.getRequireJBossURLStreamHandlerFactory())
+ {
+ internalInitURLHandlers();
+ } // end of if ()
+ else
+ {
+ try
+ {
+ internalInitURLHandlers();
+ }
+ catch (SecurityException e)
+ {
+ log.warn("You do not have permissions to set URLStreamHandlerFactory", e);
+ } // end of try-catch
+ catch (Error e)
+ {
+ log.warn("URLStreamHandlerFactory already set", e);
+ } // end of catch
+ } // end of else
+ }
+
+ /**
+ * Set up our only URLStreamHandlerFactory.
+ * This is needed to ensure Sun's version is not used (as it leaves files
+ * locked on Win2K/WinXP platforms.
+ */
+ private void internalInitURLHandlers()
+ {
+ try
+ {
+ // Install a URLStreamHandlerFactory that uses the TCL
+ URL.setURLStreamHandlerFactory(new URLStreamHandlerFactory());
+
+ // Preload JBoss URL handlers
+ URLStreamHandlerFactory.preload();
+ }
+ catch (Error error)
+ { //very naughty but we HAVE to do this or
+ //we'll fail if we ever try to do this again
+ log.warn("Caught Throwable Error, this probably means " +
+ "we've already set the URLStreamHAndlerFactory before");
+ }
+
+ // Include the default JBoss protocol handler package
+ String handlerPkgs = System.getProperty("java.protocol.handler.pkgs");
+ if (handlerPkgs != null)
+ {
+ handlerPkgs += "|org.jboss.net.protocol";
+ }
+ else
+ {
+ handlerPkgs = "org.jboss.net.protocol";
+ }
+ System.setProperty("java.protocol.handler.pkgs", handlerPkgs);
+ }
+
+ /**
+ * Get the typed server configuration object which the
+ * server has been initalized to use.
+ *
+ * @return Typed server configuration object.
+ *
+ * @throws IllegalStateException Not initialized.
+ */
+ public ServerConfig getConfig() throws IllegalStateException
+ {
+ if (config == null)
+ throw new IllegalStateException("not initialized");
+
+ return config;
+ }
+
+ /**
+ * Check if the server is started.
+ *
+ * @return True if the server is started, else false.
+ */
+ public boolean isStarted()
+ {
+ return started;
+ }
+
+ /**
+ Check if the shutdown operation has been called/is in progress.
+
+ @return true if shutdown has been called, false otherwise
+ */
+ public boolean isInShutdown()
+ {
+ return isInShutdown;
+ }
+
+ /**
+ * Start the Server instance.
+ *
+ * @throws IllegalStateException Already started or not initialized.
+ * @throws Exception Failed to start.
+ */
+ public void start() throws IllegalStateException, Exception
+ {
+ synchronized( this )
+ {
+ if( isInStart == false )
+ {
+ isInStart = true;
+ }
+ else
+ {
+ log.debug("Already in start, ignoring duplicate start");
+ return;
+ }
+ }
+
+ // make sure we are initialized
+ ServerConfig config = getConfig();
+
+ // make sure we aren't started yet
+ if (started)
+ throw new IllegalStateException("already started");
+
+ ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
+
+ try
+ {
+ ClassLoader myCL = getClass().getClassLoader();
+ Thread.currentThread().setContextClassLoader(myCL);
+
+ // See how long it takes us to start up
+ StopWatch watch = new StopWatch(true);
+ // remeber when we we started
+ startDate = new Date();
+
+ // Install the shutdown hook
+ shutdownHook = new ShutdownHook();
+ shutdownHook.setDaemon(true);
+ try
+ {
+ Runtime.getRuntime().addShutdownHook(shutdownHook);
+ log.debug("Shutdown hook added " + shutdownHook);
+ }
+ catch (Exception e)
+ {
+ log.warn("Failed to add shutdown hook; ignoring", e);
+ }
+
+ // Do the main start
+ doStart(watch);
+
+ // TODO Fix the TCL hack used here!
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ // Run the bootstraps
+ for (Bootstrap bootstrap : bootstraps)
+ {
+ Thread.currentThread().setContextClassLoader(bootstrap.getClass().getClassLoader());
+ bootstrap.start(this);
+ startedBootstraps.add(0, bootstrap);
+ }
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(cl);
+ }
+
+ if (config.isInstallLifeThread())
+ {
+ lifeThread = new LifeThread();
+ log.debug("Installing life thread " + lifeThread);
+ lifeThread.start();
+ }
+
+ started = true;
+
+ // Send a JMX notification that the startup is complete
+ Notification msg = new Notification(START_NOTIFICATION_TYPE, this, 1);
+ msg.setUserData(new Long(watch.getLapTime()));
+ sendNotification(msg);
+
+ watch.stop();
+
+ // Tell the world how fast it was =)
+ if (jbossPackage != null)
+ {
+ log.info("JBoss (Microcontainer) [" + jbossPackage.getImplementationVersion() +
+ "] Started in " + watch);
+ }
+ else
+ {
+ log.info("JBoss (Microcontainer) [unknown version] Started in " + watch);
+ }
+ }
+ catch (Throwable t)
+ {
+ log.debug("Failed to start", t);
+
+ if (t instanceof Exception)
+ throw (Exception)t;
+ if (t instanceof Error)
+ throw (Error)t;
+
+ throw new RuntimeException("Unexpected error", t);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(oldCL);
+ isInStart = false;
+ }
+ }
+
+ /**
+ * Override to perform the start operations
+ *
+ * @param watch the stop watch
+ * @throws Throwable for any error
+ */
+ protected abstract void doStart(StopWatch watch) throws Throwable;
+
+ /**
+ * Shutdown the server
+ */
+ protected void shutdownServer()
+ {
+ // Send a notification that mbeanServer stop is initiated
+ log.info("JBoss SHUTDOWN");
+ if (log.isTraceEnabled())
+ log.trace("Shutdown caller:", new Throwable("Here"));
+
+ // Execute the jdk JBossJDKLogManager doReset via reflection
+ LogManager lm = LogManager.getLogManager();
+ try
+ {
+ Class<?>[] sig = {};
+ Method doReset = lm.getClass().getDeclaredMethod("doReset", sig);
+ Object[] args = {};
+ doReset.invoke(lm, args);
+ }
+ catch(Exception e)
+ {
+ if(log.isTraceEnabled())
+ log.trace("No doReset found?", e);
+ }
+
+ Notification msg = new Notification(Server.STOP_NOTIFICATION_TYPE, this, 2);
+ sendNotification(msg);
+
+ // TODO Fix the TCL hack used here!
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ // Do the bootstraps in reverse order
+ for (Bootstrap bootstrap : startedBootstraps)
+ {
+ Thread.currentThread().setContextClassLoader(bootstrap.getClass().getClassLoader());
+ try
+ {
+ bootstrap.shutdown(this);
+ }
+ catch (Throwable t)
+ {
+ log.warn("Error shutting down bootstrap: " + bootstrap, t);
+ }
+ }
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(cl);
+ }
+
+ try
+ {
+ doShutdown();
+ }
+ finally
+ {
+ log.info("Shutdown complete");
+ System.out.println("Shutdown complete");
+ }
+ }
+
+ /**
+ * Override to perform the shutdown
+ */
+ protected abstract void doShutdown();
+
+ /**
+ * Shutdown the Server instance and run shutdown hooks.
+ *
+ * <p>If the exit on shutdown flag is true, then {@link #exit()}
+ * is called, else only the shutdown hook is run.
+ *
+ * @throws IllegalStateException No started.
+ */
+ public void shutdown() throws IllegalStateException
+ {
+ if (!started)
+ throw new IllegalStateException("not started");
+
+ final AbstractServerImpl server = this;
+
+ log.debug("Shutting down");
+
+ isInShutdown = true;
+ boolean exitOnShutdown = config.getExitOnShutdown();
+ boolean blockingShutdown = config.getBlockingShutdown();
+
+ log.debug("exitOnShutdown: " + exitOnShutdown);
+ log.debug("blockingShutdown: " + blockingShutdown);
+
+ if (lifeThread != null)
+ {
+ lifeThread.interrupt();
+ lifeThread = null;
+ }
+
+ if (exitOnShutdown)
+ {
+ log.debug("Calling server.exit(0)");
+ server.exit(0);
+ }
+ else if (blockingShutdown)
+ {
+ log.debug("Invoking shutdown in calling thread");
+ shutdownServer();
+ }
+ else
+ {
+ // start in new thread to give positive
+ // feedback to requesting client of success.
+ new Thread()
+ {
+ public void run()
+ {
+ // just run the hook, don't call System.exit, as we may
+ // be embeded in a vm that would not like that very much
+ log.debug("Invoking shutdown in background thread");
+ shutdownServer();
+ }
+ }.start();
+ }
+ }
+
+ /**
+ * Shutdown the server, the JVM and run shutdown hooks.
+ *
+ * @param exitcode The exit code returned to the operating system.
+ */
+ public void exit(final int exitcode)
+ {
+ // start in new thread so that we might have a chance to give positive
+ // feed back to requesting client of success.
+ new Thread()
+ {
+ public void run()
+ {
+ log.info("Shutting down the JVM now!");
+ Runtime.getRuntime().exit(exitcode);
+ }
+ }.start();
+ }
+
+ /**
+ * Shutdown the server, the JVM and run shutdown hooks. Exits with
+ * code 1.
+ */
+ public void exit()
+ {
+ exit(1);
+ }
+
+ /**
+ * Forcibly terminates the currently running Java virtual machine.
+ *
+ * @param exitcode The exit code returned to the operating system.
+ */
+ public void halt(final int exitcode)
+ {
+ // start in new thread so that we might have a chance to give positive
+ // feed back to requesting client of success.
+ new Thread()
+ {
+ public void run()
+ {
+ System.err.println("Halting the system now!");
+ Runtime.getRuntime().halt(exitcode);
+ }
+ }.start();
+ }
+
+ /**
+ * Forcibly terminates the currently running Java virtual machine.
+ * Exits with code 1.
+ */
+ public void halt()
+ {
+ halt(1);
+ }
+
+
+////////////////////////////////////////////////////////////////////////// /
+// Runtime Access //
+////////////////////////////////////////////////////////////////////////// /
+
+ /**
+ * A simple helper used to log the Runtime memory information.
+ *
+ * @param rt the runtime
+ */
+ private void logMemoryUsage(final Runtime rt)
+ {
+ log.info("Total/free memory: " + rt.totalMemory() + "/" + rt.freeMemory());
+ }
+
+ /**
+ * Hint to the JVM to run the garbage collector.
+ */
+ public void runGarbageCollector()
+ {
+ Runtime rt = Runtime.getRuntime();
+
+ logMemoryUsage(rt);
+ rt.gc();
+ log.info("Hinted to the JVM to run garbage collection");
+ logMemoryUsage(rt);
+ }
+
+ /**
+ * Hint to the JVM to run any pending object finalizations.
+ */
+ public void runFinalization()
+ {
+ Runtime.getRuntime().runFinalization();
+ log.info("Hinted to the JVM to run any pending object finalizations");
+ }
+
+ /**
+ * Enable or disable tracing method calls at the Runtime level.
+ *
+ * @param flag whether to enable trace
+ */
+ public void traceMethodCalls(final Boolean flag)
+ {
+ Runtime.getRuntime().traceMethodCalls(flag.booleanValue());
+ }
+
+ /**
+ * Enable or disable tracing instructions the Runtime level.
+ *
+ * @param flag whether to enable trace
+ */
+ public void traceInstructions(final Boolean flag)
+ {
+ Runtime.getRuntime().traceInstructions(flag.booleanValue());
+ }
+
+
+////////////////////////////////////////////////////////////////////////// /
+// Server Information //
+////////////////////////////////////////////////////////////////////////// /
+
+ public Date getStartDate()
+ {
+ return startDate;
+ }
+
+ public String getVersion()
+ {
+ return version.toString();
+ }
+
+ public String getVersionName()
+ {
+ return version.getName();
+ }
+
+ public String getVersionNumber()
+ {
+ return version.getVersionNumber();
+ }
+
+ public String getBuildNumber()
+ {
+ return version.getBuildNumber();
+ }
+
+ public String getBuildJVM()
+ {
+ return version.getBuildJVM();
+ }
+
+ public String getBuildOS()
+ {
+ return version.getBuildOS();
+ }
+
+ public String getBuildID()
+ {
+ return version.getBuildID();
+ }
+
+ /**
+ * The server build date
+ * @return server build date
+ */
+ public String getBuildDate()
+ {
+ return version.getBuildDate();
+ }
+
+ /** A simple thread that keeps the vm alive in the event there are no
+ * other threads started.
+ */
+ private class LifeThread extends Thread
+ {
+ Object lock = new Object();
+ LifeThread()
+ {
+ super("JBossLifeThread");
+ }
+ public void run()
+ {
+ synchronized (lock)
+ {
+ try
+ {
+ lock.wait();
+ }
+ catch (InterruptedException ignore)
+ {
+ }
+ }
+ log.info("LifeThread.run exits!");
+ }
+ }
+
+ private class ShutdownHook extends Thread
+ {
+ private boolean forceHalt = true;
+
+ public ShutdownHook()
+ {
+ super("JBoss Shutdown Hook");
+
+ String value = SecurityActions.getSystemProperty("jboss.shutdown.forceHalt", null);
+ if (value != null)
+ {
+ forceHalt = new Boolean(value).booleanValue();
+ }
+ }
+
+ public void run()
+ {
+ shutdownServer();
+ if (forceHalt)
+ {
+ System.out.println("Halting VM");
+ Runtime.getRuntime().halt(0);
+ }
+ }
+ }
+}
Added: trunk/bootstrap/src/main/org/jboss/bootstrap/BaseServerConfig.java
===================================================================
--- trunk/bootstrap/src/main/org/jboss/bootstrap/BaseServerConfig.java (rev 0)
+++ trunk/bootstrap/src/main/org/jboss/bootstrap/BaseServerConfig.java 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,652 @@
+/* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.bootstrap;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Properties;
+
+import org.jboss.system.server.Server;
+import org.jboss.system.server.ServerConfig;
+import org.jboss.util.NestedRuntimeException;
+import org.jboss.util.Null;
+import org.jboss.util.Primitives;
+import org.jboss.util.platform.Java;
+
+/**
+ * A container for the basic configuration elements required to create
+ * a Server instance.
+ *
+ * <p>MalformedURLException are rethrown as NestedRuntimeExceptions, so that
+ * code that needs to access these values does not have to directly
+ * worry about problems with lazy construction of final URL values.
+ *
+ * <p>Most values are determined durring first call to getter. All values
+ * when determined will have equivilent system properties set.
+ *
+ * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
+ * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
+ * @author Scott.Stark at jboss.org
+ * @version <tt>$Revision: 41281 $</tt>
+ */
+
+
+public class BaseServerConfig
+ implements ServerConfig
+{
+ /** The configuration properties to pull data from. */
+ private Properties props;
+
+ private URL bootstrapURL;
+ private File homeDir;
+ private URL homeURL;
+ private URL libraryURL;
+
+ /**
+ * The base URL where patch files will be loaded from. This is
+ * typed as an Object to allow its value to contain Null.VALUE
+ * or a URL. If value is Null.VALUE then we have determined
+ * that there is no user configuration for this value and it will
+ * be passed back as null to the requesting client.
+ */
+ private Object patchURL;
+
+ private String serverSpecificationVersion;
+
+ private String serverName;
+ private File serverBaseDir;
+ private File serverHomeDir;
+ private File serverLogDir;
+ private File serverTempDir;
+ private File serverDataDir;
+ private URL serverBaseURL;
+ private URL serverHomeURL;
+ private URL serverLibraryURL;
+ private URL serverConfigURL;
+
+ /** Exit on shutdown flag. */
+ private Boolean exitOnShutdown;
+ private Boolean blockingShutdown;
+ private Boolean requireJBossURLStreamHandlerFactory;
+ private Boolean platformMBeanServer;
+
+ private Boolean installLifeThread;
+
+ private String rootDeployableFilename;
+
+ /**
+ * Construct a new <tt>ServerConfigImpl</tt> instance.
+ *
+ * @param props Configuration properties.
+ *
+ * @throws Exception Missing or invalid configuration.
+ */
+ public BaseServerConfig(final Properties props) throws Exception
+ {
+ this.props = props;
+
+ // Must have HOME_DIR
+ homeDir = getFile(ServerConfig.HOME_DIR);
+ if (homeDir == null)
+ throw new Exception("Missing configuration value for: " + ServerConfig.HOME_DIR);
+ System.setProperty(ServerConfig.HOME_DIR, homeDir.toString());
+ // Setup the SERVER_HOME_DIR system property
+ getServerHomeDir();
+
+ Package thisPackage = getClass().getPackage();
+ serverSpecificationVersion = thisPackage.getSpecificationVersion();
+ }
+
+ /** Breakout the initialization of URLs from the constructor as we need
+ * the ServerConfig.HOME_DIR set for log setup, but we cannot create any
+ * file URLs prior to the
+ *
+ * @throws MalformedURLException for a bad home url
+ */
+ public void initURLs()
+ throws MalformedURLException
+ {
+ // If not set then default to homeDir
+ homeURL = getURL(ServerConfig.HOME_URL);
+ if (homeURL == null)
+ homeURL = homeDir.toURL();
+ System.setProperty(ServerConfig.HOME_URL, homeURL.toString());
+ }
+
+ /////////////////////////////////////////////////////////////////////////
+ // Typed Access //
+ /////////////////////////////////////////////////////////////////////////
+
+ public URL getBootstrapURL()
+ {
+ if (bootstrapURL == null)
+ {
+ try
+ {
+ bootstrapURL = getURL(ServerConfig.BOOTSTRAP_URL);
+ if (bootstrapURL != null)
+ System.setProperty(ServerConfig.BOOTSTRAP_URL, BOOTSTRAP_URL.toString());
+ }
+ catch (MalformedURLException e)
+ {
+ throw new NestedRuntimeException(e);
+ }
+ }
+
+ return bootstrapURL;
+ }
+
+ public File getHomeDir()
+ {
+ return homeDir;
+ }
+
+ public URL getHomeURL()
+ {
+ return homeURL;
+ }
+
+ public URL getLibraryURL()
+ {
+ if (libraryURL == null)
+ {
+ try
+ {
+ libraryURL = getURL(ServerConfig.LIBRARY_URL);
+ if (libraryURL == null)
+ {
+ libraryURL = new URL(homeURL, ServerConfig.LIBRARY_URL_SUFFIX);
+ }
+ System.setProperty(ServerConfig.LIBRARY_URL, libraryURL.toString());
+ }
+ catch (MalformedURLException e)
+ {
+ throw new NestedRuntimeException(e);
+ }
+ }
+ return libraryURL;
+ }
+
+ public URL getPatchURL()
+ {
+ if (patchURL == null)
+ {
+ try
+ {
+ patchURL = getURL(ServerConfig.PATCH_URL);
+ if (patchURL == null)
+ {
+ patchURL = Null.VALUE;
+ }
+ else
+ {
+ System.setProperty(ServerConfig.PATCH_URL, patchURL.toString());
+ }
+ }
+ catch (MalformedURLException e)
+ {
+ throw new NestedRuntimeException(e);
+ }
+ }
+
+ if (patchURL == Null.VALUE)
+ return null;
+
+ return (URL) patchURL;
+ }
+
+ public String getServerName()
+ {
+ if (serverName == null)
+ {
+ serverName = props.getProperty(ServerConfig.SERVER_NAME, ServerConfig.DEFAULT_SERVER_NAME);
+ System.setProperty(ServerConfig.SERVER_NAME, serverName);
+ }
+ return serverName;
+ }
+
+ public File getServerBaseDir()
+ {
+ if (serverBaseDir == null)
+ {
+ serverBaseDir = getFile(ServerConfig.SERVER_BASE_DIR);
+ if (serverBaseDir == null)
+ {
+ serverBaseDir = new File(homeDir, ServerConfig.SERVER_BASE_DIR_SUFFIX);
+ System.setProperty(ServerConfig.SERVER_BASE_DIR, serverBaseDir.toString());
+ }
+ }
+ return serverBaseDir;
+ }
+
+ public File getServerHomeDir()
+ {
+ if (serverHomeDir == null)
+ {
+ serverHomeDir = getFile(ServerConfig.SERVER_HOME_DIR);
+ if (serverHomeDir == null)
+ {
+ serverHomeDir = new File(getServerBaseDir(), getServerName());
+ System.setProperty(ServerConfig.SERVER_HOME_DIR, serverHomeDir.toString());
+ }
+ }
+ return serverHomeDir;
+ }
+
+ /**
+ * Get the directory where temporary files will be stored. The associated
+ * ServerConfig.SERVER_LOG_DIR system property needs to be set before
+ * the logging framework is used.
+ *
+ * @see ServerConfig#SERVER_LOG_DIR
+ * @return the writable temp directory
+ */
+ public File getServerLogDir()
+ {
+ if (serverLogDir == null)
+ {
+ serverLogDir = getFile(ServerConfig.SERVER_LOG_DIR);
+ if (serverLogDir == null)
+ {
+ serverLogDir = new File(getServerHomeDir(), ServerConfig.SERVER_LOG_DIR_SUFFIX);
+ System.setProperty(ServerConfig.SERVER_LOG_DIR, serverLogDir.toString());
+ }
+ }
+ return serverLogDir;
+ }
+
+ /**
+ * Get the directory where temporary files will be stored.
+ *
+ * @return the writable temp directory
+ */
+ public File getServerTempDir()
+ {
+ if (serverTempDir == null)
+ {
+ serverTempDir = getFile(ServerConfig.SERVER_TEMP_DIR);
+ if (serverTempDir == null)
+ {
+ serverTempDir = new File(getServerHomeDir(), ServerConfig.SERVER_TEMP_DIR_SUFFIX);
+ System.setProperty(ServerConfig.SERVER_TEMP_DIR, serverTempDir.toString());
+ }
+ }
+ return serverTempDir;
+ }
+
+ /**
+ * Get the directory where local data will be stored.
+ *
+ * @return the data directory
+ */
+ public File getServerDataDir()
+ {
+ if (serverDataDir == null)
+ {
+ serverDataDir = getFile(ServerConfig.SERVER_DATA_DIR);
+ if (serverDataDir == null)
+ {
+ serverDataDir = new File(getServerHomeDir(), ServerConfig.SERVER_DATA_DIR_SUFFIX);
+ System.setProperty(ServerConfig.SERVER_DATA_DIR, serverDataDir.toString());
+ }
+ }
+ return serverDataDir;
+ }
+
+ /**
+ * Get the native dir for unpacking
+ *
+ * @return the directory
+ */
+ public File getServerNativeDir()
+ {
+ String fileName = System.getProperty(NATIVE_DIR_PROPERTY);
+ if (fileName != null)
+ return new File(fileName);
+ return new File(getServerTempDir(), "native");
+ }
+
+ /**
+ * Get the temporary deployment dir for unpacking
+ *
+ * @return the directory
+ */
+ public File getServerTempDeployDir()
+ {
+ return new File(getServerTempDir(), "deploy");
+ }
+
+ public URL getServerBaseURL()
+ {
+ if (serverBaseURL == null)
+ {
+ try
+ {
+ serverBaseURL = getURL(ServerConfig.SERVER_BASE_URL);
+ if (serverBaseURL == null)
+ {
+ serverBaseURL = new URL(homeURL, ServerConfig.SERVER_BASE_URL_SUFFIX);
+ }
+ System.setProperty(ServerConfig.SERVER_BASE_URL, serverBaseURL.toString());
+ }
+ catch (MalformedURLException e)
+ {
+ throw new NestedRuntimeException(e);
+ }
+ }
+ return serverBaseURL;
+ }
+
+ public URL getServerHomeURL()
+ {
+ if (serverHomeURL == null)
+ {
+ try
+ {
+ serverHomeURL = getURL(ServerConfig.SERVER_HOME_URL);
+ if (serverHomeURL == null)
+ {
+ serverHomeURL = new URL(getServerBaseURL(), getServerName() + "/");
+ }
+ System.setProperty(ServerConfig.SERVER_HOME_URL, serverHomeURL.toString());
+ }
+ catch (MalformedURLException e)
+ {
+ throw new NestedRuntimeException(e);
+ }
+ }
+ return serverHomeURL;
+ }
+
+ public URL getServerLibraryURL()
+ {
+ if (serverLibraryURL == null)
+ {
+ try
+ {
+ serverLibraryURL = getURL(ServerConfig.SERVER_LIBRARY_URL);
+ if (serverLibraryURL == null)
+ {
+ serverLibraryURL = new URL(getServerHomeURL(), ServerConfig.LIBRARY_URL_SUFFIX);
+ }
+ System.setProperty(ServerConfig.SERVER_LIBRARY_URL, serverLibraryURL.toString());
+ }
+ catch (MalformedURLException e)
+ {
+ throw new NestedRuntimeException(e);
+ }
+ }
+ return serverLibraryURL;
+ }
+
+ public URL getServerConfigURL()
+ {
+ if (serverConfigURL == null)
+ {
+ try
+ {
+ serverConfigURL = getURL(ServerConfig.SERVER_CONFIG_URL);
+ if (serverConfigURL == null)
+ {
+ serverConfigURL = new URL(getServerHomeURL(), ServerConfig.SERVER_CONFIG_URL_SUFFIX);
+ }
+ System.setProperty(ServerConfig.SERVER_CONFIG_URL, serverConfigURL.toString());
+ }
+ catch (MalformedURLException e)
+ {
+ throw new NestedRuntimeException(e);
+ }
+ }
+ return serverConfigURL;
+ }
+
+ /**
+ * Get the current value of the flag that indicates if we are
+ * using the platform MBeanServer as the main jboss server.
+ * Both the {@link ServerConfig#PLATFORM_MBEANSERVER}
+ * property must be set, and the jvm must be jdk1.5+
+ *
+ * @return true if jboss runs on the jvm platfrom MBeanServer
+ */
+ public boolean getPlatformMBeanServer()
+ {
+ if (platformMBeanServer == null)
+ {
+ if (Java.isCompatible(Java.VERSION_1_5))
+ {
+ // get whatever the user has specified or the default
+ String value = props.getProperty(ServerConfig.PLATFORM_MBEANSERVER,
+ (new Boolean(ServerConfig.DEFAULT_PLATFORM_MBEANSERVER)).toString());
+
+ // treat empty string as true
+ value = "".equals(value) ? "true" : value;
+
+ // true or false
+ platformMBeanServer = new Boolean(value);
+ }
+ else
+ {
+ // negative :)
+ platformMBeanServer = Boolean.FALSE;
+ }
+ }
+ return platformMBeanServer.booleanValue();
+ }
+
+ /**
+ * Enable or disable exiting the JVM when {@link Server#shutdown()} is called.
+ * If enabled, then shutdown calls {@link Server#exit()}. If disabled, then
+ * only the shutdown hook will be run.
+ *
+ * @param flag True to enable calling exit on shutdown.
+ */
+ public void setExitOnShutdown(final boolean flag)
+ {
+ exitOnShutdown = Primitives.valueOf(flag);
+ }
+
+ /**
+ * Get the current value of the exit on shutdown flag.
+ *
+ * @return The current value of the exit on shutdown flag.
+ */
+ public boolean getExitOnShutdown()
+ {
+ if (exitOnShutdown == null)
+ {
+ String value = props.getProperty(ServerConfig.EXIT_ON_SHUTDOWN, null);
+ if (value == null)
+ {
+ exitOnShutdown = Primitives.valueOf(ServerConfig.DEFAULT_EXIT_ON_SHUTDOWN);
+ }
+ else
+ {
+ exitOnShutdown = new Boolean(value);
+ }
+ }
+ return exitOnShutdown.booleanValue();
+ }
+
+ public void setInstallLifeThread(final boolean flag)
+ {
+ installLifeThread = Primitives.valueOf(flag);
+ }
+
+ public boolean isInstallLifeThread()
+ {
+ if (installLifeThread == null)
+ {
+ String value = props.getProperty(ServerConfig.INSTALL_LIFE_THREAD, null);
+ if (value == null)
+ {
+ installLifeThread = Primitives.valueOf(ServerConfig.DEFAULT_INSTALL_LIFE_THREAD);
+ }
+ else
+ {
+ installLifeThread = new Boolean(value);
+ }
+ }
+ return installLifeThread.booleanValue();
+ }
+
+ /**
+ * Enable or disable blocking when {@link Server#shutdown} is
+ * called. If enabled, then shutdown will be called in the current
+ * thread. If disabled, then the shutdown hook will be run
+ * ansynchronously in a separate thread.
+ *
+ * @param flag True to enable blocking shutdown.
+ */
+ public void setBlockingShutdown(final boolean flag)
+ {
+ blockingShutdown = Primitives.valueOf(flag);
+ }
+
+ /**
+ * Get the current value of the blocking shutdown flag.
+ *
+ * @return The current value of the blocking shutdown flag.
+ */
+ public boolean getBlockingShutdown()
+ {
+ if (blockingShutdown == null)
+ {
+ String value = props.getProperty(ServerConfig.BLOCKING_SHUTDOWN, null);
+ if (value == null)
+ {
+ blockingShutdown = Primitives.valueOf(ServerConfig.DEFAULT_BLOCKING_SHUTDOWN);
+ }
+ else
+ {
+ blockingShutdown = new Boolean(value);
+ }
+ }
+ return blockingShutdown.booleanValue();
+ }
+
+
+ /**
+ * Set the RequireJBossURLStreamHandlerFactory flag. if false,
+ * exceptions when setting the URLStreamHandlerFactory will be
+ * logged and ignored.
+ *
+ * @param flag True to enable blocking shutdown.
+ */
+ public void setRequireJBossURLStreamHandlerFactory(final boolean flag)
+ {
+ requireJBossURLStreamHandlerFactory = Primitives.valueOf(flag);
+ }
+
+ /**
+ * Get the current value of the requireJBossURLStreamHandlerFactory flag.
+ *
+ * @return The current value of the requireJBossURLStreamHandlerFactory flag.
+ */
+ public boolean getRequireJBossURLStreamHandlerFactory()
+ {
+ if (requireJBossURLStreamHandlerFactory == null)
+ {
+ String value = props.getProperty(ServerConfig.REQUIRE_JBOSS_URL_STREAM_HANDLER_FACTORY, null);
+ if (value == null)
+ {
+ requireJBossURLStreamHandlerFactory = Primitives.valueOf(ServerConfig.DEFAULT_REQUIRE_JBOSS_URL_STREAM_HANDLER_FACTORY);
+ }
+ else
+ {
+ requireJBossURLStreamHandlerFactory = new Boolean(value);
+ }
+ }
+ return requireJBossURLStreamHandlerFactory.booleanValue();
+ }
+
+ /**
+ * Set the filename of the root deployable that will be used to finalize
+ * the bootstrap process.
+ *
+ * @param filename The filename of the root deployable.
+ */
+ public void setRootDeploymentFilename(final String filename)
+ {
+ this.rootDeployableFilename = filename;
+ }
+
+ /**
+ * Get the filename of the root deployable that will be used to finalize
+ * the bootstrap process.
+ *
+ * @return The filename of the root deployable.
+ */
+ public String getRootDeploymentFilename()
+ {
+ if (rootDeployableFilename == null)
+ {
+ rootDeployableFilename = props.getProperty(ServerConfig.ROOT_DEPLOYMENT_FILENAME,
+ ServerConfig.DEFAULT_ROOT_DEPLOYMENT_FILENAME);
+ }
+
+ return rootDeployableFilename;
+ }
+
+ /**
+ * Get a URL from configuration.
+ */
+ private URL getURL(final String name) throws MalformedURLException
+ {
+ String value = props.getProperty(name, null);
+ if (value != null)
+ {
+ if (!value.endsWith("/")) value += "/";
+ return new URL(value);
+ }
+
+ return null;
+ }
+
+ /**
+ * Get a File from configuration.
+ * @return the CanonicalFile form for the given name.
+ */
+ private File getFile(final String name)
+ {
+ String value = props.getProperty(name, null);
+ if (value != null)
+ {
+ try
+ {
+ File f = new File(value);
+ return f.getCanonicalFile();
+ }
+ catch(IOException e)
+ {
+ return new File(value);
+ }
+ }
+
+ return null;
+ }
+
+ public String getSpecificationVersion()
+ {
+ return serverSpecificationVersion;
+ }
+}
Added: trunk/bootstrap/src/main/org/jboss/bootstrap/SecurityActions.java
===================================================================
--- trunk/bootstrap/src/main/org/jboss/bootstrap/SecurityActions.java (rev 0)
+++ trunk/bootstrap/src/main/org/jboss/bootstrap/SecurityActions.java 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bootstrap;
+
+import java.security.PrivilegedAction;
+import java.security.AccessController;
+
+/**
+ * Package privileged actions.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+class SecurityActions
+{
+ static String getSystemProperty(final String name, final String defaultValue)
+ {
+ PrivilegedAction<String> action = new PrivilegedAction<String>()
+ {
+ public String run()
+ {
+ return System.getProperty(name, defaultValue);
+ }
+ };
+ return AccessController.doPrivileged(action);
+ }
+}
Added: trunk/bootstrap/src/main/org/jboss/bootstrap/microcontainer/ServerImpl.java
===================================================================
--- trunk/bootstrap/src/main/org/jboss/bootstrap/microcontainer/ServerImpl.java (rev 0)
+++ trunk/bootstrap/src/main/org/jboss/bootstrap/microcontainer/ServerImpl.java 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,156 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.bootstrap.microcontainer;
+
+import java.net.URL;
+import java.util.Collections;
+
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.InstallCallbackMetaData;
+import org.jboss.beans.metadata.plugins.UninstallCallbackMetaData;
+import org.jboss.beans.metadata.spi.CallbackMetaData;
+import org.jboss.bootstrap.AbstractServerImpl;
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
+import org.jboss.kernel.plugins.deployment.xml.BasicXMLDeployer;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.kernel.spi.event.KernelEvent;
+import org.jboss.util.StopWatch;
+
+/**
+ * ServerImpl.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ServerImpl extends AbstractServerImpl
+{
+ /** The bootstrap file */
+ public static String BOOTSTRAP_XML_NAME = "bootstrap-beans.xml";
+
+ /** The bootstrap */
+ private BasicBootstrap bootstrap;
+
+ /** The kernel */
+ private Kernel kernel;
+
+ /** The kernel deployer */
+ private BasicXMLDeployer kernelDeployer;
+
+ /**
+ * Get the kernel
+ *
+ * @return the kernel
+ */
+ public Kernel getKernel()
+ {
+ return kernel;
+ }
+
+ @Override
+ protected void doStart(StopWatch watch) throws Throwable
+ {
+ // Bootstrap the kernel
+ BasicBootstrap bootstrap = new BasicBootstrap();
+ bootstrap.run();
+ kernel = bootstrap.getKernel();
+
+ // Register the server implementation
+ KernelController controller = kernel.getController();
+ AbstractBeanMetaData metaData = new AbstractBeanMetaData("JBossServer", getClass().getName());
+ InstallCallbackMetaData install = new InstallCallbackMetaData();
+ install.setMethodName("addBootstrap");
+ metaData.setInstallCallbacks(Collections.singletonList((CallbackMetaData) install));
+ UninstallCallbackMetaData uninstall = new UninstallCallbackMetaData();
+ uninstall.setMethodName("removeBootstrap");
+ metaData.setUninstallCallbacks(Collections.singletonList((CallbackMetaData) uninstall));
+ controller.install(metaData, this);
+
+ // Determine the url for the bootstrap
+ URL url = getConfig().getBootstrapURL();
+ if (url == null)
+ {
+ URL configURL = getConfig().getServerConfigURL();
+ url = new URL(configURL, BOOTSTRAP_XML_NAME);
+ log.info("Starting Microcontainer, bootstrapURL=" + url);
+ }
+
+ // Create an xml deployer
+ kernelDeployer = new BasicXMLDeployer(kernel);
+
+ // Deploy the bootstrap url
+ kernelDeployer.deploy(url);
+
+ // Check it is complete
+ kernelDeployer.validate();
+
+ // Send a notification that the startup is complete
+ KernelEvent startEvent = bootstrap.createEvent(START_NOTIFICATION_TYPE, new Long(watch.getLapTime()));
+ bootstrap.fireKernelEvent(startEvent);
+ }
+
+ @Override
+ protected void doShutdown()
+ {
+ // Send a stop event msg
+ try
+ {
+ if (bootstrap != null)
+ {
+ KernelEvent stopEvent = bootstrap.createEvent(STOP_NOTIFICATION_TYPE, null);
+ bootstrap.fireKernelEvent(stopEvent);
+ }
+ }
+ catch (Throwable t)
+ {
+ log.warn("Error sending stop notification", t);
+ }
+
+ // Shutdown the deployer
+ try
+ {
+ if (kernelDeployer != null)
+ kernelDeployer.shutdown();
+ kernelDeployer = null;
+ }
+ catch (Throwable t)
+ {
+ log.warn("Error stopping xml deployer", t);
+ }
+
+ // Shutdown the controller
+ try
+ {
+ if (bootstrap != null)
+ {
+ Kernel kernel = bootstrap.getKernel();
+ KernelController controller = kernel.getController();
+ controller.shutdown();
+ bootstrap = null;
+ }
+ }
+ catch (Throwable t)
+ {
+ log.warn("Error stopping xml deployer", t);
+ }
+ }
+}
Added: trunk/bootstrap/src/main/org/jboss/bootstrap/spi/Bootstrap.java
===================================================================
--- trunk/bootstrap/src/main/org/jboss/bootstrap/spi/Bootstrap.java (rev 0)
+++ trunk/bootstrap/src/main/org/jboss/bootstrap/spi/Bootstrap.java 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,48 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.bootstrap.spi;
+
+import org.jboss.system.server.Server;
+
+/**
+ * Bootstrap.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public interface Bootstrap
+{
+ /**
+ * Invoked at startup
+ *
+ * @param server the server instance
+ * @throws Exception for any error
+ */
+ void start(Server server) throws Exception;
+
+ /**
+ * Invoked at shutdown
+ *
+ * @param server the server instance
+ */
+ void shutdown(Server server);
+}
Modified: trunk/build/build-distr.xml
===================================================================
--- trunk/build/build-distr.xml 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/build/build-distr.xml 2007-08-14 15:48:44 UTC (rev 64576)
@@ -230,12 +230,12 @@
</target>
- <!-- ====== -->
- <!-- System -->
- <!-- ====== -->
+ <!-- ==== -->
+ <!-- Main -->
+ <!-- ==== -->
- <target name="_module-system-most">
- <property name="_module.name" value="system" override="true"/>
+ <target name="_module-main-most">
+ <property name="_module.name" value="main" override="true"/>
<property name="_module.output" override="true" value="${project.root}/${_module.name}/output"/>
<!-- Copy the generated libraries -->
@@ -243,7 +243,7 @@
<copy todir="${install.lib}" filtering="no">
<fileset dir="${_module.output}/lib">
<include name="log4j-boot.jar"/>
- <include name="jboss-system.jar"/>
+ <include name="jboss-main.jar"/>
</fileset>
</copy>
@@ -295,6 +295,70 @@
</fileset>
</copy>
+ </target>
+
+ <target name="_module-main-all" depends="_module-main-most">
+ <!-- Copy the generated javadocs -->
+ <mkdir dir="${install.api}/${_module.name}"/>
+ <copy todir="${install.api}/${_module.name}" filtering="no">
+ <fileset dir="${_module.output}/api">
+ <include name="**/*"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <!-- ========= -->
+ <!-- Bootstrap -->
+ <!-- ========= -->
+
+ <target name="_module-bootstrap-most">
+ <property name="_module.name" value="bootstrap" override="true"/>
+ <property name="_module.output" override="true" value="${project.root}/${_module.name}/output"/>
+
+ <!-- Copy the generated libraries -->
+ <mkdir dir="${install.lib}"/>
+ <copy todir="${install.lib}" filtering="no">
+ <fileset dir="${_module.output}/lib">
+ <include name="jboss-bootstrap.jar"/>
+ </fileset>
+ </copy>
+
+ </target>
+
+ <target name="_module-bootstrap-all" depends="_module-bootstrap-most">
+ <!-- Copy the generated javadocs -->
+ <mkdir dir="${install.api}/${_module.name}"/>
+ <copy todir="${install.api}/${_module.name}" filtering="no">
+ <fileset dir="${_module.output}/api">
+ <include name="**/*"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <!-- ====== -->
+ <!-- System -->
+ <!-- ====== -->
+
+ <target name="_module-system-most">
+ <property name="_module.name" value="system" override="true"/>
+ <property name="_module.output" override="true" value="${project.root}/${_module.name}/output"/>
+
+ <!-- Copy the generated libraries -->
+ <mkdir dir="${install.lib}"/>
+ <copy todir="${install.lib}" filtering="no">
+ <fileset dir="${_module.output}/lib">
+ <include name="jboss-system.jar"/>
+ </fileset>
+ </copy>
+
+ <!-- Copy the generated client -->
+ <mkdir dir="${install.client}"/>
+ <copy todir="${install.client}" filtering="no">
+ <fileset dir="${_module.output}/lib">
+ <include name="*-client.jar"/>
+ </fileset>
+ </copy>
+
<!-- Copy the DTDs -->
<mkdir dir="${install.dtd}"/>
<copy todir="${install.dtd}" filtering="no">
Modified: trunk/build/build-thirdparty.xml
===================================================================
--- trunk/build/build-thirdparty.xml 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/build/build-thirdparty.xml 2007-08-14 15:48:44 UTC (rev 64576)
@@ -97,7 +97,7 @@
<componentref name="jboss/jbossws-native50" version="snapshot"/>
<componentref name="jboss/jbossws-jboss50" version="2.0.1.CR1"/>
<componentref name="jboss/messaging" version="snapshot"/>
- <componentref name="jboss/microcontainer" version="snapshot-classloader"/>
+ <componentref name="jboss/microcontainer" version="snapshot"/>
<componentref name="jboss/jboss-vfs" version="2.0.0.Beta4"/>
<componentref name="jboss/remoting" version="2.2.0.SP4"/>
<componentref name="jboss/jbossretro" version="1.0.5.GA"/>
Modified: trunk/build/build.xml
===================================================================
--- trunk/build/build.xml 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/build/build.xml 2007-08-14 15:48:44 UTC (rev 64576)
@@ -83,6 +83,7 @@
<!-- Modules -->
<module name="aspects"/>
+ <module name="bootstrap"/>
<module name="cluster"/>
<module name="connector"/>
<module name="console"/>
@@ -93,6 +94,7 @@
<module name="iiop"/>
<module name="j2se"/>
<module name="jmx"/>
+ <module name="main"/>
<module name="management"/>
<module name="mbeans"/>
<module name="messaging"/>
@@ -122,7 +124,7 @@
</group>
<group name="core">
- <include modules="j2se, mbeans, jmx, system, system-jmx, naming"/>
+ <include modules="main, bootstrap, j2se, mbeans, jmx, system, system-jmx, naming"/>
</group>
<group name="basic">
@@ -412,7 +414,30 @@
</target>
-->
+ <!-- ==== -->
+ <!-- Main -->
+ <!-- ==== -->
+ <target name="_module-main-most">
+ <ant antfile="build-distr.xml" target="_module-main-most"/>
+ </target>
+
+ <target name="_module-main-all" depends="_module-main-most">
+ <ant antfile="build-distr.xml" target="_module-main-all"/>
+ </target>
+
+ <!-- ========= -->
+ <!-- Bootstrap -->
+ <!-- ========= -->
+
+ <target name="_module-bootstrap-most">
+ <ant antfile="build-distr.xml" target="_module-bootstrap-most"/>
+ </target>
+
+ <target name="_module-bootstrap-all" depends="_module-bootstrap-most">
+ <ant antfile="build-distr.xml" target="_module-bootstrap-all"/>
+ </target>
+
<!-- ====== -->
<!-- System -->
<!-- ====== -->
Modified: trunk/cluster/.classpath
===================================================================
--- trunk/cluster/.classpath 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/cluster/.classpath 2007-08-14 15:48:44 UTC (rev 64576)
@@ -24,5 +24,6 @@
<classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-deployers-core-spi.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-deployers-core-spi-sources.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-deployers-vfs-spi.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-deployers-vfs-spi-sources.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/integration/lib/jboss-integration.jar" sourcepath="/thirdparty/jboss/integration/lib/integration-sources.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/main"/>
<classpathentry kind="output" path="output/eclipse-classes"/>
</classpath>
Modified: trunk/cluster/build.xml
===================================================================
--- trunk/cluster/build.xml 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/cluster/build.xml 2007-08-14 15:48:44 UTC (rev 64576)
@@ -96,6 +96,7 @@
<path refid="jboss.common.logging.log4j.classpath"/>
<path refid="jboss.common.logging.jdk.classpath"/>
<path refid="jboss.jboss.vfs.classpath"/>
+ <path refid="jboss.main.classpath"/>
<path refid="jboss.system.classpath"/>
<path refid="jboss.systemjmx.classpath"/>
<path refid="jboss.naming.classpath"/>
Modified: trunk/connector/.classpath
===================================================================
--- trunk/connector/.classpath 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/connector/.classpath 2007-08-14 15:48:44 UTC (rev 64576)
@@ -35,5 +35,6 @@
<classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-managed.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-managed-sources.jar"/>
<classpathentry kind="lib" path="/thirdparty/quartz/lib/quartz-all.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/integration/lib/jboss-integration.jar" sourcepath="/thirdparty/jboss/integration/lib/integration-sources.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/main"/>
<classpathentry kind="output" path="output/eclipse-classes"/>
</classpath>
Modified: trunk/connector/build.xml
===================================================================
--- trunk/connector/build.xml 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/connector/build.xml 2007-08-14 15:48:44 UTC (rev 64576)
@@ -103,6 +103,7 @@
<path refid="jboss.jbosssx.classpath"/>
<path refid="jboss.jboss.security.spi.classpath"/>
<path refid="jboss.server.classpath"/>
+ <path refid="jboss.main.classpath"/>
<path refid="jboss.system.classpath"/>
<path refid="jboss.systemjmx.classpath"/>
<path refid="jboss.profileservice.classpath"/>
Modified: trunk/console/.classpath
===================================================================
--- trunk/console/.classpath 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/console/.classpath 2007-08-14 15:48:44 UTC (rev 64576)
@@ -22,5 +22,6 @@
<classpathentry combineaccessrules="false" kind="src" path="/system-jmx"/>
<classpathentry kind="lib" path="/thirdparty/jboss/aop/lib/jboss-aop-jdk50.jar"/>
<classpathentry kind="lib" path="/thirdparty/beanshell/lib/bsh.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/main"/>
<classpathentry kind="output" path="output/eclipse-classes"/>
</classpath>
Modified: trunk/console/build.xml
===================================================================
--- trunk/console/build.xml 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/console/build.xml 2007-08-14 15:48:44 UTC (rev 64576)
@@ -98,6 +98,7 @@
<path refid="jboss.jbosssx.classpath"/>
<path refid="jboss.server.classpath"/>
<path refid="jboss.mq.classpath"/>
+ <path refid="jboss.main.classpath"/>
<path refid="jboss.system.classpath"/>
<path refid="jboss.systemjmx.classpath"/>
<path refid="jboss.varia.classpath"/>
Modified: trunk/ejb3/.classpath
===================================================================
--- trunk/ejb3/.classpath 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/ejb3/.classpath 2007-08-14 15:48:44 UTC (rev 64576)
@@ -59,5 +59,6 @@
<classpathentry kind="lib" path="/thirdparty/jboss/integration/lib/jboss-integration.jar" sourcepath="/thirdparty/jboss/integration/lib/jboss-integration-sources.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/jboss-security-spi/lib/jboss-security-spi.jar" sourcepath="/thirdparty/jboss/jboss-security-spi/lib/jboss-security-spi-sources.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/jbosssx/lib/jbosssx.jar" sourcepath="/thirdparty/jboss/security/lib/jbosssx-sources.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/main"/>
<classpathentry kind="output" path="output/eclipse-classes"/>
</classpath>
Modified: trunk/ejb3/build-test.xml
===================================================================
--- trunk/ejb3/build-test.xml 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/ejb3/build-test.xml 2007-08-14 15:48:44 UTC (rev 64576)
@@ -187,6 +187,7 @@
<path refid="jboss.common.logging.jdk.classpath"/>
<path refid="jboss.cache.classpath"/>
<path refid="jboss.cluster.classpath"/>
+ <path refid="jboss.main.classpath"/>
<path refid="jboss.system.classpath"/>
<path refid="jboss.systemjmx.classpath"/>
<path refid="jboss.naming.classpath"/>
Modified: trunk/ejb3/build.xml
===================================================================
--- trunk/ejb3/build.xml 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/ejb3/build.xml 2007-08-14 15:48:44 UTC (rev 64576)
@@ -128,6 +128,7 @@
<path refid="jboss.common.logging.log4j.classpath"/>
<path refid="jboss.common.logging.jdk.classpath"/>
<path refid="jboss.cluster.classpath"/>
+ <path refid="jboss.main.classpath"/>
<path refid="jboss.system.classpath"/>
<path refid="jboss.systemjmx.classpath"/>
<path refid="jboss.mbeans.classpath"/>
Modified: trunk/embedded/.classpath
===================================================================
--- trunk/embedded/.classpath 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/embedded/.classpath 2007-08-14 15:48:44 UTC (rev 64576)
@@ -32,5 +32,7 @@
<classpathentry kind="lib" path="/thirdparty/jboss/remoting/lib/jboss-remoting.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/test/lib/jboss-test.jar"/>
<classpathentry kind="lib" path="/thirdparty/junit/lib/junit.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/main"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/bootstrap"/>
<classpathentry kind="output" path="output/classes"/>
</classpath>
Modified: trunk/embedded/build.xml
===================================================================
--- trunk/embedded/build.xml 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/embedded/build.xml 2007-08-14 15:48:44 UTC (rev 64576)
@@ -119,6 +119,7 @@
<path refid="jboss.common.logging.log4j.classpath"/>
<path refid="jboss.common.logging.jdk.classpath"/>
<path refid="jboss.cluster.classpath"/>
+ <path refid="jboss.main.classpath"/>
<path refid="jboss.system.classpath"/>
<path refid="jboss.systemjmx.classpath"/>
<path refid="jboss.naming.classpath"/>
@@ -394,6 +395,8 @@
<zipfileset src="${jboss.jca.lib}/jms-ra.jar"/>
<zipfileset src="${jboss.jmx.lib}/jboss-jmx.jar"/>
<zipfileset src="${jboss.mbeans.lib}/jboss-mbeans.jar"/>
+ <zipfileset src="${jboss.main.lib}/jboss-main.jar"/>
+ <zipfileset src="${jboss.bootstrap.lib}/jboss-bootstrap.jar"/>
<zipfileset src="${jboss.system.lib}/jboss-system.jar"/>
<zipfileset src="${jboss.systemjmx.lib}/jboss-system-jmx.jar"/>
<zipfileset src="${jboss.serialization.lib}/jboss-serialization.jar"/>
Modified: trunk/embedded/src/main/java/org/jboss/embedded/adapters/ServerConfig.java
===================================================================
--- trunk/embedded/src/main/java/org/jboss/embedded/adapters/ServerConfig.java 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/embedded/src/main/java/org/jboss/embedded/adapters/ServerConfig.java 2007-08-14 15:48:44 UTC (rev 64576)
@@ -21,7 +21,7 @@
*/
package org.jboss.embedded.adapters;
-import org.jboss.system.server.BaseServerConfig;
+import org.jboss.bootstrap.BaseServerConfig;
import org.jboss.embedded.Bootstrap;
import org.jboss.embedded.DeploymentScanner;
@@ -124,6 +124,11 @@
return config.getHomeDir();
}
+ public URL getBootstrapURL()
+ {
+ return config.getBootstrapURL();
+ }
+
public URL getHomeURL()
{
return config.getHomeURL();
@@ -139,6 +144,11 @@
return config.getPatchURL();
}
+ public boolean isInstallLifeThread()
+ {
+ return config.isInstallLifeThread();
+ }
+
public String getServerName()
{
return config.getServerName();
Modified: trunk/iiop/.classpath
===================================================================
--- trunk/iiop/.classpath 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/iiop/.classpath 2007-08-14 15:48:44 UTC (rev 64576)
@@ -22,5 +22,6 @@
<classpathentry kind="lib" path="/thirdparty/jboss/integration/lib/jboss-integration.jar" sourcepath="/thirdparty/jboss/integration/lib/jboss-integration-sources.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/jbosssx/lib/jbosssx.jar" sourcepath="/thirdparty/jboss/security/lib/jbosssx-sources.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/jboss-security-spi/lib/jboss-security-spi.jar" sourcepath="/thirdparty/jboss/jboss-security-spi/lib/jboss-security-spi-sources.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/main"/>
<classpathentry kind="output" path="output/eclipse-classes"/>
</classpath>
Modified: trunk/iiop/build.xml
===================================================================
--- trunk/iiop/build.xml 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/iiop/build.xml 2007-08-14 15:48:44 UTC (rev 64576)
@@ -95,6 +95,7 @@
<path refid="jboss.common.logging.spi.classpath"/>
<path refid="jboss.common.logging.log4j.classpath"/>
<path refid="jboss.common.logging.jdk.classpath"/>
+ <path refid="jboss.main.classpath"/>
<path refid="jboss.system.classpath"/>
<path refid="jboss.systemjmx.classpath"/>
<path refid="jboss.naming.classpath"/>
Modified: trunk/jbossmq/.classpath
===================================================================
--- trunk/jbossmq/.classpath 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/jbossmq/.classpath 2007-08-14 15:48:44 UTC (rev 64576)
@@ -17,5 +17,6 @@
<classpathentry kind="lib" path="/thirdparty/jboss/jboss-security-spi/lib/jboss-security-spi.jar" sourcepath="/thirdparty/jboss/jboss-security-spi/lib/jboss-security-spi-sources.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/jbosssx/lib/jbosssx.jar" sourcepath="/thirdparty/jboss/security/lib/jbosssx-sources.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/jboss-jaspi-api/lib/jboss-jaspi-api.jar" sourcepath="/thirdparty/jboss/jboss-jaspi-api/lib/jboss-jaspi-api-sources.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/main"/>
<classpathentry kind="output" path="output/eclipse-classes"/>
</classpath>
Modified: trunk/jbossmq/build.xml
===================================================================
--- trunk/jbossmq/build.xml 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/jbossmq/build.xml 2007-08-14 15:48:44 UTC (rev 64576)
@@ -82,6 +82,7 @@
<path refid="jboss.common.logging.spi.classpath"/>
<path refid="jboss.common.logging.log4j.classpath"/>
<path refid="jboss.common.logging.jdk.classpath"/>
+ <path refid="jboss.main.classpath"/>
<path refid="jboss.system.classpath"/>
<path refid="jboss.systemjmx.classpath"/>
<path refid="jboss.naming.classpath"/>
Added: trunk/main/.classpath
===================================================================
--- trunk/main/.classpath (rev 0)
+++ trunk/main/.classpath 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="lib" path="/thirdparty/gnu-getopt/lib/getopt.jar"/>
+ <classpathentry kind="output" path="output/eclipse-classes"/>
+</classpath>
Added: trunk/main/.project
===================================================================
--- trunk/main/.project (rev 0)
+++ trunk/main/.project 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>main</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/main/build.bat
===================================================================
--- trunk/main/build.bat (rev 0)
+++ trunk/main/build.bat 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,89 @@
+ at echo off
+REM ======================================================================
+REM
+REM This is the main entry point for the build system.
+REM
+REM Users should be sure to execute this file rather than 'ant' to ensure
+REM the correct version is being used with the correct configuration.
+REM
+REM ======================================================================
+REM
+REM $Id: build.bat 24242 2004-10-04 20:13:37Z andd $
+REM
+REM Authors:
+REM Jason Dillon <jason at planet57.com>
+REM Sacha Labourey <sacha.labourey at cogito-info.ch>
+REM
+
+REM ******************************************************
+REM Ignore the ANT_HOME variable: we want to use *our*
+REM ANT version and associated JARs.
+REM ******************************************************
+REM Ignore the users classpath, cause it might mess
+REM things up
+REM ******************************************************
+
+SETLOCAL
+
+set CLASSPATH=
+set ANT_HOME=
+set ANT_OPTS=-Djava.protocol.handler.pkgs=org.jboss.net.protocol -Dbuild.script=build.bat
+
+REM ******************************************************
+REM - "for" loops have been unrolled for compatibility
+REM with some WIN32 systems.
+REM ******************************************************
+
+set NAMES=tools;tools\ant;tools\apache\ant
+set SUBFOLDERS=..;..\..;..\..\..;..\..\..\..
+
+REM ******************************************************
+REM ******************************************************
+
+SET EXECUTED=FALSE
+for %%i in (%NAMES%) do call :subLoop %%i %1 %2 %3 %4 %5 %6
+
+goto :EOF
+
+
+REM ******************************************************
+REM ********* Search for names in the subfolders *********
+REM ******************************************************
+
+:subLoop
+for %%j in (%SUBFOLDERS%) do call :testIfExists %%j\%1\bin\ant.bat %2 %3 %4 %5 %6 %7
+
+goto :EOF
+
+
+REM ******************************************************
+REM ************ Test if ANT Batch file exists ***********
+REM ******************************************************
+
+:testIfExists
+if exist %1 call :BatchFound %1 %2 %3 %4 %5 %6 %7 %8
+
+goto :EOF
+
+
+REM ******************************************************
+REM ************** Batch file has been found *************
+REM ******************************************************
+
+:BatchFound
+if (%EXECUTED%)==(FALSE) call :ExecuteBatch %1 %2 %3 %4 %5 %6 %7 %8
+set EXECUTED=TRUE
+
+goto :EOF
+
+REM ******************************************************
+REM ************* Execute Batch file only once ***********
+REM ******************************************************
+
+:ExecuteBatch
+echo Calling %1 %2 %3 %4 %5 %6 %7 %8
+call %1 %2 %3 %4 %5 %6 %7 %8
+
+:end
+
+if "%NOPAUSE%" == "" pause
Property changes on: trunk/main/build.bat
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/main/build.sh
===================================================================
--- trunk/main/build.sh (rev 0)
+++ trunk/main/build.sh 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,172 @@
+#!/bin/sh
+### ====================================================================== ###
+## ##
+## This is the main entry point for the build system. ##
+## ##
+## Users should be sure to execute this file rather than 'ant' to ensure ##
+## the correct version is being used with the correct configuration. ##
+## ##
+### ====================================================================== ###
+
+# $Id: build.sh 24242 2004-10-04 20:13:37Z andd $
+
+PROGNAME=`basename $0`
+DIRNAME=`dirname $0`
+GREP="grep"
+ROOT="/"
+
+# Ignore user's ANT_HOME if it is set
+ANT_HOME=""
+
+# the default search path for ant
+ANT_SEARCH_PATH="\
+ tools
+ tools/ant \
+ tools/apache/ant \
+ ant"
+
+# the default build file name
+ANT_BUILD_FILE="build.xml"
+
+# the default arguments
+ANT_OPTIONS="-find $ANT_BUILD_FILE"
+
+# Use the maximum available, or set MAX_FD != -1 to use that
+MAX_FD="maximum"
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false;
+darwin=false;
+case "`uname`" in
+ CYGWIN*)
+ cygwin=true
+ ;;
+
+ Darwin*)
+ darwin=true
+ ;;
+esac
+
+#
+# Helper to complain.
+#
+die() {
+ echo "${PROGNAME}: $*"
+ exit 1
+}
+
+#
+# Helper to complain.
+#
+warn() {
+ echo "${PROGNAME}: $*"
+}
+
+#
+# Helper to source a file if it exists.
+#
+maybe_source() {
+ for file in $*; do
+ if [ -f "$file" ]; then
+ . $file
+ fi
+ done
+}
+
+search() {
+ search="$*"
+ for d in $search; do
+ ANT_HOME="`pwd`/$d"
+ ANT="$ANT_HOME/bin/ant"
+ if [ -x "$ANT" ]; then
+ # found one
+ echo $ANT_HOME
+ break
+ fi
+ done
+}
+
+#
+# Main function.
+#
+main() {
+ # if there is a build config file. then source it
+ maybe_source "$DIRNAME/build.conf" "$HOME/.build.conf"
+
+ # Increase the maximum file descriptors if we can
+ if [ $cygwin = "false" ]; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ]; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then
+ # use the system max
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ]; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query system maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+ fi
+
+ # try the search path
+ ANT_HOME=`search $ANT_SEARCH_PATH`
+
+ # try looking up to root
+ if [ "x$ANT_HOME" = "x" ]; then
+ target="build"
+ _cwd=`pwd`
+
+ while [ "x$ANT_HOME" = "x" ] && [ "$cwd" != "$ROOT" ]; do
+ cd ..
+ cwd=`pwd`
+ ANT_HOME=`search $ANT_SEARCH_PATH`
+ done
+
+ # make sure we get back
+ cd $_cwd
+
+ if [ "$cwd" != "$ROOT" ]; then
+ found="true"
+ fi
+
+ # complain if we did not find anything
+ if [ "$found" != "true" ]; then
+ die "Could not locate Ant; check \$ANT or \$ANT_HOME."
+ fi
+ fi
+
+ # make sure we have one
+ ANT=$ANT_HOME/bin/ant
+ if [ ! -x "$ANT" ]; then
+ die "Ant file is not executable: $ANT"
+ fi
+
+ # need to specify planet57/buildmagic protocol handler package
+ ANT_OPTS="-Djava.protocol.handler.pkgs=org.jboss.net.protocol"
+
+ # setup some build properties
+ ANT_OPTS="$ANT_OPTS -Dbuild.script=$0"
+
+ # change to the directory where the script lives so users are not forced
+ # to be in the same directory as build.xml
+ cd $DIRNAME
+
+ # export some stuff for ant
+ export ANT ANT_HOME ANT_OPTS
+
+ # execute in debug mode, or simply execute
+ if [ "x$ANT_DEBUG" != "x" ]; then
+ /bin/sh -x $ANT $ANT_OPTIONS "$@"
+ else
+ exec $ANT $ANT_OPTIONS "$@"
+ fi
+}
+
+##
+## Bootstrap
+##
+
+main "$@"
Property changes on: trunk/main/build.sh
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/main/build.xml
===================================================================
--- trunk/main/build.xml (rev 0)
+++ trunk/main/build.xml 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,167 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE project [
+ <!ENTITY buildmagic SYSTEM "../tools/etc/buildmagic/buildmagic.ent">
+ <!ENTITY libraries SYSTEM "../thirdparty/libraries.ent">
+ <!ENTITY targets SYSTEM "../tools/etc/buildmagic/targets.ent">
+]>
+
+<!-- ====================================================================== -->
+<!-- -->
+<!-- JBoss, the OpenSource J2EE webOS -->
+<!-- -->
+<!-- Distributable under LGPL license. -->
+<!-- See terms of license at http://www.gnu.org. -->
+<!-- -->
+<!-- ====================================================================== -->
+
+<!-- $Id: build.xml 63730 2007-06-28 17:24:29Z adrian at jboss.org $ -->
+
+<project default="main" name="JBoss/Main">
+
+ <!-- ================================================================== -->
+ <!-- Setup -->
+ <!-- ================================================================== -->
+
+ <!--
+ | Include the common Buildmagic elements.
+ |
+ | This defines several different targets, properties and paths.
+ | It also sets up the basic extention tasks amoung other things.
+ -->
+
+ &buildmagic;
+
+ <!--
+ | Include the normal targets.
+ -->
+ &targets;
+
+ <!-- ================================================================== -->
+ <!-- Configuration -->
+ <!-- ================================================================== -->
+
+ <!--
+ | Configure the build system.
+ |
+ | This target is invoked by the Buildmagic initialization logic and
+ | should contain module specific configuration elements.
+ -->
+
+ <target name="configure" unless="configure.disable">
+
+ <!-- =================== -->
+ <!-- Basic Configuration -->
+ <!-- =================== -->
+
+ <!-- Module name(s) & version -->
+ <property name="module.name" value="main"/>
+ <property name="module.Name" value="JBoss Main"/>
+ <property name="module.version" value="DEV"/>
+
+ <!-- ========= -->
+ <!-- Libraries -->
+ <!-- ========= -->
+
+ &libraries;
+
+ <!-- The combined library classpath -->
+ <path id="library.classpath">
+ <path refid="gnu.getopt.classpath"/>
+ </path>
+
+ <!-- The combined dependant module classpath -->
+ <path id="dependentmodule.classpath">
+ </path>
+
+ <!-- ===== -->
+ <!-- Tasks -->
+ <!-- ===== -->
+
+ <property name="jar.prefix" value="jboss-main"/>
+ <property name="javac.target" value="1.5"/>
+ <property name="javac.source" value="1.5"/>
+ <property name="jar.client.includes"
+ value="org/jboss/system/server/ServerLoader*.class,
+ org/jboss/system/server/Server.class,
+ org/jboss/system/server/ServerConfig.class,
+ **/*MBean.class"
+ />
+
+ <call target="_default:task-init"/>
+
+ </target>
+
+ <!-- ================================================================== -->
+ <!-- Compile -->
+ <!-- ================================================================== -->
+
+ <!--
+ | Compile everything.
+ |
+ | This target should depend on other compile-* targets for each
+ | different type of compile that needs to be performed, short of
+ | documentation compiles.
+ -->
+
+ <target name="compile"
+ description="Compile all source files."
+ depends="_default:compile-classes,
+ _default:compile-resources,
+ _default:compile-etc,
+ _default:compile-bin"/>
+
+ <!-- ================================================================== -->
+ <!-- Archives -->
+ <!-- ================================================================== -->
+
+ <!--
+ | Build all jar files.
+ -->
+ <target name="module-jars" >
+
+ <!--
+ | Build log4j-boot.jar This is a minimal subset of the log4j
+ | classes that allow the boot process to use log4j but avoids
+ | loading log4j classes that depend on other features like
+ | JMS, JDBC, JavaMail, etc.
+ -->
+
+ <jar jarfile="${build.lib}/log4j-boot.jar">
+ <zipfileset src="${apache.log4j.lib}/log4j.jar">
+ <include name="org/apache/log4j/*"/>
+ <include name="org/apache/log4j/config/*"/>
+ <include name="org/apache/log4j/helpers/*"/>
+ <include name="org/apache/log4j/or/*"/>
+ <include name="org/apache/log4j/spi/*"/>
+ </zipfileset>
+ </jar>
+
+ <!-- -->
+ <jar jarfile="${build.lib}/jboss-main.jar" manifest="${build.etc}/default.mf">
+ <fileset dir="${build.classes}"/>
+ </jar>
+
+ <jar jarfile="${build.lib}/${jar.client.name}" manifest="${build.etc}/default.mf">
+ <fileset dir="${build.classes}" includes="${jar.client.includes}"/>
+ </jar>
+
+ <!-- Build run.jar -->
+ <jar jarfile="${build.lib}/run.jar" manifest="${build.etc}/run.mf">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/**"/>
+ </fileset>
+ <fileset dir="${build.resources}">
+ <include name="*.properties"/>
+ <include name="jdklogger.xml"/>
+ <include name="org/jboss/version.properties"/>
+ </fileset>
+
+ <!-- Include getopt -->
+ <zipfileset src="${gnu.getopt.lib}/getopt.jar">
+ <include name="**"/>
+ </zipfileset>
+ </jar>
+
+ </target>
+
+</project>
Added: trunk/main/src/bin/classpath.sh
===================================================================
--- trunk/main/src/bin/classpath.sh (rev 0)
+++ trunk/main/src/bin/classpath.sh 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,193 @@
+#!/bin/sh
+### ====================================================================== ###
+## ##
+## A tool to determine JBoss classpaths. ##
+## ##
+### ====================================================================== ###
+
+### $Id: classpath.sh 7809 2002-05-22 02:39:56Z user57 $ ###
+
+DIRNAME=`dirname $0`
+PROGNAME=`basename $0`
+CAT="cat"
+
+#
+# Helper to complain.
+#
+warn() {
+ echo "${PROGNAME}: $*"
+}
+
+#
+# Helper to puke.
+#
+die() {
+ warn $*
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false;
+darwin=false;
+case "`uname`" in
+ CYGWIN*)
+ cygwin=true
+ ;;
+
+ Darwin*)
+ darwin=true
+ ;;
+esac
+
+#
+# Print the command line help message.
+#
+printHelpMessage() {
+ $CAT <<EOF
+usage: $PROGNAME [options] <classpath>
+
+options:
+ -h, --help Print this help message.
+ -- Stop processing options.
+ -r, --relative Use relative paths.
+
+classpath:
+ -c, --client Client classpath (client/*).
+ -s, --server Server classpath (lib/*).
+ -b, --both Both the client and server classpaths.
+EOF
+}
+
+RELATIVE=false
+
+#
+# Process command line options.
+#
+processCommandLine() {
+ while [ "x$1" != "x" ]; do
+ case "$1" in
+ --help|-h)
+ printHelpMessage
+ exit 1
+ ;;
+
+ --relative|-r)
+ RELATIVE=true
+ ;;
+
+ --)
+ shift
+ if [ "x$argv" = "x" ]; then
+ argv="$1"
+ else
+ argv="$argv $1"
+ fi
+ break
+ ;;
+
+ *)
+ if [ "x$argv" = "x" ]; then
+ argv="$1"
+ else
+ argv="$argv $1"
+ fi
+ ;;
+ esac
+ shift
+ done
+}
+
+if [ -n "$CLASSPATH" ] ; then
+ LOCALCLASSPATH=$CLASSPATH
+fi
+
+#
+# Print the class path for the given type.
+#
+printClassPath() {
+
+#
+# jason: should be fixed to only include proper classpath bits
+#
+
+ case "$1" in
+ -c|--client)
+ DIRLIBS="`ls $JBOSS_HOME/client/*`:$JBOSS_HOME/client"
+ ;;
+
+ -s|--server)
+ DIRLIBS=`ls $JBOSS_HOME/lib/*`
+ ;;
+
+ -b|--both)
+ DIRLIBS="`ls $JBOSS_HOME/client/*`:$JBOSS_HOME/client"
+ DIRLIBS="${DIRLIBS}:`ls $JBOSS_HOME/lib/*`"
+ ;;
+
+ *)
+ printHelpMessage
+ exit 0
+ ;;
+ esac
+
+ for i in ${DIRLIBS}; do
+ if [ "$i" != "${DIRLIBS}" ] ; then
+ if [ -z "$LOCALCLASSPATH" ] ; then
+ LOCALCLASSPATH=$i
+ else
+ LOCALCLASSPATH="$i":$LOCALCLASSPATH
+ fi
+ fi
+ done
+
+ # For Cygwin, switch paths to Windows format before running java
+ if $cygwin; then
+ LOCALCLASSPATH=`cygpath --path --windows "$LOCALCLASSPATH"`
+ fi
+
+ echo $LOCALCLASSPATH
+}
+
+#
+# Main entry-point.
+#
+main() {
+ argv=""
+
+ # process the command line
+ processCommandLine "$@"
+
+ # For Cygwin, ensure paths are in UNIX format before anything is touched
+ if $cygwin ; then
+ [ -n "$JBOSS_HOME" ] &&
+ JBOSS_HOME=`cygpath --unix "$JBOSS_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+ [ -n "$JAVAC_JAR" ] &&
+ JAVAC_JAR=`cygpath --unix "$JAVAC_JAR"`
+ fi
+
+ # Setup JBOSS_HOME
+ if [ "x$JBOSS_HOME" = "x" ]; then
+ if $RELATIVE ; then
+ JBOSS_HOME="$DIRNAME/.."
+ else
+ # get the full path (without any relative bits)
+ JBOSS_HOME=`cd $DIRNAME/..; pwd`
+ fi
+ fi
+
+ if [ "x$argv" = "x" ]; then
+ printHelpMessage
+ exit 0
+ fi
+
+ printClassPath $argv
+}
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+
+#
+# Boot-strap
+#
+main "$@"
\ No newline at end of file
Added: trunk/main/src/bin/probe.bat
===================================================================
--- trunk/main/src/bin/probe.bat (rev 0)
+++ trunk/main/src/bin/probe.bat 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,13 @@
+ at echo off
+rem -------------------------------------------------------------------------
+rem JGroups Cluster Discovery Script for Win32
+rem -------------------------------------------------------------------------
+
+REM Discovers all UDP-based members running on a certain mcast address (use -help for help)
+REM Probe [-help] [-addr <addr>] [-port <port>] [-ttl <ttl>] [-timeout <timeout>]
+
+set CLASSPATH=..\lib\commons-logging.jar;..\server\all\lib\jgroups.jar
+
+set CP=%CLASSPATH%
+
+java -cp %CP% org.jgroups.tests.Probe %*
Added: trunk/main/src/bin/probe.sh
===================================================================
--- trunk/main/src/bin/probe.sh (rev 0)
+++ trunk/main/src/bin/probe.sh 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,27 @@
+#!/bin/sh
+### ====================================================================== ###
+## ##
+## JGroups Cluster Discovery Script ##
+## ##
+### ====================================================================== ###
+
+# Discovers all UDP-based members running on a certain mcast address (use -help for help)
+# Probe [-help] [-addr <addr>] [-port <port>] [-ttl <ttl>] [-timeout <timeout>]
+
+CLASSPATH=.:../lib/commons-logging.jar:../server/all/lib/jgroups.jar:$CLASSPATH
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false;
+case "`uname`" in
+ CYGWIN*)
+ cygwin=true
+ ;;
+esac
+
+if [ $cygwin = "true" ]; then
+ CP=`cygpath -wp $CLASSPATH`
+else
+ CP=$CLASSPATH
+fi
+
+java -cp $CP org.jgroups.tests.Probe $*
Added: trunk/main/src/bin/run.bat
===================================================================
--- trunk/main/src/bin/run.bat (rev 0)
+++ trunk/main/src/bin/run.bat 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,120 @@
+ at echo off
+rem -------------------------------------------------------------------------
+rem JBoss Bootstrap Script for Win32
+rem -------------------------------------------------------------------------
+
+rem $Id: run.bat 63250 2007-05-30 13:22:21Z dimitris at jboss.org $
+
+ at if not "%ECHO%" == "" echo %ECHO%
+ at if "%OS%" == "Windows_NT" setlocal
+
+set DIRNAME=.\
+if "%OS%" == "Windows_NT" set DIRNAME=%~dp0%
+set PROGNAME=run.bat
+if "%OS%" == "Windows_NT" set PROGNAME=%~nx0%
+
+pushd %DIRNAME%..
+set JBOSS_HOME=%CD%
+popd
+
+REM Add bin/native to the PATH if present
+if exist "%JBOSS_HOME%\bin\native" set PATH=%JBOSS_HOME%\bin\native;%PATH%
+if exist "%JBOSS_HOME%\bin\native" set JAVA_OPTS=%JAVA_OPTS% -Djava.library.path="%PATH%"
+
+rem Read all command line arguments
+
+REM
+REM The %ARGS% env variable commented out in favor of using %* to include
+REM all args in java command line. See bug #840239. [jpl]
+REM
+REM set ARGS=
+REM :loop
+REM if [%1] == [] goto endloop
+REM set ARGS=%ARGS% %1
+REM shift
+REM goto loop
+REM :endloop
+
+rem Find run.jar, or we can't continue
+
+set RUNJAR=%JBOSS_HOME%\bin\run.jar
+if exist "%RUNJAR%" goto FOUND_RUN_JAR
+echo Could not locate %RUNJAR%. Please check that you are in the
+echo bin directory when running this script.
+goto END
+
+:FOUND_RUN_JAR
+
+if not "%JAVA_HOME%" == "" goto ADD_TOOLS
+
+set JAVA=java
+
+echo JAVA_HOME is not set. Unexpected results may occur.
+echo Set JAVA_HOME to the directory of your local JDK to avoid this message.
+goto SKIP_TOOLS
+
+:ADD_TOOLS
+
+set JAVA=%JAVA_HOME%\bin\java
+
+rem A full JDK with toos.jar is not required anymore since jboss web packages
+rem the eclipse jdt compiler and javassist has its own internal compiler.
+if not exist "%JAVA_HOME%\lib\tools.jar" goto SKIP_TOOLS
+
+rem If exists, point to the JDK javac compiler in case the user wants to
+rem later override the eclipse jdt compiler for compiling JSP pages.
+set JAVAC_JAR=%JAVA_HOME%\lib\tools.jar
+
+:SKIP_TOOLS
+
+rem If JBOSS_CLASSPATH or JAVAC_JAR is empty, don't include it, as this will
+rem result in including the local directory in the classpath, which makes
+rem error tracking harder.
+if not "%JAVAC_JAR%" == "" set RUNJAR=%JAVAC_JAR%;%RUNJAR%
+if "%JBOSS_CLASSPATH%" == "" set RUN_CLASSPATH=%RUNJAR%
+if "%RUN_CLASSPATH%" == "" set RUN_CLASSPATH=%JBOSS_CLASSPATH%;%RUNJAR%
+
+set JBOSS_CLASSPATH=%RUN_CLASSPATH%
+
+rem Setup JBoss specific properties
+set JAVA_OPTS=%JAVA_OPTS% -Dprogram.name=%PROGNAME%
+
+rem Add -server to the JVM options, if supported
+"%JAVA%" -version 2>&1 | findstr /I hotspot > nul
+if not errorlevel == 1 (set JAVA_OPTS=%JAVA_OPTS% -server)
+
+rem JVM memory allocation pool parameters. Modify as appropriate.
+set JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx512m -XX:MaxPermSize=256m
+
+rem With Sun JVMs reduce the RMI GCs to once per hour
+set JAVA_OPTS=%JAVA_OPTS% -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000
+
+rem JPDA options. Uncomment and modify as appropriate to enable remote debugging.
+rem set JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y %JAVA_OPTS%
+
+rem Setup the java endorsed dirs
+set JBOSS_ENDORSED_DIRS=%JBOSS_HOME%\lib\endorsed
+
+echo ===============================================================================
+echo.
+echo JBoss Bootstrap Environment
+echo.
+echo JBOSS_HOME: %JBOSS_HOME%
+echo.
+echo JAVA: %JAVA%
+echo.
+echo JAVA_OPTS: %JAVA_OPTS%
+echo.
+echo CLASSPATH: %JBOSS_CLASSPATH%
+echo.
+echo ===============================================================================
+echo.
+
+:RESTART
+"%JAVA%" %JAVA_OPTS% "-Djava.endorsed.dirs=%JBOSS_ENDORSED_DIRS%" -classpath "%JBOSS_CLASSPATH%" org.jboss.Main %*
+if ERRORLEVEL 10 goto RESTART
+
+:END
+if "%NOPAUSE%" == "" pause
+
+:END_NO_PAUSE
Added: trunk/main/src/bin/run.conf
===================================================================
--- trunk/main/src/bin/run.conf (rev 0)
+++ trunk/main/src/bin/run.conf 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,50 @@
+## -*- shell-script -*- ######################################################
+## ##
+## JBoss Bootstrap Script Configuration ##
+## ##
+##############################################################################
+
+### $Id: run.conf 62748 2007-05-02 17:46:46Z dimitris at jboss.org $
+
+#
+# This file is optional; it may be removed if not needed.
+#
+
+#
+# Specify the maximum file descriptor limit, use "max" or "maximum" to use
+# the default, as queried by the system.
+#
+# Defaults to "maximum"
+#
+#MAX_FD="maximum"
+
+#
+# Specify the profiler configuration file to load.
+#
+# Default is to not load profiler configuration file.
+#
+#PROFILER=""
+
+#
+# Specify the location of the Java home directory. If set then $JAVA will
+# be defined to $JAVA_HOME/bin/java, else $JAVA will be "java".
+#
+#JAVA_HOME="/opt/java/jdk"
+
+#
+# Specify the exact Java VM executable to use.
+#
+#JAVA=""
+
+#
+# Specify options to pass to the Java VM.
+#
+if [ "x$JAVA_OPTS" = "x" ]; then
+ JAVA_OPTS="-Xms128m -Xmx512m -XX:MaxPermSize=256m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000"
+fi
+
+# Sample JPDA settings for remote socket debuging
+#JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
+
+# Sample JPDA settings for shared memory debugging
+#JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_shmem,server=y,suspend=n,address=jboss"
Added: trunk/main/src/bin/run.sh
===================================================================
--- trunk/main/src/bin/run.sh (rev 0)
+++ trunk/main/src/bin/run.sh 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,247 @@
+#!/bin/sh
+### ====================================================================== ###
+## ##
+## JBoss Bootstrap Script ##
+## ##
+### ====================================================================== ###
+
+### $Id: run.sh 64260 2007-07-24 20:33:53Z cazzius $ ###
+
+DIRNAME=`dirname $0`
+PROGNAME=`basename $0`
+GREP="grep"
+
+# Use the maximum available, or set MAX_FD != -1 to use that
+MAX_FD="maximum"
+
+#
+# Helper to complain.
+#
+warn() {
+ echo "${PROGNAME}: $*"
+}
+
+#
+# Helper to puke.
+#
+die() {
+ warn $*
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false;
+darwin=false;
+linux=false;
+case "`uname`" in
+ CYGWIN*)
+ cygwin=true
+ ;;
+
+ Darwin*)
+ darwin=true
+ ;;
+
+ Linux)
+ linux=true
+ ;;
+esac
+
+# Read an optional running configuration file
+if [ "x$RUN_CONF" = "x" ]; then
+ RUN_CONF="$DIRNAME/run.conf"
+fi
+if [ -r "$RUN_CONF" ]; then
+ . "$RUN_CONF"
+fi
+
+# Force IPv4 on Linux systems since IPv6 doesn't work correctly with jdk5 and lower
+if [ "$linux" = "true" ]; then
+ JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true"
+fi
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin ; then
+ [ -n "$JBOSS_HOME" ] &&
+ JBOSS_HOME=`cygpath --unix "$JBOSS_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+ [ -n "$JAVAC_JAR" ] &&
+ JAVAC_JAR=`cygpath --unix "$JAVAC_JAR"`
+fi
+
+# Setup JBOSS_HOME
+if [ "x$JBOSS_HOME" = "x" ]; then
+ # get the full path (without any relative bits)
+ JBOSS_HOME=`cd $DIRNAME/..; pwd`
+fi
+export JBOSS_HOME
+
+# Increase the maximum file descriptors if we can
+if [ "$cygwin" = "false" ]; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ]; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then
+ # use the system max
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ]; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query system maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# Setup the JVM
+if [ "x$JAVA" = "x" ]; then
+ if [ "x$JAVA_HOME" != "x" ]; then
+ JAVA="$JAVA_HOME/bin/java"
+ else
+ JAVA="java"
+ fi
+fi
+
+# Setup the classpath
+runjar="$JBOSS_HOME/bin/run.jar"
+if [ ! -f "$runjar" ]; then
+ die "Missing required file: $runjar"
+fi
+JBOSS_BOOT_CLASSPATH="$runjar"
+
+# Tomcat uses the JDT Compiler
+# Only include tools.jar if someone wants to use the JDK instead.
+# compatible distribution which JAVA_HOME points to
+if [ "x$JAVAC_JAR" = "x" ]; then
+ JAVAC_JAR_FILE="$JAVA_HOME/lib/tools.jar"
+else
+ JAVAC_JAR_FILE="$JAVAC_JAR"
+fi
+if [ ! -f "$JAVAC_JAR_FILE" ]; then
+ # MacOSX does not have a seperate tools.jar
+ if [ "$darwin" != "true" -a "x$JAVAC_JAR" != "x" ]; then
+ warn "Missing file: JAVAC_JAR=$JAVAC_JAR"
+ warn "Unexpected results may occur."
+ fi
+ JAVAC_JAR_FILE=
+fi
+
+if [ "x$JBOSS_CLASSPATH" = "x" ]; then
+ JBOSS_CLASSPATH="$JBOSS_BOOT_CLASSPATH"
+else
+ JBOSS_CLASSPATH="$JBOSS_CLASSPATH:$JBOSS_BOOT_CLASSPATH"
+fi
+if [ "x$JAVAC_JAR_FILE" != "x" ]; then
+ JBOSS_CLASSPATH="$JBOSS_CLASSPATH:$JAVAC_JAR_FILE"
+fi
+
+# If -server not set in JAVA_OPTS, set it, if supported
+SERVER_SET=`echo $JAVA_OPTS | $GREP "\-server"`
+if [ "x$SERVER_SET" = "x" ]; then
+
+ # Check for SUN(tm) JVM w/ HotSpot support
+ if [ "x$HAS_HOTSPOT" = "x" ]; then
+ HAS_HOTSPOT=`"$JAVA" -version 2>&1 | $GREP -i HotSpot`
+ fi
+
+ # Enable -server if we have Hotspot, unless we can't
+ if [ "x$HAS_HOTSPOT" != "x" ]; then
+ # MacOS does not support -server flag
+ if [ "$darwin" != "true" ]; then
+ JAVA_OPTS="-server $JAVA_OPTS"
+ fi
+ fi
+fi
+
+# Setup JBosst Native library path
+JBOSS_NATIVE_DIR="$JBOSS_HOME/bin/native"
+if [ -d "$JBOSS_NATIVE_DIR" ]; then
+ if $cygwin ; then
+ export PATH="$JBOSS_NATIVE_DIR:$PATH"
+ JBOSS_NATIVE_DIR=`cygpath --dos "$JBOSS_NATIVE_DIR"`
+ fi
+ if [ "x$LD_LIBRARY_PATH" = "x" ]; then
+ LD_LIBRARY_PATH="$JBOSS_NATIVE_DIR"
+ else
+ LD_LIBRARY_PATH="$JBOSS_NATIVE_DIR:$LD_LIBRARY_PATH"
+ fi
+ export LD_LIBRARY_PATH
+ if [ "x$JAVA_OPTS" = "x" ]; then
+ JAVA_OPTS="-Djava.library.path=$JBOSS_NATIVE_DIR"
+ else
+ JAVA_OPTS="$JAVA_OPTS -Djava.library.path=$JBOSS_NATIVE_DIR"
+ fi
+fi
+
+# Setup JBoss specific properties
+JAVA_OPTS="-Dprogram.name=$PROGNAME $JAVA_OPTS"
+
+# Setup the java endorsed dirs
+JBOSS_ENDORSED_DIRS="$JBOSS_HOME/lib/endorsed"
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+ JBOSS_HOME=`cygpath --path --windows "$JBOSS_HOME"`
+ JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+ JBOSS_CLASSPATH=`cygpath --path --windows "$JBOSS_CLASSPATH"`
+ JBOSS_ENDORSED_DIRS=`cygpath --path --windows "$JBOSS_ENDORSED_DIRS"`
+fi
+
+# Display our environment
+echo "========================================================================="
+echo ""
+echo " JBoss Bootstrap Environment"
+echo ""
+echo " JBOSS_HOME: $JBOSS_HOME"
+echo ""
+echo " JAVA: $JAVA"
+echo ""
+echo " JAVA_OPTS: $JAVA_OPTS"
+echo ""
+echo " CLASSPATH: $JBOSS_CLASSPATH"
+echo ""
+echo "========================================================================="
+echo ""
+
+while true; do
+ if [ "x$LAUNCH_JBOSS_IN_BACKGROUND" = "x" ]; then
+ # Execute the JVM in the foreground
+ "$JAVA" $JAVA_OPTS \
+ -Djava.endorsed.dirs="$JBOSS_ENDORSED_DIRS" \
+ -classpath "$JBOSS_CLASSPATH" \
+ org.jboss.Main "$@"
+ JBOSS_STATUS=$?
+ else
+ # Execute the JVM in the background
+ "$JAVA" $JAVA_OPTS \
+ -Djava.endorsed.dirs="$JBOSS_ENDORSED_DIRS" \
+ -classpath "$JBOSS_CLASSPATH" \
+ org.jboss.Main "$@" &
+ JBOSS_PID=$!
+ # Trap common signals and relay them to the jboss process
+ trap "kill -HUP $JBOSS_PID" HUP
+ trap "kill -TERM $JBOSS_PID" INT
+ trap "kill -QUIT $JBOSS_PID" QUIT
+ trap "kill -PIPE $JBOSS_PID" PIPE
+ trap "kill -TERM $JBOSS_PID" TERM
+ # Wait until the background process exits
+ WAIT_STATUS=0
+ while [ "$WAIT_STATUS" -ne 127 ]; do
+ JBOSS_STATUS=$WAIT_STATUS
+ wait $JBOSS_PID 2>/dev/null
+ WAIT_STATUS=$?
+ done
+ fi
+ # If restart doesn't work, check you are running JBossAS 4.0.4+
+ # http://jira.jboss.com/jira/browse/JBAS-2483
+ # or the following if you're running Red Hat 7.0
+ # http://developer.java.sun.com/developer/bugParade/bugs/4465334.html
+ if [ $JBOSS_STATUS -eq 10 ]; then
+ echo "Restarting JBoss..."
+ else
+ exit $JBOSS_STATUS
+ fi
+done
+
Added: trunk/main/src/etc/default.mf
===================================================================
--- trunk/main/src/etc/default.mf (rev 0)
+++ trunk/main/src/etc/default.mf 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Created-By: @java.vm.version@ (@java.vm.vendor@)
+Specification-Title: @specification.title@
+Specification-Version: @specification.version@
+Specification-Vendor: @specification.vendor@
+Implementation-Title: @implementation.title@
+Implementation-URL: @implementation.url@
+Implementation-Version: @implementation.version@
+Implementation-Vendor: @implementation.vendor@
+Implementation-Vendor-Id: @implementation.vendor.id@
Added: trunk/main/src/etc/run.mf
===================================================================
--- trunk/main/src/etc/run.mf (rev 0)
+++ trunk/main/src/etc/run.mf 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Created-By: @java.vm.version@ (@java.vm.vendor@)
+Specification-Title: @specification.title@
+Specification-Version: @specification.version@
+Specification-Vendor: @specification.vendor@
+Implementation-Title: @implementation.title@
+Implementation-URL: @implementation.url@
+Implementation-Version: @implementation.version@
+Implementation-Vendor: @implementation.vendor@
+Implementation-Vendor-Id: @implementation.vendor.id@
+Main-Class: org.jboss.Main
+Class-Path: ../client/getopt.jar
Added: trunk/main/src/main/org/jboss/Main.java
===================================================================
--- trunk/main/src/main/org/jboss/Main.java (rev 0)
+++ trunk/main/src/main/org/jboss/Main.java 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,557 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss;
+
+import gnu.getopt.Getopt;
+import gnu.getopt.LongOpt;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLDecoder;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Properties;
+
+import org.jboss.system.server.Server;
+import org.jboss.system.server.ServerConfig;
+import org.jboss.system.server.ServerConfigUtil;
+import org.jboss.system.server.ServerLoader;
+
+/**
+ * Provides a command line interface to start the JBoss server.
+ *
+ * <p>
+ * To enable debug or trace messages durring boot change the Log4j
+ * configuration to use either <tt>log4j-debug.properties</tt>
+ * <tt>log4j-trace.properties</tt> by setting the system property
+ * <tt>log4j.configuration</tt>:
+ *
+ * <pre>
+ * ./run.sh -Dlog4j.configuration=log4j-debug.properties
+ * </pre>
+ * TODO: Should jdk logging be the default
+ *
+ * @author <a href="mailto:marc.fleury at jboss.org">Marc Fleury</a>
+ * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
+ * @author <a href="mailto:adrian.brock at happeningtimes.com">Adrian Brock</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 63730 $
+ */
+public class Main
+{
+ /** EDU.oswego.cs.dl.util.concurrent */
+ private String concurrentLib = "concurrent.jar";
+
+ /** A URL for obtaining microkernel patches */
+ private URL bootURL;
+
+ /** Extra jars from the /lib location that are added to the start of the boot
+ classpath. This can be used to override jboss /lib boot classes.
+ */
+ private List<String> bootLibraries = new LinkedList<String>();
+
+ /** Extra libraries to load the server with .*/
+ private List<String> extraLibraries = new LinkedList<String>();
+
+ /** Extra classpath URLS to load the server with .*/
+ private List<URL> extraClasspath = new LinkedList<URL>();
+
+ /**
+ * Server properties. This object holds all of the required
+ * information to get the server up and running. Use System
+ * properties for defaults.
+ */
+ private Properties props = new Properties(System.getProperties());
+ /** The booted server instance */
+ private Server server;
+
+ /**
+ * Explicit constructor.
+ */
+ public Main()
+ {
+ super();
+ }
+
+ /**
+ * Access the booted server.
+ * @return the Server instance.
+ */
+ public Server getServer()
+ {
+ return server;
+ }
+
+ /**
+ * Boot up JBoss.
+ *
+ * @param args The command line arguments.
+ *
+ * @throws Exception Failed to boot.
+ */
+ public void boot(final String[] args) throws Exception
+ {
+ // First process the command line to pickup custom props/settings
+ processCommandLine(args);
+
+ // Auto set HOME_DIR to ../bin/run.jar if not set
+ String homeDir = props.getProperty(ServerConfig.HOME_DIR);
+ if (homeDir == null)
+ {
+ String path = Main.class.getProtectionDomain().getCodeSource().getLocation().getFile();
+ /* The 1.4 JDK munges the code source file with URL encoding so run
+ * this path through the decoder so that is JBoss starts in a path with
+ * spaces we don't come crashing down.
+ */
+ path = URLDecoder.decode(path, "UTF-8");
+ File runJar = new File(path);
+ File homeFile = runJar.getParentFile().getParentFile();
+ homeDir = homeFile.getCanonicalPath();
+ }
+ props.setProperty(ServerConfig.HOME_DIR, homeDir);
+
+ // Setup HOME_URL too, ServerLoader needs this
+ String homeURL = props.getProperty(ServerConfig.HOME_URL);
+ if (homeURL == null)
+ {
+ File file = new File(homeDir);
+ homeURL = file.toURL().toString();
+ props.setProperty(ServerConfig.HOME_URL, homeURL);
+ }
+
+ // Load the server instance
+ ServerLoader loader = new ServerLoader(props);
+
+ /* If there is a patch dir specified make it the first element of the
+ loader bootstrap classpath. If its a file url pointing to a dir, then
+ add the dir and its contents.
+ */
+ if (bootURL != null)
+ {
+ if (bootURL.getProtocol().equals("file"))
+ {
+ File dir = new File(bootURL.getFile());
+ if (dir.exists())
+ {
+ // Add the local file patch directory
+ loader.addURL(dir.toURL());
+
+ // Add the contents of the directory too
+ File[] jars = dir.listFiles(new JarFilter());
+
+ for (int j = 0; jars != null && j < jars.length; j++)
+ {
+ loader.addURL(jars[j].getCanonicalFile().toURL());
+ }
+ }
+ }
+ else
+ {
+ loader.addURL(bootURL);
+ }
+ }
+
+ // Add any extra libraries
+ for (int i = 0; i < bootLibraries.size(); i++)
+ {
+ loader.addLibrary(bootLibraries.get(i));
+ }
+
+ // Add the jars from the endorsed dir
+ loader.addEndorsedJars();
+
+ // Add jmx libs
+ //loader.addLibraries(jmxLibs);
+
+ // jmx UnifiedLoaderRepository needs a concurrent class...
+ loader.addLibrary(concurrentLib);
+
+ // Add any extra libraries after the boot libs
+ for (int i = 0; i < extraLibraries.size(); i++)
+ {
+ loader.addLibrary(extraLibraries.get(i));
+ }
+
+ // Add any extra classapth URLs
+ for (int i = 0; i < extraClasspath.size(); i++)
+ {
+ loader.addURL(extraClasspath.get(i));
+ }
+
+ // Load the server
+ ClassLoader parentCL = Thread.currentThread().getContextClassLoader();
+ server = loader.load(parentCL);
+
+ // Initialize the server
+ server.init(props);
+
+ // Start 'er up mate!
+ server.start();
+ }
+
+ /**
+ * Shutdown the booted Server instance.
+ *
+ */
+ public void shutdown()
+ {
+ server.shutdown();
+ }
+
+ private URL makeURL(String urlspec) throws MalformedURLException
+ {
+ urlspec = urlspec.trim();
+
+ URL url;
+
+ try
+ {
+ url = new URL(urlspec);
+ if (url.getProtocol().equals("file"))
+ {
+ // make sure the file is absolute & canonical file url
+ File file = new File(url.getFile()).getCanonicalFile();
+ url = file.toURL();
+ }
+ }
+ catch (Exception e)
+ {
+ // make sure we have a absolute & canonical file url
+ try
+ {
+ File file = new File(urlspec).getCanonicalFile();
+ url = file.toURL();
+ }
+ catch (Exception n)
+ {
+ throw new MalformedURLException(n.toString());
+ }
+ }
+
+ return url;
+ }
+
+ /** Process the command line... */
+ private void processCommandLine(final String[] args) throws Exception
+ {
+ // set this from a system property or default to jboss
+ String programName = System.getProperty("program.name", "jboss");
+ String sopts = "-:hD:d:p:n:c:Vj::B:L:C:P:b:g:u:m:l:";
+ LongOpt[] lopts =
+ {
+ new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'h'),
+ new LongOpt("bootdir", LongOpt.REQUIRED_ARGUMENT, null, 'd'),
+ new LongOpt("patchdir", LongOpt.REQUIRED_ARGUMENT, null, 'p'),
+ new LongOpt("netboot", LongOpt.REQUIRED_ARGUMENT, null, 'n'),
+ new LongOpt("configuration", LongOpt.REQUIRED_ARGUMENT, null, 'c'),
+ new LongOpt("version", LongOpt.NO_ARGUMENT, null, 'V'),
+ new LongOpt("jaxp", LongOpt.REQUIRED_ARGUMENT, null, 'j'),
+ new LongOpt("bootlib", LongOpt.REQUIRED_ARGUMENT, null, 'B'),
+ new LongOpt("library", LongOpt.REQUIRED_ARGUMENT, null, 'L'),
+ new LongOpt("classpath", LongOpt.REQUIRED_ARGUMENT, null, 'C'),
+ new LongOpt("properties", LongOpt.REQUIRED_ARGUMENT, null, 'P'),
+ new LongOpt("host", LongOpt.REQUIRED_ARGUMENT, null, 'b'),
+ new LongOpt("partition", LongOpt.REQUIRED_ARGUMENT, null, 'g'),
+ new LongOpt("udp", LongOpt.REQUIRED_ARGUMENT, null, 'u'),
+ new LongOpt("mcast_port", LongOpt.REQUIRED_ARGUMENT, null, 'm'),
+ new LongOpt("log", LongOpt.REQUIRED_ARGUMENT, null, 'l'),
+ };
+
+ Getopt getopt = new Getopt(programName, args, sopts, lopts);
+ int code;
+ String arg;
+ props.setProperty(ServerConfig.SERVER_BIND_ADDRESS, "0.0.0.0");
+ System.setProperty(ServerConfig.SERVER_BIND_ADDRESS, "0.0.0.0");
+ while ((code = getopt.getopt()) != -1)
+ {
+ switch (code)
+ {
+ case ':':
+ case '?':
+ // for now both of these should exit with error status
+ System.exit(1);
+ break; // for completeness
+
+ case 1:
+ // this will catch non-option arguments
+ // (which we don't currently care about)
+ System.err.println(programName +
+ ": unused non-option argument: " +
+ getopt.getOptarg());
+ break; // for completeness
+
+ case 'h':
+ // show command line help
+ System.out.println("usage: " + programName + " [options]");
+ System.out.println();
+ System.out.println("options:");
+ System.out.println(" -h, --help Show this help message");
+ System.out.println(" -V, --version Show version information");
+ System.out.println(" -- Stop processing options");
+ System.out.println(" -D<name>[=<value>] Set a system property");
+ System.out.println(" -d, --bootdir=<dir> Set the boot patch directory; Must be absolute or url");
+ System.out.println(" -p, --patchdir=<dir> Set the patch directory; Must be absolute or url");
+ System.out.println(" -n, --netboot=<url> Boot from net with the given url as base");
+ System.out.println(" -c, --configuration=<name> Set the server configuration name");
+ System.out.println(" -B, --bootlib=<filename> Add an extra library to the front bootclasspath");
+ System.out.println(" -L, --library=<filename> Add an extra library to the loaders classpath");
+ System.out.println(" -C, --classpath=<url> Add an extra url to the loaders classpath");
+ System.out.println(" -P, --properties=<url> Load system properties from the given url");
+ System.out.println(" -b, --host=<host or ip> Bind address for all JBoss services");
+ System.out.println(" -g, --partition=<name> HA Partition name (default=DefaultDomain)");
+ System.out.println(" -m, --mcast_port=<ip> UDP multicast port; Only used by JGroups multiplexer");
+ System.out.println(" -u, --udp=<ip> UDP multicast address");
+ System.out.println(" -l, --log=<log4j|jdk> Specify the logger plugin type");
+ System.out.println();
+ System.exit(0);
+ break; // for completeness
+
+ case 'D':
+ {
+ // set a system property
+ arg = getopt.getOptarg();
+ String name, value;
+ int i = arg.indexOf("=");
+ if (i == -1)
+ {
+ name = arg;
+ value = "true";
+ }
+ else
+ {
+ name = arg.substring(0, i);
+ value = arg.substring(i + 1, arg.length());
+ }
+ System.setProperty(name, value);
+ // Ensure setting the old bind.address property also sets the new
+ // jgroups.bind_addr property, otherwise jgroups may ignore it
+ if ("bind.address".equals(name))
+ {
+ // Wildcard address is not valid for JGroups
+ String addr = ServerConfigUtil.fixRemoteAddress(value);
+ System.setProperty("jgroups.bind_addr", addr);
+ }
+ break;
+ }
+
+ case 'd':
+ // set the boot patch URL
+ bootURL = makeURL(getopt.getOptarg());
+ break;
+
+ case 'p':
+ {
+ // set the patch URL
+ URL patchURL = makeURL(getopt.getOptarg());
+ props.put(ServerConfig.PATCH_URL, patchURL.toString());
+
+ break;
+ }
+
+ case 'n':
+ // set the net boot url
+ arg = getopt.getOptarg();
+
+ // make sure there is a trailing '/'
+ if (!arg.endsWith("/")) arg += "/";
+
+ props.put(ServerConfig.HOME_URL, new URL(arg).toString());
+ break;
+
+ case 'c':
+ // set the server name
+ arg = getopt.getOptarg();
+ props.put(ServerConfig.SERVER_NAME, arg);
+ break;
+
+ case 'V':
+ {
+ // Package information for org.jboss
+ Package jbossPackage = Package.getPackage("org.jboss");
+
+ // show version information
+ System.out.println("JBoss " + jbossPackage.getImplementationVersion());
+ System.out.println();
+ System.out.println("Distributable under LGPL license.");
+ System.out.println("See terms of license at gnu.org.");
+ System.out.println();
+ System.exit(0);
+ break; // for completness
+ }
+
+ case 'j':
+ // Show an error and exit
+ System.err.println(programName + ": option '-j, --jaxp' no longer supported");
+ System.exit(1);
+ break; // for completness
+
+ case 'B':
+ arg = getopt.getOptarg();
+ bootLibraries.add(arg);
+ break;
+
+ case 'L':
+ arg = getopt.getOptarg();
+ extraLibraries.add(arg);
+ break;
+
+ case 'C':
+ {
+ URL url = makeURL(getopt.getOptarg());
+ extraClasspath.add(url);
+ break;
+ }
+
+ case 'P':
+ {
+ // Set system properties from url/file
+ URL url = makeURL(getopt.getOptarg());
+ Properties props = System.getProperties();
+ props.load(url.openConnection().getInputStream());
+ break;
+ }
+ case 'b':
+ arg = getopt.getOptarg();
+ props.put(ServerConfig.SERVER_BIND_ADDRESS, arg);
+ System.setProperty(ServerConfig.SERVER_BIND_ADDRESS, arg);
+ // used by JGroups; only set if not set via -D so users
+ // can use a different interface for cluster communication
+ // There are 2 versions of this property, deprecated bind.address
+ // and the new version, jgroups.bind_addr
+ String bindAddress = System.getProperty("bind.address");
+ if (bindAddress == null)
+ {
+ // Wildcard address is not valid for JGroups
+ bindAddress = ServerConfigUtil.fixRemoteAddress(arg);
+ System.setProperty("bind.address", bindAddress);
+ }
+ bindAddress = System.getProperty("jgroups.bind_addr");
+ if (bindAddress == null)
+ {
+ // Wildcard address is not valid for JGroups
+ bindAddress = ServerConfigUtil.fixRemoteAddress(arg);
+ System.setProperty("jgroups.bind_addr", bindAddress);
+ }
+
+ // Set the java.rmi.server.hostname if not set
+ String rmiHost = System.getProperty("java.rmi.server.hostname");
+ if( rmiHost == null )
+ {
+ rmiHost = ServerConfigUtil.fixRemoteAddress(arg);
+ System.setProperty("java.rmi.server.hostname", rmiHost);
+ }
+ break;
+ case 'g':
+ arg = getopt.getOptarg();
+ props.put(ServerConfig.PARTITION_NAME_PROPERTY, arg);
+ System.setProperty(ServerConfig.PARTITION_NAME_PROPERTY, arg);
+ break;
+ case 'u':
+ arg = getopt.getOptarg();
+ props.put(ServerConfig.PARTITION_UDP_PROPERTY, arg);
+ System.setProperty(ServerConfig.PARTITION_UDP_PROPERTY, arg);
+ // the new jgroups property name
+ System.setProperty("jgroups.udp.mcast_addr", arg);
+ break;
+ case 'm':
+ arg = getopt.getOptarg();
+ props.put(ServerConfig.PARTITION_UDP_PORT_PROPERTY, arg);
+ System.setProperty(ServerConfig.PARTITION_UDP_PORT_PROPERTY, arg);
+ break;
+ case 'l':
+ {
+ arg = getopt.getOptarg();
+ String logPlugin = arg;
+ if( arg.equalsIgnoreCase("log4j") )
+ logPlugin = "org.jboss.logging.Log4jLoggerPlugin";
+ else if( arg.equalsIgnoreCase("jdk") )
+ {
+ logPlugin = "org.jboss.logging.JDK14LoggerPlugin";
+ // Also override the jdk LogManager
+ System.setProperty("java.util.logging.manager",
+ "org.jboss.logging.jdk.JDKLogManager");
+ }
+ System.setProperty("org.jboss.logging.Logger.pluginClass", logPlugin);
+ break;
+ }
+ default:
+ // this should not happen,
+ // if it does throw an error so we know about it
+ throw new Error("unhandled option code: " + code);
+ }
+ }
+ }
+
+ /**
+ * This is where the magic begins.
+ *
+ * <P>Starts up inside of a "jboss" thread group to allow better
+ * identification of JBoss threads.
+ *
+ * @param args The command line arguments.
+ * @throws Exception for any error
+ */
+ public static void main(final String[] args) throws Exception
+ {
+ Runnable worker = new Runnable() {
+ public void run()
+ {
+ try
+ {
+ Main main = new Main();
+ main.boot(args);
+ }
+ catch (Exception e)
+ {
+ System.err.println("Failed to boot JBoss:");
+ e.printStackTrace();
+ }
+ }
+
+ };
+
+ ThreadGroup threads = new ThreadGroup("jboss");
+ new Thread(threads, worker, "main").start();
+ }
+
+ /**
+ * This method is here so that if JBoss is running under
+ * Alexandria (An NT Service Installer), Alexandria can shutdown
+ * the system down correctly.
+ *
+ * @param argv the arguments
+ */
+ public static void systemExit(String argv[])
+ {
+ System.exit(0);
+ }
+
+ static class JarFilter implements FilenameFilter
+ {
+ public boolean accept(File dir, String name)
+ {
+ return name.endsWith(".jar");
+ }
+ }
+}
\ No newline at end of file
Added: trunk/main/src/main/org/jboss/Version.java
===================================================================
--- trunk/main/src/main/org/jboss/Version.java (rev 0)
+++ trunk/main/src/main/org/jboss/Version.java 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,303 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * Provides access to JBoss version (and build) properties.
+ *
+ * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
+ * @author Scott.Stark at jboss.org
+ * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
+ * @version $Revision: 63730 $
+ */
+public final class Version
+{
+ public final static String VERSION_MAJOR = "version.major";
+ public final static String VERSION_MINOR = "version.minor";
+ public final static String VERSION_REVISION = "version.revision";
+ public final static String VERSION_TAG = "version.tag";
+ public final static String VERSION_NAME = "version.name";
+ public final static String VERSION_CVSTAG = "version.cvstag";
+
+ public final static String BUILD_NUMBER = "build.number";
+ public final static String BUILD_ID = "build.id";
+ public final static String BUILD_DATE = "build.day";
+ public final static String BUILD_JVM_VERSION = "java.vm.version";
+ public final static String BUILD_JVM_VENDOR = "java.vendor";
+ public final static String BUILD_OS = "os.name";
+ public final static String BUILD_OS_ARCH = "os.arch";
+ public final static String BUILD_OS_VERSION = "os.version";
+
+ /**
+ * The single instance.
+ */
+ private static Version instance = null;
+
+ /**
+ * The version properties.
+ */
+ private Properties props;
+
+ /**
+ * Do not allow direct public construction.
+ */
+ private Version()
+ {
+ props = loadProperties();
+ }
+
+ /**
+ * Get the single <tt>Version</tt> instance.
+ *
+ * @return The single <tt>Version</tt> instance.
+ */
+ public static Version getInstance()
+ {
+ if (instance == null)
+ {
+ instance = new Version();
+ }
+ return instance;
+ }
+
+ /**
+ * Returns an unmodifiable map of version properties.
+ *
+ * @return An unmodifiable map of version properties.
+ */
+ public Map<Object, Object> getProperties()
+ {
+ return Collections.unmodifiableMap(props);
+ }
+
+ /**
+ * Returns the value for the given property name.
+ *
+ * @param name - The name of the property.
+ * @return The property value or null if the property is not set.
+ */
+ public String getProperty(final String name)
+ {
+ return props.getProperty(name);
+ }
+
+ /**
+ * Returns the major number of the version.
+ *
+ * @return The major number of the version.
+ */
+ public int getMajor()
+ {
+ return getIntProperty(VERSION_MAJOR);
+ }
+
+ /**
+ * Returns the minor number of the version.
+ *
+ * @return The minor number of the version.
+ */
+ public int getMinor()
+ {
+ return getIntProperty(VERSION_MINOR);
+ }
+
+ /**
+ * Returns the revision number of the version.
+ *
+ * @return The revision number of the version.
+ */
+ public int getRevision()
+ {
+ return getIntProperty(VERSION_REVISION);
+ }
+
+ /**
+ * Returns the tag of the version.
+ *
+ * @return The tag of the version.
+ */
+ public String getTag()
+ {
+ return props.getProperty(VERSION_TAG);
+ }
+ /**
+ * Returns the CVS tag of the version.
+ *
+ * @return The CVS tag of the version.
+ */
+ public String getCvsTag()
+ {
+ return props.getProperty(VERSION_CVSTAG);
+ }
+
+ /**
+ * Returns the name number of the version.
+ *
+ * @return The name of the version.
+ */
+ public String getName()
+ {
+ return props.getProperty(VERSION_NAME);
+ }
+
+ /**
+ * Returns the build identifier for this version.
+ *
+ * @return The build identifier for this version.
+ */
+ public String getBuildID()
+ {
+ return props.getProperty(BUILD_ID);
+ }
+
+ /**
+ * Returns the build number for this version.
+ *
+ * @return The build number for this version.
+ */
+ public String getBuildNumber()
+ {
+ return props.getProperty(BUILD_NUMBER);
+ }
+
+ /**
+ * Returns the build date for this version.
+ *
+ * @return The build date for this version.
+ */
+ public String getBuildDate()
+ {
+ return props.getProperty(BUILD_DATE);
+ }
+
+ /** Returns the BUILD_JVM_VERSION (BUILD_JVM_VENDOR) which should look like:
+ * 1.4.2_05-b04 (Sun Microsystems Inc.)
+ * @return the jvm
+ */
+ public String getBuildJVM()
+ {
+ String vm = props.getProperty(BUILD_JVM_VERSION);
+ String vendor = props.getProperty(BUILD_JVM_VENDOR);
+ return vm + '(' + vendor + ')';
+ }
+
+ /** Returns the BUILD_OS (BUILD_OS_ARCH,BUILD_OS_VERSION) which should look
+ * like:
+ * Windows XP (x86,5.1)
+ * Linux (i386,2.4.21-4.ELsmp)
+ * @return the OS
+ */
+ public String getBuildOS()
+ {
+ String os = props.getProperty(BUILD_OS);
+ String arch = props.getProperty(BUILD_OS_ARCH);
+ String version = props.getProperty(BUILD_OS_VERSION);
+ return os + '(' + arch +',' + version + ')';
+ }
+
+ /**
+ * Returns the full version number, e.g. 5.0.0.GA
+ *
+ * @return The full version number as string
+ */
+ public String getVersionNumber()
+ {
+ StringBuffer buff = new StringBuffer();
+
+ buff.append(getMajor()).append(".");
+ buff.append(getMinor()).append(".");
+ buff.append(getRevision()).append(".");
+ buff.append(getTag());
+
+ return buff.toString();
+ }
+
+ /**
+ * Returns the version information as a string.
+ *
+ * @return Basic information as a string.
+ */
+ public String toString()
+ {
+ StringBuffer buff = new StringBuffer();
+
+ buff.append(getVersionNumber());
+ buff.append(" (build: SVNTag=");
+ buff.append(getCvsTag());
+ buff.append(" date=");
+ buff.append(getBuildID());
+ buff.append(")");
+
+ return buff.toString();
+ }
+
+ /**
+ * Returns a property value as an int.
+ *
+ * @param name - The name of the property.
+ * @return The property value, or -1 if there was a problem converting
+ * it to an int.
+ */
+ private int getIntProperty(final String name)
+ {
+ try
+ {
+ return Integer.valueOf(props.getProperty(name)).intValue();
+ }
+ catch (Exception e)
+ {
+ return -1;
+ }
+ }
+
+ /**
+ * Load the version properties from a resource.
+ */
+ private Properties loadProperties()
+ {
+ props = new Properties();
+
+ try
+ {
+ InputStream in =
+ Version.class.getResourceAsStream("/org/jboss/version.properties");
+ if( in != null )
+ {
+ props.load(in);
+ in.close();
+ }
+ }
+ catch (IOException e)
+ {
+ throw new Error("Missing version.properties");
+ }
+
+ return props;
+ }
+}
Added: trunk/main/src/main/org/jboss/system/JBossRMIClassLoader.java
===================================================================
--- trunk/main/src/main/org/jboss/system/JBossRMIClassLoader.java (rev 0)
+++ trunk/main/src/main/org/jboss/system/JBossRMIClassLoader.java 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,121 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.system;
+
+import java.net.MalformedURLException;
+
+import java.rmi.server.RMIClassLoader;
+import java.rmi.server.RMIClassLoaderSpi;
+
+/**
+ * An implementation of RMIClassLoaderSpi to workaround the
+ * proxy ClassCastException problem in 1.4<p>
+ *
+ * <b>THIS IS A HACK!</b><p>
+ *
+ * Sun's implementation uses the caller classloader when
+ * unmarshalling proxies. This is effectively jboss.jar since
+ * that is where JRMPInvokerProxy lives. On a redeploy the
+ * new interfaces are ignored because a proxy is already cached
+ * against the classloader.<p>
+ *
+ * Another redeployment problem is that the getClassAnnotation(String)
+ * will end up using the old deployment class loader and this can result
+ * in NPEs do the class loader being destroyed.
+ *
+ * This class ignores Sun's guess at a suitable classloader and
+ * uses the thread context classloader instead.<p>
+ *
+ * It has to exist in the system classloader so I have included it
+ * in "system" for inclusion in run.jar<p>
+ *
+ * @author <a href="mailto:adrian.brock at happeningtimes.com">Adrian Brock</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 63730 $
+ */
+public class JBossRMIClassLoader
+ extends RMIClassLoaderSpi
+{
+ // Attributes ----------------------------------------------------
+
+ /**
+ * The JVM implementation (we delegate most work to it)
+ */
+ RMIClassLoaderSpi delegate = RMIClassLoader.getDefaultProviderInstance();
+
+ // Constructors --------------------------------------------------
+
+ /**
+ * Required constructor
+ */
+ public JBossRMIClassLoader()
+ {
+ }
+
+ // RMIClassLoaderSpi Implementation ------------------------------
+
+ /*
+ * Ignore the JVM, use the thread context classloader for proxy caching
+ */
+ public Class<?> loadProxyClass(String codebase, String[] interfaces, ClassLoader ignored)
+ throws MalformedURLException, ClassNotFoundException
+ {
+ return delegate.loadProxyClass(codebase, interfaces, Thread.currentThread().getContextClassLoader());
+ }
+
+ /*
+ * Just delegate
+ */
+ public Class<?> loadClass(String codebase, String name, ClassLoader ignored)
+ throws MalformedURLException, ClassNotFoundException
+ {
+ return delegate.loadClass(codebase, name, Thread.currentThread().getContextClassLoader());
+ }
+
+ /*
+ * Just delegate
+ */
+ public ClassLoader getClassLoader(String codebase)
+ throws MalformedURLException
+ {
+ return delegate.getClassLoader(codebase);
+ }
+
+ /*
+ * Try to delegate an default to the java.rmi.server.codebase on any
+ * failure.
+ */
+ public String getClassAnnotation(Class<?> cl)
+ {
+ String annotation = null;
+ try
+ {
+ annotation = delegate.getClassAnnotation(cl);
+ }
+ catch(Throwable t)
+ {
+ // Try the java.rmi.server.codebase property
+ annotation = System.getProperty("java.rmi.server.codebase");
+ }
+ return annotation;
+ }
+}
Added: trunk/main/src/main/org/jboss/system/NoAnnotationURLClassLoader.java
===================================================================
--- trunk/main/src/main/org/jboss/system/NoAnnotationURLClassLoader.java (rev 0)
+++ trunk/main/src/main/org/jboss/system/NoAnnotationURLClassLoader.java 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,120 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.system;
+
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.net.URLStreamHandlerFactory;
+
+/**
+ * A URL classloader to avoid URL annotation of classes in RMI
+ *
+ * @author <a href="mailto:Adrian.Brock at HappeningTimes.com">Adrian Brock</a>
+ * @version $Revision: 63730 $
+ */
+public class NoAnnotationURLClassLoader
+ extends URLClassLoader
+{
+ /** The value returned by {@link getURLs}. */
+ private static final URL[] EMPTY_URL_ARRAY = {};
+
+ /**
+ * Create a classloader with the context classloader as parent
+ *
+ * @param urls the urls
+ * @return the classloader
+ */
+ public static NoAnnotationURLClassLoader createClassLoader(URL... urls)
+ {
+ return createClassLoader(Thread.currentThread().getContextClassLoader(), urls);
+ }
+
+ /**
+ * Create a classloader
+ *
+ * @param parent the parent classloader
+ * @param urls the urls
+ * @return the classloader
+ */
+ public static NoAnnotationURLClassLoader createClassLoader(ClassLoader parent, URL... urls)
+ {
+ return new NoAnnotationURLClassLoader(urls, parent);
+ }
+
+ /**
+ * Construct a <tt>URLClassLoader</tt>
+ *
+ * @param urls the URLs to load classes from.
+ */
+ public NoAnnotationURLClassLoader(URL[] urls)
+ {
+ super(urls);
+ }
+
+ /**
+ * Construct a <tt>URLClassLoader</tt>
+ *
+ * @param urls the URLs to load classes from.
+ * @param parent the parent classloader.
+ */
+ public NoAnnotationURLClassLoader(URL[] urls, ClassLoader parent)
+ {
+ super(urls, parent);
+ }
+
+ /**
+ * Construct a <tt>URLClassLoader</tt>
+ *
+ * @param urls the URLs to load classes from.
+ * @param parent the parent classloader.
+ * @param factory the url stream factory.
+ */
+ public NoAnnotationURLClassLoader(URL[] urls, ClassLoader parent,
+ URLStreamHandlerFactory factory)
+ {
+ super(urls, parent, factory);
+ }
+
+ /**
+ * Return all library URLs
+ *
+ * <p>Do not remove this method without running the WebIntegrationTestSuite
+ * @return the urls
+ */
+ public URL[] getAllURLs()
+ {
+ return super.getURLs();
+ }
+
+ /**
+ * Return an empty URL array to force the RMI marshalling subsystem to
+ * use the <tt>java.server.codebase</tt> property as the annotated codebase.
+ *
+ * <p>Do not remove this method without discussing it on the dev list.
+ *
+ * @return Empty URL[]
+ */
+ public URL[] getURLs()
+ {
+ return EMPTY_URL_ARRAY;
+ }
+}
Added: trunk/main/src/main/org/jboss/system/ORBSingleton.java
===================================================================
--- trunk/main/src/main/org/jboss/system/ORBSingleton.java (rev 0)
+++ trunk/main/src/main/org/jboss/system/ORBSingleton.java 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,360 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.system;
+
+import java.util.Properties;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.Context;
+import org.omg.CORBA.ContextList;
+import org.omg.CORBA.Current;
+import org.omg.CORBA.Environment;
+import org.omg.CORBA.ExceptionList;
+import org.omg.CORBA.INITIALIZE;
+import org.omg.CORBA.NamedValue;
+import org.omg.CORBA.NO_IMPLEMENT;
+import org.omg.CORBA.NVList;
+import org.omg.CORBA.ORBPackage.InvalidName;
+import org.omg.CORBA.Request;
+import org.omg.CORBA.StructMember;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.UnionMember;
+import org.omg.CORBA.ValueMember;
+import org.omg.CORBA_2_3.ORB;
+
+/**
+ * Thin wrapper class that fulfills the contract of an ORB singleton and
+ * forwards every invocation to an instance of the actual ORB singleton class,
+ * which it loads with the context classloader. The name of the actual ORB
+ * singleton class is specified by the system property
+ * <code>org.jboss.ORBSingletonDelegate</code>.
+ * <p>
+ * This class is a workaround to the the following problem: unlike the Sun VMs,
+ * IBM VMs do not use the context classloader to load the ORB singleton class
+ * specified by the system property
+ * <code>org.omg.CORBA.ORBSingletonClass</code>. IBM VMs use the
+ * system classloader, thus requiring the ORB singleton class to be in
+ * the system classpath. Rather than adding a third-party jar file (e.g.
+ * jacorb.jar) to the system classpath, we include this class in run.jar.
+ * Instead of setting the system property
+ * <pre>
+ * org.omg.CORBA.ORBSingletonClass=some.orb.impl.ORBSingletonImpl
+ * </pre>
+ * we set two properties:
+ * <pre>
+ * org.omg.CORBA.ORBSingletonClass=org.jboss.system.ORBSingleton
+ * org.jboss.ORBSingletonDelegate=some.orb.impl.ORBSingletonImpl
+ * </pre>
+ * <p>
+ * This class should be removed when IBM fixes its VMs.
+ *
+ * @author <a href="mailto:reverbel at ime.usp.br">Francisco Reverbel</a>
+ * @version $Revision: 37459 $
+ */
+public class ORBSingleton extends ORB
+{
+ /** System property key that specifies the actual ORB singleton class. */
+ public static String DELEGATE_CLASS_KEY = "org.jboss.ORBSingletonDelegate";
+
+ /** The ORB singleton instance to which all invocations are forwarded. */
+ private static ORB delegate = null;
+
+ /**
+ * The ORBSingleton constructor does what the IBM VM does not do: it uses
+ * the context classloader to load the actual ORB singleton class.
+ */
+ public ORBSingleton()
+ {
+ if (delegate == null)
+ {
+ String className = System.getProperty(DELEGATE_CLASS_KEY);
+ if (className == null)
+ className = "org.jacorb.orb.ORBSingleton";
+ try
+ {
+ delegate = (ORB)Class.forName(className).newInstance();
+ }
+ catch (ClassNotFoundException ex)
+ {
+ }
+ catch (Exception ex) {
+ throw new INITIALIZE(
+ "can't instantiate ORBSingleton implementation " + className);
+ }
+
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ if (cl == null)
+ cl = ClassLoader.getSystemClassLoader();
+ try
+ {
+ delegate = (ORB)Class.forName(className, true, cl).newInstance();
+ }
+ catch (Exception ex)
+ {
+ throw new INITIALIZE(
+ "can't instantiate ORBSingleton implementation " + className);
+ }
+ }
+ }
+
+ // All the rest is pretty dumb code: it implements all the methods of the
+ // class org.omg.CORBA.ORB, either forwarding the invocation to the
+ // delegate (methods that may be called on the restricted singleton ORB
+ // instance) or throwing an exception (methods that may not be called on
+ // the restricted singleton ORB instance).
+
+ public Any create_any()
+ {
+ return delegate.create_any();
+ }
+
+ public TypeCode create_alias_tc(String id,
+ String name,
+ TypeCode original_type)
+ {
+ return delegate.create_alias_tc(id, name, original_type);
+ }
+
+ public TypeCode create_array_tc(int length, TypeCode element_type)
+ {
+ return delegate.create_array_tc(length, element_type);
+ }
+
+ public TypeCode create_enum_tc(String id, String name, String[] members)
+ {
+ return delegate.create_enum_tc(id, name, members);
+ }
+
+ public TypeCode create_exception_tc(String id,
+ String name,
+ StructMember[] members)
+ {
+ return delegate.create_exception_tc(id, name, members);
+ }
+
+ public TypeCode create_interface_tc(String id, String name)
+ {
+ return delegate.create_interface_tc(id, name);
+ }
+
+ public TypeCode create_fixed_tc(short digits, short scale)
+ {
+ return delegate.create_fixed_tc(digits, scale);
+ }
+
+ public TypeCode create_recursive_tc(String id)
+ {
+ return delegate.create_recursive_tc(id);
+ }
+
+ /*
+ * @deprecated Deprecated by CORBA 2.3.
+ */
+ public TypeCode create_recursive_sequence_tc(int bound, int offset)
+ {
+ throw new NO_IMPLEMENT("deprecated by CORBA 2.3");
+ }
+
+ public TypeCode create_sequence_tc(int bound, TypeCode element_type)
+ {
+ return delegate.create_sequence_tc(bound, element_type);
+ }
+
+ public TypeCode create_string_tc(int bound)
+ {
+ return delegate.create_string_tc(bound);
+ }
+
+ public TypeCode create_wstring_tc(int bound)
+ {
+ return delegate.create_wstring_tc(bound);
+ }
+
+ public TypeCode create_struct_tc(String id,
+ String name,
+ StructMember[] members)
+ {
+ return delegate.create_struct_tc(id, name, members);
+ }
+
+ public TypeCode create_union_tc(String id,
+ String name,
+ TypeCode discriminator_type,
+ UnionMember[] members)
+ {
+ return delegate.create_union_tc(id, name,
+ discriminator_type, members);
+ }
+
+ public TypeCode get_primitive_tc(TCKind tcKind)
+ {
+ return delegate.get_primitive_tc(tcKind);
+ }
+
+ public TypeCode create_value_tc(String id,
+ String name,
+ short type_modifier,
+ TypeCode concrete_base,
+ ValueMember[] members)
+ {
+ return delegate.create_value_tc(id, name, type_modifier,
+ concrete_base, members);
+ }
+
+ public TypeCode create_value_box_tc(String id,
+ String name,
+ TypeCode boxed_type)
+ {
+ return delegate.create_value_box_tc(id, name, boxed_type);
+ }
+
+ public TypeCode create_abstract_interface_tc(String id, String name)
+ {
+ return delegate.create_abstract_interface_tc(id, name);
+ }
+
+ public TypeCode create_native_tc(String id, String name)
+ {
+ return delegate.create_native_tc(id, name);
+ }
+
+ /* Methods not allowed on the singleton ORB: */
+
+ public ExceptionList create_exception_list()
+ {
+ throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
+ }
+
+ public NVList create_list(int count)
+ {
+ throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
+ }
+
+ public NamedValue create_named_value(String name, Any value, int flags)
+ {
+ throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
+ }
+
+ public NVList create_operation_list(org.omg.CORBA.Object obj)
+ {
+ throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
+ }
+
+ public org.omg.CORBA.Object string_to_object(String str)
+ {
+ throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
+ }
+
+ public Environment create_environment()
+ {
+ throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
+ }
+
+ public ContextList create_context_list()
+ {
+ throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
+ }
+
+ public org.omg.CORBA.portable.OutputStream create_output_stream()
+ {
+ throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
+ }
+
+ /*
+ * @deprecated Deprecated by CORBA 2.3.
+ */
+ public Current get_current()
+ {
+ throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
+ }
+
+ public Context get_default_context()
+ {
+ throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
+ }
+
+ public Request get_next_response()
+ {
+ throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
+ }
+
+ public String[] list_initial_services()
+ {
+ throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
+ }
+
+ public String object_to_string(org.omg.CORBA.Object obj)
+ {
+ throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
+ }
+
+ public boolean poll_next_response()
+ {
+ throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
+ }
+
+ public org.omg.CORBA.Object resolve_initial_references(String identifier)
+ throws InvalidName
+ {
+ throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
+ }
+
+ public void send_multiple_requests_deferred(Request[] req)
+ {
+ throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
+ }
+
+ public void send_multiple_requests_oneway(Request[] req)
+ {
+ throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
+ }
+
+ protected void set_parameters(String[] args, Properties props)
+ {
+ throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
+ }
+
+ protected void set_parameters(java.applet.Applet app, Properties props)
+ {
+ throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
+ }
+
+ public void run()
+ {
+ throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
+ }
+
+ public void shutdown(boolean wait_for_completion)
+ {
+ throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
+ }
+
+ public boolean work_pending()
+ {
+ throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
+ }
+
+ public void perform_work()
+ {
+ throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
+ }
+}
Added: trunk/main/src/main/org/jboss/system/server/Server.java
===================================================================
--- trunk/main/src/main/org/jboss/system/server/Server.java (rev 0)
+++ trunk/main/src/main/org/jboss/system/server/Server.java 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,141 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.system.server;
+
+import java.util.Date;
+import java.util.Properties;
+
+/**
+ * The interface of the server loaded by the ServerLoader
+ * @see ServerLoader
+ *
+ * @author Jason Dillon
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 63730 $
+ */
+public interface Server
+{
+ /** The JMX notification event type sent on end of server startup */
+ public final String START_NOTIFICATION_TYPE = "org.jboss.system.server.started";
+ /** The JMX notification event type sent on begin of the server shutdown */
+ public final String STOP_NOTIFICATION_TYPE = "org.jboss.system.server.stopped";
+
+ /** @return The server start date */
+ Date getStartDate();
+
+ /** @return The server version */
+ String getVersion();
+
+ /** @return The server version code name */
+ String getVersionName();
+
+ /** @return The full server version number */
+ String getVersionNumber();
+
+ /** @return The date the server was build (compiled) */
+ String getBuildNumber();
+
+ /** @return The JVM used to build the server */
+ String getBuildJVM();
+
+ /** @return The Operating System used to build the server */
+ String getBuildOS();
+
+ /** @return The build id */
+ String getBuildID();
+
+ /** @return The date the server was build */
+ String getBuildDate();
+
+ /** @return A flag indicating if shutdown has been called */
+ boolean isInShutdown();
+
+ // Operations ----------------------------------------------------
+
+
+ /**
+ * Initialize the Server instance.
+ *
+ * @param props The configuration properties for the server.
+ *
+ * @throws IllegalStateException Already initialized.
+ * @throws Exception Failed to initialize.
+ */
+ void init(Properties props) throws IllegalStateException, Exception;
+
+ /**
+ * Get the typed server configuration object which the
+ * server has been initalized to use.
+ *
+ * @return Typed server configuration object.
+ *
+ * @throws IllegalStateException Not initialized.
+ */
+ ServerConfig getConfig() throws IllegalStateException;
+
+ /**
+ * Start the Server instance.
+ *
+ * @throws IllegalStateException Already started or not initialized.
+ * @throws Exception Failed to start.
+ */
+ void start() throws IllegalStateException, Exception;
+
+ /**
+ * Check if the server is started.
+ *
+ * @return True if the server is started, else false.
+ */
+ boolean isStarted();
+
+ /**
+ * Shutdown the Server instance and run shutdown hooks.
+ *
+ * <p>If the exit on shutdown flag is true, then {@link #exit()}
+ * is called, else only the shutdown hook is run.
+ *
+ * @throws IllegalStateException No started.
+ */
+ void shutdown() throws IllegalStateException;
+
+ /**
+ * Shutdown the server, the JVM and run shutdown hooks.
+ *
+ * @param exitcode The exit code returned to the operating system.
+ */
+ void exit(int exitcode);
+ /**
+ * Shutdown the server, the JVM and run shutdown hooks. Exits with code 1.
+ */
+ void exit();
+
+ /**
+ * Forcibly terminates the currently running Java virtual machine.
+ *
+ * @param exitcode The exit code returned to the operating system.
+ */
+ void halt(int exitcode);
+ /**
+ * Forcibly terminates the currently running Java virtual machine. Exits with code 1.
+ */
+ void halt();
+}
Added: trunk/main/src/main/org/jboss/system/server/ServerConfig.java
===================================================================
--- trunk/main/src/main/org/jboss/system/server/ServerConfig.java (rev 0)
+++ trunk/main/src/main/org/jboss/system/server/ServerConfig.java 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,537 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.system.server;
+
+import java.io.File;
+import java.net.URL;
+
+/**
+ * The interface of the basic <em>typed</em> JBoss server configuration.
+ *
+ * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 63730 $
+ */
+public interface ServerConfig
+{
+
+ /** The default partition name */
+ String DEFAULT_PARITION_NAME = "DefaultPartition";
+
+ /** The partition name property */
+ String PARTITION_NAME_PROPERTY = "jboss.partition.name";
+
+ /** The udp address property */
+ String PARTITION_UDP_PROPERTY = "jboss.partition.udpGroup";
+
+ /** The udp port property */
+ String PARTITION_UDP_PORT_PROPERTY = "jgroups.udp.mcast_port";
+
+ /** Whether to load native libraries */
+ String NATIVE_LOAD_PROPERTY = "jboss.native.load";
+
+ /** The location of native libraries property */
+ String NATIVE_DIR_PROPERTY = "jboss.native.dir";
+
+ /////////////////////////////////////////////////////////////////////////
+ // Bootstrap Specific Config //
+ /////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constant that holds the name of the environment property
+ * for specifying a comma seperated list of the basenames of
+ * to the boot libraries required load the core system.
+ *
+ * <p>These libraries will be loaded from <tt>LIBRARY_URL</tt>.
+ */
+ String BOOT_LIBRARY_LIST = "jboss.boot.library.list";
+
+ /**
+ * Constant that holds the name of the environment property
+ * for specifying the class type of the server to create.
+ */
+ String SERVER_TYPE = "jboss.server.type";
+
+ /**
+ * The bootstrap url
+ *
+ * <p>If not set then the server will default to {@link #DEFAULT_ROOT_DEPLOYMENT_FILENAME}.
+ */
+ String BOOTSTRAP_URL = "jboss.bootstrap.url";
+
+ /**
+ * Constant that holds the name of the environment property
+ * for specifying the root deployment filename (relative to the server
+ * config URL that will be deployed to finalize the boot strap process.
+ *
+ * <p>If not set then the server will default to {@link #DEFAULT_ROOT_DEPLOYMENT_FILENAME}.
+ */
+ String ROOT_DEPLOYMENT_FILENAME = "jboss.server.root.deployment.filename";
+
+
+ /////////////////////////////////////////////////////////////////////////
+ // Configuration Value Identifiers //
+ /////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constant that holds the name of the environment property
+ * for specifying the home directory for JBoss.
+ */
+ String HOME_DIR = "jboss.home.dir";
+
+ /**
+ * Constant that holds the name of the environment property
+ * for specifying the home URL for JBoss.
+ *
+ * <p>If not set then the value of HOME_DIR will converted into a URL.
+ */
+ String HOME_URL = "jboss.home.url";
+
+ /**
+ * Constant that holds the name of the environment property
+ * for specifying the URL where JBoss will read library files
+ * from.
+ *
+ * <p>Defaults to <tt><em>HOME_URL</em>/lib</tt>/
+ */
+ String LIBRARY_URL = "jboss.lib.url";
+
+ /**
+ * Constant that holds the name of the environment property
+ * for specifying the URL where JBoss will read patch library files
+ * from.
+ *
+ * <p>If this value is a <tt>file</tt> URL, then all .zip and .jar files
+ * inside will be prepended to the classpath. Otherwise the URL will be
+ * added to the classpath. If not set then the no patch files will be
+ * loaded.
+ */
+ String PATCH_URL = "jboss.patch.url";
+
+ /**
+ * Constant that holds the name of the environment property
+ * for specifying the name of the server which will be used to
+ * calculate the servers home directory and url.
+ *
+ * <p>Defaults to <tt>default</tt>.
+ */
+ String SERVER_NAME = "jboss.server.name";
+
+ /**
+ * Constant that holds the name of the environment property
+ * for specifying the base directory for calculating server
+ * home directories.
+ *
+ * <p>Defaults to <tt><em>HOME_DIR</em>/server</tt>.
+ */
+ String SERVER_BASE_DIR = "jboss.server.base.dir";
+
+ /**
+ * Constant that holds the name of the environment property
+ * for specifying the server home directory for JBoss.
+ *
+ * <p>Defaults to <tt><em>SERVER_BASE_DIR</em>/<em>SERVER_NAME</em></tt>.
+ */
+ String SERVER_HOME_DIR = "jboss.server.home.dir";
+
+ /**
+ * Constant that holds the name of the environment property
+ * for specifying the server log directory for JBoss.
+ *
+ * <p>Defaults to <tt><em>SERVER_HOME_DIR</em>/<em>log</em></tt>.
+ */
+ String SERVER_LOG_DIR = "jboss.server.log.dir";
+
+ /**
+ * Constant that holds the name of the environment property
+ * for specifying the directory which JBoss will use for
+ * temporary file storage.
+ *
+ * <p>Defaults to <tt><em>SERVER_HOME_DIR</em>/tmp</tt> .
+ */
+ String SERVER_TEMP_DIR = "jboss.server.temp.dir";
+
+ /**
+ * Constant that holds the name of the environment property
+ * for specifying the directory which JBoss will use for
+ * persistent data file storage.
+ *
+ * <p>Defaults to <tt><em>SERVER_HOME_DIR</em>/data</tt>.
+ */
+ String SERVER_DATA_DIR = "jboss.server.data.dir";
+
+ /**
+ * Constant that holds the name of the environment property
+ * for specifying the base URL for calculating server
+ * home URLs.
+ *
+ * <p>Defaults to <tt><em>HOME_URL</em>/server</tt>.
+ */
+ String SERVER_BASE_URL = "jboss.server.base.url";
+
+ /**
+ * Constant that holds the name of the environment property
+ * for specifying the server home URL for JBoss.
+ *
+ * <p>Defaults to <tt><em>SERVER_BASE_URL</em>/<em>SERVER_NAME</em></tt>.
+ */
+ String SERVER_HOME_URL = "jboss.server.home.url";
+
+ /**
+ * Constant that holds the name of the environment property
+ * for specifying the server configuration URL.
+ *
+ * <p>Defaults to <tt><em>SERVER_HOME_UTL</em>/conf</tt> .
+ */
+ String SERVER_CONFIG_URL = "jboss.server.config.url";
+
+ /**
+ * Constant that holds the name of the environment property
+ * for specifying the URL where JBoss will read server specific
+ * library files from.
+ *
+ * <p>Defaults to <tt><em>SERVER_HOME_URL</em>/lib</tt>/
+ */
+ String SERVER_LIBRARY_URL = "jboss.server.lib.url";
+
+ /**
+ * Constant that holds the name of the environment property
+ * for specifying the bind address for all jboss services
+ *
+ */
+ String SERVER_BIND_ADDRESS = "jboss.bind.address";
+
+ /**
+ * Constant that holds the name of the environment property
+ * for specifying whether or not the server should exit the
+ * JVM on shutdown.
+ *
+ * <p>If not set then the server will default to exiting on shutdown.
+ */
+ String EXIT_ON_SHUTDOWN = "jboss.server.exitonshutdown";
+
+ /**
+ * Constant that holds the name of the environment property for
+ * specifying whether or not the server should shutdown
+ * synchronously (true) or asynchronously (false).
+ *
+ * <p>If not set then the server will default to asynchronous shutdown.
+ */
+ String BLOCKING_SHUTDOWN = "jboss.server.blockingshutdown";
+
+ /**
+ * Constant that holds the name of the environment property
+ * for specifying whether or not to install the lifethread
+ *
+ * <p>If not set then the server will default to installing the lifethread.
+ */
+ String INSTALL_LIFE_THREAD = "jboss.server.lifethread";
+
+ /**
+ * Constant that holds the name of the environment property for
+ * specifying whether or not the server should log and ignore
+ * exceptions when setting the URLStreamHandlerFactory.
+ *
+ * <p>If not set then the server will default to asynchronous shutdown.
+ */
+ String REQUIRE_JBOSS_URL_STREAM_HANDLER_FACTORY = "jboss.server.requirejbossurlstreamhandlerfactory";
+
+ /**
+ * Constant that holds the name of the environment property for specifying
+ * whether or not to use as the main jboss server the MBeanServer returned
+ * from ManagementFactory.getPlatformMBeanServer(), when running under jdk1.5+
+ *
+ * <p>If not set then jboss will instantiate its own MBeanServer
+ */
+ String PLATFORM_MBEANSERVER = "jboss.platform.mbeanserver";
+
+ /////////////////////////////////////////////////////////////////////////
+ // Path Suffixes //
+ /////////////////////////////////////////////////////////////////////////
+
+ /**
+ * The suffix used when generating the default value for {@link #LIBRARY_URL}
+ * and {@link #SERVER_LIBRARY_URL}.
+ */
+ String LIBRARY_URL_SUFFIX = "lib/";
+
+ /**
+ * The suffix used when generating the default value for {@link #SERVER_CONFIG_URL}.
+ */
+ String SERVER_CONFIG_URL_SUFFIX = "conf/";
+
+ /**
+ * The suffix used when generating the default value for {@link #SERVER_BASE_DIR}.
+ */
+ String SERVER_BASE_DIR_SUFFIX = "server";
+
+ /**
+ * The suffix used when generating the default value for {@link #SERVER_BASE_URL}.
+ */
+ String SERVER_BASE_URL_SUFFIX = "server/";
+
+ /**
+ * The suffix used when generating the default value for {@link #SERVER_DATA_DIR}.
+ */
+ String SERVER_DATA_DIR_SUFFIX = "data";
+
+ /**
+ * The suffix used when generating the default value for {@link #SERVER_LOG_DIR}.
+ */
+ String SERVER_LOG_DIR_SUFFIX = "log";
+
+ /**
+ * The suffix used when generating the default value for {@link #SERVER_TEMP_DIR}.
+ */
+ String SERVER_TEMP_DIR_SUFFIX = "tmp";
+
+
+ /////////////////////////////////////////////////////////////////////////
+ // Defaults //
+ /////////////////////////////////////////////////////////////////////////
+
+ /** The default value for {@link #SERVER_NAME}. */
+ String DEFAULT_SERVER_NAME = "default";
+
+ /** The default value for {@link #EXIT_ON_SHUTDOWN}. */
+ boolean DEFAULT_EXIT_ON_SHUTDOWN = true;
+
+ /** The default value for {@link #BLOCKING_SHUTDOWN}. */
+ boolean DEFAULT_BLOCKING_SHUTDOWN = false;
+
+ /** The default value for {@link #INSTALL_LIFE_THREAD}. */
+ boolean DEFAULT_INSTALL_LIFE_THREAD = true;
+
+ /** The default value for {@link #REQUIRE_JBOSS_URL_STREAM_HANDLER_FACTORY}. */
+ boolean DEFAULT_REQUIRE_JBOSS_URL_STREAM_HANDLER_FACTORY = true;
+
+ /** The default value for {@link #PLATFORM_MBEANSERVER}. */
+ boolean DEFAULT_PLATFORM_MBEANSERVER = false;
+
+ /** The default value for {@link #ROOT_DEPLOYMENT_FILENAME}. */
+ String DEFAULT_ROOT_DEPLOYMENT_FILENAME = "jboss-service.xml";
+
+
+ /////////////////////////////////////////////////////////////////////////
+ // Typed Access Methods //
+ /////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get the bootstrap url
+ *
+ * @return the bootstrap url
+ */
+ URL getBootstrapURL();
+
+ /**
+ * Get the local home directory which the server is running from.
+ *
+ * @return The local server home directory.
+ */
+ File getHomeDir();
+
+ /**
+ * Get the home URL which the server is running from.
+ *
+ * @return The home URL which the server is running from.
+ */
+ URL getHomeURL();
+
+ /**
+ * Get the library URL for the server.
+ *
+ * @return The library URL for the server.
+ */
+ URL getLibraryURL();
+
+ /**
+ * Get the patch URL for the server.
+ *
+ * @return The patch URL for the server.
+ */
+ URL getPatchURL();
+
+ /**
+ * Get the name of the server.
+ *
+ * @return The name of the server.
+ */
+ String getServerName();
+
+ /**
+ * Get the base directory for calculating server home directories.
+ *
+ * @return Base server home directory.
+ */
+ File getServerBaseDir();
+
+ /**
+ * Get the server home directory.
+ *
+ * @return Server home directory.
+ */
+ File getServerHomeDir();
+
+ /**
+ * Get the directory where log files will be stored.
+ *
+ * @return The directory where the server writes log files.
+ */
+ File getServerLogDir();
+
+ /**
+ * Get the directory where temporary files will be stored.
+ *
+ * @return The directory where the server stores temporary files.
+ */
+ File getServerTempDir();
+
+ /**
+ * Get the directory where local data will be stored.
+ *
+ * @return The directory where the server stores local data.
+ */
+ File getServerDataDir();
+
+ /**
+ * Get the base directory for calculating server home URLs.
+ *
+ * @return Base server home URL.
+ */
+ URL getServerBaseURL();
+
+ /**
+ * Get the server home URL.
+ *
+ * @return Server home URL.
+ */
+ URL getServerHomeURL();
+
+ /**
+ * Get the server library URL.
+ *
+ * @return Server library URL.
+ */
+ URL getServerLibraryURL();
+
+ /**
+ * Get the server configuration URL.
+ *
+ * @return Server configuration URL.
+ */
+ URL getServerConfigURL();
+
+ /**
+ * Get the current value of the flag that indicates if we are
+ * using the platform MBeanServer as the main jboss server.
+ * Both the {@link ServerConfig#PLATFORM_MBEANSERVER}
+ * property must be set, and the jvm must be jdk1.5+
+ *
+ * @return true if jboss runs on the jvm platfrom MBeanServer
+ */
+ boolean getPlatformMBeanServer();
+
+ /**
+ * Enable or disable exiting the JVM when {@link Server#shutdown()} is called.
+ * If enabled, then shutdown calls {@link Server#exit()}. If disabled, then
+ * only the shutdown hook will be run.
+ *
+ * @param flag True to enable calling exit on shutdown.
+ */
+ void setExitOnShutdown(boolean flag);
+
+ /**
+ * Get the current value of the exit on shutdown flag.
+ *
+ * @return The current value of the exit on shutdown flag.
+ */
+ boolean getExitOnShutdown();
+
+
+ /**
+ * Get the BlockingShutdown value.
+ * @return the BlockingShutdown value.
+ */
+ boolean getBlockingShutdown();
+
+ /**
+ * Set the BlockingShutdown value.
+ * @param blockingShutdown The new BlockingShutdown value.
+ */
+ void setBlockingShutdown(boolean blockingShutdown);
+
+ /**
+ * Whether to install the lifethread
+ *
+ * @return true to install the life thread
+ */
+ boolean isInstallLifeThread();
+
+ /**
+ * Get the RequireJBossURLStreamHandlerFactory value.
+ * @return the RequireJBossURLStreamHandlerFactory value.
+ */
+ boolean getRequireJBossURLStreamHandlerFactory();
+
+ /**
+ * Set the RequireJBossURLStreamHandlerFactory value.
+ * @param requireJBossURLStreamHandlerFactory The new RequireJBossURLStreamHandlerFactory value.
+ */
+ void setRequireJBossURLStreamHandlerFactory(boolean requireJBossURLStreamHandlerFactory);
+
+ /**
+ * Set the filename of the root deployable that will be used to finalize
+ * the bootstrap process.
+ *
+ * @param filename The filename of the root deployable.
+ */
+ void setRootDeploymentFilename(String filename);
+
+ /**
+ * Get the filename of the root deployable that will be used to finalize
+ * the bootstrap process.
+ *
+ * @return The filename of the root deployable.
+ */
+ String getRootDeploymentFilename();
+
+ /**
+ * Get the native dir for unpacking
+ *
+ * @return the directory
+ */
+ File getServerNativeDir();
+
+ /**
+ * Get the temporary deployment dir for unpacking
+ *
+ * @return the directory
+ */
+ File getServerTempDeployDir();
+
+ /**
+ * Get the server Specification-Version
+ *
+ * @return the spec version
+ */
+ String getSpecificationVersion();
+}
Added: trunk/main/src/main/org/jboss/system/server/ServerConfigUtil.java
===================================================================
--- trunk/main/src/main/org/jboss/system/server/ServerConfigUtil.java (rev 0)
+++ trunk/main/src/main/org/jboss/system/server/ServerConfigUtil.java 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,146 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.system.server;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+/**
+ * Utilities for accessing server configuration
+ *
+ * @author <a href="mailto:adrian at jboss.org">Adrian Brock</a>
+ * @version <tt>$Revision: 57108 $</tt>
+ */
+public class ServerConfigUtil
+{
+ private static final String ANY = "0.0.0.0";
+
+ /**
+ * Retrieve the default bind address for the server
+ *
+ * @return the default bind adress
+ */
+ public static String getDefaultBindAddress()
+ {
+ return System.getProperty(ServerConfig.SERVER_BIND_ADDRESS);
+ }
+
+ /**
+ * Retrieve the default bind address, but only if it is specific
+ *
+ * @return the specific bind address
+ */
+ public static String getSpecificBindAddress()
+ {
+ String address = System.getProperty(ServerConfig.SERVER_BIND_ADDRESS);
+ if (address == null || address.equals(ANY))
+ return null;
+ return address;
+ }
+
+ /**
+ * Fix the remote inet address.
+ *
+ * If we pass the address to the client we don't want to
+ * tell it to connect to 0.0.0.0, use our host name instead
+ * @param address the passed address
+ * @return the fixed address
+ */
+ public static InetAddress fixRemoteAddress(InetAddress address)
+ {
+ try
+ {
+ if (address == null || InetAddress.getByName(ANY).equals(address))
+ return InetAddress.getLocalHost();
+ }
+ catch (UnknownHostException ignored)
+ {
+ }
+ return address;
+ }
+
+ /**
+ * Fix the remote address.
+ *
+ * If we pass the address to the client we don't want to
+ * tell it to connect to 0.0.0.0, use our host name instead
+ * @param address the passed address
+ * @return the fixed address
+ */
+ public static String fixRemoteAddress(String address)
+ {
+ try
+ {
+ if (address == null || ANY.equals(address))
+ return InetAddress.getLocalHost().getHostName();
+ }
+ catch (UnknownHostException ignored)
+ {
+ }
+ return address;
+ }
+
+ /**
+ * Get the default partition name
+ *
+ * @return the default partition name
+ */
+ public static String getDefaultPartitionName()
+ {
+ return System.getProperty(ServerConfig.PARTITION_NAME_PROPERTY, ServerConfig.DEFAULT_PARITION_NAME);
+ }
+
+ /**
+ * Whether to load native directories
+ *
+ * @return true when loading native directories
+ */
+ public static boolean isLoadNative()
+ {
+ return Boolean.getBoolean(ServerConfig.NATIVE_LOAD_PROPERTY);
+ }
+
+ /**
+ * Utility to get a shortened url relative to the server home if possible
+ *
+ * @param longUrl
+ * @return the short url
+ */
+ public static String shortUrlFromServerHome(String longUrl)
+ {
+ String serverHomeUrl = System.getProperty(org.jboss.system.server.ServerConfig.SERVER_HOME_URL);
+
+ if (longUrl == null || serverHomeUrl == null)
+ return longUrl;
+
+ if (longUrl.startsWith(serverHomeUrl))
+ return ".../" + longUrl.substring(serverHomeUrl.length());
+ else
+ {
+ String jarServerHomeUrl = "jar:" + serverHomeUrl;
+ if (longUrl.startsWith(jarServerHomeUrl))
+ return ".../" + longUrl.substring(jarServerHomeUrl.length());
+ else
+ return longUrl;
+ }
+ }
+}
Added: trunk/main/src/main/org/jboss/system/server/ServerLoader.java
===================================================================
--- trunk/main/src/main/org/jboss/system/server/ServerLoader.java (rev 0)
+++ trunk/main/src/main/org/jboss/system/server/ServerLoader.java 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,331 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.system.server;
+
+// $Id: ServerLoader.java 64043 2007-07-13 16:59:19Z adrian at jboss.org $
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Properties;
+import java.util.StringTokenizer;
+
+import org.jboss.system.NoAnnotationURLClassLoader;
+
+/**
+ * A helper class to load a JBoss server instance.
+ *
+ * <p>Basic usage is something like this:
+ * <pre>
+ * // setup the basic server config properties
+ * Properties props = new Properties(System.getProperties());
+ * props.put(ServerConfig.SERVER_LIBRARY_URL, "http://myserver.com/myjboss/lib/");
+ * // set some more properties
+ *
+ * // create a new loader to do the dirty work
+ * ServerLoader loader = new ServerLoader(props);
+ *
+ * // add the jaxp & jmx library to use
+ * loader.addLibrary("crimson.jar");
+ * loader.addLibrary("jboss-jmx-core.jar");
+ *
+ * // load and initialize the server instance
+ * ClassLoader parent = Thread.currentThread().getContextClassLoader();
+ * Server server = loader.load(parent);
+ * server.init(props);
+ *
+ * // start up the server
+ * server.start();
+ *
+ * // go make some coffee, drink a beer or play GTA3
+ * // ...
+ *
+ * // shutdown and go to sleep
+ * server.shutdown();
+ * </pre>
+ * @version <tt>$Revision: 64043 $</tt>
+ * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
+ * @author <a href="mailto:adrian.brock at happeningtimes.com">Adrian Brock</a>
+ * @author Scott.Stark at jboss.org
+ * @author Thomas.Diesler at jboss.org
+ */
+public class ServerLoader
+{
+ /**
+ * The default list of boot libraries. Does not include
+ * the JAXP or JMX impl, users of this class should add the
+ * proper libraries.
+ * TODO: use vfs to list the root directory
+ */
+ public static final String[] DEFAULT_BOOT_LIBRARY_LIST = {
+ // Logging
+ "log4j-boot.jar",
+ "jboss-logging-spi.jar",
+ "jboss-logging-log4j.jar",
+ "jboss-logging-jdk.jar",
+ "jboss-xml-binding.jar",
+ // Common jars
+ "jboss-common-core.jar",
+ // Bootstrap
+ "jboss-bootstrap.jar",
+ // Microcontainer
+ "javassist.jar",
+ "jboss-container.jar",
+ "jboss-dependency.jar",
+ "jboss-kernel.jar",
+ };
+
+ /** The default server type. */
+ public static final String DEFAULT_SERVER_TYPE = "org.jboss.bootstrap.microcontainer.ServerImpl";
+
+ /**
+ * Configuration properties.
+ */
+ protected Properties props;
+
+ /**
+ * The URL where libraries are read from.
+ */
+ protected URL libraryURL;
+
+ /**
+ * A list of extra URLs to add to the classpath when loading
+ * the server.
+ */
+ protected List<URL> extraClasspath = new LinkedList<URL>();
+
+ /**
+ * Construct a <tt>ServerLoader</tt>.
+ *
+ * @param props Configuration properties.
+ *
+ * @throws Exception Invalid configuration
+ */
+ public ServerLoader(final Properties props) throws Exception
+ {
+ if (props == null)
+ throw new IllegalArgumentException("props is null");
+
+ this.props = props;
+
+ // must have HOME_URL, or we can't continue
+ URL homeURL = getURL(ServerConfig.HOME_URL);
+ if (homeURL == null)
+ {
+ throw new Exception("Missing configuration value for: "
+ + ServerConfig.HOME_URL);
+ }
+
+ libraryURL = getURL(ServerConfig.LIBRARY_URL);
+ if (libraryURL == null)
+ {
+ // need library url to make boot urls list
+ libraryURL = new URL(homeURL, ServerConfig.LIBRARY_URL_SUFFIX);
+ }
+
+ // If the home URL begins with http add the webav and httpclient jars
+ if( homeURL.getProtocol().startsWith("http") == true )
+ {
+ this.addLibrary("webdavlib.jar");
+ this.addLibrary("commons-httpclient.jar");
+ this.addLibrary("commons-logging.jar");
+ }
+ }
+
+ /**
+ * Add an extra library to the end of list of libraries
+ * which will be loaded from the library URL when loading
+ * the Server class.
+ *
+ * @param filename A filename (no directory parts)
+ *
+ * @throws MalformedURLException Could not generate URL from library URL + filename
+ */
+ public void addLibrary(final String filename) throws MalformedURLException
+ {
+ if (filename == null)
+ throw new IllegalArgumentException("filename is null");
+
+ URL jarURL = new URL(libraryURL, filename);
+ extraClasspath.add(jarURL);
+ }
+
+ /**
+ * Add a list of comma seperated library file names.
+ *
+ * @param filenames A list of comma seperated filenames (with no directory parts)
+ *
+ * @throws MalformedURLException Could not generate URL from library URL + filename
+ */
+ public void addLibraries(final String filenames) throws MalformedURLException
+ {
+ if (filenames == null)
+ throw new IllegalArgumentException("filenames is null");
+
+ StringTokenizer stok = new StringTokenizer(filenames, ",");
+ while (stok.hasMoreElements())
+ {
+ addLibrary(stok.nextToken().trim());
+ }
+ }
+
+ /**
+ * Add an extra URL to the classpath used to load the server.
+ *
+ * @param url A URL to add to the classpath.
+ */
+ public void addURL(final URL url)
+ {
+ if (url == null)
+ throw new IllegalArgumentException("url is null");
+
+ extraClasspath.add(url);
+ }
+
+ /**
+ * Add the jars from the lib/endorsed dir if it exists.
+ * Note, the path must exist locally for this to work.
+ * @throws MalformedURLException Could not generate URL from library URL + filename
+ */
+ public void addEndorsedJars() throws MalformedURLException
+ {
+ File endorsedDir = new File(libraryURL.getPath() + "/endorsed");
+ if (endorsedDir.exists())
+ {
+ String [] list = endorsedDir.list();
+ for (int i = 0; list != null && i < list.length; i++)
+ {
+ String jarname = list[i];
+ addLibrary("endorsed/" + jarname);
+ }
+ }
+ }
+
+ /**
+ * Get a URL from configuration or system properties.
+ *
+ * @param name the system property
+ * @return the url
+ * @throws MalformedURLException for a bad url
+ */
+ protected URL getURL(final String name) throws MalformedURLException
+ {
+ String value = props.getProperty(name, null);
+ if (value != null)
+ {
+ if (!value.endsWith("/")) value += "/";
+ return new URL(value);
+ }
+ return null;
+ }
+
+ /**
+ * Returns an array of URLs which will be used to load the
+ * core system and construct a new Server object instance.
+ * @return the urls
+ * @throws MalformedURLException for a bad url
+ */
+ protected URL[] getBootClasspath() throws MalformedURLException
+ {
+ List<URL> list = new LinkedList<URL>();
+
+ // prepend users classpath to allow for overrides
+ list.addAll(extraClasspath);
+
+ String value = props.getProperty(ServerConfig.BOOT_LIBRARY_LIST);
+ if( value != null )
+ {
+ StringTokenizer stok = new StringTokenizer(value, ",");
+ while (stok.hasMoreElements())
+ {
+ URL url = new URL(libraryURL, stok.nextToken().trim());
+ list.add(url);
+ }
+ }
+ else
+ {
+ for(String jar : DEFAULT_BOOT_LIBRARY_LIST)
+ {
+ URL url = new URL(libraryURL, jar);
+ list.add(url);
+ }
+ }
+
+ return list.toArray(new URL[list.size()]);
+ }
+
+ /**
+ * Load a {@link Server} instance.
+ *
+ * @parent The parent of any class loader created during boot.
+ * @return An uninitialized (and unstarted) Server instance.
+ *
+ * @param parent the parent classloader
+ * @throws Exception Failed to load or create Server instance.
+ */
+ public Server load(final ClassLoader parent) throws Exception
+ {
+ Server server;
+ ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
+
+ try
+ {
+ // get the boot lib list
+ URL[] urls = getBootClasspath();
+ URLClassLoader classLoader = new NoAnnotationURLClassLoader(urls, parent);
+ Thread.currentThread().setContextClassLoader(classLoader);
+
+ // construct a new Server instance
+ String typename = props.getProperty(ServerConfig.SERVER_TYPE, DEFAULT_SERVER_TYPE);
+ server = createServer(typename, classLoader);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(oldCL);
+ }
+
+ // thats all folks, have fun
+ return server;
+ }
+
+ /**
+ * Construct a new instance of Server, loading all required classes from
+ * the given ClassLoader.
+ * @param typename - the fqcn of the Server implementation
+ * @param loader - the ClassLoader to load typename with
+ * @return the server
+ * @throws Exception for any error
+ */
+ protected Server createServer(final String typename, final ClassLoader loader)
+ throws Exception
+ {
+ // load the class first
+ Class<?> type = loader.loadClass(typename);
+
+ // and then create a new instance
+ Server server = (Server) type.newInstance();
+ return server;
+ }
+}
Added: trunk/main/src/resources/log4j-debug.properties
===================================================================
--- trunk/main/src/resources/log4j-debug.properties (rev 0)
+++ trunk/main/src/resources/log4j-debug.properties 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,22 @@
+### ====================================================================== ###
+## ##
+## JBoss Bootstrap Log4j Configuration (DEBUG) ##
+## ##
+### ====================================================================== ###
+
+### $Id: log4j-debug.properties 41281 2006-02-18 00:05:17Z starksm $ ###
+
+log4j.rootCategory=DEBUG, FILE, CONSOLE
+
+### A bootstrap file appender
+log4j.appender.FILE=org.jboss.logging.appender.FileAppender
+log4j.appender.FILE.File=${jboss.server.log.dir}/boot.log
+log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
+log4j.appender.FILE.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{1}] %m%n
+log4j.appender.FILE.Append=false
+
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.Target=System.out
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{1}] %m%n
+
Added: trunk/main/src/resources/log4j-trace.properties
===================================================================
--- trunk/main/src/resources/log4j-trace.properties (rev 0)
+++ trunk/main/src/resources/log4j-trace.properties 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,22 @@
+### ====================================================================== ###
+## ##
+## JBoss Bootstrap Log4j Configuration (TRACE) ##
+## ##
+### ====================================================================== ###
+
+### $Id: log4j-trace.properties 41281 2006-02-18 00:05:17Z starksm $ ###
+
+log4j.rootCategory=TRACE#org.jboss.logging.XLevel, FILE, CONSOLE
+
+### A bootstrap file appender
+log4j.appender.FILE=org.jboss.logging.appender.FileAppender
+log4j.appender.FILE.File=${jboss.server.log.dir}/boot.log
+log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
+log4j.appender.FILE.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{1}] %m%n
+log4j.appender.FILE.Append=false
+
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.Target=System.out
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{1}] %m%n
+
Added: trunk/main/src/resources/log4j.properties
===================================================================
--- trunk/main/src/resources/log4j.properties (rev 0)
+++ trunk/main/src/resources/log4j.properties 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,24 @@
+### ====================================================================== ###
+## ##
+## JBoss Bootstrap Log4j Configuration ##
+## ##
+### ====================================================================== ###
+
+### $Id: log4j.properties 57108 2006-09-23 20:55:54Z scott.stark at jboss.org $ ###
+
+log4j.rootCategory=DEBUG, FILE, CONSOLE
+
+### A bootstrap file appender
+log4j.appender.FILE=org.jboss.logging.appender.FileAppender
+log4j.appender.FILE.File=${jboss.server.log.dir}/boot.log
+log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
+log4j.appender.FILE.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{1}] %m%n
+log4j.appender.FILE.Append=false
+
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.Threshold=INFO
+log4j.appender.CONSOLE.Target=System.out
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{1}] %m%n
+
+#log4j.category.org.jboss.deployers=TRACE#org.jboss.logging.XLevel
Property changes on: trunk/main/src/resources/log4j.properties
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/main/src/resources/org/jboss/version.properties
===================================================================
--- trunk/main/src/resources/org/jboss/version.properties (rev 0)
+++ trunk/main/src/resources/org/jboss/version.properties 2007-08-14 15:48:44 UTC (rev 64576)
@@ -0,0 +1,37 @@
+### ====================================================================== ###
+## ##
+## Holds version properties for JBoss. ##
+## ##
+### ====================================================================== ###
+
+### $Id: version.properties 24677 2004-10-17 21:20:54Z starksm $ ###
+
+# The version of the server
+version.major=@version.major@
+version.minor=@version.minor@
+version.revision=@version.revision@
+version.tag=@version.tag@
+version.name=@version.name@
+version.cvstag=@version.cvstag@
+
+# Build identifiers
+build.number=@build.number@
+build.id=@build.id@
+build.date=@DSTAMP@
+build.time=@TSTAMP@
+build.day=@TODAY@
+
+# Information about Java version used to compile
+java.version=@java.version@
+java.vendor=@java.vendor@
+java.vm.specification.version=@java.vm.specification.version@
+java.vm.version=@java.vm.version@
+java.vm.name=@java.vm.name@
+java.vm.info=@java.vm.info@
+java.specification.version=@java.specification.version@
+java.class.version=@java.class.version@
+
+# Information about the OS the server was compiled on
+os.name=@os.name@
+os.arch=@os.arch@
+os.version=@os.version@
Modified: trunk/management/.classpath
===================================================================
--- trunk/management/.classpath 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/management/.classpath 2007-08-14 15:48:44 UTC (rev 64576)
@@ -12,5 +12,6 @@
<classpathentry combineaccessrules="false" kind="src" path="/system-jmx"/>
<classpathentry combineaccessrules="false" kind="src" path="/system"/>
<classpathentry kind="lib" path="/thirdparty/jboss/jboss-javaee/lib/jboss-javaee.jar" sourcepath="/thirdparty/jboss/jboss-javaee/lib/jboss-javaee-sources.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/main"/>
<classpathentry kind="output" path="output/eclipse-classes"/>
</classpath>
Modified: trunk/management/build.xml
===================================================================
--- trunk/management/build.xml 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/management/build.xml 2007-08-14 15:48:44 UTC (rev 64576)
@@ -103,6 +103,7 @@
<path refid="jboss.cluster.classpath"/>
<path refid="jboss.jca.classpath"/>
<path refid="jboss.server.classpath"/>
+ <path refid="jboss.main.classpath"/>
<path refid="jboss.system.classpath"/>
<path refid="jboss.systemjmx.classpath"/>
<path refid="jboss.j2se.classpath"/>
Modified: trunk/server/.classpath
===================================================================
--- trunk/server/.classpath 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/server/.classpath 2007-08-14 15:48:44 UTC (rev 64576)
@@ -44,5 +44,6 @@
<classpathentry kind="lib" path="/thirdparty/jboss/integration/lib/jboss-integration.jar" sourcepath="/thirdparty/jboss/integration/lib/jboss-integration-sources.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/jboss-security-spi/lib/jboss-security-spi.jar" sourcepath="/thirdparty/jboss/jboss-security-spi/lib/jboss-security-spi-sources.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/jbosssx/lib/jbosssx.jar" sourcepath="/thirdparty/jboss/security/lib/jbosssx-sources.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/main"/>
<classpathentry kind="output" path="output/eclipse-classes"/>
</classpath>
Modified: trunk/server/build.xml
===================================================================
--- trunk/server/build.xml 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/server/build.xml 2007-08-14 15:48:44 UTC (rev 64576)
@@ -108,6 +108,7 @@
<path refid="jboss.common.logging.spi.classpath"/>
<path refid="jboss.common.logging.log4j.classpath"/>
<path refid="jboss.common.logging.jdk.classpath"/>
+ <path refid="jboss.main.classpath"/>
<path refid="jboss.system.classpath"/>
<path refid="jboss.systemjmx.classpath"/>
<path refid="jboss.j2se.classpath"/>
Modified: trunk/server/src/etc/conf/default/bootstrap-beans.xml
===================================================================
--- trunk/server/src/etc/conf/default/bootstrap-beans.xml 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/server/src/etc/conf/default/bootstrap-beans.xml 2007-08-14 15:48:44 UTC (rev 64576)
@@ -6,6 +6,62 @@
$Id:$
-->
<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <!-- All beans use the bootstrap classloader -->
+ <classloader><inject bean="BootstrapClassLoader"/></classloader>
+
+ <!-- TODO Should split this file up and use the new classloader -->
+ <bean name="BootstrapClassLoader" class="org.jboss.system.NoAnnotationURLClassLoader">
+ <classloader><null/></classloader>
+ <constructor factoryClass="org.jboss.system.NoAnnotationURLClassLoader" factoryMethod="createClassLoader">
+ <parameter>
+ <array elementClass="java.net.URL">
+ <!-- VFS -->
+ <value>${jboss.lib.url}/jboss-vfs.jar</value>
+ <!-- ClassLoader -->
+ <value>${jboss.lib.url}/jboss-classloading-spi.jar</value>
+ <value>${jboss.lib.url}/jboss-classloader.jar</value>
+ <!-- Deployers -->
+ <value>${jboss.lib.url}/jboss-metatype.jar</value>
+ <value>${jboss.lib.url}/jboss-managed.jar</value>
+ <value>${jboss.lib.url}/jboss-deployers-core-spi.jar</value>
+ <value>${jboss.lib.url}/jboss-deployers-core.jar</value>
+ <value>${jboss.lib.url}/jboss-deployers-client-spi.jar</value>
+ <value>${jboss.lib.url}/jboss-deployers-client.jar</value>
+ <value>${jboss.lib.url}/jboss-deployers-structure-spi.jar</value>
+ <value>${jboss.lib.url}/jboss-deployers-spi.jar</value>
+ <value>${jboss.lib.url}/jboss-deployers-impl.jar</value>
+ <value>${jboss.lib.url}/jboss-deployers-vfs-spi.jar</value>
+ <value>${jboss.lib.url}/jboss-deployers-vfs.jar</value>
+ <!-- System -->
+ <value>${jboss.lib.url}/jboss-system.jar</value>
+ <!-- JMX -->
+ <value>${jboss.lib.url}/jboss-j2se.jar</value>
+ <value>${jboss.lib.url}/jboss-mbeans.jar</value>
+ <value>${jboss.lib.url}/jboss-jmx.jar</value>
+ <value>${jboss.lib.url}/jboss-system-jmx.jar</value>
+ <value>${jboss.lib.url}/dom4j.jar</value>
+ <!-- AOP -->
+ <value>${jboss.lib.url}/jboss-aop-jdk50.jar</value>
+ <value>${jboss.lib.url}/jboss-aop-deployer-jdk50.jar</value>
+ <value>${jboss.lib.url}/jboss-aop-mc-int.jar</value>
+ <value>${jboss.lib.url}/trove.jar</value>
+ <!-- JAXB - shouldn't this be in endorsed? -->
+ <value>${jboss.lib.url}/jaxb-api.jar</value>
+ <value>${jboss.lib.url}/jaxb-impl.jar</value>
+ <value>${jboss.lib.url}/stax-api.jar</value>
+ <value>${jboss.lib.url}/activation.jar</value>
+ </array>
+ </parameter>
+ </constructor>
+ </bean>
+
+ <!-- FIXME REMOVE THIS -->
+ <bean name="AOPMCFIX" class="org.jboss.aop.deployers.temp.Hack">
+ <constructor>
+ <parameter><inject bean="jboss.kernel:service=Kernel"/></parameter>
+ </constructor>
+ </bean>
<!-- The basic profile service which relies on vfs scanners
to determine the profile deployments. This version does not
@@ -17,6 +73,10 @@
</constructor>
<property name="profileRoot">${jboss.server.home.dir}</property>
</bean>
+
+ <bean name="ProfileServiceBootstrap" class="org.jboss.system.server.profileservice.ProfileServiceBootstrap">
+ <property name="kernel"><inject bean="jboss.kernel:service=Kernel"/></property>
+ </bean>
<!-- The legacy JMX kernel -->
<bean name="JMXKernel" class="org.jboss.system.server.jmx.JMXKernel">
Modified: trunk/server/src/etc/conf/default/bootstrap-repo-beans.xml
===================================================================
--- trunk/server/src/etc/conf/default/bootstrap-repo-beans.xml 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/server/src/etc/conf/default/bootstrap-repo-beans.xml 2007-08-14 15:48:44 UTC (rev 64576)
@@ -6,6 +6,55 @@
$Id$
-->
<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <!-- All beans use the bootstrap classloader -->
+ <classloader><inject bean="BootstrapClassLoader"/></classloader>
+
+ <!-- TODO Should split this file up and use the new classloader -->
+ <bean name="BootstrapClassLoader" class="org.jboss.system.NoAnnotationURLClassLoader">
+ <classloader><null/></classloader>
+ <constructor factoryClass="org.jboss.system.NoAnnotationURLClassLoader" factoryMethod="createClassLoader">
+ <parameter>
+ <array elementClass="java.net.URL">
+ <!-- VFS -->
+ <value>${jboss.lib.url}/jboss-vfs.jar</value>
+ <!-- ClassLoader -->
+ <value>${jboss.lib.url}/jboss-classloading-spi.jar</value>
+ <value>${jboss.lib.url}/jboss-classloader.jar</value>
+ <!-- Deployers -->
+ <value>${jboss.lib.url}/jboss-metatype.jar</value>
+ <value>${jboss.lib.url}/jboss-managed.jar</value>
+ <value>${jboss.lib.url}/jboss-deployers-core-spi.jar</value>
+ <value>${jboss.lib.url}/jboss-deployers-core.jar</value>
+ <value>${jboss.lib.url}/jboss-deployers-client-spi.jar</value>
+ <value>${jboss.lib.url}/jboss-deployers-client.jar</value>
+ <value>${jboss.lib.url}/jboss-deployers-structure-spi.jar</value>
+ <value>${jboss.lib.url}/jboss-deployers-spi.jar</value>
+ <value>${jboss.lib.url}/jboss-deployers-impl.jar</value>
+ <value>${jboss.lib.url}/jboss-deployers-vfs-spi.jar</value>
+ <value>${jboss.lib.url}/jboss-deployers-vfs.jar</value>
+ <!-- System -->
+ <value>${jboss.lib.url}/jboss-system.jar</value>
+ <!-- JMX -->
+ <value>${jboss.lib.url}/jboss-j2se.jar</value>
+ <value>${jboss.lib.url}/jboss-mbeans.jar</value>
+ <value>${jboss.lib.url}/jboss-jmx.jar</value>
+ <value>${jboss.lib.url}/jboss-system-jmx.jar</value>
+ <value>${jboss.lib.url}/dom4j.jar</value>
+ <!-- AOP
+ <value>${jboss.lib.url}/jboss-aop-jdk50.jar</value>
+ <value>${jboss.lib.url}/jboss-aop-deployer-jdk50.jar</value>
+ <value>${jboss.lib.url}/jboss-aop-mc-int.jar</value>
+ <value>${jboss.lib.url}/trove.jar</value-->
+ <!-- JAXB - shouldn't this be in endorsed? -->
+ <value>${jboss.lib.url}/jaxb-api.jar</value>
+ <value>${jboss.lib.url}/jaxb-impl.jar</value>
+ <value>${jboss.lib.url}/stax-api.jar</value>
+ <value>${jboss.lib.url}/activation.jar</value>
+ </array>
+ </parameter>
+ </constructor>
+ </bean>
<!--
Valid values for the AspectManager bean for use with enableTransformer=true are:
@@ -82,6 +131,10 @@
<property name="attachmentsStoreDir">${jboss.server.home.dir}/attachments</property>
</bean>
+ <bean name="ProfileServiceBootstrap" class="org.jboss.system.server.profileservice.ProfileServiceBootstrap">
+ <property name="kernel"><inject bean="jboss.kernel:service=Kernel"/></property>
+ </bean>
+
<!-- The legacy JMX kernel -->
<bean name="JMXKernel" class="org.jboss.system.server.jmx.JMXKernel">
<property name="kernel"><inject bean="jboss.kernel:service=Kernel"/></property>
Modified: trunk/system/.classpath
===================================================================
--- trunk/system/.classpath 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/system/.classpath 2007-08-14 15:48:44 UTC (rev 64576)
@@ -30,5 +30,8 @@
<classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-deployers-vfs-spi.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-deployers-vfs-spi-sources.jar"/>
<classpathentry kind="lib" path="/thirdparty/javassist/lib/javassist.jar" sourcepath="/thirdparty/javassist/lib/javassist-src.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/aop/lib/jboss-aop-deployer-jdk50.jar" sourcepath="/thirdparty/jboss/aop/lib/jboss-asintegration-src.zip"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/main"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/bootstrap"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-aop-mc-int.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-aop-mc-int-sources.jar"/>
<classpathentry kind="output" path="output/eclipse-classes"/>
</classpath>
Modified: trunk/system/build-test.xml
===================================================================
--- trunk/system/build-test.xml 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/system/build-test.xml 2007-08-14 15:48:44 UTC (rev 64576)
@@ -86,6 +86,7 @@
<path refid="apache.log4j.classpath" />
<path refid="oswego.concurrent.classpath" />
<path refid="jboss.jbossxb.classpath" />
+ <path refid="jboss.jboss.vfs.classpath" />
<path refid="jboss.common.core.classpath"/>
<path refid="jboss.common.logging.spi.classpath"/>
<path refid="jboss.common.logging.log4j.classpath"/>
@@ -114,6 +115,8 @@
<path refid="jboss.microcontainer.classpath"/>
<path refid="jboss.j2se.classpath" />
<path refid="jboss.mbeans.classpath" />
+ <path refid="jboss.main.classpath" />
+ <path refid="jboss.bootstrap.classpath" />
<path refid="jboss.test.classpath" />
<pathelement location="output/classes" />
<pathelement location="src/resources/tests/bootstrap" />
Modified: trunk/system/build.xml
===================================================================
--- trunk/system/build.xml 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/system/build.xml 2007-08-14 15:48:44 UTC (rev 64576)
@@ -2,6 +2,7 @@
<!DOCTYPE project [
<!ENTITY buildmagic SYSTEM "../tools/etc/buildmagic/buildmagic.ent">
<!ENTITY libraries SYSTEM "../thirdparty/libraries.ent">
+ <!ENTITY modules SYSTEM "../tools/etc/buildmagic/modules.ent">
<!ENTITY targets SYSTEM "../tools/etc/buildmagic/targets.ent">
]>
@@ -81,8 +82,12 @@
<path refid="javassist.javassist.classpath"/>
</path>
+ &modules;
+
<!-- The combined dependant module classpath -->
<path id="dependentmodule.classpath">
+ <path refid="jboss.main.classpath"/>
+ <path refid="jboss.bootstrap.classpath"/>
</path>
<!-- ===== -->
@@ -97,9 +102,6 @@
org/jboss/deployment/IncompleteDeploymentException*,
org/jboss/deployment/Deployer*,
org/jboss/system/Service.class,
- org/jboss/system/server/ServerLoader*.class,
- org/jboss/system/server/Server.class,
- org/jboss/system/server/ServerConfig.class,
**/*MBean.class"
/>
@@ -123,8 +125,7 @@
description="Compile all source files."
depends="_default:compile-classes,
_default:compile-resources,
- _default:compile-etc,
- _default:compile-bin"/>
+ _default:compile-etc"/>
<!-- ================================================================== -->
<!-- Archives -->
@@ -137,23 +138,6 @@
| Build all jar files.
-->
<target name="module-jars" >
-
- <!--
- | Build log4j-boot.jar This is a minimal subset of the log4j
- | classes that allow the boot process to use log4j but avoids
- | loading log4j classes that depend on other features like
- | JMS, JDBC, JavaMail, etc.
- -->
-
- <jar jarfile="${build.lib}/log4j-boot.jar">
- <zipfileset src="${apache.log4j.lib}/log4j.jar">
- <include name="org/apache/log4j/*"/>
- <include name="org/apache/log4j/config/*"/>
- <include name="org/apache/log4j/helpers/*"/>
- <include name="org/apache/log4j/or/*"/>
- <include name="org/apache/log4j/spi/*"/>
- </zipfileset>
- </jar>
<!-- -->
<jar jarfile="${build.lib}/jboss-system.jar" manifest="${build.etc}/default.mf">
@@ -166,64 +150,7 @@
<jar jarfile="${build.lib}/${jar.client.name}" manifest="${build.etc}/default.mf">
<fileset dir="${build.classes}" includes="${jar.client.includes}"/>
</jar>
-
- <!-- Build jboss-boot.jar -->
- <jar jarfile="${build.lib}/jboss-boot.jar" manifest="${build.etc}/default.mf">
- <fileset dir="${build.classes}">
- <include name="org/jboss/system/server/NoAnnotationURLClassLoader.class"/>
- <include name="org/jboss/system/server/ServerLoader*.class"/>
- <include name="org/jboss/system/server/Server.class"/>
- <include name="org/jboss/system/server/ServerConfig.class"/>
- </fileset>
- </jar>
- <!-- Build run.jar -->
- <jar jarfile="${build.lib}/run.jar" manifest="${build.etc}/run.mf">
- <fileset dir="${build.classes}">
- <include name="org/jboss/Version*.class"/>
- <include name="org/jboss/Main*.class"/>
- <include name="org/jboss/system/JBossRMIClassLoader.class"/>
- <include name="org/jboss/system/server/NoAnnotationURLClassLoader.class"/>
- <include name="org/jboss/system/server/ServerLoader*.class"/>
- <include name="org/jboss/system/server/Server.class"/>
- <include name="org/jboss/system/server/ServerConfig.class"/>
- <include name="org/jboss/system/server/ServerConfigUtil.class"/>
- <include name="org/jboss/system/server/jmx/*"/>
- <include name="org/jboss/system/ORBSingleton.class"/>
- </fileset>
- <fileset dir="${build.resources}">
- <include name="*.properties"/>
- <include name="jdklogger.xml"/>
- <include name="org/jboss/version.properties"/>
- </fileset>
-
- <!-- Include getopt -->
- <zipfileset src="${gnu.getopt.lib}/getopt.jar">
- <include name="**"/>
- </zipfileset>
- </jar>
-
- <!--
- | JBoss/Testsuite Support
- -->
-
- <!-- testsuite-support.jar -->
- <jar jarfile="${build.lib}/testsuite-support.jar" manifest="${build.etc}/default.mf">
- <fileset dir="${build.classes}">
- <include name="org/jboss/deployment/**"/>
- <include name="org/jboss/system/Service.class"/>
- <include name="org/jboss/system/ServiceMBean.class"/>
- <include name="org/jboss/system/*MBeanSupport.class"/>
- <include name="org/jboss/system/MBeanClassLoader*.class"/>
- <include name="org/jboss/system/UnifiedClassLoader*.class"/>
- <include name="org/jboss/system/ServiceLibraries*.class"/>
- <include name="org/jboss/system/server/*MBean.class"/>
- <include name="org/jboss/system/server/ServerConfigLocator.class"/>
- <include name="org/jboss/system/server/ServerConfig.class"/>
- <include name="org/jboss/system/server/Server.class"/>
- </fileset>
- </jar>
-
</target>
</project>
Deleted: trunk/system/src/etc/run.mf
===================================================================
--- trunk/system/src/etc/run.mf 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/system/src/etc/run.mf 2007-08-14 15:48:44 UTC (rev 64576)
@@ -1,12 +0,0 @@
-Manifest-Version: 1.0
-Created-By: @java.vm.version@ (@java.vm.vendor@)
-Specification-Title: @specification.title@
-Specification-Version: @specification.version@
-Specification-Vendor: @specification.vendor@
-Implementation-Title: @implementation.title@
-Implementation-URL: @implementation.url@
-Implementation-Version: @implementation.version@
-Implementation-Vendor: @implementation.vendor@
-Implementation-Vendor-Id: @implementation.vendor.id@
-Main-Class: org.jboss.Main
-Class-Path: ../client/getopt.jar
Deleted: trunk/system/src/main/org/jboss/Main.java
===================================================================
--- trunk/system/src/main/org/jboss/Main.java 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/system/src/main/org/jboss/Main.java 2007-08-14 15:48:44 UTC (rev 64576)
@@ -1,557 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss;
-
-import gnu.getopt.Getopt;
-import gnu.getopt.LongOpt;
-
-import java.io.File;
-import java.io.FilenameFilter;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLDecoder;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Properties;
-
-import org.jboss.system.server.Server;
-import org.jboss.system.server.ServerConfig;
-import org.jboss.system.server.ServerConfigUtil;
-import org.jboss.system.server.ServerLoader;
-
-/**
- * Provides a command line interface to start the JBoss server.
- *
- * <p>
- * To enable debug or trace messages durring boot change the Log4j
- * configuration to use either <tt>log4j-debug.properties</tt>
- * <tt>log4j-trace.properties</tt> by setting the system property
- * <tt>log4j.configuration</tt>:
- *
- * <pre>
- * ./run.sh -Dlog4j.configuration=log4j-debug.properties
- * </pre>
- * TODO: Should jdk logging be the default
- *
- * @author <a href="mailto:marc.fleury at jboss.org">Marc Fleury</a>
- * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @author <a href="mailto:adrian.brock at happeningtimes.com">Adrian Brock</a>
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class Main
-{
- /** EDU.oswego.cs.dl.util.concurrent */
- private String concurrentLib = "concurrent.jar";
-
- /** A URL for obtaining microkernel patches */
- private URL bootURL;
-
- /** Extra jars from the /lib location that are added to the start of the boot
- classpath. This can be used to override jboss /lib boot classes.
- */
- private List<String> bootLibraries = new LinkedList<String>();
-
- /** Extra libraries to load the server with .*/
- private List<String> extraLibraries = new LinkedList<String>();
-
- /** Extra classpath URLS to load the server with .*/
- private List<URL> extraClasspath = new LinkedList<URL>();
-
- /**
- * Server properties. This object holds all of the required
- * information to get the server up and running. Use System
- * properties for defaults.
- */
- private Properties props = new Properties(System.getProperties());
- /** The booted server instance */
- private Server server;
-
- /**
- * Explicit constructor.
- */
- public Main()
- {
- super();
- }
-
- /**
- * Access the booted server.
- * @return the Server instance.
- */
- public Server getServer()
- {
- return server;
- }
-
- /**
- * Boot up JBoss.
- *
- * @param args The command line arguments.
- *
- * @throws Exception Failed to boot.
- */
- public void boot(final String[] args) throws Exception
- {
- // First process the command line to pickup custom props/settings
- processCommandLine(args);
-
- // Auto set HOME_DIR to ../bin/run.jar if not set
- String homeDir = props.getProperty(ServerConfig.HOME_DIR);
- if (homeDir == null)
- {
- String path = Main.class.getProtectionDomain().getCodeSource().getLocation().getFile();
- /* The 1.4 JDK munges the code source file with URL encoding so run
- * this path through the decoder so that is JBoss starts in a path with
- * spaces we don't come crashing down.
- */
- path = URLDecoder.decode(path, "UTF-8");
- File runJar = new File(path);
- File homeFile = runJar.getParentFile().getParentFile();
- homeDir = homeFile.getCanonicalPath();
- }
- props.setProperty(ServerConfig.HOME_DIR, homeDir);
-
- // Setup HOME_URL too, ServerLoader needs this
- String homeURL = props.getProperty(ServerConfig.HOME_URL);
- if (homeURL == null)
- {
- File file = new File(homeDir);
- homeURL = file.toURL().toString();
- props.setProperty(ServerConfig.HOME_URL, homeURL);
- }
-
- // Load the server instance
- ServerLoader loader = new ServerLoader(props);
-
- /* If there is a patch dir specified make it the first element of the
- loader bootstrap classpath. If its a file url pointing to a dir, then
- add the dir and its contents.
- */
- if (bootURL != null)
- {
- if (bootURL.getProtocol().equals("file"))
- {
- File dir = new File(bootURL.getFile());
- if (dir.exists())
- {
- // Add the local file patch directory
- loader.addURL(dir.toURL());
-
- // Add the contents of the directory too
- File[] jars = dir.listFiles(new JarFilter());
-
- for (int j = 0; jars != null && j < jars.length; j++)
- {
- loader.addURL(jars[j].getCanonicalFile().toURL());
- }
- }
- }
- else
- {
- loader.addURL(bootURL);
- }
- }
-
- // Add any extra libraries
- for (int i = 0; i < bootLibraries.size(); i++)
- {
- loader.addLibrary(bootLibraries.get(i));
- }
-
- // Add the jars from the endorsed dir
- loader.addEndorsedJars();
-
- // Add jmx libs
- //loader.addLibraries(jmxLibs);
-
- // jmx UnifiedLoaderRepository needs a concurrent class...
- loader.addLibrary(concurrentLib);
-
- // Add any extra libraries after the boot libs
- for (int i = 0; i < extraLibraries.size(); i++)
- {
- loader.addLibrary(extraLibraries.get(i));
- }
-
- // Add any extra classapth URLs
- for (int i = 0; i < extraClasspath.size(); i++)
- {
- loader.addURL(extraClasspath.get(i));
- }
-
- // Load the server
- ClassLoader parentCL = Thread.currentThread().getContextClassLoader();
- server = loader.load(parentCL);
-
- // Initialize the server
- server.init(props);
-
- // Start 'er up mate!
- server.start();
- }
-
- /**
- * Shutdown the booted Server instance.
- *
- */
- public void shutdown()
- {
- server.shutdown();
- }
-
- private URL makeURL(String urlspec) throws MalformedURLException
- {
- urlspec = urlspec.trim();
-
- URL url;
-
- try
- {
- url = new URL(urlspec);
- if (url.getProtocol().equals("file"))
- {
- // make sure the file is absolute & canonical file url
- File file = new File(url.getFile()).getCanonicalFile();
- url = file.toURL();
- }
- }
- catch (Exception e)
- {
- // make sure we have a absolute & canonical file url
- try
- {
- File file = new File(urlspec).getCanonicalFile();
- url = file.toURL();
- }
- catch (Exception n)
- {
- throw new MalformedURLException(n.toString());
- }
- }
-
- return url;
- }
-
- /** Process the command line... */
- private void processCommandLine(final String[] args) throws Exception
- {
- // set this from a system property or default to jboss
- String programName = System.getProperty("program.name", "jboss");
- String sopts = "-:hD:d:p:n:c:Vj::B:L:C:P:b:g:u:m:l:";
- LongOpt[] lopts =
- {
- new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'h'),
- new LongOpt("bootdir", LongOpt.REQUIRED_ARGUMENT, null, 'd'),
- new LongOpt("patchdir", LongOpt.REQUIRED_ARGUMENT, null, 'p'),
- new LongOpt("netboot", LongOpt.REQUIRED_ARGUMENT, null, 'n'),
- new LongOpt("configuration", LongOpt.REQUIRED_ARGUMENT, null, 'c'),
- new LongOpt("version", LongOpt.NO_ARGUMENT, null, 'V'),
- new LongOpt("jaxp", LongOpt.REQUIRED_ARGUMENT, null, 'j'),
- new LongOpt("bootlib", LongOpt.REQUIRED_ARGUMENT, null, 'B'),
- new LongOpt("library", LongOpt.REQUIRED_ARGUMENT, null, 'L'),
- new LongOpt("classpath", LongOpt.REQUIRED_ARGUMENT, null, 'C'),
- new LongOpt("properties", LongOpt.REQUIRED_ARGUMENT, null, 'P'),
- new LongOpt("host", LongOpt.REQUIRED_ARGUMENT, null, 'b'),
- new LongOpt("partition", LongOpt.REQUIRED_ARGUMENT, null, 'g'),
- new LongOpt("udp", LongOpt.REQUIRED_ARGUMENT, null, 'u'),
- new LongOpt("mcast_port", LongOpt.REQUIRED_ARGUMENT, null, 'm'),
- new LongOpt("log", LongOpt.REQUIRED_ARGUMENT, null, 'l'),
- };
-
- Getopt getopt = new Getopt(programName, args, sopts, lopts);
- int code;
- String arg;
- props.setProperty(ServerConfig.SERVER_BIND_ADDRESS, "0.0.0.0");
- System.setProperty(ServerConfig.SERVER_BIND_ADDRESS, "0.0.0.0");
- while ((code = getopt.getopt()) != -1)
- {
- switch (code)
- {
- case ':':
- case '?':
- // for now both of these should exit with error status
- System.exit(1);
- break; // for completeness
-
- case 1:
- // this will catch non-option arguments
- // (which we don't currently care about)
- System.err.println(programName +
- ": unused non-option argument: " +
- getopt.getOptarg());
- break; // for completeness
-
- case 'h':
- // show command line help
- System.out.println("usage: " + programName + " [options]");
- System.out.println();
- System.out.println("options:");
- System.out.println(" -h, --help Show this help message");
- System.out.println(" -V, --version Show version information");
- System.out.println(" -- Stop processing options");
- System.out.println(" -D<name>[=<value>] Set a system property");
- System.out.println(" -d, --bootdir=<dir> Set the boot patch directory; Must be absolute or url");
- System.out.println(" -p, --patchdir=<dir> Set the patch directory; Must be absolute or url");
- System.out.println(" -n, --netboot=<url> Boot from net with the given url as base");
- System.out.println(" -c, --configuration=<name> Set the server configuration name");
- System.out.println(" -B, --bootlib=<filename> Add an extra library to the front bootclasspath");
- System.out.println(" -L, --library=<filename> Add an extra library to the loaders classpath");
- System.out.println(" -C, --classpath=<url> Add an extra url to the loaders classpath");
- System.out.println(" -P, --properties=<url> Load system properties from the given url");
- System.out.println(" -b, --host=<host or ip> Bind address for all JBoss services");
- System.out.println(" -g, --partition=<name> HA Partition name (default=DefaultDomain)");
- System.out.println(" -m, --mcast_port=<ip> UDP multicast port; Only used by JGroups multiplexer");
- System.out.println(" -u, --udp=<ip> UDP multicast address");
- System.out.println(" -l, --log=<log4j|jdk> Specify the logger plugin type");
- System.out.println();
- System.exit(0);
- break; // for completeness
-
- case 'D':
- {
- // set a system property
- arg = getopt.getOptarg();
- String name, value;
- int i = arg.indexOf("=");
- if (i == -1)
- {
- name = arg;
- value = "true";
- }
- else
- {
- name = arg.substring(0, i);
- value = arg.substring(i + 1, arg.length());
- }
- System.setProperty(name, value);
- // Ensure setting the old bind.address property also sets the new
- // jgroups.bind_addr property, otherwise jgroups may ignore it
- if ("bind.address".equals(name))
- {
- // Wildcard address is not valid for JGroups
- String addr = ServerConfigUtil.fixRemoteAddress(value);
- System.setProperty("jgroups.bind_addr", addr);
- }
- break;
- }
-
- case 'd':
- // set the boot patch URL
- bootURL = makeURL(getopt.getOptarg());
- break;
-
- case 'p':
- {
- // set the patch URL
- URL patchURL = makeURL(getopt.getOptarg());
- props.put(ServerConfig.PATCH_URL, patchURL.toString());
-
- break;
- }
-
- case 'n':
- // set the net boot url
- arg = getopt.getOptarg();
-
- // make sure there is a trailing '/'
- if (!arg.endsWith("/")) arg += "/";
-
- props.put(ServerConfig.HOME_URL, new URL(arg).toString());
- break;
-
- case 'c':
- // set the server name
- arg = getopt.getOptarg();
- props.put(ServerConfig.SERVER_NAME, arg);
- break;
-
- case 'V':
- {
- // Package information for org.jboss
- Package jbossPackage = Package.getPackage("org.jboss");
-
- // show version information
- System.out.println("JBoss " + jbossPackage.getImplementationVersion());
- System.out.println();
- System.out.println("Distributable under LGPL license.");
- System.out.println("See terms of license at gnu.org.");
- System.out.println();
- System.exit(0);
- break; // for completness
- }
-
- case 'j':
- // Show an error and exit
- System.err.println(programName + ": option '-j, --jaxp' no longer supported");
- System.exit(1);
- break; // for completness
-
- case 'B':
- arg = getopt.getOptarg();
- bootLibraries.add(arg);
- break;
-
- case 'L':
- arg = getopt.getOptarg();
- extraLibraries.add(arg);
- break;
-
- case 'C':
- {
- URL url = makeURL(getopt.getOptarg());
- extraClasspath.add(url);
- break;
- }
-
- case 'P':
- {
- // Set system properties from url/file
- URL url = makeURL(getopt.getOptarg());
- Properties props = System.getProperties();
- props.load(url.openConnection().getInputStream());
- break;
- }
- case 'b':
- arg = getopt.getOptarg();
- props.put(ServerConfig.SERVER_BIND_ADDRESS, arg);
- System.setProperty(ServerConfig.SERVER_BIND_ADDRESS, arg);
- // used by JGroups; only set if not set via -D so users
- // can use a different interface for cluster communication
- // There are 2 versions of this property, deprecated bind.address
- // and the new version, jgroups.bind_addr
- String bindAddress = System.getProperty("bind.address");
- if (bindAddress == null)
- {
- // Wildcard address is not valid for JGroups
- bindAddress = ServerConfigUtil.fixRemoteAddress(arg);
- System.setProperty("bind.address", bindAddress);
- }
- bindAddress = System.getProperty("jgroups.bind_addr");
- if (bindAddress == null)
- {
- // Wildcard address is not valid for JGroups
- bindAddress = ServerConfigUtil.fixRemoteAddress(arg);
- System.setProperty("jgroups.bind_addr", bindAddress);
- }
-
- // Set the java.rmi.server.hostname if not set
- String rmiHost = System.getProperty("java.rmi.server.hostname");
- if( rmiHost == null )
- {
- rmiHost = ServerConfigUtil.fixRemoteAddress(arg);
- System.setProperty("java.rmi.server.hostname", rmiHost);
- }
- break;
- case 'g':
- arg = getopt.getOptarg();
- props.put(ServerConfig.PARTITION_NAME_PROPERTY, arg);
- System.setProperty(ServerConfig.PARTITION_NAME_PROPERTY, arg);
- break;
- case 'u':
- arg = getopt.getOptarg();
- props.put(ServerConfig.PARTITION_UDP_PROPERTY, arg);
- System.setProperty(ServerConfig.PARTITION_UDP_PROPERTY, arg);
- // the new jgroups property name
- System.setProperty("jgroups.udp.mcast_addr", arg);
- break;
- case 'm':
- arg = getopt.getOptarg();
- props.put(ServerConfig.PARTITION_UDP_PORT_PROPERTY, arg);
- System.setProperty(ServerConfig.PARTITION_UDP_PORT_PROPERTY, arg);
- break;
- case 'l':
- {
- arg = getopt.getOptarg();
- String logPlugin = arg;
- if( arg.equalsIgnoreCase("log4j") )
- logPlugin = "org.jboss.logging.Log4jLoggerPlugin";
- else if( arg.equalsIgnoreCase("jdk") )
- {
- logPlugin = "org.jboss.logging.JDK14LoggerPlugin";
- // Also override the jdk LogManager
- System.setProperty("java.util.logging.manager",
- "org.jboss.logging.jdk.JDKLogManager");
- }
- System.setProperty("org.jboss.logging.Logger.pluginClass", logPlugin);
- break;
- }
- default:
- // this should not happen,
- // if it does throw an error so we know about it
- throw new Error("unhandled option code: " + code);
- }
- }
- }
-
- /**
- * This is where the magic begins.
- *
- * <P>Starts up inside of a "jboss" thread group to allow better
- * identification of JBoss threads.
- *
- * @param args The command line arguments.
- * @throws Exception for any error
- */
- public static void main(final String[] args) throws Exception
- {
- Runnable worker = new Runnable() {
- public void run()
- {
- try
- {
- Main main = new Main();
- main.boot(args);
- }
- catch (Exception e)
- {
- System.err.println("Failed to boot JBoss:");
- e.printStackTrace();
- }
- }
-
- };
-
- ThreadGroup threads = new ThreadGroup("jboss");
- new Thread(threads, worker, "main").start();
- }
-
- /**
- * This method is here so that if JBoss is running under
- * Alexandria (An NT Service Installer), Alexandria can shutdown
- * the system down correctly.
- *
- * @param argv the arguments
- */
- public static void systemExit(String argv[])
- {
- System.exit(0);
- }
-
- static class JarFilter implements FilenameFilter
- {
- public boolean accept(File dir, String name)
- {
- return name.endsWith(".jar");
- }
- }
-}
\ No newline at end of file
Deleted: trunk/system/src/main/org/jboss/Version.java
===================================================================
--- trunk/system/src/main/org/jboss/Version.java 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/system/src/main/org/jboss/Version.java 2007-08-14 15:48:44 UTC (rev 64576)
@@ -1,303 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import java.util.Collections;
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * Provides access to JBoss version (and build) properties.
- *
- * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @author Scott.Stark at jboss.org
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @version $Revision$
- */
-public final class Version
-{
- public final static String VERSION_MAJOR = "version.major";
- public final static String VERSION_MINOR = "version.minor";
- public final static String VERSION_REVISION = "version.revision";
- public final static String VERSION_TAG = "version.tag";
- public final static String VERSION_NAME = "version.name";
- public final static String VERSION_CVSTAG = "version.cvstag";
-
- public final static String BUILD_NUMBER = "build.number";
- public final static String BUILD_ID = "build.id";
- public final static String BUILD_DATE = "build.day";
- public final static String BUILD_JVM_VERSION = "java.vm.version";
- public final static String BUILD_JVM_VENDOR = "java.vendor";
- public final static String BUILD_OS = "os.name";
- public final static String BUILD_OS_ARCH = "os.arch";
- public final static String BUILD_OS_VERSION = "os.version";
-
- /**
- * The single instance.
- */
- private static Version instance = null;
-
- /**
- * The version properties.
- */
- private Properties props;
-
- /**
- * Do not allow direct public construction.
- */
- private Version()
- {
- props = loadProperties();
- }
-
- /**
- * Get the single <tt>Version</tt> instance.
- *
- * @return The single <tt>Version</tt> instance.
- */
- public static Version getInstance()
- {
- if (instance == null)
- {
- instance = new Version();
- }
- return instance;
- }
-
- /**
- * Returns an unmodifiable map of version properties.
- *
- * @return An unmodifiable map of version properties.
- */
- public Map getProperties()
- {
- return Collections.unmodifiableMap(props);
- }
-
- /**
- * Returns the value for the given property name.
- *
- * @param name - The name of the property.
- * @return The property value or null if the property is not set.
- */
- public String getProperty(final String name)
- {
- return props.getProperty(name);
- }
-
- /**
- * Returns the major number of the version.
- *
- * @return The major number of the version.
- */
- public int getMajor()
- {
- return getIntProperty(VERSION_MAJOR);
- }
-
- /**
- * Returns the minor number of the version.
- *
- * @return The minor number of the version.
- */
- public int getMinor()
- {
- return getIntProperty(VERSION_MINOR);
- }
-
- /**
- * Returns the revision number of the version.
- *
- * @return The revision number of the version.
- */
- public int getRevision()
- {
- return getIntProperty(VERSION_REVISION);
- }
-
- /**
- * Returns the tag of the version.
- *
- * @return The tag of the version.
- */
- public String getTag()
- {
- return props.getProperty(VERSION_TAG);
- }
- /**
- * Returns the CVS tag of the version.
- *
- * @return The CVS tag of the version.
- */
- public String getCvsTag()
- {
- return props.getProperty(VERSION_CVSTAG);
- }
-
- /**
- * Returns the name number of the version.
- *
- * @return The name of the version.
- */
- public String getName()
- {
- return props.getProperty(VERSION_NAME);
- }
-
- /**
- * Returns the build identifier for this version.
- *
- * @return The build identifier for this version.
- */
- public String getBuildID()
- {
- return props.getProperty(BUILD_ID);
- }
-
- /**
- * Returns the build number for this version.
- *
- * @return The build number for this version.
- */
- public String getBuildNumber()
- {
- return props.getProperty(BUILD_NUMBER);
- }
-
- /**
- * Returns the build date for this version.
- *
- * @return The build date for this version.
- */
- public String getBuildDate()
- {
- return props.getProperty(BUILD_DATE);
- }
-
- /** Returns the BUILD_JVM_VERSION (BUILD_JVM_VENDOR) which should look like:
- * 1.4.2_05-b04 (Sun Microsystems Inc.)
- * @return the jvm
- */
- public String getBuildJVM()
- {
- String vm = props.getProperty(BUILD_JVM_VERSION);
- String vendor = props.getProperty(BUILD_JVM_VENDOR);
- return vm + '(' + vendor + ')';
- }
-
- /** Returns the BUILD_OS (BUILD_OS_ARCH,BUILD_OS_VERSION) which should look
- * like:
- * Windows XP (x86,5.1)
- * Linux (i386,2.4.21-4.ELsmp)
- * @return the OS
- */
- public String getBuildOS()
- {
- String os = props.getProperty(BUILD_OS);
- String arch = props.getProperty(BUILD_OS_ARCH);
- String version = props.getProperty(BUILD_OS_VERSION);
- return os + '(' + arch +',' + version + ')';
- }
-
- /**
- * Returns the full version number, e.g. 5.0.0.GA
- *
- * @return The full version number as string
- */
- public String getVersionNumber()
- {
- StringBuffer buff = new StringBuffer();
-
- buff.append(getMajor()).append(".");
- buff.append(getMinor()).append(".");
- buff.append(getRevision()).append(".");
- buff.append(getTag());
-
- return buff.toString();
- }
-
- /**
- * Returns the version information as a string.
- *
- * @return Basic information as a string.
- */
- public String toString()
- {
- StringBuffer buff = new StringBuffer();
-
- buff.append(getVersionNumber());
- buff.append(" (build: SVNTag=");
- buff.append(getCvsTag());
- buff.append(" date=");
- buff.append(getBuildID());
- buff.append(")");
-
- return buff.toString();
- }
-
- /**
- * Returns a property value as an int.
- *
- * @param name - The name of the property.
- * @return The property value, or -1 if there was a problem converting
- * it to an int.
- */
- private int getIntProperty(final String name)
- {
- try
- {
- return Integer.valueOf(props.getProperty(name)).intValue();
- }
- catch (Exception e)
- {
- return -1;
- }
- }
-
- /**
- * Load the version properties from a resource.
- */
- private Properties loadProperties()
- {
- props = new Properties();
-
- try
- {
- InputStream in =
- Version.class.getResourceAsStream("/org/jboss/version.properties");
- if( in != null )
- {
- props.load(in);
- in.close();
- }
- }
- catch (IOException e)
- {
- throw new Error("Missing version.properties");
- }
-
- return props;
- }
-}
Deleted: trunk/system/src/main/org/jboss/system/JBossRMIClassLoader.java
===================================================================
--- trunk/system/src/main/org/jboss/system/JBossRMIClassLoader.java 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/system/src/main/org/jboss/system/JBossRMIClassLoader.java 2007-08-14 15:48:44 UTC (rev 64576)
@@ -1,121 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.system;
-
-import java.net.MalformedURLException;
-
-import java.rmi.server.RMIClassLoader;
-import java.rmi.server.RMIClassLoaderSpi;
-
-/**
- * An implementation of RMIClassLoaderSpi to workaround the
- * proxy ClassCastException problem in 1.4<p>
- *
- * <b>THIS IS A HACK!</b><p>
- *
- * Sun's implementation uses the caller classloader when
- * unmarshalling proxies. This is effectively jboss.jar since
- * that is where JRMPInvokerProxy lives. On a redeploy the
- * new interfaces are ignored because a proxy is already cached
- * against the classloader.<p>
- *
- * Another redeployment problem is that the getClassAnnotation(String)
- * will end up using the old deployment class loader and this can result
- * in NPEs do the class loader being destroyed.
- *
- * This class ignores Sun's guess at a suitable classloader and
- * uses the thread context classloader instead.<p>
- *
- * It has to exist in the system classloader so I have included it
- * in "system" for inclusion in run.jar<p>
- *
- * @author <a href="mailto:adrian.brock at happeningtimes.com">Adrian Brock</a>
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class JBossRMIClassLoader
- extends RMIClassLoaderSpi
-{
- // Attributes ----------------------------------------------------
-
- /**
- * The JVM implementation (we delegate most work to it)
- */
- RMIClassLoaderSpi delegate = RMIClassLoader.getDefaultProviderInstance();
-
- // Constructors --------------------------------------------------
-
- /**
- * Required constructor
- */
- public JBossRMIClassLoader()
- {
- }
-
- // RMIClassLoaderSpi Implementation ------------------------------
-
- /**
- * Ignore the JVM, use the thread context classloader for proxy caching
- */
- public Class<?> loadProxyClass(String codebase, String[] interfaces, ClassLoader ignored)
- throws MalformedURLException, ClassNotFoundException
- {
- return delegate.loadProxyClass(codebase, interfaces, Thread.currentThread().getContextClassLoader());
- }
-
- /**
- * Just delegate
- */
- public Class<?> loadClass(String codebase, String name, ClassLoader ignored)
- throws MalformedURLException, ClassNotFoundException
- {
- return delegate.loadClass(codebase, name, Thread.currentThread().getContextClassLoader());
- }
-
- /**
- * Just delegate
- */
- public ClassLoader getClassLoader(String codebase)
- throws MalformedURLException
- {
- return delegate.getClassLoader(codebase);
- }
-
- /**
- * Try to delegate an default to the java.rmi.server.codebase on any
- * failure.
- */
- public String getClassAnnotation(Class cl)
- {
- String annotation = null;
- try
- {
- annotation = delegate.getClassAnnotation(cl);
- }
- catch(Throwable t)
- {
- // Try the java.rmi.server.codebase property
- annotation = System.getProperty("java.rmi.server.codebase");
- }
- return annotation;
- }
-}
Deleted: trunk/system/src/main/org/jboss/system/ORBSingleton.java
===================================================================
--- trunk/system/src/main/org/jboss/system/ORBSingleton.java 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/system/src/main/org/jboss/system/ORBSingleton.java 2007-08-14 15:48:44 UTC (rev 64576)
@@ -1,360 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.system;
-
-import java.util.Properties;
-import org.omg.CORBA.Any;
-import org.omg.CORBA.Context;
-import org.omg.CORBA.ContextList;
-import org.omg.CORBA.Current;
-import org.omg.CORBA.Environment;
-import org.omg.CORBA.ExceptionList;
-import org.omg.CORBA.INITIALIZE;
-import org.omg.CORBA.NamedValue;
-import org.omg.CORBA.NO_IMPLEMENT;
-import org.omg.CORBA.NVList;
-import org.omg.CORBA.ORBPackage.InvalidName;
-import org.omg.CORBA.Request;
-import org.omg.CORBA.StructMember;
-import org.omg.CORBA.TCKind;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.UnionMember;
-import org.omg.CORBA.ValueMember;
-import org.omg.CORBA_2_3.ORB;
-
-/**
- * Thin wrapper class that fulfills the contract of an ORB singleton and
- * forwards every invocation to an instance of the actual ORB singleton class,
- * which it loads with the context classloader. The name of the actual ORB
- * singleton class is specified by the system property
- * <code>org.jboss.ORBSingletonDelegate</code>.
- * <p>
- * This class is a workaround to the the following problem: unlike the Sun VMs,
- * IBM VMs do not use the context classloader to load the ORB singleton class
- * specified by the system property
- * <code>org.omg.CORBA.ORBSingletonClass</code>. IBM VMs use the
- * system classloader, thus requiring the ORB singleton class to be in
- * the system classpath. Rather than adding a third-party jar file (e.g.
- * jacorb.jar) to the system classpath, we include this class in run.jar.
- * Instead of setting the system property
- * <pre>
- * org.omg.CORBA.ORBSingletonClass=some.orb.impl.ORBSingletonImpl
- * </pre>
- * we set two properties:
- * <pre>
- * org.omg.CORBA.ORBSingletonClass=org.jboss.system.ORBSingleton
- * org.jboss.ORBSingletonDelegate=some.orb.impl.ORBSingletonImpl
- * </pre>
- * <p>
- * This class should be removed when IBM fixes its VMs.
- *
- * @author <a href="mailto:reverbel at ime.usp.br">Francisco Reverbel</a>
- * @version $Revision$
- */
-public class ORBSingleton extends ORB
-{
- /** System property key that specifies the actual ORB singleton class. */
- public static String DELEGATE_CLASS_KEY = "org.jboss.ORBSingletonDelegate";
-
- /** The ORB singleton instance to which all invocations are forwarded. */
- private static ORB delegate = null;
-
- /**
- * The ORBSingleton constructor does what the IBM VM does not do: it uses
- * the context classloader to load the actual ORB singleton class.
- */
- public ORBSingleton()
- {
- if (delegate == null)
- {
- String className = System.getProperty(DELEGATE_CLASS_KEY);
- if (className == null)
- className = "org.jacorb.orb.ORBSingleton";
- try
- {
- delegate = (ORB)Class.forName(className).newInstance();
- }
- catch (ClassNotFoundException ex)
- {
- }
- catch (Exception ex) {
- throw new INITIALIZE(
- "can't instantiate ORBSingleton implementation " + className);
- }
-
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- if (cl == null)
- cl = ClassLoader.getSystemClassLoader();
- try
- {
- delegate = (ORB)Class.forName(className, true, cl).newInstance();
- }
- catch (Exception ex)
- {
- throw new INITIALIZE(
- "can't instantiate ORBSingleton implementation " + className);
- }
- }
- }
-
- // All the rest is pretty dumb code: it implements all the methods of the
- // class org.omg.CORBA.ORB, either forwarding the invocation to the
- // delegate (methods that may be called on the restricted singleton ORB
- // instance) or throwing an exception (methods that may not be called on
- // the restricted singleton ORB instance).
-
- public Any create_any()
- {
- return delegate.create_any();
- }
-
- public TypeCode create_alias_tc(String id,
- String name,
- TypeCode original_type)
- {
- return delegate.create_alias_tc(id, name, original_type);
- }
-
- public TypeCode create_array_tc(int length, TypeCode element_type)
- {
- return delegate.create_array_tc(length, element_type);
- }
-
- public TypeCode create_enum_tc(String id, String name, String[] members)
- {
- return delegate.create_enum_tc(id, name, members);
- }
-
- public TypeCode create_exception_tc(String id,
- String name,
- StructMember[] members)
- {
- return delegate.create_exception_tc(id, name, members);
- }
-
- public TypeCode create_interface_tc(String id, String name)
- {
- return delegate.create_interface_tc(id, name);
- }
-
- public TypeCode create_fixed_tc(short digits, short scale)
- {
- return delegate.create_fixed_tc(digits, scale);
- }
-
- public TypeCode create_recursive_tc(String id)
- {
- return delegate.create_recursive_tc(id);
- }
-
- /**
- * @deprecated Deprecated by CORBA 2.3.
- */
- public TypeCode create_recursive_sequence_tc(int bound, int offset)
- {
- throw new NO_IMPLEMENT("deprecated by CORBA 2.3");
- }
-
- public TypeCode create_sequence_tc(int bound, TypeCode element_type)
- {
- return delegate.create_sequence_tc(bound, element_type);
- }
-
- public TypeCode create_string_tc(int bound)
- {
- return delegate.create_string_tc(bound);
- }
-
- public TypeCode create_wstring_tc(int bound)
- {
- return delegate.create_wstring_tc(bound);
- }
-
- public TypeCode create_struct_tc(String id,
- String name,
- StructMember[] members)
- {
- return delegate.create_struct_tc(id, name, members);
- }
-
- public TypeCode create_union_tc(String id,
- String name,
- TypeCode discriminator_type,
- UnionMember[] members)
- {
- return delegate.create_union_tc(id, name,
- discriminator_type, members);
- }
-
- public TypeCode get_primitive_tc(TCKind tcKind)
- {
- return delegate.get_primitive_tc(tcKind);
- }
-
- public TypeCode create_value_tc(String id,
- String name,
- short type_modifier,
- TypeCode concrete_base,
- ValueMember[] members)
- {
- return delegate.create_value_tc(id, name, type_modifier,
- concrete_base, members);
- }
-
- public TypeCode create_value_box_tc(String id,
- String name,
- TypeCode boxed_type)
- {
- return delegate.create_value_box_tc(id, name, boxed_type);
- }
-
- public TypeCode create_abstract_interface_tc(String id, String name)
- {
- return delegate.create_abstract_interface_tc(id, name);
- }
-
- public TypeCode create_native_tc(String id, String name)
- {
- return delegate.create_native_tc(id, name);
- }
-
- /* Methods not allowed on the singleton ORB: */
-
- public ExceptionList create_exception_list()
- {
- throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
- }
-
- public NVList create_list(int count)
- {
- throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
- }
-
- public NamedValue create_named_value(String name, Any value, int flags)
- {
- throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
- }
-
- public NVList create_operation_list(org.omg.CORBA.Object obj)
- {
- throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
- }
-
- public org.omg.CORBA.Object string_to_object(String str)
- {
- throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
- }
-
- public Environment create_environment()
- {
- throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
- }
-
- public ContextList create_context_list()
- {
- throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
- }
-
- public org.omg.CORBA.portable.OutputStream create_output_stream()
- {
- throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
- }
-
- /**
- * @deprecated Deprecated by CORBA 2.3.
- */
- public Current get_current()
- {
- throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
- }
-
- public Context get_default_context()
- {
- throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
- }
-
- public Request get_next_response()
- {
- throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
- }
-
- public String[] list_initial_services()
- {
- throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
- }
-
- public String object_to_string(org.omg.CORBA.Object obj)
- {
- throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
- }
-
- public boolean poll_next_response()
- {
- throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
- }
-
- public org.omg.CORBA.Object resolve_initial_references(String identifier)
- throws InvalidName
- {
- throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
- }
-
- public void send_multiple_requests_deferred(Request[] req)
- {
- throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
- }
-
- public void send_multiple_requests_oneway(Request[] req)
- {
- throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
- }
-
- protected void set_parameters(String[] args, Properties props)
- {
- throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
- }
-
- protected void set_parameters(java.applet.Applet app, Properties props)
- {
- throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
- }
-
- public void run()
- {
- throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
- }
-
- public void shutdown(boolean wait_for_completion)
- {
- throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
- }
-
- public boolean work_pending()
- {
- throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
- }
-
- public void perform_work()
- {
- throw new NO_IMPLEMENT("The Singleton ORB only permits factory methods");
- }
-}
Deleted: trunk/system/src/main/org/jboss/system/server/BaseServerConfig.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/BaseServerConfig.java 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/system/src/main/org/jboss/system/server/BaseServerConfig.java 2007-08-14 15:48:44 UTC (rev 64576)
@@ -1,641 +0,0 @@
-/* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.system.server;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Properties;
-
-import org.jboss.util.NestedRuntimeException;
-import org.jboss.util.Null;
-import org.jboss.util.Primitives;
-import org.jboss.util.platform.Java;
-
-/**
- * A container for the basic configuration elements required to create
- * a Server instance.
- *
- * <p>MalformedURLException are rethrown as NestedRuntimeExceptions, so that
- * code that needs to access these values does not have to directly
- * worry about problems with lazy construction of final URL values.
- *
- * <p>Most values are determined durring first call to getter. All values
- * when determined will have equivilent system properties set.
- *
- * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @author Scott.Stark at jboss.org
- * @version <tt>$Revision: 41281 $</tt>
- */
-
-
-public class BaseServerConfig
- implements ServerConfig
-{
- /** The configuration properties to pull data from. */
- private Properties props;
-
- private File homeDir;
- private URL homeURL;
- private URL libraryURL;
-
- /**
- * The base URL where patch files will be loaded from. This is
- * typed as an Object to allow its value to contain Null.VALUE
- * or a URL. If value is Null.VALUE then we have determined
- * that there is no user configuration for this value and it will
- * be passed back as null to the requesting client.
- */
- private Object patchURL;
-
- private String serverSpecificationVersion;
-
- private String serverName;
- private File serverBaseDir;
- private File serverHomeDir;
- private File serverLogDir;
- private File serverTempDir;
- private File serverDataDir;
- private URL serverBaseURL;
- private URL serverHomeURL;
- private URL serverLibraryURL;
- private URL serverConfigURL;
-
- /** Exit on shutdown flag. */
- private Boolean exitOnShutdown;
- private Boolean blockingShutdown;
- private Boolean requireJBossURLStreamHandlerFactory;
- private Boolean platformMBeanServer;
-
- private String rootDeployableFilename;
-
- /**
- * Construct a new <tt>ServerConfigImpl</tt> instance.
- *
- * @param props Configuration properties.
- *
- * @throws Exception Missing or invalid configuration.
- */
- public BaseServerConfig(final Properties props) throws Exception
- {
- this.props = props;
-
- // Must have HOME_DIR
- homeDir = getFile(ServerConfig.HOME_DIR);
- if (homeDir == null)
- throw new Exception("Missing configuration value for: " + ServerConfig.HOME_DIR);
- System.setProperty(ServerConfig.HOME_DIR, homeDir.toString());
- // Setup the SERVER_HOME_DIR system property
- getServerHomeDir();
-
- Package thisPackage = getClass().getPackage();
- serverSpecificationVersion = thisPackage.getSpecificationVersion();
- }
-
- /** Breakout the initialization of URLs from the constructor as we need
- * the ServerConfig.HOME_DIR set for log setup, but we cannot create any
- * file URLs prior to the
- *
- * @throws MalformedURLException for a bad home url
- */
- public void initURLs()
- throws MalformedURLException
- {
- // If not set then default to homeDir
- homeURL = getURL(ServerConfig.HOME_URL);
- if (homeURL == null)
- homeURL = homeDir.toURL();
- System.setProperty(ServerConfig.HOME_URL, homeURL.toString());
- }
-
- /////////////////////////////////////////////////////////////////////////
- // Typed Access //
- /////////////////////////////////////////////////////////////////////////
-
- /**
- * Get the local home directory which the server is running from.
- */
- public File getHomeDir()
- {
- return homeDir;
- }
-
- /**
- * Get the home URL which the server is running from.
- */
- public URL getHomeURL()
- {
- return homeURL;
- }
-
- /**
- * Get the home URL which the server is running from.
- */
- public URL getLibraryURL()
- {
- if (libraryURL == null)
- {
- try
- {
- libraryURL = getURL(ServerConfig.LIBRARY_URL);
- if (libraryURL == null)
- {
- libraryURL = new URL(homeURL, ServerConfig.LIBRARY_URL_SUFFIX);
- }
- System.setProperty(ServerConfig.LIBRARY_URL, libraryURL.toString());
- }
- catch (MalformedURLException e)
- {
- throw new NestedRuntimeException(e);
- }
- }
- return libraryURL;
- }
-
- /**
- * Get the patch URL for the server.
- */
- public URL getPatchURL()
- {
- if (patchURL == null)
- {
- try
- {
- patchURL = getURL(ServerConfig.PATCH_URL);
- if (patchURL == null)
- {
- patchURL = Null.VALUE;
- }
- else
- {
- System.setProperty(ServerConfig.PATCH_URL, patchURL.toString());
- }
- }
- catch (MalformedURLException e)
- {
- throw new NestedRuntimeException(e);
- }
- }
-
- if (patchURL == Null.VALUE)
- return null;
-
- return (URL) patchURL;
- }
-
- /**
- * Get the name of the server.
- */
- public String getServerName()
- {
- if (serverName == null)
- {
- serverName = props.getProperty(ServerConfig.SERVER_NAME, ServerConfig.DEFAULT_SERVER_NAME);
- System.setProperty(ServerConfig.SERVER_NAME, serverName);
- }
- return serverName;
- }
-
- /**
- * Get the base directory for calculating server home directories.
- */
- public File getServerBaseDir()
- {
- if (serverBaseDir == null)
- {
- serverBaseDir = getFile(ServerConfig.SERVER_BASE_DIR);
- if (serverBaseDir == null)
- {
- serverBaseDir = new File(homeDir, ServerConfig.SERVER_BASE_DIR_SUFFIX);
- System.setProperty(ServerConfig.SERVER_BASE_DIR, serverBaseDir.toString());
- }
- }
- return serverBaseDir;
- }
-
- /**
- * Get the server home directory.
- */
- public File getServerHomeDir()
- {
- if (serverHomeDir == null)
- {
- serverHomeDir = getFile(ServerConfig.SERVER_HOME_DIR);
- if (serverHomeDir == null)
- {
- serverHomeDir = new File(getServerBaseDir(), getServerName());
- System.setProperty(ServerConfig.SERVER_HOME_DIR, serverHomeDir.toString());
- }
- }
- return serverHomeDir;
- }
-
- /**
- * Get the directory where temporary files will be stored. The associated
- * ServerConfig.SERVER_LOG_DIR system property needs to be set before
- * the logging framework is used.
- *
- * @see ServerConfig#SERVER_LOG_DIR
- * @return the writable temp directory
- */
- public File getServerLogDir()
- {
- if (serverLogDir == null)
- {
- serverLogDir = getFile(ServerConfig.SERVER_LOG_DIR);
- if (serverLogDir == null)
- {
- serverLogDir = new File(getServerHomeDir(), ServerConfig.SERVER_LOG_DIR_SUFFIX);
- System.setProperty(ServerConfig.SERVER_LOG_DIR, serverLogDir.toString());
- }
- }
- return serverLogDir;
- }
-
- /**
- * Get the directory where temporary files will be stored.
- *
- * @return the writable temp directory
- */
- public File getServerTempDir()
- {
- if (serverTempDir == null)
- {
- serverTempDir = getFile(ServerConfig.SERVER_TEMP_DIR);
- if (serverTempDir == null)
- {
- serverTempDir = new File(getServerHomeDir(), ServerConfig.SERVER_TEMP_DIR_SUFFIX);
- System.setProperty(ServerConfig.SERVER_TEMP_DIR, serverTempDir.toString());
- }
- }
- return serverTempDir;
- }
-
- /**
- * Get the directory where local data will be stored.
- *
- * @return the data directory
- */
- public File getServerDataDir()
- {
- if (serverDataDir == null)
- {
- serverDataDir = getFile(ServerConfig.SERVER_DATA_DIR);
- if (serverDataDir == null)
- {
- serverDataDir = new File(getServerHomeDir(), ServerConfig.SERVER_DATA_DIR_SUFFIX);
- System.setProperty(ServerConfig.SERVER_DATA_DIR, serverDataDir.toString());
- }
- }
- return serverDataDir;
- }
-
- /**
- * Get the native dir for unpacking
- *
- * @return the directory
- */
- public File getServerNativeDir()
- {
- String fileName = System.getProperty(NATIVE_DIR_PROPERTY);
- if (fileName != null)
- return new File(fileName);
- return new File(getServerTempDir(), "native");
- }
-
- /**
- * Get the temporary deployment dir for unpacking
- *
- * @return the directory
- */
- public File getServerTempDeployDir()
- {
- return new File(getServerTempDir(), "deploy");
- }
-
- /**
- * Get the base directory for calculating server home URLs.
- */
- public URL getServerBaseURL()
- {
- if (serverBaseURL == null)
- {
- try
- {
- serverBaseURL = getURL(ServerConfig.SERVER_BASE_URL);
- if (serverBaseURL == null)
- {
- serverBaseURL = new URL(homeURL, ServerConfig.SERVER_BASE_URL_SUFFIX);
- }
- System.setProperty(ServerConfig.SERVER_BASE_URL, serverBaseURL.toString());
- }
- catch (MalformedURLException e)
- {
- throw new NestedRuntimeException(e);
- }
- }
- return serverBaseURL;
- }
-
- /**
- * Get the server home URL.
- */
- public URL getServerHomeURL()
- {
- if (serverHomeURL == null)
- {
- try
- {
- serverHomeURL = getURL(ServerConfig.SERVER_HOME_URL);
- if (serverHomeURL == null)
- {
- serverHomeURL = new URL(getServerBaseURL(), getServerName() + "/");
- }
- System.setProperty(ServerConfig.SERVER_HOME_URL, serverHomeURL.toString());
- }
- catch (MalformedURLException e)
- {
- throw new NestedRuntimeException(e);
- }
- }
- return serverHomeURL;
- }
-
- /**
- * Get the server library URL.
- */
- public URL getServerLibraryURL()
- {
- if (serverLibraryURL == null)
- {
- try
- {
- serverLibraryURL = getURL(ServerConfig.SERVER_LIBRARY_URL);
- if (serverLibraryURL == null)
- {
- serverLibraryURL = new URL(getServerHomeURL(), ServerConfig.LIBRARY_URL_SUFFIX);
- }
- System.setProperty(ServerConfig.SERVER_LIBRARY_URL, serverLibraryURL.toString());
- }
- catch (MalformedURLException e)
- {
- throw new NestedRuntimeException(e);
- }
- }
- return serverLibraryURL;
- }
-
- /**
- * Get the server configuration URL.
- */
- public URL getServerConfigURL()
- {
- if (serverConfigURL == null)
- {
- try
- {
- serverConfigURL = getURL(ServerConfig.SERVER_CONFIG_URL);
- if (serverConfigURL == null)
- {
- serverConfigURL = new URL(getServerHomeURL(), ServerConfig.SERVER_CONFIG_URL_SUFFIX);
- }
- System.setProperty(ServerConfig.SERVER_CONFIG_URL, serverConfigURL.toString());
- }
- catch (MalformedURLException e)
- {
- throw new NestedRuntimeException(e);
- }
- }
- return serverConfigURL;
- }
-
- /**
- * Get the current value of the flag that indicates if we are
- * using the platform MBeanServer as the main jboss server.
- * Both the {@link ServerConfig#PLATFORM_MBEANSERVER}
- * property must be set, and the jvm must be jdk1.5+
- *
- * @return true if jboss runs on the jvm platfrom MBeanServer
- */
- public boolean getPlatformMBeanServer()
- {
- if (platformMBeanServer == null)
- {
- if (Java.isCompatible(Java.VERSION_1_5))
- {
- // get whatever the user has specified or the default
- String value = props.getProperty(ServerConfig.PLATFORM_MBEANSERVER,
- (new Boolean(ServerConfig.DEFAULT_PLATFORM_MBEANSERVER)).toString());
-
- // treat empty string as true
- value = "".equals(value) ? "true" : value;
-
- // true or false
- platformMBeanServer = new Boolean(value);
- }
- else
- {
- // negative :)
- platformMBeanServer = Boolean.FALSE;
- }
- }
- return platformMBeanServer.booleanValue();
- }
-
- /**
- * Enable or disable exiting the JVM when {@link Server#shutdown()} is called.
- * If enabled, then shutdown calls {@link Server#exit()}. If disabled, then
- * only the shutdown hook will be run.
- *
- * @param flag True to enable calling exit on shutdown.
- */
- public void setExitOnShutdown(final boolean flag)
- {
- exitOnShutdown = Primitives.valueOf(flag);
- }
-
- /**
- * Get the current value of the exit on shutdown flag.
- *
- * @return The current value of the exit on shutdown flag.
- */
- public boolean getExitOnShutdown()
- {
- if (exitOnShutdown == null)
- {
- String value = props.getProperty(ServerConfig.EXIT_ON_SHUTDOWN, null);
- if (value == null)
- {
- exitOnShutdown = Primitives.valueOf(ServerConfig.DEFAULT_EXIT_ON_SHUTDOWN);
- }
- else
- {
- exitOnShutdown = new Boolean(value);
- }
- }
- return exitOnShutdown.booleanValue();
- }
-
- /**
- * Enable or disable blocking when {@link Server#shutdown} is
- * called. If enabled, then shutdown will be called in the current
- * thread. If disabled, then the shutdown hook will be run
- * ansynchronously in a separate thread.
- *
- * @param flag True to enable blocking shutdown.
- */
- public void setBlockingShutdown(final boolean flag)
- {
- blockingShutdown = Primitives.valueOf(flag);
- }
-
- /**
- * Get the current value of the blocking shutdown flag.
- *
- * @return The current value of the blocking shutdown flag.
- */
- public boolean getBlockingShutdown()
- {
- if (blockingShutdown == null)
- {
- String value = props.getProperty(ServerConfig.BLOCKING_SHUTDOWN, null);
- if (value == null)
- {
- blockingShutdown = Primitives.valueOf(ServerConfig.DEFAULT_BLOCKING_SHUTDOWN);
- }
- else
- {
- blockingShutdown = new Boolean(value);
- }
- }
- return blockingShutdown.booleanValue();
- }
-
-
- /**
- * Set the RequireJBossURLStreamHandlerFactory flag. if false,
- * exceptions when setting the URLStreamHandlerFactory will be
- * logged and ignored.
- *
- * @param flag True to enable blocking shutdown.
- */
- public void setRequireJBossURLStreamHandlerFactory(final boolean flag)
- {
- requireJBossURLStreamHandlerFactory = Primitives.valueOf(flag);
- }
-
- /**
- * Get the current value of the requireJBossURLStreamHandlerFactory flag.
- *
- * @return The current value of the requireJBossURLStreamHandlerFactory flag.
- */
- public boolean getRequireJBossURLStreamHandlerFactory()
- {
- if (requireJBossURLStreamHandlerFactory == null)
- {
- String value = props.getProperty(ServerConfig.REQUIRE_JBOSS_URL_STREAM_HANDLER_FACTORY, null);
- if (value == null)
- {
- requireJBossURLStreamHandlerFactory = Primitives.valueOf(ServerConfig.DEFAULT_REQUIRE_JBOSS_URL_STREAM_HANDLER_FACTORY);
- }
- else
- {
- requireJBossURLStreamHandlerFactory = new Boolean(value);
- }
- }
- return requireJBossURLStreamHandlerFactory.booleanValue();
- }
-
- /**
- * Set the filename of the root deployable that will be used to finalize
- * the bootstrap process.
- *
- * @param filename The filename of the root deployable.
- */
- public void setRootDeploymentFilename(final String filename)
- {
- this.rootDeployableFilename = filename;
- }
-
- /**
- * Get the filename of the root deployable that will be used to finalize
- * the bootstrap process.
- *
- * @return The filename of the root deployable.
- */
- public String getRootDeploymentFilename()
- {
- if (rootDeployableFilename == null)
- {
- rootDeployableFilename = props.getProperty(ServerConfig.ROOT_DEPLOYMENT_FILENAME,
- ServerConfig.DEFAULT_ROOT_DEPLOYMENT_FILENAME);
- }
-
- return rootDeployableFilename;
- }
-
- /**
- * Get a URL from configuration.
- */
- private URL getURL(final String name) throws MalformedURLException
- {
- String value = props.getProperty(name, null);
- if (value != null)
- {
- if (!value.endsWith("/")) value += "/";
- return new URL(value);
- }
-
- return null;
- }
-
- /**
- * Get a File from configuration.
- * @return the CanonicalFile form for the given name.
- */
- private File getFile(final String name)
- {
- String value = props.getProperty(name, null);
- if (value != null)
- {
- try
- {
- File f = new File(value);
- return f.getCanonicalFile();
- }
- catch(IOException e)
- {
- return new File(value);
- }
- }
-
- return null;
- }
-
- /** Get the server Specification-Version
- */
- public String getSpecificationVersion()
- {
- return serverSpecificationVersion;
- }
-}
Deleted: trunk/system/src/main/org/jboss/system/server/NoAnnotationURLClassLoader.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/NoAnnotationURLClassLoader.java 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/system/src/main/org/jboss/system/server/NoAnnotationURLClassLoader.java 2007-08-14 15:48:44 UTC (rev 64576)
@@ -1,97 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.system.server;
-
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.net.URLStreamHandlerFactory;
-
-/**
- * A URL classloader to avoid URL annotation of classes in RMI
- *
- * @author <a href="mailto:Adrian.Brock at HappeningTimes.com">Adrian Brock</a>
- * @version $Revision$
- */
-public class NoAnnotationURLClassLoader
- extends URLClassLoader
-{
- /** The value returned by {@link getURLs}. */
- private static final URL[] EMPTY_URL_ARRAY = {};
-
- /**
- * Construct a <tt>URLClassLoader</tt>
- *
- * @param urls the URLs to load classes from.
- */
- public NoAnnotationURLClassLoader(URL[] urls)
- {
- super(urls);
- }
-
- /**
- * Construct a <tt>URLClassLoader</tt>
- *
- * @param urls the URLs to load classes from.
- * @param parent the parent classloader.
- */
- public NoAnnotationURLClassLoader(URL[] urls, ClassLoader parent)
- {
- super(urls, parent);
- }
-
- /**
- * Construct a <tt>URLClassLoader</tt>
- *
- * @param urls the URLs to load classes from.
- * @param parent the parent classloader.
- * @param factory the url stream factory.
- */
- public NoAnnotationURLClassLoader(URL[] urls, ClassLoader parent,
- URLStreamHandlerFactory factory)
- {
- super(urls, parent, factory);
- }
-
- /**
- * Return all library URLs
- *
- * <p>Do not remove this method without running the WebIntegrationTestSuite
- * @return the urls
- */
- public URL[] getAllURLs()
- {
- return super.getURLs();
- }
-
- /**
- * Return an empty URL array to force the RMI marshalling subsystem to
- * use the <tt>java.server.codebase</tt> property as the annotated codebase.
- *
- * <p>Do not remove this method without discussing it on the dev list.
- *
- * @return Empty URL[]
- */
- public URL[] getURLs()
- {
- return EMPTY_URL_ARRAY;
- }
-}
Deleted: trunk/system/src/main/org/jboss/system/server/Server.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/Server.java 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/system/src/main/org/jboss/system/server/Server.java 2007-08-14 15:48:44 UTC (rev 64576)
@@ -1,141 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.system.server;
-
-import java.util.Date;
-import java.util.Properties;
-
-/**
- * The interface of the server loaded by the ServerLoader
- * @see ServerLoader
- *
- * @author Jason Dillon
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public interface Server
-{
- /** The JMX notification event type sent on end of server startup */
- public final String START_NOTIFICATION_TYPE = "org.jboss.system.server.started";
- /** The JMX notification event type sent on begin of the server shutdown */
- public final String STOP_NOTIFICATION_TYPE = "org.jboss.system.server.stopped";
-
- /** @return The server start date */
- Date getStartDate();
-
- /** @return The server version */
- String getVersion();
-
- /** @return The server version code name */
- String getVersionName();
-
- /** @return The full server version number */
- String getVersionNumber();
-
- /** @return The date the server was build (compiled) */
- String getBuildNumber();
-
- /** @return The JVM used to build the server */
- String getBuildJVM();
-
- /** @return The Operating System used to build the server */
- String getBuildOS();
-
- /** @return The build id */
- String getBuildID();
-
- /** @return The date the server was build */
- String getBuildDate();
-
- /** @return A flag indicating if shutdown has been called */
- boolean isInShutdown();
-
- // Operations ----------------------------------------------------
-
-
- /**
- * Initialize the Server instance.
- *
- * @param props The configuration properties for the server.
- *
- * @throws IllegalStateException Already initialized.
- * @throws Exception Failed to initialize.
- */
- void init(Properties props) throws IllegalStateException, Exception;
-
- /**
- * Get the typed server configuration object which the
- * server has been initalized to use.
- *
- * @return Typed server configuration object.
- *
- * @throws IllegalStateException Not initialized.
- */
- ServerConfig getConfig() throws IllegalStateException;
-
- /**
- * Start the Server instance.
- *
- * @throws IllegalStateException Already started or not initialized.
- * @throws Exception Failed to start.
- */
- void start() throws IllegalStateException, Exception;
-
- /**
- * Check if the server is started.
- *
- * @return True if the server is started, else false.
- */
- boolean isStarted();
-
- /**
- * Shutdown the Server instance and run shutdown hooks.
- *
- * <p>If the exit on shutdown flag is true, then {@link #exit()}
- * is called, else only the shutdown hook is run.
- *
- * @throws IllegalStateException No started.
- */
- void shutdown() throws IllegalStateException;
-
- /**
- * Shutdown the server, the JVM and run shutdown hooks.
- *
- * @param exitcode The exit code returned to the operating system.
- */
- void exit(int exitcode);
- /**
- * Shutdown the server, the JVM and run shutdown hooks. Exits with code 1.
- */
- void exit();
-
- /**
- * Forcibly terminates the currently running Java virtual machine.
- *
- * @param exitcode The exit code returned to the operating system.
- */
- void halt(int exitcode);
- /**
- * Forcibly terminates the currently running Java virtual machine. Exits with code 1.
- */
- void halt();
-}
Deleted: trunk/system/src/main/org/jboss/system/server/ServerConfig.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/ServerConfig.java 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/system/src/main/org/jboss/system/server/ServerConfig.java 2007-08-14 15:48:44 UTC (rev 64576)
@@ -1,505 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.system.server;
-
-import java.io.File;
-import java.net.URL;
-
-/**
- * The interface of the basic <em>typed</em> JBoss server configuration.
- *
- * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public interface ServerConfig
-{
-
- /** The default partition name */
- String DEFAULT_PARITION_NAME = "DefaultPartition";
-
- /** The partition name property */
- String PARTITION_NAME_PROPERTY = "jboss.partition.name";
-
- /** The udp address property */
- String PARTITION_UDP_PROPERTY = "jboss.partition.udpGroup";
-
- /** The udp port property */
- String PARTITION_UDP_PORT_PROPERTY = "jgroups.udp.mcast_port";
-
- /** Whether to load native libraries */
- String NATIVE_LOAD_PROPERTY = "jboss.native.load";
-
- /** The location of native libraries property */
- String NATIVE_DIR_PROPERTY = "jboss.native.dir";
-
- /////////////////////////////////////////////////////////////////////////
- // Bootstrap Specific Config //
- /////////////////////////////////////////////////////////////////////////
-
- /**
- * Constant that holds the name of the environment property
- * for specifying a comma seperated list of the basenames of
- * to the boot libraries required load the core system.
- *
- * <p>These libraries will be loaded from <tt>LIBRARY_URL</tt>.
- */
- String BOOT_LIBRARY_LIST = "jboss.boot.library.list";
-
- /**
- * Constant that holds the name of the environment property
- * for specifying the class type of the server to create.
- */
- String SERVER_TYPE = "jboss.server.type";
-
- /**
- * Constant that holds the name of the environment property
- * for specifying the root deployment filename (relative to the server
- * config URL that will be deployed to finalize the boot strap process.
- *
- * <p>If not set then the server will default to {@link #DEFAULT_ROOT_DEPLOYMENT_FILENAME}.
- */
- String ROOT_DEPLOYMENT_FILENAME = "jboss.server.root.deployment.filename";
-
-
- /////////////////////////////////////////////////////////////////////////
- // Configuration Value Identifiers //
- /////////////////////////////////////////////////////////////////////////
-
- /**
- * Constant that holds the name of the environment property
- * for specifying the home directory for JBoss.
- */
- String HOME_DIR = "jboss.home.dir";
-
- /**
- * Constant that holds the name of the environment property
- * for specifying the home URL for JBoss.
- *
- * <p>If not set then the value of HOME_DIR will converted into a URL.
- */
- String HOME_URL = "jboss.home.url";
-
- /**
- * Constant that holds the name of the environment property
- * for specifying the URL where JBoss will read library files
- * from.
- *
- * <p>Defaults to <tt><em>HOME_URL</em>/lib</tt>/
- */
- String LIBRARY_URL = "jboss.lib.url";
-
- /**
- * Constant that holds the name of the environment property
- * for specifying the URL where JBoss will read patch library files
- * from.
- *
- * <p>If this value is a <tt>file</tt> URL, then all .zip and .jar files
- * inside will be prepended to the classpath. Otherwise the URL will be
- * added to the classpath. If not set then the no patch files will be
- * loaded.
- */
- String PATCH_URL = "jboss.patch.url";
-
- /**
- * Constant that holds the name of the environment property
- * for specifying the name of the server which will be used to
- * calculate the servers home directory and url.
- *
- * <p>Defaults to <tt>default</tt>.
- */
- String SERVER_NAME = "jboss.server.name";
-
- /**
- * Constant that holds the name of the environment property
- * for specifying the base directory for calculating server
- * home directories.
- *
- * <p>Defaults to <tt><em>HOME_DIR</em>/server</tt>.
- */
- String SERVER_BASE_DIR = "jboss.server.base.dir";
-
- /**
- * Constant that holds the name of the environment property
- * for specifying the server home directory for JBoss.
- *
- * <p>Defaults to <tt><em>SERVER_BASE_DIR</em>/<em>SERVER_NAME</em></tt>.
- */
- String SERVER_HOME_DIR = "jboss.server.home.dir";
-
- /**
- * Constant that holds the name of the environment property
- * for specifying the server log directory for JBoss.
- *
- * <p>Defaults to <tt><em>SERVER_HOME_DIR</em>/<em>log</em></tt>.
- */
- String SERVER_LOG_DIR = "jboss.server.log.dir";
-
- /**
- * Constant that holds the name of the environment property
- * for specifying the directory which JBoss will use for
- * temporary file storage.
- *
- * <p>Defaults to <tt><em>SERVER_HOME_DIR</em>/tmp</tt> .
- */
- String SERVER_TEMP_DIR = "jboss.server.temp.dir";
-
- /**
- * Constant that holds the name of the environment property
- * for specifying the directory which JBoss will use for
- * persistent data file storage.
- *
- * <p>Defaults to <tt><em>SERVER_HOME_DIR</em>/data</tt>.
- */
- String SERVER_DATA_DIR = "jboss.server.data.dir";
-
- /**
- * Constant that holds the name of the environment property
- * for specifying the base URL for calculating server
- * home URLs.
- *
- * <p>Defaults to <tt><em>HOME_URL</em>/server</tt>.
- */
- String SERVER_BASE_URL = "jboss.server.base.url";
-
- /**
- * Constant that holds the name of the environment property
- * for specifying the server home URL for JBoss.
- *
- * <p>Defaults to <tt><em>SERVER_BASE_URL</em>/<em>SERVER_NAME</em></tt>.
- */
- String SERVER_HOME_URL = "jboss.server.home.url";
-
- /**
- * Constant that holds the name of the environment property
- * for specifying the server configuration URL.
- *
- * <p>Defaults to <tt><em>SERVER_HOME_UTL</em>/conf</tt> .
- */
- String SERVER_CONFIG_URL = "jboss.server.config.url";
-
- /**
- * Constant that holds the name of the environment property
- * for specifying the URL where JBoss will read server specific
- * library files from.
- *
- * <p>Defaults to <tt><em>SERVER_HOME_URL</em>/lib</tt>/
- */
- String SERVER_LIBRARY_URL = "jboss.server.lib.url";
-
- /**
- * Constant that holds the name of the environment property
- * for specifying the bind address for all jboss services
- *
- */
- String SERVER_BIND_ADDRESS = "jboss.bind.address";
-
- /**
- * Constant that holds the name of the environment property
- * for specifying whether or not the server should exit the
- * JVM on shutdown.
- *
- * <p>If not set then the server will default to exiting on shutdown.
- */
- String EXIT_ON_SHUTDOWN = "jboss.server.exitonshutdown";
-
- /**
- * Constant that holds the name of the environment property for
- * specifying whether or not the server should shutdown
- * synchronously (true) or asynchronously (false).
- *
- * <p>If not set then the server will default to asynchronous shutdown.
- */
- String BLOCKING_SHUTDOWN = "jboss.server.blockingshutdown";
-
- /**
- * Constant that holds the name of the environment property for
- * specifying whether or not the server should log and ignore
- * exceptions when setting the URLStreamHandlerFactory.
- *
- * <p>If not set then the server will default to asynchronous shutdown.
- */
- String REQUIRE_JBOSS_URL_STREAM_HANDLER_FACTORY = "jboss.server.requirejbossurlstreamhandlerfactory";
-
- /**
- * Constant that holds the name of the environment property for specifying
- * whether or not to use as the main jboss server the MBeanServer returned
- * from ManagementFactory.getPlatformMBeanServer(), when running under jdk1.5+
- *
- * <p>If not set then jboss will instantiate its own MBeanServer
- */
- String PLATFORM_MBEANSERVER = "jboss.platform.mbeanserver";
-
- /////////////////////////////////////////////////////////////////////////
- // Path Suffixes //
- /////////////////////////////////////////////////////////////////////////
-
- /**
- * The suffix used when generating the default value for {@link #LIBRARY_URL}
- * and {@link #SERVER_LIBRARY_URL}.
- */
- String LIBRARY_URL_SUFFIX = "lib/";
-
- /**
- * The suffix used when generating the default value for {@link #SERVER_CONFIG_URL}.
- */
- String SERVER_CONFIG_URL_SUFFIX = "conf/";
-
- /**
- * The suffix used when generating the default value for {@link #SERVER_BASE_DIR}.
- */
- String SERVER_BASE_DIR_SUFFIX = "server";
-
- /**
- * The suffix used when generating the default value for {@link #SERVER_BASE_URL}.
- */
- String SERVER_BASE_URL_SUFFIX = "server/";
-
- /**
- * The suffix used when generating the default value for {@link #SERVER_DATA_DIR}.
- */
- String SERVER_DATA_DIR_SUFFIX = "data";
-
- /**
- * The suffix used when generating the default value for {@link #SERVER_LOG_DIR}.
- */
- String SERVER_LOG_DIR_SUFFIX = "log";
-
- /**
- * The suffix used when generating the default value for {@link #SERVER_TEMP_DIR}.
- */
- String SERVER_TEMP_DIR_SUFFIX = "tmp";
-
-
- /////////////////////////////////////////////////////////////////////////
- // Defaults //
- /////////////////////////////////////////////////////////////////////////
-
- /** The default value for {@link #SERVER_NAME}. */
- String DEFAULT_SERVER_NAME = "default";
-
- /** The default value for {@link #EXIT_ON_SHUTDOWN}. */
- boolean DEFAULT_EXIT_ON_SHUTDOWN = true;
-
- /** The default value for {@link #BLOCKING_SHUTDOWN}. */
- boolean DEFAULT_BLOCKING_SHUTDOWN = false;
-
- /** The default value for {@link #REQUIRE_JBOSS_URL_STREAM_HANDLER_FACTORY}. */
- boolean DEFAULT_REQUIRE_JBOSS_URL_STREAM_HANDLER_FACTORY = true;
-
- /** The default value for {@link #PLATFORM_MBEANSERVER}. */
- boolean DEFAULT_PLATFORM_MBEANSERVER = false;
-
- /** The default value for {@link #ROOT_DEPLOYMENT_FILENAME}. */
- String DEFAULT_ROOT_DEPLOYMENT_FILENAME = "jboss-service.xml";
-
-
- /////////////////////////////////////////////////////////////////////////
- // Typed Access Methods //
- /////////////////////////////////////////////////////////////////////////
-
- /**
- * Get the local home directory which the server is running from.
- *
- * @return The local server home directory.
- */
- File getHomeDir();
-
- /**
- * Get the home URL which the server is running from.
- *
- * @return The home URL which the server is running from.
- */
- URL getHomeURL();
-
- /**
- * Get the library URL for the server.
- *
- * @return The library URL for the server.
- */
- URL getLibraryURL();
-
- /**
- * Get the patch URL for the server.
- *
- * @return The patch URL for the server.
- */
- URL getPatchURL();
-
- /**
- * Get the name of the server.
- *
- * @return The name of the server.
- */
- String getServerName();
-
- /**
- * Get the base directory for calculating server home directories.
- *
- * @return Base server home directory.
- */
- File getServerBaseDir();
-
- /**
- * Get the server home directory.
- *
- * @return Server home directory.
- */
- File getServerHomeDir();
-
- /**
- * Get the directory where log files will be stored.
- *
- * @return The directory where the server writes log files.
- */
- File getServerLogDir();
-
- /**
- * Get the directory where temporary files will be stored.
- *
- * @return The directory where the server stores temporary files.
- */
- File getServerTempDir();
-
- /**
- * Get the directory where local data will be stored.
- *
- * @return The directory where the server stores local data.
- */
- File getServerDataDir();
-
- /**
- * Get the base directory for calculating server home URLs.
- *
- * @return Base server home URL.
- */
- URL getServerBaseURL();
-
- /**
- * Get the server home URL.
- *
- * @return Server home URL.
- */
- URL getServerHomeURL();
-
- /**
- * Get the server library URL.
- *
- * @return Server library URL.
- */
- URL getServerLibraryURL();
-
- /**
- * Get the server configuration URL.
- *
- * @return Server configuration URL.
- */
- URL getServerConfigURL();
-
- /**
- * Get the current value of the flag that indicates if we are
- * using the platform MBeanServer as the main jboss server.
- * Both the {@link ServerConfig#PLATFORM_MBEANSERVER}
- * property must be set, and the jvm must be jdk1.5+
- *
- * @return true if jboss runs on the jvm platfrom MBeanServer
- */
- boolean getPlatformMBeanServer();
-
- /**
- * Enable or disable exiting the JVM when {@link Server#shutdown()} is called.
- * If enabled, then shutdown calls {@link Server#exit()}. If disabled, then
- * only the shutdown hook will be run.
- *
- * @param flag True to enable calling exit on shutdown.
- */
- void setExitOnShutdown(boolean flag);
-
- /**
- * Get the current value of the exit on shutdown flag.
- *
- * @return The current value of the exit on shutdown flag.
- */
- boolean getExitOnShutdown();
-
-
- /**
- * Get the BlockingShutdown value.
- * @return the BlockingShutdown value.
- */
- boolean getBlockingShutdown();
-
- /**
- * Set the BlockingShutdown value.
- * @param blockingShutdown The new BlockingShutdown value.
- */
- void setBlockingShutdown(boolean blockingShutdown);
-
- /**
- * Get the RequireJBossURLStreamHandlerFactory value.
- * @return the RequireJBossURLStreamHandlerFactory value.
- */
- boolean getRequireJBossURLStreamHandlerFactory();
-
- /**
- * Set the RequireJBossURLStreamHandlerFactory value.
- * @param requireJBossURLStreamHandlerFactory The new RequireJBossURLStreamHandlerFactory value.
- */
- void setRequireJBossURLStreamHandlerFactory(boolean requireJBossURLStreamHandlerFactory);
-
- /**
- * Set the filename of the root deployable that will be used to finalize
- * the bootstrap process.
- *
- * @param filename The filename of the root deployable.
- */
- void setRootDeploymentFilename(String filename);
-
- /**
- * Get the filename of the root deployable that will be used to finalize
- * the bootstrap process.
- *
- * @return The filename of the root deployable.
- */
- String getRootDeploymentFilename();
-
- /**
- * Get the native dir for unpacking
- *
- * @return the directory
- */
- File getServerNativeDir();
-
- /**
- * Get the temporary deployment dir for unpacking
- *
- * @return the directory
- */
- File getServerTempDeployDir();
-
- /**
- * Get the server Specification-Version
- *
- * @return the spec version
- */
- String getSpecificationVersion();
-}
Deleted: trunk/system/src/main/org/jboss/system/server/ServerConfigUtil.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/ServerConfigUtil.java 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/system/src/main/org/jboss/system/server/ServerConfigUtil.java 2007-08-14 15:48:44 UTC (rev 64576)
@@ -1,146 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.system.server;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-/**
- * Utilities for accessing server configuration
- *
- * @author <a href="mailto:adrian at jboss.org">Adrian Brock</a>
- * @version <tt>$Revision$</tt>
- */
-public class ServerConfigUtil
-{
- private static final String ANY = "0.0.0.0";
-
- /**
- * Retrieve the default bind address for the server
- *
- * @return the default bind adress
- */
- public static String getDefaultBindAddress()
- {
- return System.getProperty(ServerConfig.SERVER_BIND_ADDRESS);
- }
-
- /**
- * Retrieve the default bind address, but only if it is specific
- *
- * @return the specific bind address
- */
- public static String getSpecificBindAddress()
- {
- String address = System.getProperty(ServerConfig.SERVER_BIND_ADDRESS);
- if (address == null || address.equals(ANY))
- return null;
- return address;
- }
-
- /**
- * Fix the remote inet address.
- *
- * If we pass the address to the client we don't want to
- * tell it to connect to 0.0.0.0, use our host name instead
- * @param address the passed address
- * @return the fixed address
- */
- public static InetAddress fixRemoteAddress(InetAddress address)
- {
- try
- {
- if (address == null || InetAddress.getByName(ANY).equals(address))
- return InetAddress.getLocalHost();
- }
- catch (UnknownHostException ignored)
- {
- }
- return address;
- }
-
- /**
- * Fix the remote address.
- *
- * If we pass the address to the client we don't want to
- * tell it to connect to 0.0.0.0, use our host name instead
- * @param address the passed address
- * @return the fixed address
- */
- public static String fixRemoteAddress(String address)
- {
- try
- {
- if (address == null || ANY.equals(address))
- return InetAddress.getLocalHost().getHostName();
- }
- catch (UnknownHostException ignored)
- {
- }
- return address;
- }
-
- /**
- * Get the default partition name
- *
- * @return the default partition name
- */
- public static String getDefaultPartitionName()
- {
- return System.getProperty(ServerConfig.PARTITION_NAME_PROPERTY, ServerConfig.DEFAULT_PARITION_NAME);
- }
-
- /**
- * Whether to load native directories
- *
- * @return true when loading native directories
- */
- public static boolean isLoadNative()
- {
- return Boolean.getBoolean(ServerConfig.NATIVE_LOAD_PROPERTY);
- }
-
- /**
- * Utility to get a shortened url relative to the server home if possible
- *
- * @param longUrl
- * @return the short url
- */
- public static String shortUrlFromServerHome(String longUrl)
- {
- String serverHomeUrl = System.getProperty(org.jboss.system.server.ServerConfig.SERVER_HOME_URL);
-
- if (longUrl == null || serverHomeUrl == null)
- return longUrl;
-
- if (longUrl.startsWith(serverHomeUrl))
- return ".../" + longUrl.substring(serverHomeUrl.length());
- else
- {
- String jarServerHomeUrl = "jar:" + serverHomeUrl;
- if (longUrl.startsWith(jarServerHomeUrl))
- return ".../" + longUrl.substring(jarServerHomeUrl.length());
- else
- return longUrl;
- }
- }
-}
Deleted: trunk/system/src/main/org/jboss/system/server/ServerLoader.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/ServerLoader.java 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/system/src/main/org/jboss/system/server/ServerLoader.java 2007-08-14 15:48:44 UTC (rev 64576)
@@ -1,357 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.system.server;
-
-// $Id$
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Properties;
-import java.util.StringTokenizer;
-
-/**
- * A helper class to load a JBoss server instance.
- *
- * <p>Basic usage is something like this:
- * <pre>
- * // setup the basic server config properties
- * Properties props = new Properties(System.getProperties());
- * props.put(ServerConfig.SERVER_LIBRARY_URL, "http://myserver.com/myjboss/lib/");
- * // set some more properties
- *
- * // create a new loader to do the dirty work
- * ServerLoader loader = new ServerLoader(props);
- *
- * // add the jaxp & jmx library to use
- * loader.addLibrary("crimson.jar");
- * loader.addLibrary("jboss-jmx-core.jar");
- *
- * // load and initialize the server instance
- * ClassLoader parent = Thread.currentThread().getContextClassLoader();
- * Server server = loader.load(parent);
- * server.init(props);
- *
- * // start up the server
- * server.start();
- *
- * // go make some coffee, drink a beer or play GTA3
- * // ...
- *
- * // shutdown and go to sleep
- * server.shutdown();
- * </pre>
- * @version <tt>$Revision$</tt>
- * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @author <a href="mailto:adrian.brock at happeningtimes.com">Adrian Brock</a>
- * @author Scott.Stark at jboss.org
- * @author Thomas.Diesler at jboss.org
- */
-public class ServerLoader
-{
- /**
- * The default list of boot libraries. Does not include
- * the JAXP or JMX impl, users of this class should add the
- * proper libraries.
- * TODO: use vfs to list the root directory
- */
- public static final String[] DEFAULT_BOOT_LIBRARY_LIST = {
- // Logging
- "log4j-boot.jar",
- "jboss-common-core.jar",
- "jboss-logging-spi.jar",
- "jboss-logging-log4j.jar",
- "jboss-logging-jdk.jar",
- "jboss-xml-binding.jar",
- // MC jars
- "javassist.jar",
- "jboss-aop-jdk50.jar",
- "jboss-aop-deployer-jdk50.jar",
- "jboss-aop-mc-int.jar",
- "trove.jar",
- "jboss-vfs.jar",
- "jboss-classloading-spi.jar",
- "jboss-classloader.jar",
- "jboss-container.jar",
- "jboss-dependency.jar",
- "jboss-kernel.jar",
- "jboss-managed.jar",
- "jboss-metatype.jar",
- "jboss-deployers-client.jar",
- "jboss-deployers-client-spi.jar",
- "jboss-deployers-core.jar",
- "jboss-deployers-core-spi.jar",
- "jboss-deployers-impl.jar",
- "jboss-deployers-spi.jar",
- "jboss-deployers-structure-spi.jar",
- "jboss-deployers-vfs.jar",
- "jboss-deployers-vfs-spi.jar",
- // Core server bootstrap
- "jboss-system.jar",
- // JMX related dependencies
- "jboss-j2se.jar",
- "dom4j.jar",
- "jboss-mbeans.jar",
- "jboss-jmx.jar",
- "jboss-system-jmx.jar",
- //JAXB
- "jaxb-api.jar",
- "jaxb-impl.jar",
- "stax-api.jar",
- "activation.jar"
- };
-
- /** The default server type. */
- public static final String DEFAULT_SERVER_TYPE = "org.jboss.system.server.profileservice.ServerImpl";
-
- /**
- * Configuration properties.
- */
- protected Properties props;
-
- /**
- * The URL where libraries are read from.
- */
- protected URL libraryURL;
-
- /**
- * A list of extra URLs to add to the classpath when loading
- * the server.
- */
- protected List<URL> extraClasspath = new LinkedList<URL>();
-
- /**
- * Construct a <tt>ServerLoader</tt>.
- *
- * @param props Configuration properties.
- *
- * @throws Exception Invalid configuration
- */
- public ServerLoader(final Properties props) throws Exception
- {
- if (props == null)
- throw new IllegalArgumentException("props is null");
-
- this.props = props;
-
- // must have HOME_URL, or we can't continue
- URL homeURL = getURL(ServerConfig.HOME_URL);
- if (homeURL == null)
- {
- throw new Exception("Missing configuration value for: "
- + ServerConfig.HOME_URL);
- }
-
- libraryURL = getURL(ServerConfig.LIBRARY_URL);
- if (libraryURL == null)
- {
- // need library url to make boot urls list
- libraryURL = new URL(homeURL, ServerConfig.LIBRARY_URL_SUFFIX);
- }
-
- // If the home URL begins with http add the webav and httpclient jars
- if( homeURL.getProtocol().startsWith("http") == true )
- {
- this.addLibrary("webdavlib.jar");
- this.addLibrary("commons-httpclient.jar");
- this.addLibrary("commons-logging.jar");
- }
- }
-
- /**
- * Add an extra library to the end of list of libraries
- * which will be loaded from the library URL when loading
- * the Server class.
- *
- * @param filename A filename (no directory parts)
- *
- * @throws MalformedURLException Could not generate URL from library URL + filename
- */
- public void addLibrary(final String filename) throws MalformedURLException
- {
- if (filename == null)
- throw new IllegalArgumentException("filename is null");
-
- URL jarURL = new URL(libraryURL, filename);
- extraClasspath.add(jarURL);
- }
-
- /**
- * Add a list of comma seperated library file names.
- *
- * @param filenames A list of comma seperated filenames (with no directory parts)
- *
- * @throws MalformedURLException Could not generate URL from library URL + filename
- */
- public void addLibraries(final String filenames) throws MalformedURLException
- {
- if (filenames == null)
- throw new IllegalArgumentException("filenames is null");
-
- StringTokenizer stok = new StringTokenizer(filenames, ",");
- while (stok.hasMoreElements())
- {
- addLibrary(stok.nextToken().trim());
- }
- }
-
- /**
- * Add an extra URL to the classpath used to load the server.
- *
- * @param url A URL to add to the classpath.
- */
- public void addURL(final URL url)
- {
- if (url == null)
- throw new IllegalArgumentException("url is null");
-
- extraClasspath.add(url);
- }
-
- /**
- * Add the jars from the lib/endorsed dir if it exists.
- * Note, the path must exist locally for this to work.
- * @throws MalformedURLException Could not generate URL from library URL + filename
- */
- public void addEndorsedJars() throws MalformedURLException
- {
- File endorsedDir = new File(libraryURL.getPath() + "/endorsed");
- if (endorsedDir.exists())
- {
- String [] list = endorsedDir.list();
- for (int i = 0; list != null && i < list.length; i++)
- {
- String jarname = list[i];
- addLibrary("endorsed/" + jarname);
- }
- }
- }
-
- /**
- * Get a URL from configuration or system properties.
- *
- * @param name the system property
- * @return the url
- * @throws MalformedURLException for a bad url
- */
- protected URL getURL(final String name) throws MalformedURLException
- {
- String value = props.getProperty(name, null);
- if (value != null)
- {
- if (!value.endsWith("/")) value += "/";
- return new URL(value);
- }
- return null;
- }
-
- /**
- * Returns an array of URLs which will be used to load the
- * core system and construct a new Server object instance.
- * @return the urls
- * @throws MalformedURLException for a bad url
- */
- protected URL[] getBootClasspath() throws MalformedURLException
- {
- List<URL> list = new LinkedList<URL>();
-
- // prepend users classpath to allow for overrides
- list.addAll(extraClasspath);
-
- String value = props.getProperty(ServerConfig.BOOT_LIBRARY_LIST);
- if( value != null )
- {
- StringTokenizer stok = new StringTokenizer(value, ",");
- while (stok.hasMoreElements())
- {
- URL url = new URL(libraryURL, stok.nextToken().trim());
- list.add(url);
- }
- }
- else
- {
- for(String jar : DEFAULT_BOOT_LIBRARY_LIST)
- {
- URL url = new URL(libraryURL, jar);
- list.add(url);
- }
- }
-
- return list.toArray(new URL[list.size()]);
- }
-
- /**
- * Load a {@link Server} instance.
- *
- * @parent The parent of any class loader created during boot.
- * @return An uninitialized (and unstarted) Server instance.
- *
- * @param parent the parent classloader
- * @throws Exception Failed to load or create Server instance.
- */
- public Server load(final ClassLoader parent) throws Exception
- {
- Server server;
- ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
-
- try
- {
- // get the boot lib list
- URL[] urls = getBootClasspath();
- URLClassLoader classLoader = new NoAnnotationURLClassLoader(urls, parent);
- Thread.currentThread().setContextClassLoader(classLoader);
-
- // construct a new Server instance
- String typename = props.getProperty(ServerConfig.SERVER_TYPE, DEFAULT_SERVER_TYPE);
- server = createServer(typename, classLoader);
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(oldCL);
- }
-
- // thats all folks, have fun
- return server;
- }
-
- /**
- * Construct a new instance of Server, loading all required classes from
- * the given ClassLoader.
- * @param typename - the fqcn of the Server implementation
- * @param loader - the ClassLoader to load typename with
- * @return the server
- * @throws Exception for any error
- */
- protected Server createServer(final String typename, final ClassLoader loader)
- throws Exception
- {
- // load the class first
- Class type = loader.loadClass(typename);
-
- // and then create a new instance
- Server server = (Server) type.newInstance();
- return server;
- }
-}
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java 2007-08-14 15:48:44 UTC (rev 64576)
@@ -21,11 +21,9 @@
*/
package org.jboss.system.server.profileservice;
-import java.net.URL;
import java.util.Collection;
-import java.util.Enumeration;
-import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.bootstrap.spi.Bootstrap;
import org.jboss.dependency.spi.ControllerContext;
import org.jboss.deployers.client.spi.IncompleteDeploymentException;
import org.jboss.deployers.client.spi.main.MainDeployer;
@@ -33,9 +31,8 @@
import org.jboss.deployers.structure.spi.DeploymentContext;
import org.jboss.deployers.vfs.spi.client.VFSDeployment;
import org.jboss.kernel.Kernel;
-import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
-import org.jboss.kernel.plugins.deployment.xml.BasicXMLDeployer;
import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.logging.Logger;
import org.jboss.profileservice.spi.Profile;
import org.jboss.profileservice.spi.ProfileKey;
import org.jboss.profileservice.spi.ProfileService;
@@ -51,22 +48,13 @@
* @author adrian at jboss.org
* @version $Revision$
*/
-public class ProfileServiceBootstrap extends BasicBootstrap
+public class ProfileServiceBootstrap implements Bootstrap
{
- /** The bootstrap file */
- public static String BOOTSTRAP_XML_NAME = "bootstrap-beans.xml";
-
+ /** The log */
+ private static final Logger log = Logger.getLogger(ProfileServiceBootstrap.class);
+
/** The name of the profile that is being booted */
- protected String profileName;
-
- /** The Server instance bootstraping the profile service */
- protected Server server;
-
- /** The kernel deployer used to load the server deployers */
- protected BasicXMLDeployer kernelDeployer;
-
- /** The controller */
- protected KernelController controller;
+ protected String profileName = "default";
/** The server MainDeployer */
protected MainDeployer mainDeployer;
@@ -74,38 +62,17 @@
/** The server ProfileService */
protected ProfileService profileService;
- /** The deployer beans prefix */
- protected String deployerBeansPrefix;
-
- /** An explicit deployer-beans.xml URL to deploy */
- protected URL bootstrapURL;
-
+ /** The kernel */
+ protected Kernel kernel;
+
/**
* Create a new ProfileServiceBootstrap.
*/
public ProfileServiceBootstrap()
{
- this("default", null);
}
/**
- * Create a new ProfileServiceBootstrap.
- *
- * @param name the name
- * @param server the server instance
- */
- public ProfileServiceBootstrap(String name, Server server)
- {
- this.profileName = name;
- this.server = server;
- }
-
- public Server getServer()
- {
- return server;
- }
-
- /**
* Return the MainDeployer bean.
*
* @return the MainDeployer bean if bootstrap succeeded, null otherwise.
@@ -126,112 +93,29 @@
}
/**
- * Return the bootstrap XML kernel deployer.
+ * Get the kernel.
*
- * @return BasicXMLDeployer instance.
+ * @return the kernel.
*/
- public BasicXMLDeployer getKernelDeployer()
+ public Kernel getKernel()
{
- return kernelDeployer;
+ return kernel;
}
/**
- * Get the deployer bean prefix
+ * Set the kernel.
*
- * @return the prefix
+ * @param kernel the kernel.
*/
- public String getDeployerBeansPrefix()
+ public void setKernel(Kernel kernel)
{
- return deployerBeansPrefix;
+ this.kernel = kernel;
}
- /**
- * Set the prefix to add to the DEPLOYERS_XML_NAME in order to create the
- * classpath resource to look for bootstrap descriptors.
- *
- * @param prefix - the prefix for the bootstrap descriptor resource. If null
- * or empty, a value of profileName + "/" is used.
- */
- public void setDeployerBeansPrefix(String prefix)
+ public void start(Server server) throws Exception
{
- if (prefix != null && prefix.length() == 0)
- prefix = null;
- this.deployerBeansPrefix = prefix;
- }
-
- /**
- * Get the bootstrap url
- *
- * @return the bootstrap url
- */
- public URL getBootstrapURL()
- {
- return bootstrapURL;
- }
-
- /**
- * Set the explicit kernel bootstrap deployer-beans.xml URL. If set, not
- * resource discovery will be preformed.
- *
- * @param bootstrapURL - URL to the bootstrap deployer-beans.xml
- */
- public void setBootstrapURL(URL bootstrapURL)
- {
- this.bootstrapURL = bootstrapURL;
- }
-
- @Override
- public void bootstrap() throws Throwable
- {
- // Bootstrap the core kernel
- super.bootstrap();
-
- kernelDeployer = new BasicXMLDeployer(getKernel());
-
- if (bootstrapURL == null)
- {
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
-
- String bootstrapResName;
- if (deployerBeansPrefix == null)
- bootstrapResName = profileName + "/" + BOOTSTRAP_XML_NAME;
- else
- bootstrapResName = deployerBeansPrefix + BOOTSTRAP_XML_NAME;
-
- log.debug("Scanning for bootstrap resources: " + bootstrapResName);
- Enumeration<URL> descriptors = cl.getResources(bootstrapResName);
- while (descriptors.hasMoreElements())
- {
- URL url = descriptors.nextElement();
- log.debug("Found: "+url);
- deploy(url);
- }
-
- String metaInfBootstrapResName = "META-INF/" + bootstrapResName;
- log.debug("Scanning for bootstrap resources: " + metaInfBootstrapResName);
- descriptors = cl.getResources(metaInfBootstrapResName);
- while (descriptors.hasMoreElements())
- {
- URL url = descriptors.nextElement();
- log.debug("Found: "+url);
- deploy(url);
- }
- }
- else
- {
- deploy(bootstrapURL);
- }
-
- Kernel kernel = getKernel();
- controller = kernel.getController();
-
- // Register the Server instance in the kernel
- if (server != null)
- {
- AbstractBeanMetaData metaData = new AbstractBeanMetaData("JBossServer", server.getClass().getName());
- controller.install(metaData, server);
- }
-
+ KernelController controller = kernel.getController();
+
// Get the beans TODO injection!
profileService = getBean(controller, "ProfileService", ProfileService.class);
log.debug("Using ProfileService: " + profileService);
@@ -260,6 +144,18 @@
profile.enableModifiedDeploymentChecks(true);
}
+ public void shutdown(Server server)
+ {
+ try
+ {
+ mainDeployer.shutdown();
+ }
+ catch (Throwable t)
+ {
+ log.warn("Error shutting down the main deployer", t);
+ }
+ }
+
/**
* Get a bean
*
@@ -282,47 +178,17 @@
throw new IllegalStateException(name + " expected " + expectedType.getName() + " was " + result.getClass().getName());
return expectedType.cast(result);
}
-
- /**
- * Bootstrap deployment of the
- *
- * @param url the deployment url
- * @throws Throwable for any error
- */
- protected void deploy(URL url) throws Throwable
- {
- log.debug("Deploying bootstrap config: " + url);
- kernelDeployer.deploy(url);
- }
/**
- * Undeploy a url
- *
- * @param url the deployment url
- */
- protected void undeploy(URL url)
- {
- try
- {
- log.debug("Undeploying bootstrap config: " + url);
- kernelDeployer.undeploy(url);
- }
- catch (Throwable t)
- {
- log.warn("Error during undeployment: " + url, t);
- }
- }
-
- /**
* Load the deployments associated with the named profile and deploy them
* using the MainDeployer.
*
* @param name
- * @throws Throwable
+ * @throws Exception for any error
* @throws NullPointerException if either the MainDeployer or ProfileService
* have not been injected.
*/
- protected void loadProfile(String name) throws Throwable
+ protected void loadProfile(String name) throws Exception
{
MainDeployer deployer = getMainDeployer();
if (deployer == null)
Deleted: trunk/system/src/main/org/jboss/system/server/profileservice/ServerImpl.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/ServerImpl.java 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/ServerImpl.java 2007-08-14 15:48:44 UTC (rev 64576)
@@ -1,794 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.system.server.profileservice;
-
-import java.io.File;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.util.Date;
-import java.util.Properties;
-import java.util.logging.LogManager;
-
-import javax.management.Notification;
-import javax.management.NotificationBroadcasterSupport;
-import javax.management.NotificationEmitter;
-
-import org.jboss.Version;
-import org.jboss.deployers.client.spi.main.MainDeployer;
-import org.jboss.kernel.Kernel;
-import org.jboss.kernel.plugins.deployment.BasicKernelDeployer;
-import org.jboss.kernel.spi.event.KernelEvent;
-import org.jboss.logging.Logger;
-import org.jboss.net.protocol.URLStreamHandlerFactory;
-import org.jboss.system.server.BaseServerConfig;
-import org.jboss.system.server.Server;
-import org.jboss.system.server.ServerConfig;
-import org.jboss.util.StopWatch;
-
-
-/**
- * A Server implementation that uses the deployer-beans.xml and ProfileService
- * to boot the server.
- *
- * @author Scott.Stark at jboss.org
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @version $Revision$
- */
-public class ServerImpl extends NotificationBroadcasterSupport
- implements Server, NotificationEmitter
-{
- /** Instance logger. */
- private Logger log;
-
- /** Container for version information. */
- private final Version version = Version.getInstance();
-
- /** Package information for org.jboss */
- private final Package jbossPackage = Package.getPackage("org.jboss");
-
- /** The kernel bootstrap */
- private ProfileServiceBootstrap bootstrap;
- /** A resource prefix */
- private String deployerBeansPrefix;
-
- /** The basic configuration for the server. */
- private BaseServerConfig config;
-
- /** When the server was started. */
- private Date startDate;
-
- /** Flag to indicate if we are started. */
- private boolean started;
- /** A flag indicating if start has been called */
- private boolean isInStart;
- /** A flag indicating if shutdown has been called */
- private boolean isInShutdown;
-
- /** The JVM shutdown hook */
- private ShutdownHook shutdownHook;
-
- /** The JBoss Life Thread */
- private LifeThread lifeThread;
-
- /**
- * No-arg constructor for ServerImpl
- */
- public ServerImpl()
- {
- }
-
- /**
- * Initialize the Server instance.
- *
- * @param props - The configuration properties for the server.
- *
- * @throws IllegalStateException Already initialized.
- * @throws Exception Failed to initialize.
- */
- public void init(final Properties props)
- throws IllegalStateException, Exception
- {
- if (props == null)
- throw new IllegalArgumentException("props is null");
- if (config != null)
- throw new IllegalStateException("already initialized");
-
- ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
-
- try
- {
- Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
- doInit(props);
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(oldCL);
- }
- }
-
- /**
- * Initialize server configuration and jvm settings.
- * @param props
- * @throws Exception
- */
- private void doInit(final Properties props) throws Exception
- {
- // Create a new config object from the give properties
- this.config = new BaseServerConfig(props);
- this.deployerBeansPrefix = props.getProperty("jboss.server.deployerBeansPrefix");
-
- // Set the VM temp directory to the server tmp dir
- boolean overrideTmpDir = Boolean.getBoolean("jboss.server.temp.dir.overrideJavaTmpDir");
- if( overrideTmpDir )
- {
- File serverTmpDir = config.getServerTempDir();
- System.setProperty("java.io.tmpdir", serverTmpDir.getCanonicalPath());
- }
-
- /* Initialize the logging layer using the ServerImpl class. The server log
- directory is initialized prior to this to ensure the jboss.server.log.dir
- system property is set in case its used by the logging configs.
- */
- config.getServerLogDir();
- log = Logger.getLogger(getClass());
-
- // Setup URL handlers - do this before initializing the ServerConfig
- initURLHandlers();
- config.initURLs();
-
- log.info("Starting JBoss (Microcontainer)...");
-
- if (jbossPackage != null)
- {
- // Show what release this is...
- log.info("Release ID: " +
- jbossPackage.getImplementationTitle() + " " +
- jbossPackage.getImplementationVersion());
- }
- else
- {
- log.warn("could not get package info to display release, either the " +
- "jar manifest in jboss-system.jar has been mangled or you're " +
- "running unit tests from ant outside of JBoss itself.");
- }
-
- log.debug("Using config: " + config);
-
- // make sure our impl type is exposed
- log.debug("Server type: " + getClass());
-
- // Log the basic configuration elements
- log.info("Home Dir: " + config.getHomeDir());
- log.info("Home URL: " + config.getHomeURL());
- log.info("Library URL: " + config.getLibraryURL());
- log.info("Patch URL: " + config.getPatchURL());
- log.info("Server Name: " + config.getServerName());
- log.info("Server Home Dir: " + config.getServerHomeDir());
- log.info("Server Home URL: " + config.getServerHomeURL());
- log.info("Server Data Dir: " + config.getServerDataDir());
- log.info("Server Temp Dir: " + config.getServerTempDir());
- log.info("Server Config URL: " + config.getServerConfigURL());
- log.info("Server Library URL: " + config.getServerLibraryURL());
- log.info("Root Deployment Filename: " + config.getRootDeploymentFilename());
- }
-
- /**
- * The <code>initURLHandlers</code> method calls
- * internalInitURLHandlers. if requireJBossURLStreamHandlers is
- * false, any exceptions are logged and ignored.
- *
- */
- private void initURLHandlers()
- {
- if (config.getRequireJBossURLStreamHandlerFactory())
- {
- internalInitURLHandlers();
- } // end of if ()
- else
- {
- try
- {
- internalInitURLHandlers();
- }
- catch (SecurityException e)
- {
- log.warn("You do not have permissions to set URLStreamHandlerFactory", e);
- } // end of try-catch
- catch (Error e)
- {
- log.warn("URLStreamHandlerFactory already set", e);
- } // end of catch
- } // end of else
- }
-
- /**
- * Set up our only URLStreamHandlerFactory.
- * This is needed to ensure Sun's version is not used (as it leaves files
- * locked on Win2K/WinXP platforms.
- */
- private void internalInitURLHandlers()
- {
- try
- {
- // Install a URLStreamHandlerFactory that uses the TCL
- URL.setURLStreamHandlerFactory(new URLStreamHandlerFactory());
-
- // Preload JBoss URL handlers
- URLStreamHandlerFactory.preload();
- }
- catch (Error error)
- { //very naughty but we HAVE to do this or
- //we'll fail if we ever try to do this again
- log.warn("Caught Throwable Error, this probably means " +
- "we've already set the URLStreamHAndlerFactory before");
- }
-
- // Include the default JBoss protocol handler package
- String handlerPkgs = System.getProperty("java.protocol.handler.pkgs");
- if (handlerPkgs != null)
- {
- handlerPkgs += "|org.jboss.net.protocol";
- }
- else
- {
- handlerPkgs = "org.jboss.net.protocol";
- }
- System.setProperty("java.protocol.handler.pkgs", handlerPkgs);
- }
-
- /**
- * Get the typed server configuration object which the
- * server has been initalized to use.
- *
- * @return Typed server configuration object.
- *
- * @throws IllegalStateException Not initialized.
- */
- public ServerConfig getConfig() throws IllegalStateException
- {
- if (config == null)
- throw new IllegalStateException("not initialized");
-
- return config;
- }
-
- /**
- * Check if the server is started.
- *
- * @return True if the server is started, else false.
- */
- public boolean isStarted()
- {
- return started;
- }
-
- /**
- Check if the shutdown operation has been called/is in progress.
-
- @return true if shutdown has been called, false otherwise
- */
- public boolean isInShutdown()
- {
- return isInShutdown;
- }
-
- /**
- * Start the Server instance.
- *
- * @throws IllegalStateException Already started or not initialized.
- * @throws Exception Failed to start.
- */
- public void start() throws IllegalStateException, Exception
- {
- synchronized( this )
- {
- if( isInStart == false )
- {
- isInStart = true;
- }
- else
- {
- log.debug("Already in start, ignoring duplicate start");
- return;
- }
- }
-
- // make sure we are initialized
- getConfig();
-
- // make sure we aren't started yet
- if (started)
- throw new IllegalStateException("already started");
-
- ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
-
- try
- {
- ClassLoader myCL = getClass().getClassLoader();
- /*
- URL libURL = config.getLibraryURL();
- // Hack to add the jmx jars until the mc/legacy jmx integration is cleaned up
- URL[] jmxJars = {
- new URL(libURL, "dom4j.jar"),
- new URL(libURL, "jboss-j2se.jar"),
- new URL(libURL, "jboss-jmx.jar"),
- new URL(libURL, "jboss-mbeans.jar"),
- new URL(libURL, "jboss-system-jmx.jar")
- };
- NoAnnotationURLClassLoader jmxLoader = new NoAnnotationURLClassLoader(jmxJars, myCL);
- Thread.currentThread().setContextClassLoader(jmxLoader);
- */
- Thread.currentThread().setContextClassLoader(myCL);
- doStart();
- }
- catch (Throwable t)
- {
- log.debug("Failed to start", t);
-
- if (t instanceof Exception)
- throw (Exception)t;
- if (t instanceof Error)
- throw (Error)t;
-
- throw new org.jboss.util.UnexpectedThrowable(t);
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(oldCL);
- isInStart = false;
- }
- }
-
- /**
- * Start the server by booting the kernel, loading deployers, and loading
- * the profile deployments.
- *
- * @throws Throwable for any error
- */
- private void doStart() throws Throwable
- {
- // See how long it takes us to start up
- StopWatch watch = new StopWatch(true);
-
- // remeber when we we started
- startDate = new Date();
-
- bootstrap = new ProfileServiceBootstrap(config.getServerName(), this);
- if( deployerBeansPrefix != null )
- {
- bootstrap.setDeployerBeansPrefix(deployerBeansPrefix);
- log.info("Starting Microcontainer, deployerBeansPrefix="+deployerBeansPrefix);
- }
- else
- {
- URL configURL = config.getServerConfigURL();
- URL bootstrapURL = new URL(configURL, ProfileServiceBootstrap.BOOTSTRAP_XML_NAME);
- log.info("Starting Microcontainer, bootstrapURL="+bootstrapURL);
- bootstrap.setBootstrapURL(bootstrapURL);
- }
-
- // Install the shutdown hook
- shutdownHook = new ShutdownHook();
- shutdownHook.setDaemon(true);
- try
- {
- Runtime.getRuntime().addShutdownHook(shutdownHook);
- log.debug("Shutdown hook added");
- }
- catch (Exception e)
- {
- log.warn("Failed to add shutdown hook; ignoring", e);
- }
-
- bootstrap.run();
-
- lifeThread = new LifeThread();
- lifeThread.start();
-
- started = true;
-
- // Send a notification that the startup is complete
- KernelEvent startEvent = bootstrap.createEvent(START_NOTIFICATION_TYPE, new Long(watch.getLapTime()));
- bootstrap.fireKernelEvent(startEvent);
- // Send a JMX notification that the startup is complete
- Notification msg = new Notification(START_NOTIFICATION_TYPE, this, 1);
- msg.setUserData(new Long(watch.getLapTime()));
- sendNotification(msg);
-
- watch.stop();
-
- if (jbossPackage != null)
- {
- // Tell the world how fast it was =)
- log.info("JBoss (Microcontainer) [" + jbossPackage.getImplementationVersion() +
- "] Started in " + watch);
- }
- else
- {
- log.warn("could not get package info to display release, either the " +
- "jar manifest in run.jar has been mangled or you're " +
- "running unit tests from ant outside of JBoss itself.");
- }
- }
-
- /**
- * Shutdown the Server instance and run shutdown hooks.
- *
- * <p>If the exit on shutdown flag is true, then {@link #exit()}
- * is called, else only the shutdown hook is run.
- *
- * @throws IllegalStateException No started.
- */
- public void shutdown() throws IllegalStateException
- {
- if (!started)
- throw new IllegalStateException("not started");
-
- final ServerImpl server = this;
-
- log.debug("Shutting down");
-
- isInShutdown = true;
- boolean exitOnShutdown = config.getExitOnShutdown();
- boolean blockingShutdown = config.getBlockingShutdown();
-
- log.debug("exitOnShutdown: " + exitOnShutdown);
- log.debug("blockingShutdown: " + blockingShutdown);
-
- lifeThread.interrupt();
-
- if (exitOnShutdown)
- {
- log.debug("Calling server.exit(0)");
- server.exit(0);
- }
- else if (blockingShutdown)
- {
- log.debug("Invoking shutdownHook in calling thread");
- shutdownHook.shutdown();
- } // end of if ()
- else
- {
- // start in new thread to give positive
- // feedback to requesting client of success.
- new Thread()
- {
- public void run()
- {
- // just run the hook, don't call System.exit, as we may
- // be embeded in a vm that would not like that very much
- log.debug("Invoking shutdownHook in background thread");
- shutdownHook.shutdown();
- }
- }.start();
- }
- }
-
- /**
- * Shutdown the server, the JVM and run shutdown hooks.
- *
- * @param exitcode The exit code returned to the operating system.
- */
- public void exit(final int exitcode)
- {
- // start in new thread so that we might have a chance to give positive
- // feed back to requesting client of success.
- new Thread()
- {
- public void run()
- {
- log.info("Shutting down the JVM now!");
- Runtime.getRuntime().exit(exitcode);
- }
- }.start();
- }
-
- /**
- * Shutdown the server, the JVM and run shutdown hooks. Exits with
- * code 1.
- */
- public void exit()
- {
- exit(1);
- }
-
- /**
- * Forcibly terminates the currently running Java virtual machine.
- *
- * @param exitcode The exit code returned to the operating system.
- */
- public void halt(final int exitcode)
- {
- // Send a stop event msg
- KernelEvent stopEvent = bootstrap.createEvent(STOP_NOTIFICATION_TYPE, null);
- bootstrap.fireKernelEvent(stopEvent);
-
- // start in new thread so that we might have a chance to give positive
- // feed back to requesting client of success.
- new Thread()
- {
- public void run()
- {
- System.err.println("Halting the system now!");
- Runtime.getRuntime().halt(exitcode);
- }
- }.start();
- }
-
- /**
- * Forcibly terminates the currently running Java virtual machine.
- * Exits with code 1.
- */
- public void halt()
- {
- halt(1);
- }
-
-
- ///////////////////////////////////////////////////////////////////////////
- // Runtime Access //
- ///////////////////////////////////////////////////////////////////////////
-
- /**
- * A simple helper used to log the Runtime memory information.
- *
- * @param rt the runtime
- */
- private void logMemoryUsage(final Runtime rt)
- {
- log.info("Total/free memory: " + rt.totalMemory() + "/" + rt.freeMemory());
- }
-
- /**
- * Hint to the JVM to run the garbage collector.
- */
- public void runGarbageCollector()
- {
- Runtime rt = Runtime.getRuntime();
-
- logMemoryUsage(rt);
- rt.gc();
- log.info("Hinted to the JVM to run garbage collection");
- logMemoryUsage(rt);
- }
-
- /**
- * Hint to the JVM to run any pending object finalizations.
- */
- public void runFinalization()
- {
- Runtime.getRuntime().runFinalization();
- log.info("Hinted to the JVM to run any pending object finalizations");
- }
-
- /**
- * Enable or disable tracing method calls at the Runtime level.
- *
- * @param flag whether to enable trace
- */
- public void traceMethodCalls(final Boolean flag)
- {
- Runtime.getRuntime().traceMethodCalls(flag.booleanValue());
- }
-
- /**
- * Enable or disable tracing instructions the Runtime level.
- *
- * @param flag whether to enable trace
- */
- public void traceInstructions(final Boolean flag)
- {
- Runtime.getRuntime().traceInstructions(flag.booleanValue());
- }
-
-
- ///////////////////////////////////////////////////////////////////////////
- // Server Information //
- ///////////////////////////////////////////////////////////////////////////
-
- public Date getStartDate()
- {
- return startDate;
- }
-
- public String getVersion()
- {
- return version.toString();
- }
-
- public String getVersionName()
- {
- return version.getName();
- }
-
- public String getVersionNumber()
- {
- return version.getVersionNumber();
- }
-
- public String getBuildNumber()
- {
- return version.getBuildNumber();
- }
-
- public String getBuildJVM()
- {
- return version.getBuildJVM();
- }
-
- public String getBuildOS()
- {
- return version.getBuildOS();
- }
-
- public String getBuildID()
- {
- return version.getBuildID();
- }
-
- /**
- * The server build date
- * @return server build date
- */
- public String getBuildDate()
- {
- return version.getBuildDate();
- }
-
- /**
- * The server kernel.
- * @return server kernel.
- */
- public Kernel getKernel()
- {
- return bootstrap.getKernel();
- }
-
- /** A simple thread that keeps the vm alive in the event there are no
- * other threads started.
- */
- private class LifeThread
- extends Thread
- {
- Object lock = new Object();
- LifeThread()
- {
- super("JBossLifeThread");
- }
- public void run()
- {
- synchronized (lock)
- {
- try
- {
- lock.wait();
- }
- catch (InterruptedException ignore)
- {
- }
- }
- log.info("LifeThread.run exits!");
- }
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // Shutdown Hook //
- ///////////////////////////////////////////////////////////////////////////
-
- private class ShutdownHook
- extends Thread
- {
- private boolean forceHalt = true;
-
- public ShutdownHook()
- {
- super("JBoss Shutdown Hook");
-
- String value = SecurityActions.getSystemProperty("jboss.shutdown.forceHalt", null);
- if (value != null)
- {
- forceHalt = new Boolean(value).booleanValue();
- }
- }
-
- public void run()
- {
- shutdown();
- if (forceHalt)
- {
- System.out.println("Halting VM");
- Runtime.getRuntime().halt(0);
- }
- }
-
- public void shutdown()
- {
- // Send a notification that mbeanServer stop is initiated
- log.info("JBoss SHUTDOWN");
- if (log.isTraceEnabled())
- log.trace("Shutdown caller:", new Throwable("Here"));
-
- // Execute the jdk JBossJDKLogManager doReset via reflection
- LogManager lm = LogManager.getLogManager();
- try
- {
- Class[] sig = {};
- Method doReset = lm.getClass().getDeclaredMethod("doReset", sig);
- Object[] args = {};
- doReset.invoke(lm, args);
- }
- catch(Exception e)
- {
- if(log.isTraceEnabled())
- log.trace("No doReset found?", e);
- }
-
- Notification msg = new Notification(Server.STOP_NOTIFICATION_TYPE, this, 2);
- sendNotification(msg);
- log.info("Undeploying all packages");
- shutdownDeployments();
-
- log.debug("Shutting down Microcontainer");
- System.out.println("Shutting down Microcontainer");
-
- // Shutdown the core kernel
- shutdownKernel();
-
- log.info("Shutdown complete");
- System.out.println("Shutdown complete");
- }
-
- protected void shutdownDeployments()
- {
- try
- {
- MainDeployer deployer = bootstrap.getMainDeployer();
- if (deployer != null)
- deployer.shutdown();
- }
- catch (Exception e)
- {
- log.error("Failed to shutdown deployer", e);
- }
- }
-
- /**
- * The <code>shutdownServices</code> method calls the one and only
- * ServiceController to shut down all the mbeans registered with it.
- */
- protected void shutdownKernel()
- {
- try
- {
- BasicKernelDeployer deployer = bootstrap.getKernelDeployer();
- if (deployer != null)
- deployer.shutdown();
- }
- catch (Exception e)
- {
- log.error("Failed to shutdown services", e);
- }
- }
-
- }
-}
Modified: trunk/system/src/resources/tests/bootstrap/default/deployer-beans.xml
===================================================================
--- trunk/system/src/resources/tests/bootstrap/default/deployer-beans.xml 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/system/src/resources/tests/bootstrap/default/deployer-beans.xml 2007-08-14 15:48:44 UTC (rev 64576)
@@ -15,6 +15,10 @@
<property name="profileRoot">${jboss.server.home.url}/profile</property>
</bean>
+ <bean name="ProfileServiceBootstrap" class="org.jboss.system.server.profileservice.ProfileServiceBootstrap">
+ <property name="kernel"><inject bean="jboss.kernel:service=Kernel"/></property>
+ </bean>
+
<!-- The MainDeployer -->
<bean name="MainDeployer" class="org.jboss.deployers.plugins.deployment.MainDeployerImpl">
<property name="structureDeployers">
Modified: trunk/system/src/resources/tests/bootstrap/defaulthotdeploy/deployer-beans.xml
===================================================================
--- trunk/system/src/resources/tests/bootstrap/defaulthotdeploy/deployer-beans.xml 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/system/src/resources/tests/bootstrap/defaulthotdeploy/deployer-beans.xml 2007-08-14 15:48:44 UTC (rev 64576)
@@ -15,6 +15,10 @@
</constructor>
<property name="profileRoot">${jbosstest.deploy.dir}</property>
</bean>
+
+ <bean name="ProfileServiceBootstrap" class="org.jboss.system.server.profileservice.ProfileServiceBootstrap">
+ <property name="kernel"><inject bean="jboss.kernel:service=Kernel"/></property>
+ </bean>
<!-- The MainDeployer -->
<bean name="MainDeployer" class="org.jboss.deployers.plugins.deployment.MainDeployerImpl">
Modified: trunk/system/src/tests/org/jboss/test/server/profileservice/MainTestCase.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/MainTestCase.java 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/system/src/tests/org/jboss/test/server/profileservice/MainTestCase.java 2007-08-14 15:48:44 UTC (rev 64576)
@@ -26,14 +26,18 @@
import java.util.ArrayList;
import org.jboss.Main;
+import org.jboss.bootstrap.microcontainer.ServerImpl;
+import org.jboss.dependency.spi.ControllerContext;
import org.jboss.deployers.client.spi.main.MainDeployer;
import org.jboss.deployers.vfs.spi.client.VFSDeployment;
import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.profileservice.spi.Profile;
import org.jboss.profileservice.spi.ProfileKey;
import org.jboss.profileservice.spi.ProfileService;
import org.jboss.profileservice.spi.Profile.DeploymentPhase;
-import org.jboss.system.server.profileservice.ProfileServiceBootstrap;
+import org.jboss.system.server.ServerConfig;
import org.jboss.test.BaseTestCase;
import org.jboss.virtual.VFS;
import org.jboss.virtual.VirtualFile;
@@ -61,33 +65,44 @@
URL resourcesDir = new URL(bootstrapDir, "..");
log.info("resourcesDir: "+resourcesDir);
System.setProperty("jboss.server.home.url", resourcesDir.toString());
-
- //
- ProfileServiceBootstrap psb = new ProfileServiceBootstrap();
- psb.setDeployerBeansPrefix("bootstrap/default/");
- psb.bootstrap();
- ProfileService ps = psb.getProfileService();
- ProfileKey defaultKey = new ProfileKey("default");
- Profile profile = ps.getProfile(defaultKey);
- VFSDeployment testBeans = profile.getDeployment("test-beans.xml", DeploymentPhase.APPLICATION);
- if( testBeans == null )
+ System.setProperty(ServerConfig.EXIT_ON_SHUTDOWN, "false");
+ URL bootstrapURL = new URL(bootstrapDir, "bootstrap/default/deployer-beans.xml");
+ System.setProperty(ServerConfig.BOOTSTRAP_URL, bootstrapURL.toString());
+
+ //
+ ServerImpl server = new ServerImpl();
+ server.init(System.getProperties());
+ server.start();
+ try
{
- if( profile == null )
- profile = ps.newProfile(defaultKey);
- MainDeployer deployer = psb.getMainDeployer();
- VFS vfs = VFS.getVFS(resourcesDir);
- VirtualFile file = vfs.findChildFromRoot("deploy/beans/test-beans.xml");
- testBeans = createDeployment(file);
- deployer.addDeployment(testBeans);
- profile.addDeployment(testBeans, DeploymentPhase.APPLICATION);
+ Kernel kernel = server.getKernel();
+ ProfileService ps = getBean(kernel, "ProfileService", ProfileService.class);
+ ProfileKey defaultKey = new ProfileKey("default");
+ Profile profile = ps.getProfile(defaultKey);
+ VFSDeployment testBeans = profile.getDeployment("test-beans.xml", DeploymentPhase.APPLICATION);
+ if( testBeans == null )
+ {
+ if( profile == null )
+ profile = ps.newProfile(defaultKey);
+ MainDeployer deployer = getBean(kernel, "MainDeployer", MainDeployer.class);
+ VFS vfs = VFS.getVFS(resourcesDir);
+ VirtualFile file = vfs.findChild("deploy/beans/test-beans.xml");
+ testBeans = createDeployment(file);
+ deployer.addDeployment(testBeans);
+ profile.addDeployment(testBeans, DeploymentPhase.APPLICATION);
+ }
+ // Validate the deployment
+ testBeans = profile.getDeployment("test-beans.xml", DeploymentPhase.APPLICATION);
+ assertNotNull(testBeans);
+ // TODO String type = testBeans.getType();
+ // assertEquals("Deployment type is beans", "beans", type);
}
- // Validate the deployment
- testBeans = profile.getDeployment("test-beans.xml", DeploymentPhase.APPLICATION);
- assertNotNull(testBeans);
- // TODO String type = testBeans.getType();
- // assertEquals("Deployment type is beans", "beans", type);
+ finally
+ {
+ server.shutdown();
+ }
}
-
+
/**
* Test the startup of the org.jboss.Main entry point using the "default"
* profile.
@@ -104,15 +119,27 @@
// Set the jbosstest.support.dir to output/tests-support
File supportDir = new File("output/tests-support");
System.setProperty("jbosstest.support.dir", supportDir.toString());
- // Correct the location of the deployer-beans.xml location
- System.setProperty("jboss.server.deployerBeansPrefix", "bootstrap/default/");
+ System.setProperty(ServerConfig.EXIT_ON_SHUTDOWN, "false");
+ URL bootstrapURL = new URL(bootstrapDir, "bootstrap/default/deployer-beans.xml");
+ System.setProperty(ServerConfig.BOOTSTRAP_URL, bootstrapURL.toString());
ArrayList<String> args = new ArrayList<String>();
String[] tmp = {};
Main main = new Main();
main.boot(args.toArray(tmp));
+ main.shutdown();
}
+ protected <T> T getBean(Kernel kernel, String name, Class<T> expectedType)
+ {
+ KernelController controller = kernel.getController();
+ ControllerContext context = controller.getInstalledContext(name);
+ if (context == null)
+ fail("Context not installed " + name);
+ Object result = context.getTarget();
+ return expectedType.cast(result);
+ }
+
protected VFSDeployment createDeployment(VirtualFile file)
{
return VFSDeploymentFactory.getInstance().createVFSDeployment(file);
Modified: trunk/system/src/tests/org/jboss/test/server/profileservice/MainWithSimpleHotDeployTestCase.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/MainWithSimpleHotDeployTestCase.java 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/system/src/tests/org/jboss/test/server/profileservice/MainWithSimpleHotDeployTestCase.java 2007-08-14 15:48:44 UTC (rev 64576)
@@ -25,12 +25,12 @@
import java.security.CodeSource;
import org.jboss.Main;
+import org.jboss.bootstrap.microcontainer.ServerImpl;
import org.jboss.dependency.spi.ControllerState;
import org.jboss.kernel.Kernel;
import org.jboss.kernel.spi.registry.KernelRegistry;
import org.jboss.kernel.spi.registry.KernelRegistryEntry;
import org.jboss.system.server.Server;
-import org.jboss.system.server.profileservice.ServerImpl;
import org.jboss.test.BaseTestCase;
/**
Modified: trunk/system-jmx/.classpath
===================================================================
--- trunk/system-jmx/.classpath 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/system-jmx/.classpath 2007-08-14 15:48:44 UTC (rev 64576)
@@ -1,39 +1,40 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src/main"/>
- <classpathentry excluding="**/*.java" kind="src" output="output/eclipse-test-support-classes" path="src/tests-support"/>
- <classpathentry kind="src" output="output/eclipse-test-classes" path="src/tests"/>
- <classpathentry kind="lib" path="src/resources/tests"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry combineaccessrules="false" kind="src" path="/j2se"/>
- <classpathentry combineaccessrules="false" kind="src" path="/mbeans"/>
- <classpathentry kind="lib" path="/thirdparty/dom4j/lib/dom4j.jar"/>
- <classpathentry combineaccessrules="false" kind="src" path="/system"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/common-core/lib/jboss-common-core.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/common-logging-spi/lib/jboss-logging-spi.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/common-logging-log4j/lib/jboss-logging-log4j.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-classloader.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-classloader-sources.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-container.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-container-sources.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-dependency.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-dependency-sources.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-kernel.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-kernel-sources.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/jbossxb/lib/jboss-xml-binding.jar"/>
- <classpathentry kind="lib" path="/thirdparty/oswego-concurrent/lib/concurrent.jar"/>
- <classpathentry kind="lib" path="/thirdparty/junit/lib/junit.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/test/lib/jboss-test.jar" sourcepath="/home/svn/JBossHead/projects/test/trunk/test/src/main"/>
- <classpathentry kind="lib" path="/thirdparty/apache-xerces/lib/resolver.jar"/>
- <classpathentry kind="lib" path="/thirdparty/apache-xerces/lib/xercesImpl.jar"/>
- <classpathentry kind="lib" path="/thirdparty/apache-xerces/lib/xml-apis.jar"/>
- <classpathentry kind="lib" path="/thirdparty/apache-log4j/lib/log4j.jar"/>
- <classpathentry combineaccessrules="false" kind="src" path="/jmx"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/common-logging-jdk/lib/jboss-logging-jdk.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/jboss-vfs/lib/jboss-vfs.jar" sourcepath="/thirdparty/jboss/jboss-vfs/lib/jboss-vfs-sources.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-deployers-core-spi.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-deployers-core-spi-sources.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-deployers-client-spi.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-deployers-client-spi-sources.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-deployers-structure-spi.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-deployers-structure-spi-sources.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-deployers-spi.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-deployers-spi-sources.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-deployers-vfs.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-deployers-vfs-sources.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-deployers-vfs-spi.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-deployers-vfs-spi-sources.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-deployers-impl.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-deployers-impl-sources.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/integration/lib/jboss-integration.jar" sourcepath="/thirdparty/jboss/integration/lib/jboss-integration-sources.jar"/>
- <classpathentry kind="output" path="output/eclipse-classes"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main"/>
+ <classpathentry excluding="**/*.java" kind="src" output="output/eclipse-test-support-classes" path="src/tests-support"/>
+ <classpathentry kind="src" output="output/eclipse-test-classes" path="src/tests"/>
+ <classpathentry kind="lib" path="src/resources/tests"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/j2se"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/mbeans"/>
+ <classpathentry kind="lib" path="/thirdparty/dom4j/lib/dom4j.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/system"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/common-core/lib/jboss-common-core.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/common-logging-spi/lib/jboss-logging-spi.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/common-logging-log4j/lib/jboss-logging-log4j.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-classloader.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-classloader-sources.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-container.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-container-sources.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-dependency.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-dependency-sources.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-kernel.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-kernel-sources.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/jbossxb/lib/jboss-xml-binding.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/oswego-concurrent/lib/concurrent.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/junit/lib/junit.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/test/lib/jboss-test.jar" sourcepath="/home/svn/JBossHead/projects/test/trunk/test/src/main"/>
+ <classpathentry kind="lib" path="/thirdparty/apache-xerces/lib/resolver.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/apache-xerces/lib/xercesImpl.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/apache-xerces/lib/xml-apis.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/apache-log4j/lib/log4j.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/jmx"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/common-logging-jdk/lib/jboss-logging-jdk.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/jboss-vfs/lib/jboss-vfs.jar" sourcepath="/thirdparty/jboss/jboss-vfs/lib/jboss-vfs-sources.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-deployers-core-spi.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-deployers-core-spi-sources.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-deployers-client-spi.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-deployers-client-spi-sources.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-deployers-structure-spi.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-deployers-structure-spi-sources.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-deployers-spi.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-deployers-spi-sources.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-deployers-vfs.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-deployers-vfs-sources.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-deployers-vfs-spi.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-deployers-vfs-spi-sources.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-deployers-impl.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-deployers-impl-sources.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/integration/lib/jboss-integration.jar" sourcepath="/thirdparty/jboss/integration/lib/jboss-integration-sources.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/main"/>
+ <classpathentry kind="output" path="output/eclipse-classes"/>
+</classpath>
Modified: trunk/system-jmx/build-test.xml
===================================================================
--- trunk/system-jmx/build-test.xml 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/system-jmx/build-test.xml 2007-08-14 15:48:44 UTC (rev 64576)
@@ -82,6 +82,7 @@
<path refid="jboss.common.logging.spi.classpath"/>
<path refid="jboss.common.logging.log4j.classpath"/>
<path refid="jboss.common.logging.jdk.classpath"/>
+ <path refid="jboss.integration.classpath"/>
<path refid="jboss.profiler.jvmti.classpath" />
<path refid="apache.xerces.classpath" />
<path refid="dom4j.dom4j.classpath" />
@@ -109,6 +110,7 @@
<path refid="jboss.mbeans.classpath" />
<path refid="jboss.jmx.classpath" />
<path refid="jboss.system.classpath" />
+ <path refid="jboss.main.classpath" />
<path refid="jboss.test.classpath" />
<pathelement location="output/classes" />
</path>
Modified: trunk/system-jmx/build.xml
===================================================================
--- trunk/system-jmx/build.xml 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/system-jmx/build.xml 2007-08-14 15:48:44 UTC (rev 64576)
@@ -94,6 +94,7 @@
<path id="dependentmodule.classpath">
<path refid="jboss.j2se.classpath"/>
<path refid="jboss.mbeans.classpath"/>
+ <path refid="jboss.main.classpath"/>
<path refid="jboss.system.classpath"/>
</path>
Deleted: trunk/system-jmx/src/main/org/jboss/system/server/ServerImpl.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/system/server/ServerImpl.java 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/system-jmx/src/main/org/jboss/system/server/ServerImpl.java 2007-08-14 15:48:44 UTC (rev 64576)
@@ -1,1122 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.system.server;
-
-import java.io.File;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
-import java.util.logging.LogManager;
-
-import javax.management.Attribute;
-import javax.management.ListenerNotFoundException;
-import javax.management.MBeanNotificationInfo;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
-import javax.management.Notification;
-import javax.management.NotificationEmitter;
-import javax.management.NotificationFilter;
-import javax.management.NotificationListener;
-import javax.management.ObjectInstance;
-import javax.management.ObjectName;
-
-import org.jboss.Version;
-import org.jboss.deployment.IncompleteDeploymentException;
-import org.jboss.deployment.MainDeployerMBean;
-import org.jboss.logging.JBossJDKLogManager;
-import org.jboss.logging.Logger;
-import org.jboss.mx.loading.RepositoryClassLoader;
-import org.jboss.mx.server.ServerConstants;
-import org.jboss.mx.util.JBossNotificationBroadcasterSupport;
-import org.jboss.mx.util.JMXExceptionDecoder;
-import org.jboss.mx.util.MBeanProxyExt;
-import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.mx.util.ObjectNameFactory;
-import org.jboss.net.protocol.URLStreamHandlerFactory;
-import org.jboss.system.ServiceControllerMBean;
-import org.jboss.system.server.jmx.LazyMBeanServer;
-import org.jboss.util.StopWatch;
-import org.jboss.util.file.FileSuffixFilter;
-import org.jboss.util.file.Files;
-
-/**
- * The main container component of a JBoss server instance.
- *
- * <h3>Concurrency</h3>
- * This class is <b>not</b> thread-safe.
- *
- * @jmx:mbean name="jboss.system:type=Server"
- *
- * @author <a href="mailto:marc.fleury at jboss.org">Marc Fleury</a>
- * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @author <a href="mailto:scott.stark at jboss.org">Scott Stark</a>
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @version $Revision$
- */
-public class ServerImpl
- implements Server, ServerImplMBean, NotificationEmitter
-{
- private final static ObjectName DEFAULT_LOADER_NAME =
- ObjectNameFactory.create(ServerConstants.DEFAULT_LOADER_NAME);
-
- /** Instance logger. */
- private Logger log;
-
- /** Container for version information. */
- private final Version version = Version.getInstance();
-
- /** Package information for org.jboss */
- private final Package jbossPackage = Package.getPackage("org.jboss");
-
- /** The basic configuration for the server. */
- private ServerConfigImpl config;
-
- /** The JMX MBeanServer which will serve as our communication bus. */
- private MBeanServer server;
-
- /** When the server was started. */
- private Date startDate;
-
- /** Flag to indicate if we are started. */
- private boolean started;
-
- /** The JVM shutdown hook */
- private ShutdownHook shutdownHook;
-
- /** The JBoss Life Thread */
- private LifeThread lifeThread;
-
- /** The NotificationBroadcaster implementation delegate */
- private JBossNotificationBroadcasterSupport broadcasterSupport;
-
- /** The bootstrap UCL class loader ObjectName */
- private ObjectName bootstrapUCLName;
- /** A flag indicating if shutdown has been called */
- private boolean isInShutdown;
-
- /**
- * No-arg constructor for {@link ServerLoader}.
- */
- public ServerImpl()
- {
- }
-
- /**
- * Initialize the Server instance.
- *
- * @param props The configuration properties for the server.
- *
- * @throws IllegalStateException Already initialized.
- * @throws Exception Failed to initialize.
- */
- public void init(final Properties props) throws IllegalStateException, Exception
- {
- if (props == null)
- throw new IllegalArgumentException("props is null");
- if (config != null)
- throw new IllegalStateException("already initialized");
-
- ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
-
- try
- {
- Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
- doInit(props);
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(oldCL);
- }
- }
-
- /** Actually does the init'ing... */
- private void doInit(final Properties props) throws Exception
- {
- // Create a new config object from the give properties
- BaseServerConfig baseConfig = new BaseServerConfig(props);
- this.config = new ServerConfigImpl(baseConfig);
-
- /* Initialize the logging layer using the Server.class. The server log
- directory is initialized prior to this to ensure the jboss.server.log.dir
- system property is set in case its used by the logging configs.
- */
- config.getServerLogDir();
- log = Logger.getLogger(Server.class);
-
- // Create the NotificationBroadcaster delegate
- broadcasterSupport = new JBossNotificationBroadcasterSupport();
-
- // Set the VM temp directory to the server tmp dir
- boolean overrideTmpDir = Boolean.getBoolean("jboss.server.temp.dir.overrideJavaTmpDir");
- if( overrideTmpDir )
- {
- File serverTmpDir = config.getServerTempDir();
- System.setProperty("java.io.tmpdir", serverTmpDir.getCanonicalPath());
- }
-
- // Setup URL handlers - do this before initializing the ServerConfig
- initURLHandlers();
- baseConfig.initURLs();
-
- log.info("Starting JBoss (MX MicroKernel)...");
-
- if (jbossPackage != null)
- {
- // Show what release this is...
- log.info("Release ID: " +
- jbossPackage.getImplementationTitle() + " " +
- jbossPackage.getImplementationVersion());
- }
- else
- {
- log.warn("could not get package info to display release, either the " +
- "jar manifest in jboss-system.jar has been mangled or you're " +
- "running unit tests from ant outside of JBoss itself.");
- }
-
- log.debug("Using config: " + config);
-
- // make sure our impl type is exposed
- log.debug("Server type: " + getClass());
-
- // log the boot classloader
- ClassLoader cl = getClass().getClassLoader();
- log.debug("Server loaded through: " + cl.getClass().getName());
-
- // log the boot URLs
- if (cl instanceof NoAnnotationURLClassLoader)
- {
- NoAnnotationURLClassLoader nacl = (NoAnnotationURLClassLoader)cl;
- URL[] bootURLs = nacl.getAllURLs();
- log.debug("Boot URLs:");
- for (int i = 0; i < bootURLs.length; i++)
- {
- log.debug(" " + bootURLs[i]);
- }
- }
-
- // Log the basic configuration elements
- log.info("Home Dir: " + config.getHomeDir());
- log.info("Home URL: " + config.getHomeURL());
- log.debug("Library URL: " + config.getLibraryURL());
- log.info("Patch URL: " + config.getPatchURL());
- log.info("Server Name: " + config.getServerName());
- log.info("Server Home Dir: " + config.getServerHomeDir());
- log.info("Server Home URL: " + config.getServerHomeURL());
- log.debug("Server Data Dir: " + config.getServerDataDir());
- log.info("Server Temp Dir: " + config.getServerTempDir());
- log.debug("Server Config URL: " + config.getServerConfigURL());
- log.debug("Server Library URL: " + config.getServerLibraryURL());
- log.info("Root Deployment Filename: " + config.getRootDeploymentFilename());
- }
-
- /**
- * The <code>initURLHandlers</code> method calls
- * internalInitURLHandlers. if requireJBossURLStreamHandlers is
- * false, any exceptions are logged and ignored.
- *
- */
- private void initURLHandlers()
- {
- if (config.getRequireJBossURLStreamHandlerFactory())
- {
- internalInitURLHandlers();
- } // end of if ()
- else
- {
- try
- {
- internalInitURLHandlers();
- }
- catch (SecurityException e)
- {
- log.warn("You do not have permissions to set URLStreamHandlerFactory", e);
- } // end of try-catch
- catch (Error e)
- {
- log.warn("URLStreamHandlerFactory already set", e);
- } // end of catch
- } // end of else
- }
-
- /**
- * Set up our only URLStreamHandlerFactory.
- * This is needed to ensure Sun's version is not used (as it leaves files
- * locked on Win2K/WinXP platforms.
- */
- private void internalInitURLHandlers()
- {
- try
- {
- // Install a URLStreamHandlerFactory that uses the TCL
- URL.setURLStreamHandlerFactory(new URLStreamHandlerFactory());
-
- // Preload JBoss URL handlers
- URLStreamHandlerFactory.preload();
- }
- catch (Error error)
- { //very naughty but we HAVE to do this or
- //we'll fail if we ever try to do this again
- log.warn("Caught Throwable Error, this probably means " +
- "we've already set the URLStreamHAndlerFactory before");
- //Sys.out because we don't have logging yet
- }
-
- // Include the default JBoss protocol handler package
- String handlerPkgs = System.getProperty("java.protocol.handler.pkgs");
- if (handlerPkgs != null)
- {
- handlerPkgs += "|org.jboss.net.protocol";
- }
- else
- {
- handlerPkgs = "org.jboss.net.protocol";
- }
- System.setProperty("java.protocol.handler.pkgs", handlerPkgs);
- }
-
- /**
- * Get the typed server configuration object which the
- * server has been initalized to use.
- *
- * @return Typed server configuration object.
- *
- * @throws IllegalStateException Not initialized.
- */
- public ServerConfig getConfig() throws IllegalStateException
- {
- if (config == null)
- throw new IllegalStateException("not initialized");
-
- return config.getConfig();
- }
-
- /**
- * Check if the server is started.
- *
- * @return True if the server is started, else false.
- * @jmx:managed-attribute
- */
- public boolean isStarted()
- {
- return started;
- }
-
- /**
- Check if the shutdown operation has been called/is in progress.
-
- @return true if shutdown has been called, false otherwise
- */
- public boolean isInShutdown()
- {
- return isInShutdown;
- }
-
- /**
- * Start the Server instance.
- *
- * @throws IllegalStateException Already started or not initialized.
- * @throws Exception Failed to start.
- */
- public void start() throws IllegalStateException, Exception
- {
- // make sure we are initialized
- getConfig();
-
- // make sure we aren't started yet
- if (started)
- throw new IllegalStateException("already started");
-
- ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
-
- try
- {
- Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
-
- // Deal with those pesky JMX throwables
- try
- {
- doStart();
- }
- catch (Exception e)
- {
- JMXExceptionDecoder.rethrow(e);
- }
- }
- catch (Throwable t)
- {
- log.debug("Failed to start", t);
-
- if (t instanceof Exception)
- throw (Exception)t;
- if (t instanceof Error)
- throw (Error)t;
-
- throw new org.jboss.util.UnexpectedThrowable(t);
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(oldCL);
- }
- }
-
- /** Actually does the starting... */
- private void doStart() throws Exception
- {
- // See how long it takes us to start up
- StopWatch watch = new StopWatch(true);
-
- // remeber when we we started
- startDate = new Date();
-
- log.debug("Starting General Purpose Architecture (GPA)...");
-
- // Create the MBeanServer
- String builder = System.getProperty(ServerConstants.MBEAN_SERVER_BUILDER_CLASS_PROPERTY,
- ServerConstants.DEFAULT_MBEAN_SERVER_BUILDER_CLASS);
- System.setProperty(ServerConstants.MBEAN_SERVER_BUILDER_CLASS_PROPERTY, builder);
-
- // Check if we'll use the platform MBeanServer or instantiate our own
- if (config.getPlatformMBeanServer() == true)
- {
- // jdk1.5+
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- Class clazz = cl.loadClass("java.lang.management.ManagementFactory");
- Method method = clazz.getMethod("getPlatformMBeanServer", null);
- server = (MBeanServer)method.invoke(null, null);
- // Tell the MBeanServerLocator to point to this server
- MBeanServerLocator.setJBoss(server);
- /* If the LazyMBeanServer was used, we need to reset to the jboss
- MBeanServer to use our implementation for the jboss services.
- */
- server = LazyMBeanServer.resetToJBossServer(server);
- }
- else
- {
- // Create our own MBeanServer
- server = MBeanServerFactory.createMBeanServer("jboss");
- }
- log.debug("Created MBeanServer: " + server);
-
- // Register server components
- server.registerMBean(this, ServerImplMBean.OBJECT_NAME);
- server.registerMBean(config, ServerConfigImplMBean.OBJECT_NAME);
-
- // Initialize spine boot libraries
- RepositoryClassLoader ucl = initBootLibraries();
- bootstrapUCLName = ucl.getObjectName();
- server.registerMBean(ucl, bootstrapUCLName);
-
- // Set ServiceClassLoader as classloader for the construction of
- // the basic system
- Thread.currentThread().setContextClassLoader(ucl);
-
- // General Purpose Architecture information
- createMBean("org.jboss.system.server.ServerInfo",
- "jboss.system:type=ServerInfo");
-
- // Service Controller
- ObjectName controller = createMBean("org.jboss.system.ServiceController",
- "jboss.system:service=ServiceController");
-
- // Main Deployer
- ObjectName mainDeployer = startBootService(controller,
- "org.jboss.deployment.MainDeployer", "jboss.system:service=MainDeployer");
- server.setAttribute(mainDeployer,
- new Attribute("ServiceController", controller));
-
- // Install the shutdown hook
- shutdownHook = new ShutdownHook(controller, mainDeployer);
- shutdownHook.setDaemon(true);
-
- try
- {
- Runtime.getRuntime().addShutdownHook(shutdownHook);
- log.debug("Shutdown hook added");
- }
- catch (Exception e)
- {
- log.warn("Failed to add shutdown hook; ignoring", e);
- }
-
- // JARDeployer, required to process <classpath>
- startBootService(controller, "org.jboss.deployment.JARDeployer",
- "jboss.system:service=JARDeployer");
-
- // SARDeployer, required to process *-service.xml
- startBootService(controller, "org.jboss.deployment.SARDeployer",
- "jboss.system:service=ServiceDeployer");
-
- log.info("Core system initialized");
-
- // Ok, now deploy the root deployable to finish the job
-
- MainDeployerMBean md = (MainDeployerMBean)
- MBeanProxyExt.create(MainDeployerMBean.class, mainDeployer, server);
-
- try
- {
- md.deploy(config.getServerConfigURL() + config.getRootDeploymentFilename());
- }
- catch (IncompleteDeploymentException e)
- {
- log.error("Root deployment has missing dependencies; continuing", e);
- }
-
- lifeThread = new LifeThread();
- lifeThread.start();
-
- started = true;
-
- // Send a notification that the startup is complete
- Notification msg = new Notification(START_NOTIFICATION_TYPE, this, 1);
- msg.setUserData(new Long(watch.getLapTime()));
- sendNotification(msg);
-
- watch.stop();
-
- if (jbossPackage != null)
- {
- // Tell the world how fast it was =)
- log.info("JBoss (MX MicroKernel) [" + jbossPackage.getImplementationVersion() +
- "] Started in " + watch);
- }
- else
- {
- log.warn("could not get package info to display release, either the " +
- "jar manifest in jboss-boot.jar has been mangled or you're " +
- "running unit tests from ant outside of JBoss itself.");
- }
- }
-
- /**
- * Instantiate and register a service for the given classname into the MBean server.
- */
- private ObjectName createMBean(final String classname, String name)
- throws Exception
- {
- ObjectName mbeanName = null;
- if( name != null )
- mbeanName = new ObjectName(name);
- try
- {
- // See if there is an xmbean descriptor for the bootstrap mbean
- URL xmbeanDD = new URL("resource:xmdesc/"+classname+"-xmbean.xml");
- Object resource = server.instantiate(classname);
- // Create the XMBean
- Object[] args = {resource, xmbeanDD};
- String[] sig = {Object.class.getName(), URL.class.getName()};
- ObjectInstance instance = server.createMBean("org.jboss.mx.modelmbean.XMBean",
- mbeanName,
- bootstrapUCLName,
- args,
- sig);
- mbeanName = instance.getObjectName();
- log.debug("Created system XMBean: "+mbeanName);
- }
- catch(Exception e)
- {
- log.debug("Failed to create xmbean for: "+classname);
- mbeanName = server.createMBean(classname, mbeanName).getObjectName();
- log.debug("Created system MBean: " + mbeanName);
- }
-
- return mbeanName;
- }
-
- /**
- * Instantiate/register, create and start a service for the given classname.
- */
- private ObjectName startBootService(final ObjectName controllerName,
- final String classname, final String name)
- throws Exception
- {
- ObjectName mbeanName = createMBean(classname, name);
-
- // now go through the create/start sequence on the new service
-
- Object[] args = { mbeanName };
- String[] sig = { ObjectName.class.getName() };
-
- server.invoke(controllerName, "create", args, sig);
- server.invoke(controllerName, "start", args, sig);
-
- return mbeanName;
- }
-
- /**
- * Initialize the boot libraries.
- */
- private RepositoryClassLoader initBootLibraries() throws Exception
- {
- // Build the list of URL for the spine to boot
- List list = new ArrayList();
-
- // Add the patch URL. If the url protocol is file, then
- // add the contents of the directory it points to
- URL patchURL = config.getPatchURL();
- if (patchURL != null)
- {
- if (patchURL.getProtocol().equals("file"))
- {
- File dir = new File(patchURL.getFile());
- if (dir.exists())
- {
- // Add the local file patch directory
- list.add(dir.toURL());
-
- // Add the contents of the directory too
- File[] jars = dir.listFiles(new FileSuffixFilter(new String[] { ".jar", ".zip" }, true));
-
- for (int j = 0; jars != null && j < jars.length; j++)
- {
- list.add(jars[j].getCanonicalFile().toURL());
- }
- }
- }
- else
- {
- list.add(patchURL);
- }
- }
-
- // Add the server configuration directory to be able to load config files as resources
- list.add(config.getServerConfigURL());
-
- // Not needed, ServerImpl will have the basics on its classpath from ServerLoader
- // may want to bring this back at some point if we want to have reloadable core
- // components...
-
- // URL libraryURL = config.getLibraryURL();
- // list.add(new URL(libraryURL, "jboss-spine.jar"));
-
- log.debug("Boot url list: " + list);
-
- // Create loaders for each URL
- RepositoryClassLoader loader = null;
- for (Iterator iter = list.iterator(); iter.hasNext();)
- {
- URL url = (URL)iter.next();
- log.debug("Creating loader for URL: " + url);
-
- // This is a boot URL, so key it on itself.
- Object[] args = {url, Boolean.TRUE};
- String[] sig = {"java.net.URL", "boolean"};
- loader = (RepositoryClassLoader) server.invoke(DEFAULT_LOADER_NAME, "newClassLoader", args, sig);
- }
- return loader;
- }
-
- /**
- * Shutdown the Server instance and run shutdown hooks.
- *
- * <p>If the exit on shutdown flag is true, then {@link #exit}
- * is called, else only the shutdown hook is run.
- *
- * @jmx:managed-operation
- *
- * @throws IllegalStateException No started.
- */
- public void shutdown() throws IllegalStateException
- {
- if (log.isTraceEnabled())
- log.trace("Shutdown caller:", new Throwable("Here"));
-
- if (!started)
- throw new IllegalStateException("Server not started");
-
- isInShutdown = true;
- boolean exitOnShutdown = config.getExitOnShutdown();
- boolean blockingShutdown = config.getBlockingShutdown();
- log.info("Shutting down the server, blockingShutdown: " + blockingShutdown);
-
- if (exitOnShutdown)
- {
- exit(0);
- }
- else
- {
- // signal lifethread to exit; if no non-daemon threads
- // remain, the JVM will eventually exit
- lifeThread.interrupt();
-
- if (blockingShutdown)
- {
- shutdownHook.shutdown();
- }
- else
- {
- // start in new thread to give positive
- // feedback to requesting client of success.
- new Thread()
- {
- public void run()
- {
- // just run the hook, don't call System.exit, as we may
- // be embeded in a vm that would not like that very much
- shutdownHook.shutdown();
- }
- }.start();
- }
- }
- }
-
- /**
- * Exit the JVM, run shutdown hooks, shutdown the server.
- *
- * @jmx:managed-operation
- *
- * @param exitcode The exit code returned to the operating system.
- */
- public void exit(final int exitcode)
- {
- // exit() in new thread so that we might have a chance to give positive
- // feed back to requesting client of success.
- new Thread()
- {
- public void run()
- {
- log.info("Server exit(" + exitcode + ") called");
-
- // Set exit code in the shutdown hook, in case halt is enabled
- shutdownHook.setHaltExitCode(exitcode);
-
- // Initiate exiting, shutdown hook will be called
- Runtime.getRuntime().exit(exitcode);
- }
- }.start();
- }
-
- /**
- * Exit the JVM with code 1, run shutdown hooks, shutdown the server.
- *
- * @jmx:managed-operation
- */
- public void exit()
- {
- exit(1);
- }
-
- /**
- * Forcibly terminates the currently running Java virtual machine.
- *
- * @param exitcode The exit code returned to the operating system.
- *
- * @jmx:managed-operation
- */
- public void halt(final int exitcode)
- {
- // halt() in new thread so that we might have a chance to give positive
- // feed back to requesting client of success.
- new Thread()
- {
- public void run()
- {
- System.err.println("Server halt(" + exitcode + ") called, halting the JVM now!");
- Runtime.getRuntime().halt(exitcode);
- }
- }.start();
- }
-
- /**
- * Forcibly terminates the currently running Java virtual machine.
- * Halts with code 1.
- *
- * @jmx:managed-operation
- */
- public void halt()
- {
- halt(1);
- }
-
-
- ///////////////////////////////////////////////////////////////////////////
- // Runtime Access //
- ///////////////////////////////////////////////////////////////////////////
-
- /** A simple helper used to log the Runtime memory information. */
- private void logMemoryUsage(final Runtime rt)
- {
- log.info("Total/free memory: " + rt.totalMemory() + "/" + rt.freeMemory());
- }
-
- /**
- * Hint to the JVM to run the garbage collector.
- *
- * @jmx:managed-operation
- */
- public void runGarbageCollector()
- {
- Runtime rt = Runtime.getRuntime();
-
- logMemoryUsage(rt);
- rt.gc();
- log.info("Hinted to the JVM to run garbage collection");
- logMemoryUsage(rt);
- }
-
- /**
- * Hint to the JVM to run any pending object finailizations.
- *
- * @jmx:managed-operation
- */
- public void runFinalization()
- {
- Runtime.getRuntime().runFinalization();
- log.info("Hinted to the JVM to run any pending object finalizations");
- }
-
- /**
- * Enable or disable tracing method calls at the Runtime level.
- *
- * @jmx:managed-operation
- */
- public void traceMethodCalls(final Boolean flag)
- {
- Runtime.getRuntime().traceMethodCalls(flag.booleanValue());
- }
-
- /**
- * Enable or disable tracing instructions the Runtime level.
- *
- * @jmx:managed-operation
- */
- public void traceInstructions(final Boolean flag)
- {
- Runtime.getRuntime().traceInstructions(flag.booleanValue());
- }
-
-
- ///////////////////////////////////////////////////////////////////////////
- // Server Information //
- ///////////////////////////////////////////////////////////////////////////
-
- /**
- * @jmx:managed-attribute
- */
- public Date getStartDate()
- {
- return startDate;
- }
-
- /**
- * @jmx:managed-attribute
- */
- public String getVersion()
- {
- return version.toString();
- }
-
- /**
- * @jmx:managed-attribute
- */
- public String getVersionName()
- {
- return version.getName();
- }
-
- /**
- * @jmx:managed-attribute
- */
- public String getVersionNumber()
- {
- return version.getVersionNumber();
- }
-
- /**
- * @jmx:managed-attribute
- */
- public String getBuildNumber()
- {
- return version.getBuildNumber();
- }
-
- /**
- * @jmx:managed-attribute
- */
- public String getBuildJVM()
- {
- return version.getBuildJVM();
- }
-
- /**
- * @jmx:managed-attribute
- */
- public String getBuildOS()
- {
- return version.getBuildOS();
- }
-
- /**
- * @jmx:managed-attribute
- */
- public String getBuildID()
- {
- return version.getBuildID();
- }
-
- /**
- * @jmx:managed-attribute
- */
- public String getBuildDate()
- {
- return version.getBuildDate();
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // NotificationEmitter //
- ///////////////////////////////////////////////////////////////////////////
-
- public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
- {
- broadcasterSupport.addNotificationListener(listener, filter, handback);
- }
-
- public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException
- {
- broadcasterSupport.removeNotificationListener(listener);
- }
-
- public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
- throws ListenerNotFoundException
- {
- broadcasterSupport.removeNotificationListener(listener, filter, handback);
- }
-
- public MBeanNotificationInfo[] getNotificationInfo()
- {
- return broadcasterSupport.getNotificationInfo();
- }
-
- public void sendNotification(Notification notification)
- {
- broadcasterSupport.sendNotification(notification);
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // Lifecycle Thread //
- ///////////////////////////////////////////////////////////////////////////
-
- /** A simple thread that keeps the vm alive in the event there are no
- * other threads started.
- */
- private class LifeThread
- extends Thread
- {
- Object lock = new Object();
- LifeThread()
- {
- super("JBossLifeThread");
- }
- public void run()
- {
- synchronized (lock)
- {
- try
- {
- lock.wait();
- }
- catch (InterruptedException ignore)
- {
- }
- }
- log.debug("LifeThread.run() exits!");
- }
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // Shutdown Hook //
- ///////////////////////////////////////////////////////////////////////////
-
- private class ShutdownHook
- extends Thread
- {
- /** The ServiceController which we will ask to shut things down with. */
- private ObjectName controller;
-
- /** The MainDeployer which we will ask to undeploy everything. */
- private ObjectName mainDeployer;
-
- /** Whether to halt the JMV at the end of the shutdown hook */
- private boolean forceHalt = true;
-
- /** The exit code to use if forceHalt is enabled */
- private int haltExitCode;
-
- /** Mark when shutdown has been performed */
- private boolean shutdownCalled;
-
- public ShutdownHook(final ObjectName controller, final ObjectName mainDeployer)
- {
- super("JBoss Shutdown Hook");
-
- this.controller = controller;
- this.mainDeployer = mainDeployer;
-
- String value = System.getProperty("jboss.shutdown.forceHalt", null);
- if (value != null)
- {
- forceHalt = new Boolean(value).booleanValue();
- }
- }
-
- public void setHaltExitCode(int haltExitCode)
- {
- this.haltExitCode = haltExitCode;
- }
-
- public void run()
- {
- log.info("Runtime shutdown hook called, forceHalt: " + forceHalt);
-
- // shutdown the server
- shutdown();
-
- // Execute the jdk JBossJDKLogManager doReset
- LogManager lm = LogManager.getLogManager();
- if (lm instanceof JBossJDKLogManager)
- {
- JBossJDKLogManager jbosslm = (JBossJDKLogManager)lm;
- jbosslm.doReset();
- }
-
- // later bitch - other shutdown hooks may be killed
- if (forceHalt)
- {
- System.out.println("Halting VM");
- Runtime.getRuntime().halt(haltExitCode);
- }
- }
-
- public void shutdown()
- {
- if (log.isTraceEnabled())
- log.trace("Shutdown caller:", new Throwable("Here"));
-
- // avoid entering twice; may happen when called directly
- // from ServerImpl.shutdown(), then called again when all
- // non-daemon threads have exited and the ShutdownHook runs.
- if (shutdownCalled)
- return;
- else
- shutdownCalled = true;
-
- // Send a notification that server stop is initiated
- Notification msg = new Notification(STOP_NOTIFICATION_TYPE, this, 2);
- sendNotification(msg);
-
- // MainDeployer.shutdown()
- log.info("JBoss SHUTDOWN: Undeploying all packages");
- shutdownDeployments();
-
- // ServiceController.shutdown()
- log.debug("Shutting down all services");
- shutdownServices();
-
- // Make sure all mbeans are unregistered
- removeMBeans();
-
- // Cleanup tmp/deploy dir
- log.debug("Deleting server tmp/deploy directory");
- File tmp = config.getServerTempDir();
- File tmpDeploy = new File(tmp, "deploy");
- Files.delete(tmpDeploy);
-
- // Done
- log.info("Shutdown complete");
- System.out.println("Shutdown complete");
- }
-
- protected void shutdownDeployments()
- {
- try
- {
- // get the deployed objects from ServiceController
- server.invoke(mainDeployer,
- "shutdown",
- new Object[0],
- new String[0]);
- }
- catch (Exception e)
- {
- Throwable t = JMXExceptionDecoder.decode(e);
- log.error("Failed to shutdown deployer", t);
- }
- }
-
- /**
- * The <code>shutdownServices</code> method calls the one and only
- * ServiceController to shut down all the mbeans registered with it.
- */
- protected void shutdownServices()
- {
- try
- {
- // get the deployed objects from ServiceController
- server.invoke(controller,
- "shutdown",
- new Object[0],
- new String[0]);
- }
- catch (Exception e)
- {
- Throwable t = JMXExceptionDecoder.decode(e);
- log.error("Failed to shutdown services", t);
- }
- }
-
- /**
- * The <code>removeMBeans</code> method uses the mbean server to unregister
- * all the mbeans registered here.
- */
- protected void removeMBeans()
- {
- try
- {
- server.unregisterMBean(ServiceControllerMBean.OBJECT_NAME);
- server.unregisterMBean(ServerConfigImplMBean.OBJECT_NAME);
- server.unregisterMBean(ServerImplMBean.OBJECT_NAME);
- }
- catch (Exception e)
- {
- Throwable t = JMXExceptionDecoder.decode(e);
- log.error("Failed to unregister mbeans", t);
- }
- try
- {
- MBeanServer registeredServer = server;
- if (config.getPlatformMBeanServer() == true)
- registeredServer = LazyMBeanServer.getRegisteredMBeanServer(server);
- MBeanServerFactory.releaseMBeanServer(registeredServer);
- }
- catch (Exception e)
- {
- Throwable t = JMXExceptionDecoder.decode(e);
- log.error("Failed to release mbean server", t);
- }
- }
- }
-}
Modified: trunk/testsuite/.classpath
===================================================================
--- trunk/testsuite/.classpath 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/testsuite/.classpath 2007-08-14 15:48:44 UTC (rev 64576)
@@ -93,5 +93,6 @@
<classpathentry kind="lib" path="/thirdparty/jboss/integration/lib/jboss-integration.jar" sourcepath="/thirdparty/jboss/integration/lib/integration-sources.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/jboss-security-spi/lib/jboss-security-spi.jar" sourcepath="/thirdparty/jboss/jboss-security-spi/lib/jboss-security-spi-sources.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/jbosssx/lib/jbosssx.jar" sourcepath="/thirdparty/jboss/security/lib/jbosssx-sources.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/main"/>
<classpathentry kind="output" path="output/eclipse-classes"/>
</classpath>
Modified: trunk/testsuite/build.xml
===================================================================
--- trunk/testsuite/build.xml 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/testsuite/build.xml 2007-08-14 15:48:44 UTC (rev 64576)
@@ -169,6 +169,7 @@
<property name="jboss.internal-server.lib" value="${jboss.internal-server.root}/lib"/>
<path id="jboss.internal-server.classpath">
<pathelement path="${jboss.server.lib}/jboss.jar"/>
+ <pathelement path="${jboss.server.lib}/jboss-main.jar"/>
<pathelement path="${jboss.server.lib}/jboss-system.jar"/>
</path>
@@ -203,6 +204,8 @@
<path refid="jboss.jbosssx.classpath"/>
<path refid="jboss.security.int.classpath"/>
<path refid="jboss.server.classpath"/>
+ <path refid="jboss.main.classpath"/>
+ <path refid="jboss.bootstrap.classpath"/>
<path refid="jboss.system.classpath"/>
<path refid="jboss.systemjmx.classpath"/>
<path refid="jboss.test.classpath"/>
@@ -271,7 +274,6 @@
<pathelement path="${project.tools}/lib/ant.jar"/>
<pathelement path="${project.tools}/lib/ant-junit.jar"/>
<path refid="jboss.ejb3.classpath"/>
- <path refid="jboss.ejb3x.classpath"/>
<path refid="jboss.jmx.classpath"/>
<path refid="jboss.jmx-remoting.classpath"/>
<path refid="jboss.test.classpath"/>
@@ -292,7 +294,6 @@
<pathelement path="${project.tools}/lib/ant.jar"/>
<pathelement path="${project.tools}/lib/ant-junit.jar"/>
<path refid="jboss.ejb3.classpath"/>
- <path refid="jboss.ejb3x.classpath"/>
<path refid="jboss.jmx.classpath"/>
<path refid="jboss.jmx-remoting.classpath"/>
<path refid="jboss.test.classpath"/>
Modified: trunk/tomcat/.classpath
===================================================================
--- trunk/tomcat/.classpath 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/tomcat/.classpath 2007-08-14 15:48:44 UTC (rev 64576)
@@ -55,5 +55,6 @@
<classpathentry kind="lib" path="/thirdparty/jboss/integration/lib/jboss-integration.jar" sourcepath="/thirdparty/jboss/integration/lib/integration-sources.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/jbosssx/lib/jbosssx.jar" sourcepath="/thirdparty/jboss/security/lib/jbosssx-sources.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/jboss-security-spi/lib/jboss-security-spi.jar" sourcepath="/thirdparty/jboss/jboss-security-spi/lib/jboss-security-spi-sources.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/main"/>
<classpathentry kind="output" path="output/eclipse-classes"/>
</classpath>
Modified: trunk/tomcat/build-test.xml
===================================================================
--- trunk/tomcat/build-test.xml 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/tomcat/build-test.xml 2007-08-14 15:48:44 UTC (rev 64576)
@@ -156,6 +156,7 @@
<property name="jboss.internal-server.lib" value="${jboss.internal-server.root}/lib"/>
<path id="jboss.internal-server.classpath">
<pathelement path="${jboss.server.lib}/jboss.jar"/>
+ <pathelement path="${jboss.server.lib}/jboss-main.jar"/>
<pathelement path="${jboss.server.lib}/jboss-system.jar"/>
</path>
@@ -168,6 +169,7 @@
<path refid="jboss.common.classpath"/>
<path refid="jboss.cache.classpath"/>
<path refid="jboss.cluster.classpath"/>
+ <path refid="jboss.main.classpath"/>
<path refid="jboss.system.classpath"/>
<path refid="jboss.naming.classpath"/>
<path refid="jboss.transaction.classpath"/>
Modified: trunk/tomcat/build.xml
===================================================================
--- trunk/tomcat/build.xml 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/tomcat/build.xml 2007-08-14 15:48:44 UTC (rev 64576)
@@ -78,6 +78,7 @@
<path id="dependentmodule.classpath">
<path refid="jboss.jboss.javaee.classpath"/>
<path refid="jboss.jboss.jaspi.api.classpath"/>
+ <path refid="jboss.main.classpath"/>
<path refid="jboss.system.classpath"/>
<path refid="jboss.systemjmx.classpath"/>
<path refid="jboss.jboss.security.spi.classpath"/>
Modified: trunk/tools/etc/buildmagic/modules.ent
===================================================================
--- trunk/tools/etc/buildmagic/modules.ent 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/tools/etc/buildmagic/modules.ent 2007-08-14 15:48:44 UTC (rev 64576)
@@ -1,29 +1,18 @@
<!-- $Id$ -->
-<!-- container -->
-<property name="jboss.container.root" value="${project.root}/container"/>
-<property name="jboss.container.lib" value="${jboss.container.root}/output/lib"/>
-<path id="jboss.container.classpath">
- <fileset dir="${jboss.container.lib}">
- <include name="jboss-container.jar"/>
- </fileset>
+<!-- Main -->
+<property name="jboss.main.root" value="${project.root}/main/output"/>
+<property name="jboss.main.lib" value="${jboss.main.root}/lib"/>
+<path id="jboss.main.classpath">
+ <pathelement path="${jboss.main.lib}/jboss-main.jar"/>
</path>
-<!-- dependency -->
-<property name="jboss.dependency.root" value="${project.root}/dependency"/>
-<property name="jboss.dependency.lib" value="${jboss.dependency.root}/output/lib"/>
-<path id="jboss.dependency.classpath">
- <fileset dir="${jboss.dependency.lib}">
- <include name="jboss-dependency.jar"/>
- </fileset>
+
+<!-- Bootstrap -->
+<property name="jboss.bootstrap.root" value="${project.root}/bootstrap/output"/>
+<property name="jboss.bootstrap.lib" value="${jboss.bootstrap.root}/lib"/>
+<path id="jboss.bootstrap.classpath">
+ <pathelement path="${jboss.bootstrap.lib}/jboss-bootstrap.jar"/>
</path>
-<!-- kernel -->
-<property name="jboss.kernel.root" value="${project.root}/kernel"/>
-<property name="jboss.kernel.lib" value="${jboss.kernel.root}/output/lib"/>
-<path id="jboss.kernel.classpath">
- <fileset dir="${jboss.kernel.lib}">
- <include name="jboss-microcontainer.jar"/>
- </fileset>
-</path>
<!-- Aspects -->
<property name="jboss.aspects.root" value="${project.root}/aspects/output"/>
@@ -65,13 +54,6 @@
<pathelement path="${jboss.iiop.lib}/jboss-iiop.jar"/>
</path>
-<!-- J2EE -->
-<property name="jboss.j2ee.root" value="${project.root}/j2ee/output"/>
-<property name="jboss.j2ee.lib" value="${jboss.j2ee.root}/lib"/>
-<path id="jboss.j2ee.classpath">
- <pathelement path="${jboss.j2ee.lib}/jboss-j2ee.jar"/>
-</path>
-
<!-- J2SE -->
<property name="jboss.j2se.root" value="${project.root}/j2se/output"/>
<property name="jboss.j2se.lib" value="${jboss.j2se.root}/lib"/>
@@ -108,16 +90,6 @@
<pathelement path="${jboss.embedded.root}/bootstrap"/>
</path>
-<!-- EJB3X -->
-<property name="jboss.ejb3x.root" value="${project.root}/ejb3x/output"/>
-<property name="jboss.ejb3x.lib" value="${jboss.ejb3x.root}/lib"/>
-<path id="jboss.ejb3x.classpath">
- <pathelement path="${jboss.ejb3x.lib}/jboss-ejb3x.jar"/>
-</path>
-<path id="jboss.ejb3x.jdk14.classpath">
- <pathelement path="${jboss.ejb3x.lib}/jboss-ejb3x-jdk14.jar"/>
-</path>
-
<!-- JCA -->
<property name="jboss.jca.root" value="${project.root}/connector/output"/>
<property name="jboss.jca.lib" value="${jboss.jca.root}/lib"/>
Modified: trunk/transaction/.classpath
===================================================================
--- trunk/transaction/.classpath 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/transaction/.classpath 2007-08-14 15:48:44 UTC (rev 64576)
@@ -12,5 +12,6 @@
<classpathentry kind="lib" path="/thirdparty/oswego-concurrent/lib/concurrent.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/jboss-javaee/lib/jboss-javaee.jar" sourcepath="/thirdparty/jboss/jboss-javaee/lib/jboss-javaee-sources.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/integration/lib/jboss-integration.jar" sourcepath="/thirdparty/jboss/integration/lib/integration-sources.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/main"/>
<classpathentry kind="output" path="output/eclipse-classes"/>
</classpath>
Modified: trunk/transaction/build.xml
===================================================================
--- trunk/transaction/build.xml 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/transaction/build.xml 2007-08-14 15:48:44 UTC (rev 64576)
@@ -97,6 +97,7 @@
<path refid="jboss.systemjmx.classpath"/>
<path refid="jboss.system.classpath"/>
<path refid="jboss.j2se.classpath"/>
+ <path refid="jboss.main.classpath"/>
</path>
<!-- ===== -->
Modified: trunk/varia/.classpath
===================================================================
--- trunk/varia/.classpath 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/varia/.classpath 2007-08-14 15:48:44 UTC (rev 64576)
@@ -39,5 +39,6 @@
<classpathentry kind="lib" path="/thirdparty/jboss/integration/lib/jboss-integration.jar" sourcepath="/thirdparty/jboss/integration/lib/integration-sources.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/security"/>
<classpathentry kind="lib" path="/thirdparty/jboss/jbosssx/lib/jbosssx.jar" sourcepath="/thirdparty/jboss/security/lib/jbosssx-sources.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/main"/>
<classpathentry kind="output" path="output/eclipse-classes"/>
</classpath>
Modified: trunk/varia/build.xml
===================================================================
--- trunk/varia/build.xml 2007-08-14 15:39:53 UTC (rev 64575)
+++ trunk/varia/build.xml 2007-08-14 15:48:44 UTC (rev 64576)
@@ -111,6 +111,7 @@
<path refid="jboss.common.logging.jdk.classpath"/>
<path refid="jboss.jmx.classpath"/>
<path refid="jboss.cluster.classpath"/>
+ <path refid="jboss.main.classpath"/>
<path refid="jboss.system.classpath"/>
<path refid="jboss.systemjmx.classpath"/>
<path refid="jboss.j2se.classpath"/>
More information about the jboss-cvs-commits
mailing list