geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: rev 47116 - in geronimo/trunk/modules: assembly assembly/src/plan client client-builder client-builder/src/java/org/apache/geronimo/client/builder client/src/java/org/apache/geronimo/client deployment/src/java/org/apache/geronimo/deployment/util j2ee-schema/src/java/org/apache/geronimo/schema j2ee/src/java/org/apache/geronimo/j2ee/management/impl naming/src/java/org/apache/geronimo/naming/geronimo naming/src/test/org/apache/geronimo/naming/geronimo system/src/java/org/apache/geronimo/system/main
Date Thu, 23 Sep 2004 20:36:00 GMT
Author: dain
Date: Thu Sep 23 13:35:58 2004
New Revision: 47116

Added:
   geronimo/trunk/modules/assembly/src/plan/client-system-plan.xml
   geronimo/trunk/modules/assembly/src/plan/j2ee-client-plan.xml
   geronimo/trunk/modules/client/src/java/org/apache/geronimo/client/ClientCommandLine.java
   geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/util/UnclosableOutputStream.java
Modified:
   geronimo/trunk/modules/assembly/maven.xml
   geronimo/trunk/modules/assembly/project.xml
   geronimo/trunk/modules/assembly/src/plan/j2ee-deployer-plan.xml
   geronimo/trunk/modules/client-builder/project.xml
   geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
   geronimo/trunk/modules/client/project.xml
   geronimo/trunk/modules/client/src/java/org/apache/geronimo/client/AppClientContainer.java
   geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/util/NestedJarFile.java
   geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/util/UnpackedJarFile.java
   geronimo/trunk/modules/j2ee-schema/src/java/org/apache/geronimo/schema/SchemaConversionUtils.java
   geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/J2EEAppClientModuleImpl.java
   geronimo/trunk/modules/naming/src/java/org/apache/geronimo/naming/geronimo/GeronimoRootContext.java
   geronimo/trunk/modules/naming/src/test/org/apache/geronimo/naming/geronimo/GeronimoContextTest.java
   geronimo/trunk/modules/naming/src/test/org/apache/geronimo/naming/geronimo/GeronimoRootContextTest.java
   geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/CommandLine.java
Log:
Application client now deploys and starts (JNDI and security still broken)


Modified: geronimo/trunk/modules/assembly/maven.xml
==============================================================================
--- geronimo/trunk/modules/assembly/maven.xml	(original)
+++ geronimo/trunk/modules/assembly/maven.xml	Thu Sep 23 13:35:58 2004
@@ -76,6 +76,9 @@
             <j:if test="${dependency.getProperty('server') == 'true'}">
                 <j:set var="server.classpath" value="${server.classpath} ../lib/${artifact.name}"/>
             </j:if>
+            <j:if test="${dependency.getProperty('client') == 'true'}">
+                <j:set var="client.classpath" value="${client.classpath} ../lib/${artifact.name}"/>
+            </j:if>
             <j:if test="${dependency.getProperty('deploy') == 'true'}">
                 <j:set var="deploy.classpath" value="${deploy.classpath} ../lib/${artifact.name}"/>
             </j:if>
@@ -202,7 +205,7 @@
             />
 
         <!-- build the system configuration and server.jar -->
-        <ant:echo>Building system configuration</ant:echo>
+        <ant:echo>Building server.jar</ant:echo>
         <ant:mkdir dir="${distDir}/bin"/>
         <ant:java fork="true" jar="${distDir}/bin/deployer.jar" failonerror="true">
             <ant:jvmarg value="-ea"/>
@@ -217,7 +220,6 @@
             <ant:arg value="${server.classpath}"/>
         </ant:java>
 
-
         <!-- build the J2EEServer configuration -->
         <ant:echo>Building server configuration</ant:echo>
         <ant:java fork="true" jar="${distDir}/bin/deployer.jar" failonerror="true">
@@ -247,6 +249,30 @@
             <ant:arg value="target/plan/j2ee-secure-plan.xml"/>
         </ant:java>
 
+        <!-- build the system configuration and client.jar -->
+        <ant:echo>Building client.jar</ant:echo>
+        <ant:mkdir dir="${distDir}/bin"/>
+        <ant:java fork="true" jar="${distDir}/bin/deployer.jar" failonerror="true">
+            <ant:jvmarg value="-ea"/>
+            <ant:arg value="--install"/>
+            <ant:arg value="--plan"/>
+            <ant:arg value="target/plan/client-system-plan.xml"/>
+            <ant:arg value="--outfile"/>
+            <ant:arg value="${distDir}/bin/client.jar"/>
+            <ant:arg value="--mainClass"/>
+            <ant:arg value="org.apache.geronimo.client.ClientCommandLine"/>
+            <ant:arg value="--classPath"/>
+            <ant:arg value="${client.classpath}"/>
+        </ant:java>
+
+        <!-- build the J2EE client configuration -->
+        <ant:echo>Building J2EE Client configuration</ant:echo>
+        <ant:java fork="true" jar="${distDir}/bin/deployer.jar" failonerror="true">
+            <ant:jvmarg value="-ea"/>
+            <ant:arg value="--install"/>
+            <ant:arg value="--plan"/>
+            <ant:arg value="target/plan/j2ee-client-plan.xml"/>
+        </ant:java>
 
         <!-- build the Demo configuration -->
         <ant:echo>Building demo website configuration</ant:echo>

Modified: geronimo/trunk/modules/assembly/project.xml
==============================================================================
--- geronimo/trunk/modules/assembly/project.xml	(original)
+++ geronimo/trunk/modules/assembly/project.xml	Thu Sep 23 13:35:58 2004
@@ -61,6 +61,7 @@
         <!-- We use the follow properties in this build:                -->
         <!--     lib: copy dependency into lib                          -->
         <!--     server: include dependency in server classpath         -->
+        <!--     client: include dependency in client classpath         -->
         <!--     deploy: include dependency in deployer classpath       -->
         <!--     repository: copy dependency into repository (Note: all -->
         <!--         geronimojars are always copied to repository)      -->
