You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by am...@apache.org on 2004/11/04 16:46:44 UTC
svn commit: rev 56600 - in geronimo/trunk/modules: assembly assembly/src/plan system/src/java/org/apache/geronimo/system/main
Author: ammulder
Date: Thu Nov 4 07:46:42 2004
New Revision: 56600
Modified:
geronimo/trunk/modules/assembly/project.xml
geronimo/trunk/modules/assembly/src/plan/j2ee-deployer-plan.xml
geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/ClientCommandLine.java
geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/CommandLine.java
Log:
Preparations for the new deployer that shouldn't impact the current one
- add JSR-88 to the assembly and deployer dependencies
- make the CommandLine a bit more reusable
Modified: geronimo/trunk/modules/assembly/project.xml
==============================================================================
--- geronimo/trunk/modules/assembly/project.xml (original)
+++ geronimo/trunk/modules/assembly/project.xml Thu Nov 4 07:46:42 2004
@@ -275,7 +275,9 @@
<artifactId>geronimo-spec-j2ee-deployment</artifactId>
<version>&geronimo-spec-j2ee-deployment-version;</version>
<properties>
- <clideployer>true</clideployer>
+ <lib>true</lib>
+ <deploy>true</deploy>
+ <repository>true</repository>
</properties>
</dependency>
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 Nov 4 07:46:42 2004
@@ -68,6 +68,9 @@
<dependency>
<uri>geronimo-spec/jars/geronimo-spec-j2ee-${geronimo_spec_j2ee_version}.jar</uri>
</dependency>
+ <dependency>
+ <uri>geronimo-spec/jars/geronimo-spec-j2ee-deployment-${geronimo_spec_j2ee_deployment_version}.jar</uri>
+ </dependency>
<!-- required for rar 1.5 to load realms -->
<dependency>
<uri>regexp/jars/regexp-${regexp_version}.jar</uri>
Modified: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/ClientCommandLine.java
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/ClientCommandLine.java (original)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/ClientCommandLine.java Thu Nov 4 07:46:42 2004
@@ -50,6 +50,6 @@
public ClientCommandLine(URI configuration, String[] args) throws Exception {
- super(Collections.singletonList(configuration), new ObjectName("geronimo.client:type=ClientContainer"), "main", args);
+ invokeMainGBean(Collections.singletonList(configuration), new ObjectName("geronimo.client:type=ClientContainer"), "main", args);
}
}
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 Nov 4 07:46:42 2004
@@ -22,12 +22,14 @@
import java.util.Iterator;
import java.util.List;
import javax.management.ObjectName;
+import javax.management.InstanceNotFoundException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.geronimo.gbean.GBeanData;
import org.apache.geronimo.kernel.Kernel;
import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
import org.apache.geronimo.kernel.log.GeronimoLogging;
import org.apache.geronimo.system.url.GeronimoURLFactory;
@@ -60,7 +62,7 @@
ObjectName mainGBean = manifest.getMainGBean();
String mainMethod = manifest.getMainMethod();
- new CommandLine(configurations, mainGBean, mainMethod, args);
+ new CommandLine().invokeMainGBean(configurations, mainGBean, mainMethod, args);
log.info("Server shutdown completed");
} catch (Exception e) {
@@ -71,14 +73,34 @@
}
}
- public CommandLine(List configurations, ObjectName mainGBean, String mainMethod, String[] args) throws Exception {
+ private Kernel kernel;
+ private GBeanData config;
+
+ public void invokeMainGBean(List configurations, ObjectName mainGBean, String mainMethod, String[] args) throws Exception {
+ startKernel(configurations);
+
+ 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");
+
+ stopKernel();
+ }
+
+ protected void startKernel(List configurations) throws Exception {
// boot the kernel
- Kernel kernel = new Kernel("geronimo.kernel", "geronimo");
+ kernel = new Kernel("geronimo.kernel", "geronimo");
kernel.boot();
// load and start the configuration in this jar
ConfigurationManager configurationManager = kernel.getConfigurationManager();
- GBeanData config = new GBeanData();
+ config = new GBeanData();
ClassLoader classLoader = CommandLine.class.getClassLoader();
ObjectInputStream ois = new ObjectInputStream(classLoader.getResourceAsStream("META-INF/config.ser"));
try {
@@ -89,7 +111,7 @@
configurationManager.load(config, classLoader.getResource("/"), classLoader);
kernel.startRecursiveGBean(config.getName());
- // load and start the configurations
+ // load and start the configurations
for (Iterator i = configurations.iterator(); i.hasNext();) {
URI configID = (URI) i.next();
List list = configurationManager.loadRecursive(configID);
@@ -98,18 +120,13 @@
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");
+ protected Kernel getKernel() {
+ return kernel;
+ }
+ protected void stopKernel() throws InstanceNotFoundException, InvalidConfigException {
// stop this configuration
kernel.stopGBean(config.getName());