@@ -70,7 +71,8 @@
             <artifactId>geronimo-client</artifactId>
             <version>${pom.currentVersion}</version>
             <properties>
-                <deploy>true</deploy>
+                <lib>true</lib>
+                <client>true</client>
                 <repository>true</repository>
             </properties>
         </dependency>
@@ -80,7 +82,6 @@
             <artifactId>geronimo-client-builder</artifactId>
             <version>${pom.currentVersion}</version>
             <properties>
-                <deploy>true</deploy>
                 <repository>true</repository>
             </properties>
         </dependency>
@@ -169,6 +170,7 @@
             <properties>
                 <lib>true</lib>
                 <server>true</server>
+                <client>true</client>
                 <deploy>true</deploy>
                 <repository>true</repository>
                 <clideployer>true</clideployer>
@@ -209,6 +211,7 @@
             <properties>
                 <lib>true</lib>
                 <server>true</server>
+                <client>true</client>
                 <deploy>true</deploy>
                 <repository>true</repository>
             </properties>
@@ -335,6 +338,7 @@
             <properties>
                 <lib>true</lib>
                 <server>true</server>
+                <client>true</client>
                 <deploy>true</deploy>
             </properties>
         </dependency>
@@ -347,6 +351,7 @@
             <properties>
                 <lib>true</lib>
                 <server>true</server>
+                <client>true</client>
                 <deploy>true</deploy>
             </properties>
         </dependency>
@@ -389,6 +394,7 @@
             <properties>
                 <lib>true</lib>
                 <server>true</server>
+                <client>true</client>
                 <deploy>true</deploy>
                 <clideployer>true</clideployer>
             </properties>
@@ -430,6 +436,7 @@
             <properties>
                 <lib>true</lib>
                 <server>true</server>
+                <client>true</client>
                 <deploy>true</deploy>
             </properties>
         </dependency>
@@ -441,6 +448,7 @@
             <properties>
                 <lib>true</lib>
                 <server>true</server>
+                <client>true</client>
                 <deploy>true</deploy>
                 <clideployer>true</clideployer>
             </properties>
@@ -453,6 +461,7 @@
             <properties>
                 <lib>true</lib>
                 <server>true</server>
+                <client>true</client>
                 <deploy>true</deploy>
                 <clideployer>true</clideployer>
             </properties>
@@ -485,6 +494,7 @@
             <properties>
                 <lib>true</lib>
                 <server>true</server>
+                <client>true</client>
             </properties>
         </dependency>
 
@@ -495,6 +505,7 @@
             <properties>
                 <lib>true</lib>
                 <server>true</server>
+                <client>true</client>
             </properties>
         </dependency>
 

Added: geronimo/trunk/modules/assembly/src/plan/client-system-plan.xml
==============================================================================
--- (empty file)
+++ geronimo/trunk/modules/assembly/src/plan/client-system-plan.xml	Thu Sep 23 13:35:58 2004
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright 2004 The Apache Software Foundation
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+  
+       http://www.apache.org/licenses/LICENSE-2.0
+  
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+  
+
+<!--
+Configuration for the innermost ring of a Geronimo server.
+This configuration should only contain critical services needed to
+run other Configurations - for example, the ServerInfo, Logging
+and Repository services used to load them.
+
+This configuration should *NOT* be used to provide server or application
+specific services - those should be provided by children.
+-->
+<configuration
+    xmlns="http://geronimo.apache.org/xml/ns/deployment"
+    configId="org/apache/geronimo/ClientSystem"
+    >
+
+    <!-- ServerInfo service -->
+    <gbean name="geronimo.client:role=ServerInfo" class="org.apache.geronimo.system.serverinfo.ServerInfo"/>
+
+    <!-- URLFactory service -->
+    <gbean name="geronimo.client:role=URLFactory" class="org.apache.geronimo.system.url.GeronimoURLFactory"/>
+
+    <!-- Configuration Store service -->
+    <gbean name="geronimo.client:role=ConfigurationStore,type=Local" class="org.apache.geronimo.system.configuration.LocalConfigStore">
+        <attribute name="root" type="java.net.URI">config-store</attribute>
+        <reference name="ServerInfo">geronimo.client:role=ServerInfo</reference>
+    </gbean>
+
+    <!-- Repository -->
+    <gbean name="geronimo.client:role=Repository" class="org.apache.geronimo.system.repository.ReadOnlyRepository">
+        <attribute name="root" type="java.net.URI">repository/</attribute>
+        <reference name="ServerInfo">geronimo.client:role=ServerInfo</reference>
+    </gbean>
+
+    <!-- Logging service -->
+    <gbean name="geronimo.client:role=Logger" class="org.apache.geronimo.system.logging.log4j.Log4jService">
+        <attribute name="rootLoggerLevel" type="java.lang.String">DEBUG</attribute>
+        <attribute name="refreshPeriod" type="int">60</attribute>
+        <attribute name="configurationFile" type="java.lang.String">var/log/log4j.xml</attribute>
+        <reference name="ServerInfo">geronimo.client:role=ServerInfo</reference>
+    </gbean>
+
+    <gbean name="geronimo.client:role=LogAppender,type=ConsoleAppender" class="org.apache.geronimo.system.logging.log4j.appender.ConsoleAppenderService">
+        <attribute name="threshold" type="java.lang.String">INFO</attribute>
+        <attribute name="layoutPattern" type="java.lang.String">%d{ABSOLUTE} %-5p [%c{1}] %m%n</attribute>
+        <attribute name="target" type="java.lang.String">System.out</attribute>
+    </gbean>
+
+    <gbean name="geronimo.client:role=LogAppender,type=DailyRollingFileAppender" class="org.apache.geronimo.system.logging.log4j.appender.RollingFileAppenderService">
+        <attribute name="threshold" type="java.lang.String">DEBUG</attribute>
+        <attribute name="layoutPattern" type="java.lang.String">%d{ABSOLUTE} %-5p [%c{1}] %m%n</attribute>
+        <attribute name="append" type="boolean">true</attribute>
+        <attribute name="file" type="java.lang.String">var/log/client.log</attribute>
+        <attribute name="bufferedIO" type="boolean">false</attribute>
+        <attribute name="bufferedSize" type="int">8192</attribute>
+        <attribute name="maxBackupIndex" type="int">1</attribute>
+        <attribute name="maxFileSize" type="java.lang.String">10MB</attribute>
+        <reference name="ServerInfo">geronimo.client:role=ServerInfo</reference>
+    </gbean>
+</configuration>
\ No newline at end of file

Added: geronimo/trunk/modules/assembly/src/plan/j2ee-client-plan.xml
==============================================================================
--- (empty file)
+++ geronimo/trunk/modules/assembly/src/plan/j2ee-client-plan.xml	Thu Sep 23 13:35:58 2004
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright 2004 The Apache Software Foundation
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+<!-- $Rev: 46040 $ $Date: 2004-09-14 14:28:44 -0700 (Tue, 14 Sep 2004) $ -->
+
+<!--
+Configuration for the main ring of a Geronimo app client.
+
+This configuration should contain those services normally provided
+by the app client.
+-->
+<configuration
+    xmlns="http://geronimo.apache.org/xml/ns/deployment"
+    parentId="org/apache/geronimo/ClientSystem"
+    configId="org/apache/geronimo/Client"
+    >
+
+    <dependency>
+        <uri>geronimo-spec/jars/geronimo-spec-j2ee-${geronimo_spec_j2ee_version}.jar</uri>
+    </dependency>
+    <dependency>
+        <uri>geronimo/jars/geronimo-client-${geronimo_version}.jar</uri>
+    </dependency>
+    <dependency>
+        <uri>geronimo/jars/geronimo-naming-${geronimo_version}.jar</uri>
+    </dependency>
+    <dependency>
+        <uri>geronimo/jars/geronimo-security-${geronimo_version}.jar</uri>
+    </dependency>
+    <dependency>
+        <uri>openejb/jars/openejb-core-${openejb_version}.jar</uri>
+    </dependency>
+
+    <gbean name="geronimo.client:type=JNDIContext" class="org.openejb.client.AppClientJNDIContext">
+        <attribute name="host" type="java.lang.String">localhost</attribute>
+        <attribute name="port" type="int">4201</attribute>
+    </gbean>
+</configuration>

Modified: geronimo/trunk/modules/assembly/src/plan/j2ee-deployer-plan.xml
==============================================================================
--- geronimo/trunk/modules/assembly/src/plan/j2ee-deployer-plan.xml	(original)
+++ geronimo/trunk/modules/assembly/src/plan/j2ee-deployer-plan.xml	Thu Sep 23 13:35:58 2004
@@ -31,12 +31,6 @@
         <uri>openejb/jars/openejb-core-${openejb_version}.jar</uri>
     </dependency>
     <dependency>
-        <uri>geronimo/jars/geronimo-client-${geronimo_version}.jar</uri>
-    </dependency>
-    <dependency>
-        <uri>geronimo/jars/geronimo-client-builder-${geronimo_version}.jar</uri>
-    </dependency>
-    <dependency>
         <uri>geronimo/jars/geronimo-connector-${geronimo_version}.jar</uri>
     </dependency>
     <dependency>
@@ -78,6 +72,12 @@
     <dependency>
         <uri>tranql/jars/tranql-${tranql_version}.jar</uri>
     </dependency>
+    <dependency>
+         <uri>geronimo/jars/geronimo-client-${geronimo_version}.jar</uri>
+     </dependency>
+     <dependency>
+         <uri>geronimo/jars/geronimo-client-builder-${geronimo_version}.jar</uri>
+     </dependency>
 
     <gbean name="geronimo.deployment:role=Deployer,config=org/apache/geronimo/J2EEDeployer" class="org.apache.geronimo.deployment.Deployer">
         <reference name="Builders">geronimo.deployer:role=Builder,config=org/apache/geronimo/J2EEDeployer,*</reference>
@@ -99,6 +99,7 @@
         <reference name="EJBReferenceBuilder">geronimo.deployer:role=ModuleBuilder,type=EJB,config=org/apache/geronimo/J2EEDeployer</reference>
         <reference name="WebConfigBuilder">geronimo.deployer:role=ModuleBuilder,type=Web,config=org/apache/geronimo/J2EEDeployer</reference>
         <reference name="ConnectorConfigBuilder">geronimo.deployer:role=ModuleBuilder,type=Connector,config=org/apache/geronimo/J2EEDeployer</reference>
+        <reference name="AppClientConfigBuilder">geronimo.deployer:role=ModuleBuilder,type=AppClient,config=org/apache/geronimo/J2EEDeployer</reference>
     </gbean>
 
     <gbean name="geronimo.deployer:role=ModuleBuilder,type=Web,config=org/apache/geronimo/J2EEDeployer" class="org.apache.geronimo.jetty.deployment.JettyModuleBuilder"/>
@@ -109,6 +110,7 @@
 
     <gbean name="geronimo.deployer:role=ModuleBuilder,type=AppClient,config=org/apache/geronimo/J2EEDeployer" class="org.apache.geronimo.client.builder.AppClientModuleBuilder">
         <reference name="Repository">*:role=Repository,*</reference>
+        <reference name="Store">geronimo.deployment:role=ConfigurationStore,type=Local</reference>
     </gbean>
 
 </configuration>

Modified: geronimo/trunk/modules/client-builder/project.xml
==============================================================================
--- geronimo/trunk/modules/client-builder/project.xml	(original)
+++ geronimo/trunk/modules/client-builder/project.xml	Thu Sep 23 13:35:58 2004
@@ -155,11 +155,11 @@
     <build>
         <resources>
             <resource>
-                <directory>${basedir}/src/java</directory>
-                <includes>
-                    <include>**/*.xml</include>
-                    <include>**/*.properties</include>
-                </includes>
+                <directory>${basedir}/src/etc</directory>
+            </resource>
+            <resource>
+                <directory>${basedir}/target/xmlbeans</directory>
+                <includes>schema/**</includes>
             </resource>
         </resources>
         <unitTest>
@@ -169,6 +169,17 @@
             <excludes>
                 <exclude>**/Abstract*.java</exclude>
             </excludes>
+            <resources>
+                <resource>
+                    <directory>${basedir}/src/schema</directory>
+                    <includes>
+                        <include>*.xsd</include>
+                    </includes>
+                </resource>
+                <resource>
+                    <directory>${basedir}/src/test-resources</directory>
+                </resource>
+            </resources>
         </unitTest>
     </build>
 </project>

Modified: geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
==============================================================================
--- geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java	(original)
+++ geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java	Thu Sep 23 13:35:58 2004
@@ -18,6 +18,7 @@
 
 import java.io.BufferedOutputStream;
 import java.io.File;
+import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.MalformedURLException;
@@ -33,7 +34,6 @@
 import java.util.jar.JarFile;
 import java.util.jar.JarOutputStream;
 import java.util.jar.Manifest;
-import java.util.zip.ZipEntry;
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 
@@ -41,6 +41,7 @@
 import org.apache.geronimo.deployment.DeploymentContext;
 import org.apache.geronimo.deployment.DeploymentException;
 import org.apache.geronimo.deployment.service.GBeanHelper;
+import org.apache.geronimo.deployment.util.FileUtil;
 import org.apache.geronimo.deployment.util.JarUtil;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoFactory;
@@ -52,11 +53,10 @@
 import org.apache.geronimo.j2ee.management.impl.J2EEAppClientModuleImpl;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
+import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.naming.deployment.ENCConfigBuilder;
 import org.apache.geronimo.naming.java.ReadOnlyContext;
-import org.apache.geronimo.schema.SchemaConversionUtils;
-import org.apache.geronimo.system.main.CommandLineManifest;
 import org.apache.geronimo.xbeans.geronimo.client.GerApplicationClientDocument;
 import org.apache.geronimo.xbeans.geronimo.client.GerApplicationClientType;
 import org.apache.geronimo.xbeans.geronimo.client.GerDependencyType;
@@ -80,14 +80,15 @@
 //        XmlBeans.typeLoaderForClassLoader(GerApplicationClientDocument.class.getClassLoader())
     });
 
-    private static final URI CONFIG_ID = URI.create("application-client");
-
     private final Kernel kernel;
     private final Repository repository;
+    private final ConfigurationStore store;
+    private static final URI PARENT_ID = URI.create("org/apache/geronimo/Client");
 
-    public AppClientModuleBuilder(Kernel kernel, Repository repository) {
+    public AppClientModuleBuilder(Kernel kernel, Repository repository, ConfigurationStore store) {
         this.kernel = kernel;
         this.repository = repository;
+        this.store = store;
     }
 
     public XmlObject parseSpecDD(URL path) throws DeploymentException {
@@ -95,8 +96,9 @@
         try {
             // check if we have an alt spec dd
             in = path.openStream();
-            XmlObject dd = SchemaConversionUtils.parse(in);
-            ApplicationClientDocument applicationClientDoc = SchemaConversionUtils.convertToApplicationClientSchema(dd);
+//            XmlObject dd = SchemaConversionUtils.parse(in);
+//            ApplicationClientDocument applicationClientDoc = SchemaConversionUtils.convertToApplicationClientSchema(dd);
+            ApplicationClientDocument applicationClientDoc = ApplicationClientDocument.Factory.parse(path);
             return applicationClientDoc.getApplicationClient();
         } catch (Exception e) {
             throw new DeploymentException("Unable to parse " + path, e);
@@ -232,10 +234,15 @@
         return new AppClientModule(name, moduleURI, moduleFile, targetPath, appClient, geronimoAppClient);
     }
 
-    public void installModule(JarFile earFile, EARContext earContext, Module appClientModule) throws DeploymentException {
-        // actual module content is coppied in in tha addGBeans section... this is
-        // not a big deal sincee this method is really to install jars that are
-        // used to construct the class loader
+    public void installModule(JarFile earFile, EARContext earContext, Module module) throws DeploymentException {
+        // extract the ejbJar file into a standalone packed jar file and add the contents to the output
+        JarFile moduleFile = module.getModuleFile();
+        try {
+            File appClientJarFile = JarUtil.extractToPackedJar(moduleFile);
+            earContext.addInclude(URI.create(module.getTargetPath()), appClientJarFile.toURL());
+        } catch (IOException e) {
+            throw new DeploymentException("Unable to copy app client module jar into configuration: " + moduleFile.getName());
+        }
     }
 
     public void initContext(EARContext earContext, Module webModule, ClassLoader cl) {
@@ -248,6 +255,22 @@
         ApplicationClientType appClient = (ApplicationClientType) appClientModule.getSpecDD();
         GerApplicationClientType geronimoAppClient = (GerApplicationClientType) appClientModule.getVendorDD();
 
+        // get the app client main class
+        JarFile moduleFile = module.getModuleFile();
+        String mainClasss = null;
+        try {
+            Manifest manifest = moduleFile.getManifest();
+            if (manifest == null) {
+                throw new DeploymentException("App client module jar does not contain a manifest: " + moduleFile.getName());
+            }
+            mainClasss = manifest.getMainAttributes().getValue(Attributes.Name.MAIN_CLASS);
+            if (mainClasss == null) {
+                throw new DeploymentException("App client module jar does not have Main-Class defined in the manifest: " + moduleFile.getName());
+            }
+        } catch (IOException e) {
+            throw new DeploymentException("Could not get manifest from app client module: " + moduleFile.getName());
+        }
+
         // generate the object name for the app client
         Properties nameProps = new Properties();
         nameProps.put("J2EEServer", earContext.getJ2EEServerName());
@@ -277,36 +300,25 @@
         }
         earContext.addGBean(appClientModuleName, appClientModuleGBean);
 
+
+
         // Create a new executable jar within the ear context
-        JarOutputStream earOutputStream = earContext.getJos();
+        DeploymentContext appClientDeploymentContext = null;
+        File appClientConfiguration = null;
         try {
-            // build the manifest needed by the command line executable gbean
-            Manifest manifest = new Manifest();
-            Attributes mainAttributes = manifest.getMainAttributes();
-            mainAttributes.putValue(Attributes.Name.MANIFEST_VERSION.toString(), "1.0");
-            mainAttributes.putValue(Attributes.Name.MAIN_CLASS.toString(), "org.apache.geronimo.system.main.CommandLine");
-            mainAttributes.putValue(CommandLineManifest.MAIN_GBEAN.toString(), appClientModuleName.getCanonicalName());
-            mainAttributes.putValue(CommandLineManifest.MAIN_METHOD.toString(), "deploy");
-            mainAttributes.putValue(CommandLineManifest.CONFIGURATIONS.toString(), CONFIG_ID.toString());
-
-            // add new entry to the main ear context in which we will write the new standalone exectable jar
-            earOutputStream.putNextEntry(new ZipEntry(appClientModule.getTargetPath()));
-            JarOutputStream appClientOutputStream = new JarOutputStream(new BufferedOutputStream(earOutputStream), manifest);
-
-            // this is an executable jar add the magic startup-jar finder file
-            appClientOutputStream.putNextEntry(new ZipEntry("META-INF/startup-jar"));
-            appClientOutputStream.closeEntry();
+            appClientConfiguration = FileUtil.createTempFile();
+            JarOutputStream jos = new JarOutputStream(new BufferedOutputStream(new FileOutputStream(appClientConfiguration)));
 
             // construct the app client deployment context... this is the same class used by the ear context
-            DeploymentContext appClientDeploymentContext;
             try {
-                appClientDeploymentContext = new DeploymentContext(earOutputStream, CONFIG_ID, ConfigurationModuleType.SERVICE, null, kernel);
-            } catch (MalformedObjectNameException e) {
+                URI configId = URI.create(geronimoAppClient.getConfigId());
+                appClientDeploymentContext = new DeploymentContext(jos, configId, ConfigurationModuleType.APP_CLIENT, PARENT_ID, kernel);
+            } catch (Exception e) {
                 throw new DeploymentException("Could not create a deployment context for the app client", e);
             }
 
             // extract the ejbJar file into a standalone packed jar file and add the contents to the output
-            File appClientJarFile = JarUtil.extractToPackedJar(module.getModuleFile());
+            File appClientJarFile = JarUtil.extractToPackedJar(moduleFile);
             appClientDeploymentContext.addInclude(URI.create(module.getTargetPath()), appClientJarFile.toURL());
 
             // add the includes
@@ -350,39 +362,33 @@
                 }
             }
 
-            // add the super duper jndi provider
-            ObjectName jndiProviderName = ObjectName.getInstance("client:type=JNDIProvider");
-            GBeanMBean jndiProvicerGBean = new GBeanMBean("org.apache.geronimo.client.builder.AppClientJNDIProvider", appClientClassLoader);
-            try {
-                jndiProvicerGBean.setAttribute("host", "localhost");
-                jndiProvicerGBean.setAttribute("port", new Integer(4201));
-            } catch (Exception e) {
-                throw new DeploymentException("Unable to initialize AppClientModule GBean", e);
-            }
-            appClientDeploymentContext.addGBean(jndiProviderName, jndiProvicerGBean);
-
             // finally add the app client container
-            ObjectName appClienContainerName = ObjectName.getInstance("client:type=ClientContainer");
-            GBeanMBean appClienContainerGBean = new GBeanMBean("org.apache.geronimo.client.builder.AppClientContainer", appClientClassLoader);
+            ObjectName appClienContainerName = ObjectName.getInstance("geronimo.client:type=ClientContainer");
+            GBeanMBean appClienContainerGBean = new GBeanMBean("org.apache.geronimo.client.AppClientContainer", appClientClassLoader);
             try {
-                appClienContainerGBean.setAttribute("mainClassName", null);
+                appClienContainerGBean.setAttribute("mainClassName", mainClasss);
                 appClienContainerGBean.setAttribute("appClientModuleName", appClientModuleName);
-                appClienContainerGBean.setReferencePattern("JNDIProvider", jndiProviderName);
+                appClienContainerGBean.setReferencePattern("JNDIContext", new ObjectName("geronimo.client:type=JNDIContext"));
             } catch (Exception e) {
                 throw new DeploymentException("Unable to initialize AppClientModule GBean", e);
             }
             appClientDeploymentContext.addGBean(appClienContainerName, appClienContainerGBean);
-
-            appClientDeploymentContext.close();
         } catch (Exception e) {
             throw new DeploymentException(e);
         } finally {
-            try {
-                earOutputStream.closeEntry();
-            } catch (IOException e) {
-                throw new DeploymentException(e);
+            if (appClientDeploymentContext != null) {
+                try {
+                    appClientDeploymentContext.close();
+                } catch (IOException e) {
+                }
             }
         }
+
+        try {
+            store.install(appClientConfiguration.toURL());
+        } catch (Exception e) {
+            throw new DeploymentException(e);
+        }
     }
 
     public SchemaTypeLoader getSchemaTypeLoader() {
@@ -444,7 +450,8 @@
         GBeanInfoFactory infoFactory = new GBeanInfoFactory(AppClientModuleBuilder.class);
         infoFactory.addAttribute("kernel", Kernel.class, false);
         infoFactory.addReference("Repository", Repository.class);
-        infoFactory.setConstructor(new String[] {"kernel", "Repository"});
+        infoFactory.addReference("Store", ConfigurationStore.class);
+        infoFactory.setConstructor(new String[] {"kernel", "Repository", "Store"});
         infoFactory.addInterface(ModuleBuilder.class);
         GBEAN_INFO = infoFactory.getBeanInfo();
     }

Modified: geronimo/trunk/modules/client/project.xml
==============================================================================
--- geronimo/trunk/modules/client/project.xml	(original)
+++ geronimo/trunk/modules/client/project.xml	Thu Sep 23 13:35:58 2004
@@ -53,6 +53,12 @@
             <version>${pom.currentVersion}</version>
         </dependency>
 
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-system</artifactId>
+            <version>${pom.currentVersion}</version>
+        </dependency>
+
         <!-- Thirdparty -->
 
         <dependency>

Modified: geronimo/trunk/modules/client/src/java/org/apache/geronimo/client/AppClientContainer.java
==============================================================================
--- geronimo/trunk/modules/client/src/java/org/apache/geronimo/client/AppClientContainer.java	(original)
+++ geronimo/trunk/modules/client/src/java/org/apache/geronimo/client/AppClientContainer.java	Thu Sep 23 13:35:58 2004
@@ -18,13 +18,10 @@
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
-import java.util.Iterator;
-
 import javax.management.ObjectName;
 
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoFactory;
-import org.apache.geronimo.gbean.ReferenceCollection;
 
 /**
  * @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $
@@ -33,13 +30,13 @@
     private static final Class[] MAIN_ARGS = {String[].class};
 
     private final String mainClassName;
-    private final ReferenceCollection plugins;
+    private final AppClientPlugin jndiContext;
     private final ObjectName appClientModuleName;
     private final Method mainMethod;
 
-    public AppClientContainer(String mainClassName,  ObjectName appClientModuleName, ReferenceCollection plugins ,ClassLoader classLoader) throws Exception {
+    public AppClientContainer(String mainClassName, ObjectName appClientModuleName, AppClientPlugin jndiContext, ClassLoader classLoader) throws Exception {
         this.mainClassName = mainClassName;
-        this.plugins = plugins;
+        this.jndiContext = jndiContext;
         this.appClientModuleName = appClientModuleName;
 
         try {
@@ -63,30 +60,24 @@
     public void main(String[] args) throws Exception {
         Throwable throwable = null;
         try {
-            for (Iterator iterator = plugins.iterator(); iterator.hasNext();) {
-                AppClientPlugin plugin = (AppClientPlugin) iterator.next();
-                plugin.startClient(appClientModuleName);
-            }
+            jndiContext.startClient(appClientModuleName);
 
-            mainMethod.invoke(null, args);
+            mainMethod.invoke(null, new Object[]{args});
 
         } catch (InvocationTargetException e) {
             Throwable cause = e.getCause();
             if (cause instanceof Exception) {
                 throwable = cause;
             } else if (cause instanceof Error) {
-                throwable =  cause;
+                throwable = cause;
             }
             throwable = e;
         } finally {
-            for (Iterator iterator = plugins.iterator(); iterator.hasNext();) {
-                AppClientPlugin plugin = (AppClientPlugin) iterator.next();
-                plugin.stopClient(appClientModuleName);
-            }
+            jndiContext.stopClient(appClientModuleName);
 
             if (throwable instanceof Exception) {
                 throw (Exception) throwable;
-            } else {
+            } else if (throwable instanceof Error) {
                 throw (Error) throwable;
             }
         }
@@ -99,11 +90,11 @@
 
         infoFactory.addOperation("main", new Class[]{String[].class});
         infoFactory.addAttribute("mainClassName", String.class, true);
-        infoFactory.addAttribute("appClientModuleObjectName", ObjectName.class, true);
-        infoFactory.addReference("plugins", AppClientPlugin.class);
+        infoFactory.addAttribute("appClientModuleName", ObjectName.class, true);
+        infoFactory.addReference("JNDIContext", AppClientPlugin.class);
         infoFactory.addAttribute("classLoader", ClassLoader.class, false);
 
-        infoFactory.setConstructor(new String[]{"mainClassName", "appClientModuleName", "plugins", "classLoader"});
+        infoFactory.setConstructor(new String[]{"mainClassName", "appClientModuleName", "JNDIContext", "classLoader"});
 
         GBEAN_INFO = infoFactory.getBeanInfo();
     }

Added: geronimo/trunk/modules/client/src/java/org/apache/geronimo/client/ClientCommandLine.java
==============================================================================
--- (empty file)
+++ geronimo/trunk/modules/client/src/java/org/apache/geronimo/client/ClientCommandLine.java	Thu Sep 23 13:35:58 2004
@@ -0,0 +1,53 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.client;
+
+import java.util.Collections;
+import java.net.URI;
+import javax.management.ObjectName;
+
+import org.apache.geronimo.system.main.CommandLine;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class ClientCommandLine extends CommandLine {
+    /**
+     * Command line entry point called by executable jar
+     * @param args command line args
+     */
+    public static void main(String[] args) {
+        log.info("Client startup begun");
+        try {
+            URI configuration = new URI(args[0]);
+            String[] clientArgs = new String[args.length -1];
+            System.arraycopy(args, 1, clientArgs, 0, clientArgs.length);
+            new ClientCommandLine(configuration, clientArgs);
+
+            log.info("Client shutdown completed");
+        } catch (Exception e) {
+            e.printStackTrace();
+            System.exit(2);
+            throw new AssertionError();
+        }
+    }
+
+
+    public ClientCommandLine(URI configuration, String[] args) throws Exception {
+        super(Collections.singletonList(configuration), new ObjectName("geronimo.client:type=ClientContainer"), "main", args);
+    }
+}

Modified: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/util/NestedJarFile.java
==============================================================================
--- geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/util/NestedJarFile.java	(original)
+++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/util/NestedJarFile.java	Thu Sep 23 13:35:58 2004
@@ -89,7 +89,7 @@
     }
 
     public Manifest getManifest() throws IOException {
-        if (manifestLoaded) {
+        if (!manifestLoaded) {
             JarEntry manifestEntry = getBaseEntry("META-INF/MANIFEST.MF");
 
             if (manifestEntry != null && !manifestEntry.isDirectory()) {

Added: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/util/UnclosableOutputStream.java
==============================================================================
--- (empty file)
+++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/util/UnclosableOutputStream.java	Thu Sep 23 13:35:58 2004
@@ -0,0 +1,52 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.deployment.util;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $
+ */
+public class UnclosableOutputStream extends OutputStream {
+
+    private final OutputStream delegate;
+
+    public UnclosableOutputStream(OutputStream delegate) {
+        this.delegate = delegate;
+    }
+
+    public void close() {
+    }
+
+    public void write(int b) throws IOException {
+        delegate.write(b);
+    }
+
+    public void write(byte b[]) throws IOException {
+        delegate.write(b);
+    }
+
+    public void write(byte b[], int off, int len) throws IOException {
+        delegate.write(b, off, len);
+    }
+
+    public void flush() throws IOException {
+        delegate.flush();
+    }
+}
\ No newline at end of file

Modified: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/util/UnpackedJarFile.java
==============================================================================
--- geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/util/UnpackedJarFile.java	(original)
+++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/util/UnpackedJarFile.java	Thu Sep 23 13:35:58 2004
@@ -56,10 +56,10 @@
     }
 
     public Manifest getManifest() throws IOException {
-        if (manifestLoaded) {
+        if (!manifestLoaded) {
             File manifestFile = getFile("META-INF/MANIFEST.MF");
 
-            if (manifestFile.isFile()) {
+            if (manifestFile != null && manifestFile.isFile()) {
                 FileInputStream in = null;
                 try {
                     in = new FileInputStream(manifestFile);

Modified: geronimo/trunk/modules/j2ee-schema/src/java/org/apache/geronimo/schema/SchemaConversionUtils.java
==============================================================================
--- geronimo/trunk/modules/j2ee-schema/src/java/org/apache/geronimo/schema/SchemaConversionUtils.java	(original)
+++ geronimo/trunk/modules/j2ee-schema/src/java/org/apache/geronimo/schema/SchemaConversionUtils.java	Thu Sep 23 13:35:58 2004
@@ -164,11 +164,11 @@
     }
 
     public static ApplicationClientDocument convertToApplicationClientSchema(XmlObject xmlObject) throws XmlException {
-        if (ApplicationClientDocument.type.equals(xmlObject.schemaType())) {
-            validateDD(xmlObject);
+//        if (ApplicationClientDocument.type.equals(xmlObject.schemaType())) {
+//            validateDD(xmlObject);
             return (ApplicationClientDocument) xmlObject;
-        }
-        throw new UnsupportedOperationException("Deployment of previous version of application not supported");
+//        }
+//        throw new UnsupportedOperationException("Deployment of previous version of application not supported");
     }
 
     public static boolean convertToSchema(XmlCursor cursor, String schemaLocationURL, String version) {

Modified: geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/J2EEAppClientModuleImpl.java
==============================================================================
--- geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/J2EEAppClientModuleImpl.java	(original)
+++ geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/J2EEAppClientModuleImpl.java	Thu Sep 23 13:35:58 2004
@@ -18,6 +18,7 @@
 
 import java.util.Hashtable;
 import javax.management.ObjectName;
+import javax.naming.Context;
 
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoFactory;
@@ -32,8 +33,10 @@
     private final String deploymentDescriptor;
     private final J2EEServer server;
     private final J2EEApplication application;
+    private final Context componentContext;
 
-    public J2EEAppClientModuleImpl(String objectName, J2EEServer server, J2EEApplication application, String deploymentDescriptor) {
+    public J2EEAppClientModuleImpl(Context componentContext, String objectName, J2EEServer server, J2EEApplication application, String deploymentDescriptor) {
+        this.componentContext = componentContext;
         ObjectName myObjectName = JMXUtil.getObjectName(objectName);
         verifyObjectName(myObjectName);
 
@@ -88,6 +91,10 @@
         return server.getJavaVMs();
     }
 
+    public Context getComponentContext() {
+        return componentContext;
+    }
+
     public static final GBeanInfo GBEAN_INFO;
 
     static {
@@ -95,6 +102,7 @@
         infoFactory.addReference("J2EEServer", J2EEServer.class);
         infoFactory.addReference("J2EEApplication", J2EEApplication.class);
 
+        infoFactory.addAttribute("componentContext", Context.class, true);
         infoFactory.addAttribute("deploymentDescriptor", String.class, true);
 
         infoFactory.addAttribute("objectName", String.class, false);
@@ -103,6 +111,7 @@
         infoFactory.addAttribute("javaVMs", String[].class, false);
 
         infoFactory.setConstructor(new String[]{
+            "componentContext",
             "objectName",
             "J2EEServer",
             "J2EEApplication",

Modified: geronimo/trunk/modules/naming/src/java/org/apache/geronimo/naming/geronimo/GeronimoRootContext.java
==============================================================================
--- geronimo/trunk/modules/naming/src/java/org/apache/geronimo/naming/geronimo/GeronimoRootContext.java	(original)
+++ geronimo/trunk/modules/naming/src/java/org/apache/geronimo/naming/geronimo/GeronimoRootContext.java	Thu Sep 23 13:35:58 2004
@@ -18,10 +18,7 @@
 package org.apache.geronimo.naming.geronimo;
 
 import java.util.Hashtable;
-
 import javax.naming.NamingException;
-
-import org.apache.geronimo.naming.geronimo.GeronimoContext;
 
 /**
  *

Modified: geronimo/trunk/modules/naming/src/test/org/apache/geronimo/naming/geronimo/GeronimoContextTest.java
==============================================================================
--- geronimo/trunk/modules/naming/src/test/org/apache/geronimo/naming/geronimo/GeronimoContextTest.java	(original)
+++ geronimo/trunk/modules/naming/src/test/org/apache/geronimo/naming/geronimo/GeronimoContextTest.java	Thu Sep 23 13:35:58 2004
@@ -17,11 +17,11 @@
 
 package org.apache.geronimo.naming.geronimo;
 
-import junit.framework.TestCase;
-
+import java.util.Set;
 import javax.naming.Context;
 import javax.naming.NamingException;
-import java.util.Set;
+
+import junit.framework.TestCase;
 
 /**
  *

Modified: geronimo/trunk/modules/naming/src/test/org/apache/geronimo/naming/geronimo/GeronimoRootContextTest.java
==============================================================================
--- geronimo/trunk/modules/naming/src/test/org/apache/geronimo/naming/geronimo/GeronimoRootContextTest.java	(original)
+++ geronimo/trunk/modules/naming/src/test/org/apache/geronimo/naming/geronimo/GeronimoRootContextTest.java	Thu Sep 23 13:35:58 2004
@@ -20,7 +20,6 @@
 import javax.naming.InitialContext;
 
 import junit.framework.TestCase;
-import org.apache.geronimo.naming.geronimo.GeronimoContextManager;
 
 /**
  *

Modified: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/CommandLine.java
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/CommandLine.java	(original)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/CommandLine.java	Thu Sep 23 13:35:58 2004
@@ -17,27 +17,27 @@
 
 package org.apache.geronimo.system.main;
 
+import java.util.List;
+import java.util.Iterator;
 import java.io.ObjectInputStream;
 import java.net.URI;
-import java.util.Iterator;
 import javax.management.ObjectName;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-
-import org.apache.geronimo.gbean.jmx.GBeanMBean;
+import org.apache.geronimo.kernel.log.GeronimoLogging;
 import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
-import org.apache.geronimo.kernel.log.GeronimoLogging;
+import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.system.url.GeronimoURLFactory;
+import org.apache.geronimo.gbean.jmx.GBeanMBean;
 
 
 /**
  * @version $Rev$ $Date$
  */
 public class CommandLine {
-    private static Log log;
+    protected static final Log log;
 
     static {
         // This MUST be done before the first log is acquired
@@ -48,64 +48,22 @@
         GeronimoURLFactory.install();
     }
 
-    private CommandLine() {
-    }
-
     /**
      * Command line entry point called by executable jar
      * @param args command line args
      */
     public static void main(String[] args) {
-
         log.info("Server startup begun");
-
         try {
             // the interesting entries from the manifest
             CommandLineManifest manifest = CommandLineManifest.getManifestEntries();
+            List configurations = manifest.getConfigurations();
+            ObjectName mainGBean = manifest.getMainGBean();
+            String mainMethod = manifest.getMainMethod();
 
-            // boot the kernel
-            Kernel kernel = new Kernel("geronimo.kernel", "geronimo");
-            kernel.boot();
-
-            // load and start the configuration in this jar
-            ConfigurationManager configurationManager = kernel.getConfigurationManager();
-            GBeanMBean config = new GBeanMBean(Configuration.GBEAN_INFO);
-            ClassLoader classLoader = CommandLine.class.getClassLoader();
-            ObjectInputStream ois = new ObjectInputStream(classLoader.getResourceAsStream("META-INF/config.ser"));
-            try {
-                Configuration.loadGMBeanState(config, ois);
-            } finally {
-                ois.close();
-            }
-            ObjectName configName = configurationManager.load(config, classLoader.getResource("/"));
-            kernel.startRecursiveGBean(configName);
-
-            // load and start the configurations listed in the manifest
-            for (Iterator iterator = manifest.getConfigurations().iterator(); iterator.hasNext();) {
-                URI configurationID = (URI) iterator.next();
-                ObjectName configurationName = configurationManager.load(configurationID);
-                kernel.startRecursiveGBean(configurationName);
-            }
-
-            log.info("Server startup completed");
-
-            // invoke the main method
-            kernel.invoke(
-                    manifest.getMainGBean(),
-                    manifest.getMainMethod(),
-                    new Object[]{args},
-                    new String[]{String[].class.getName()});
-
-            log.info("Server shutdown begun");
-
-            // stop this configuration
-            kernel.stopGBean(configName);
-
-            // shutdown the kernel
-            kernel.shutdown();
+            new CommandLine(configurations, mainGBean, mainMethod, args);
 
             log.info("Server shutdown completed");
-
         } catch (Exception e) {
             e.printStackTrace();
             System.exit(2);
@@ -113,4 +71,49 @@
         }
     }
 
+    public CommandLine(List configurations, ObjectName mainGBean, String mainMethod, String[] args) throws Exception {
+        // boot the kernel
+        Kernel kernel = new Kernel("geronimo.kernel", "geronimo");
+        kernel.boot();
+
+        // load and start the configuration in this jar
+        ConfigurationManager configurationManager = kernel.getConfigurationManager();
+        GBeanMBean config = new GBeanMBean(Configuration.GBEAN_INFO);
+        ClassLoader classLoader = CommandLine.class.getClassLoader();
+        ObjectInputStream ois = new ObjectInputStream(classLoader.getResourceAsStream("META-INF/config.ser"));
+        try {
+            Configuration.loadGMBeanState(config, ois);
+        } finally {
+            ois.close();
+        }
+        ObjectName configName = configurationManager.load(config, classLoader.getResource("/"));
+        kernel.startRecursiveGBean(configName);
+
+        // load and start the configurations 
+        for (Iterator i = configurations.iterator(); i.hasNext();) {
+            URI configID = (URI) i.next();
+            List list = configurationManager.loadRecursive(configID);
+            for (Iterator iterator = list.iterator(); iterator.hasNext();) {
+                ObjectName name = (ObjectName) iterator.next();
+                kernel.startRecursiveGBean(name);
+            }
+        }
+
+        log.info("Server startup completed");
+
+        // invoke the main method
+        kernel.invoke(
+                mainGBean,
+                mainMethod,
+                new Object[]{args},
+                new String[]{String[].class.getName()});
+
+        log.info("Server shutdown begun");
+
+        // stop this configuration
+        kernel.stopGBean(configName);
+
+        // shutdown the kernel
+        kernel.shutdown();
+    }
 }

Mime
View raw message