Author: dain
Date: Wed Mar 1 19:07:21 2006
New Revision: 382257
URL: http://svn.apache.org/viewcvs?rev=382257&view=rev
Log:
Configuration manager is now strictly two phases: load and start
Modified:
geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java
geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/DeploymentPortlet.java
geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/activemqCF/ActiveMQConnectorHelper.java
geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/handlers/CreateDestinationHandler.java
geronimo/branches/1.1/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java
geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/StartCommand.java
geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/StopCommand.java
geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/UndeployCommand.java
geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java
geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java
geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java
geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java
geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/config/ConfigurationManagerTest.java
geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/CommandLine.java
geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/Daemon.java
geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
geronimo/branches/1.1/plugins/geronimo-deployment-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StartServer.java
geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java
Modified: geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java?rev=382257&r1=382256&r2=382257&view=diff
==============================================================================
--- geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java (original)
+++ geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java Wed Mar 1 19:07:21 2006
@@ -101,16 +101,15 @@
Artifact configID = Artifact.create(config);
if (START_ACTION.equals(action)) {
- List ancestors = configurationManager.loadRecursive(configID);
+ List ancestors = configurationManager.loadConfiguration(configID);
for (Iterator it = ancestors.iterator(); it.hasNext();) {
Artifact ancestor = (Artifact) it.next();
- configurationManager.loadGBeans(ancestor);
- configurationManager.start(ancestor);
+ configurationManager.startConfiguration(ancestor);
}
messageStatus = "Started application
";
} else if (STOP_ACTION.equals(action)) {
- configurationManager.stop(configID);
- configurationManager.unload(configID);
+ configurationManager.stopConfiguration(configID);
+ configurationManager.unloadConfiguration(configID);
messageStatus = "Stopped application
";
} else if (UNINSTALL_ACTION.equals(action)) {
uninstallConfig(actionRequest);
@@ -160,8 +159,8 @@
int state = kernel.getGBeanState(Configuration.getConfigurationObjectName(configURI));
if (state == State.RUNNING.toInt()) {
- configManager.stop(configURI);
- configManager.unload(configURI);
+ configManager.stopConfiguration(configURI);
+ configManager.unloadConfiguration(configURI);
}
}
kernel.invoke(configStore, UNINSTALL_METHOD, new Object[]{configURI}, UNINSTALL_SIG);
Modified: geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/DeploymentPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/DeploymentPortlet.java?rev=382257&r1=382256&r2=382257&view=diff
==============================================================================
--- geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/DeploymentPortlet.java (original)
+++ geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/DeploymentPortlet.java Wed Mar 1 19:07:21 2006
@@ -120,10 +120,9 @@
for (Iterator iterator = list.iterator(); iterator.hasNext();) {
Artifact configID = Artifact.create((String)iterator.next());
if (!configurationManager.isLoaded(configID)) {
- configurationManager.load(configID);
+ configurationManager.loadConfiguration(configID);
}
- configurationManager.loadGBeans(configID);
- configurationManager.start(configID);
+ configurationManager.startConfiguration(configID);
}
}
} catch (DeploymentException e) {
Modified: geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/activemqCF/ActiveMQConnectorHelper.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/activemqCF/ActiveMQConnectorHelper.java?rev=382257&r1=382256&r2=382257&view=diff
==============================================================================
--- geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/activemqCF/ActiveMQConnectorHelper.java (original)
+++ geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/activemqCF/ActiveMQConnectorHelper.java Wed Mar 1 19:07:21 2006
@@ -152,11 +152,10 @@
for (Iterator iterator = list.iterator(); iterator.hasNext();) {
Artifact configID = Artifact.create((String)iterator.next());
if (!configurationManager.isLoaded(configID)) {
- configurationManager.load(configID);
+ configurationManager.loadConfiguration(configID);
}
- configurationManager.loadGBeans(configID);
- configurationManager.start(configID);
+ configurationManager.startConfiguration(configID);
}
} catch (DeploymentException e) {
StringBuffer buf = new StringBuffer(256);
Modified: geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/handlers/CreateDestinationHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/handlers/CreateDestinationHandler.java?rev=382257&r1=382256&r2=382257&view=diff
==============================================================================
--- geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/handlers/CreateDestinationHandler.java (original)
+++ geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/handlers/CreateDestinationHandler.java Wed Mar 1 19:07:21 2006
@@ -155,9 +155,8 @@
installDir}, new String[] {
ConfigurationData.class.getName(), File.class.getName() });
- configurationManager.load(configId);
- configurationManager.loadGBeans(configId);
- configurationManager.start(configId);
+ configurationManager.loadConfiguration(configId);
+ configurationManager.startConfiguration(configId);
} catch (Exception e) {
log.error("problem", e);
Modified: geronimo/branches/1.1/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java?rev=382257&r1=382256&r2=382257&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java (original)
+++ geronimo/branches/1.1/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java Wed Mar 1 19:07:21 2006
@@ -413,9 +413,8 @@
ConfigurationManager configurationManager = (ConfigurationManager) kernel.getProxyManager().createProxy(configurationManagerName, ConfigurationManager.class);
Artifact parentID = (Artifact) defaultEnvironment.getImports().iterator().next();
- configurationManager.load(parentID);
- configurationManager.loadGBeans(parentID);
- configurationManager.start(parentID);
+ configurationManager.loadConfiguration(parentID);
+ configurationManager.startConfiguration(parentID);
ObjectName serverInfoObjectName = ObjectName.getInstance(j2eeContext.getJ2eeDomainName() + ":name=ServerInfo");
GBeanData serverInfoGBean = new GBeanData(serverInfoObjectName, BasicServerInfo.GBEAN_INFO);
Modified: geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java?rev=382257&r1=382256&r2=382257&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java (original)
+++ geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java Wed Mar 1 19:07:21 2006
@@ -86,7 +86,7 @@
} else throw e;
}
try {
- configurationManager.unload(configID);
+ configurationManager.unloadConfiguration(configID);
updateStatus("Unloaded "+configID);
} catch(InternalKernelException e) {
Exception cause = (Exception)e.getCause();
@@ -107,11 +107,10 @@
doDeploy(module.getTarget(), false);
updateStatus("Deployed "+configID);
- List list = configurationManager.loadRecursive(configID);
+ List list = configurationManager.loadConfiguration(configID);
for (int j = 0; j < list.size(); j++) {
Artifact name = (Artifact) list.get(j);
- configurationManager.loadGBeans(name);
- configurationManager.start(name);
+ configurationManager.startConfiguration(name);
updateStatus("Started " + name);
}
}
Modified: geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/StartCommand.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/StartCommand.java?rev=382257&r1=382256&r2=382257&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/StartCommand.java (original)
+++ geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/StartCommand.java Wed Mar 1 19:07:21 2006
@@ -67,11 +67,10 @@
}
// Load and start the module
- List list = configurationManager.loadRecursive(moduleID);
+ List list = configurationManager.loadConfiguration(moduleID);
for (int j = 0; j < list.size(); j++) {
Artifact name = (Artifact) list.get(j);
- configurationManager.loadGBeans(name);
- configurationManager.start(name);
+ configurationManager.startConfiguration(name);
String configName = name.toString();
List kids = loadChildren(kernel, configName);
TargetModuleIDImpl id = new TargetModuleIDImpl(modules[i].getTarget(), configName,
Modified: geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/StopCommand.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/StopCommand.java?rev=382257&r1=382256&r2=382257&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/StopCommand.java (original)
+++ geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/StopCommand.java Wed Mar 1 19:07:21 2006
@@ -47,12 +47,12 @@
TargetModuleID module = modules[i];
Artifact moduleID = Artifact.create(module.getModuleID());
try {
- configurationManager.stop(moduleID);
+ configurationManager.stopConfiguration(moduleID);
} catch (InvalidConfigException e) {
updateStatus("Module "+moduleID+" is not running.");
continue;
}
- configurationManager.unload(moduleID);
+ configurationManager.unloadConfiguration(moduleID);
addModule(module);
}
} finally {
Modified: geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/UndeployCommand.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/UndeployCommand.java?rev=382257&r1=382256&r2=382257&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/UndeployCommand.java (original)
+++ geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/UndeployCommand.java Wed Mar 1 19:07:21 2006
@@ -56,7 +56,7 @@
Artifact moduleID = Artifact.create(module.getModuleID());
try {
try {
- configurationManager.stop(moduleID);
+ configurationManager.stopConfiguration(moduleID);
} catch (InvalidConfigException e) {
if(e.getCause() instanceof GBeanNotFoundException) {
GBeanNotFoundException gnf = (GBeanNotFoundException) e.getCause();
@@ -67,7 +67,7 @@
}
}
}
- configurationManager.unload(moduleID);
+ configurationManager.unloadConfiguration(moduleID);
updateStatus("Module "+moduleID+" unloaded.");
} catch (InternalKernelException e) {
// this is cause by the kernel being already shutdown
Modified: geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java?rev=382257&r1=382256&r2=382257&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java (original)
+++ geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java Wed Mar 1 19:07:21 2006
@@ -118,7 +118,7 @@
try {
boolean loaded = false;
if (!configurationManager.isLoaded(parent)) {
- configurationManager.load(parent);
+ configurationManager.loadConfiguration(parent);
loaded = true;
}
try {
@@ -130,7 +130,7 @@
} finally {
if (loaded) {
// we need to unload again so the loadedAncestors list will be in the correct order to start configs.
- configurationManager.unload(parent);
+ configurationManager.unloadConfiguration(parent);
}
}
} catch (Exception e) {
@@ -473,7 +473,7 @@
try {
for (Iterator iterator = parentId.iterator(); iterator.hasNext();) {
Artifact artifact = (Artifact) iterator.next();
- List newAncestors = configurationManager.loadRecursive(artifact);
+ List newAncestors = configurationManager.loadConfiguration(artifact);
loadedAncestors.addAll(newAncestors);
}
} catch (Exception e) {
@@ -491,7 +491,6 @@
Artifact pattern = (Artifact) iterator.next();
startAncestors(pattern, kernel, started, configurationManager);
}
- configurationManager.loadGBeans(configID);
started.add(configID);
}
}
Modified: geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java?rev=382257&r1=382256&r2=382257&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java (original)
+++ geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java Wed Mar 1 19:07:21 2006
@@ -287,9 +287,8 @@
kernel.startGBean(configurationManagerName);
ConfigurationManager configurationManager = (ConfigurationManager) kernel.getProxyManager().createProxy(configurationManagerName, ConfigurationManager.class);
- configurationManager.load((Artifact) parentId.get(0));
- configurationManager.loadGBeans((Artifact) parentId.get(0));
- configurationManager.start((Artifact) parentId.get(0));
+ configurationManager.loadConfiguration((Artifact) parentId.get(0));
+ configurationManager.startConfiguration((Artifact) parentId.get(0));
Collection defaultServlets = new HashSet();
Collection defaultFilters = new HashSet();
Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java?rev=382257&r1=382256&r2=382257&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java Wed Mar 1 19:07:21 2006
@@ -672,13 +672,6 @@
infoFactory.addReference("ArtifactResolver", ArtifactResolver.class, "ArtifactResolver");
infoFactory.addInterface(Configuration.class);
-// infoFactory.addOperation("addGBean", new Class[]{GBeanData.class, boolean.class});
-// infoFactory.addOperation("removeGBean", new Class[]{ObjectName.class});
-// infoFactory.addOperation("containsGBean", new Class[]{ObjectName.class});
-// infoFactory.addOperation("loadGBeans", new Class[]{ManageableAttributeStore.class});
-// infoFactory.addOperation("startRecursiveGBeans");
-// infoFactory.addOperation("stopGBeans");
-// infoFactory.addOperation("unloadGBeans");
infoFactory.setConstructor(new String[]{
"kernel",
Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java?rev=382257&r1=382256&r2=382257&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java Wed Mar 1 19:07:21 2006
@@ -51,18 +51,6 @@
List listConfigurations(ObjectName store) throws NoSuchStoreException;
/**
- * Load the specified configuration into the kernel. This does not start the configuration gbean
- * and thus does not load or start any gbeans in the configuration.
- *
- * @param configID the id of the configuration
- * @return the name of the new configuration object mounted into the kernel
- * @throws NoSuchConfigException if no configuration with the given id exists in the configuration stores
- * @throws IOException if there is a problem loading te configuration from the store
- * @throws InvalidConfigException if the configuration is corrupt
- */
- ObjectName load(Artifact configID) throws NoSuchConfigException, IOException, InvalidConfigException;
-
- /**
* Load the specified configuration and all parent configurations into the kernel. This does not
* start any configuration gbeans or load any gbeans from the configurations loaded. It does
* not hurt to call this even if some or all of the GBeans are already loaded -- though only
@@ -74,7 +62,7 @@
* @throws IOException if there is a problem loading te configuration from the store
* @throws InvalidConfigException if the configuration is corrupt
*/
- List loadRecursive(Artifact configID) throws NoSuchConfigException, IOException, InvalidConfigException;
+ List loadConfiguration(Artifact configID) throws NoSuchConfigException, IOException, InvalidConfigException;
/**
* Unloads the gbeans of the specified configuration, stops the configuration gbean, and unloads the
@@ -83,17 +71,7 @@
* @param configID the name fo the configuration to remove
* @throws NoSuchConfigException if the configuration is now loaded into the kernel
*/
- void unload(Artifact configID) throws NoSuchConfigException;
-
- /**
- * Load the gbeans of the named configuration into the kernel, but do not start them.
- * This starts the configuration gbean. You must have loaded the configuration using load(uri) or loadRecursive(uri)
- * before calling this method.
- *
- * @param configID
- * @throws InvalidConfigException
- */
- void loadGBeans(Artifact configID) throws InvalidConfigException;
+ void unloadConfiguration(Artifact configID) throws NoSuchConfigException;
/**
* Start the gbeans in this configuration. You must have called loadGBeans before calling this method.
@@ -101,7 +79,7 @@
* @param configID
* @throws InvalidConfigException
*/
- void start(Artifact configID) throws InvalidConfigException;
+ void startConfiguration(Artifact configID) throws InvalidConfigException;
/**
* Stop the gbeans in this configuration, but do not stop the configuration gbean.
@@ -109,5 +87,5 @@
* @param configID
* @throws InvalidConfigException
*/
- void stop(Artifact configID) throws InvalidConfigException;
+ void stopConfiguration(Artifact configID) throws InvalidConfigException;
}
Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java?rev=382257&r1=382256&r2=382257&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java Wed Mar 1 19:07:21 2006
@@ -48,6 +48,7 @@
import java.util.Map;
import java.net.URL;
import java.net.URI;
+import java.net.MalformedURLException;
/**
* The standard non-editable ConfigurationManager implementation. That is,
@@ -115,17 +116,16 @@
}
}
- public boolean isLoaded(Artifact configID) {
+ public boolean isLoaded(Artifact configId) {
try {
- ObjectName name = Configuration.getConfigurationObjectName(configID);
- return kernel.isLoaded(name);
- } catch (InvalidConfigException e) {
- //todo really?
+ ObjectName configurationName = Configuration.getConfigurationObjectName(configId);
+ return State.RUNNING_INDEX == kernel.getGBeanState(configurationName);
+ } catch (Exception e) {
return false;
}
}
- public List loadRecursive(Artifact configID) throws NoSuchConfigException, IOException, InvalidConfigException {
+ public List loadConfiguration(Artifact configID) throws NoSuchConfigException, IOException, InvalidConfigException {
Set preloaded = kernel.listGBeans(CONFIGURATION_NAME_QUERY);
for (Iterator it = preloaded.iterator(); it.hasNext();) {
ObjectName name = (ObjectName) it.next();
@@ -146,26 +146,51 @@
List parentToChild = new LinkedList(ancestors);
for (Iterator iterator = parentToChild.iterator(); iterator.hasNext();) {
Artifact parent = (Artifact) iterator.next();
- startConfiguration(parent);
+ ObjectName configurationName = Configuration.getConfigurationObjectName(parent);
+
+ // start configuration and assure it started
+ try {
+ kernel.startGBean(configurationName);
+ if (State.RUNNING_INDEX != kernel.getGBeanState(configurationName)) {
+ throw new InvalidConfigurationException("Configuration " + parent + " failed to start");
+ }
+ } catch (InvalidConfigurationException e) {
+ throw e;
+ } catch (GBeanNotFoundException e) {
+ throw new InvalidConfigException("Unable to start configuration gbean", e);
+ }
+
+ log.debug("Loaded Configuration " + configurationName);
+
+ // todo move this to startConfiguration when deployment code has been update to not search kernel
+ Configuration configuration = (Configuration) kernel.getProxyManager().createProxy(configurationName, Configuration.class);
+ registerGBeans(configuration);
}
// todo clean up after failure
return ancestors;
}
- private void loadRecursive(Artifact configID, LinkedList ancestors, Set preloaded) throws NoSuchConfigException, IOException, InvalidConfigException {
+ private void loadRecursive(Artifact configId, LinkedList ancestors, Set preloaded) throws NoSuchConfigException, IOException, InvalidConfigException {
try {
- ObjectName name = Configuration.getConfigurationObjectName(configID);
+ ObjectName name = Configuration.getConfigurationObjectName(configId);
if (preloaded.contains(name)) {
return;
}
- if (!isLoaded(configID)) {
- load(configID);
+ if (!isLoaded(configId)) {
+ GBeanData gbeanData = loadConfigurationGBeanData(configId);
+ try {
+ kernel.loadGBean(gbeanData, Configuration.class.getClassLoader());
+ } catch (Exception e) {
+ throw new InvalidConfigException("Unable to register configuration", e);
+ }
+
+ log.debug("Loaded Configuration " + configId);
}
//put the earliest ancestors first, even if we have already started them.
- ancestors.remove(configID);
- ancestors.addFirst(configID);
+ ancestors.remove(configId);
+ ancestors.addFirst(configId);
Environment environment = (Environment) kernel.getAttribute(name, "environment");
LinkedHashSet imports = environment.getImports();
@@ -196,7 +221,7 @@
}
}
- public ObjectName load(Artifact configId) throws NoSuchConfigException, IOException, InvalidConfigException {
+ private GBeanData loadConfigurationGBeanData(Artifact configId) throws NoSuchConfigException, IOException, InvalidConfigException {
List storeSnapshot = getStores();
for (int i = 0; i < storeSnapshot.size(); i++) {
@@ -208,41 +233,13 @@
configurationGBean.setName(configurationName);
configurationGBean.setAttribute("configurationStore", store);
- try {
- kernel.loadGBean(configurationGBean, Configuration.class.getClassLoader());
- } catch (Exception e) {
- throw new InvalidConfigException("Unable to register configuration", e);
- }
-
- log.debug("Loaded Configuration " + configurationName);
- return configurationName;
+ return configurationGBean;
}
-
}
throw new NoSuchConfigException("No configuration with id: " + configId);
}
- public void startConfiguration(Artifact configId) throws NoSuchConfigException, IOException, InvalidConfigException {
- ObjectName configurationName = Configuration.getConfigurationObjectName(configId);
-
- Configuration configuration;
- try {
- // start and assure it started
- kernel.startGBean(configurationName);
- if (State.RUNNING_INDEX != kernel.getGBeanState(configurationName)) {
- throw new InvalidConfigurationException("Configuration " + configId + " failed to start");
- }
-
- // create a proxy to the configuration
- configuration = (Configuration) kernel.getProxyManager().createProxy(configurationName, Configuration.class);
- } catch (InvalidConfigurationException e) {
- throw e;
- } catch (GBeanNotFoundException e) {
- throw new InvalidConfigException("Unable to start configuration gbean", e);
- }
-
- log.debug("Loaded Configuration " + configurationName);
-
+ private void registerGBeans(Configuration configuration) throws InvalidConfigException, NoSuchConfigException, MalformedURLException {
// load the attribute overrides from the attribute store
Collection gbeans = configuration.getGBeans().values();
if (attributeStore != null) {
@@ -278,36 +275,60 @@
}
}
- public void loadGBeans(Artifact configID) throws InvalidConfigException {
- }
+ public void startConfiguration(Artifact configId) throws InvalidConfigException {
+ if (!isLoaded(configId)) {
+ throw new InvalidConfigurationException("Configuration " + configId + " failed to start");
+ }
+
+ Configuration configuration = getConfiguration(configId);
- public void start(Artifact configId) throws InvalidConfigException {
- ObjectName configurationName = Configuration.getConfigurationObjectName(configId);
+ // todo move this from loadConfiguration when deployment code has been update to not search kernel
+ // registerGBeans(configuration);
try {
- // start and assure it started
- kernel.startGBean(configurationName);
- if (State.RUNNING_INDEX != kernel.getGBeanState(configurationName)) {
- throw new InvalidConfigurationException("Configuration " + configId + " failed to start");
+ // start the gbeans
+ Map gbeans = configuration.getGBeans();
+ for (Iterator iterator = gbeans.keySet().iterator(); iterator.hasNext();) {
+ ObjectName gbeanName = (ObjectName) iterator.next();
+ if (kernel.isGBeanEnabled(gbeanName)) {
+ kernel.startRecursiveGBean(gbeanName);
+ }
}
- // create a proxy to the configuration
- Configuration configuration = (Configuration) kernel.getProxyManager().createProxy(configurationName, Configuration.class);
-
- startConfiguration(configuration);
- } catch (Exception e) {
- throw new InvalidConfigException("Could not start gbeans in configuration", e);
+ // assure all of the gbeans are started
+ for (Iterator iterator = gbeans.keySet().iterator(); iterator.hasNext();) {
+ ObjectName gbeanName = (ObjectName) iterator.next();
+ if (State.RUNNING_INDEX != kernel.getGBeanState(gbeanName)) {
+ throw new InvalidConfigurationException("Configuration " + configuration.getId() + " failed to start because gbean " + gbeanName + " did not start");
+ }
+ }
+ } catch (GBeanNotFoundException e) {
+ throw new InvalidConfigException(e);
}
+ // todo clean up after failure
if (configurationList != null) {
configurationList.addConfiguration(configId.toString());
}
}
- public void stop(Artifact configId) throws InvalidConfigException {
+ public void stopConfiguration(Artifact configId) throws InvalidConfigException {
try {
Configuration configuration = getConfiguration(configId);
- stopConfiguration(configuration);
+ Collection gbeans = configuration.getGBeans().values();
+
+ // stop the gbeans
+ for (Iterator iterator = gbeans.iterator(); iterator.hasNext();) {
+ ObjectName gbeanName = (ObjectName) iterator.next();
+ kernel.stopGBean(gbeanName);
+ }
+
+ // unload the gbeans
+ // todo this is very weird to have here since registration happens in load
+ for (Iterator iterator = gbeans.iterator(); iterator.hasNext();) {
+ ObjectName gbeanName = (ObjectName) iterator.next();
+ kernel.unloadGBean(gbeanName);
+ }
} catch (Exception e) {
throw new InvalidConfigException("Could not stop gbeans in configuration", e);
}
@@ -316,7 +337,7 @@
}
}
- public void unload(Artifact configId) throws NoSuchConfigException {
+ public void unloadConfiguration(Artifact configId) throws NoSuchConfigException {
ObjectName configName;
try {
configName = Configuration.getConfigurationObjectName(configId);
@@ -334,48 +355,6 @@
throw new NoSuchConfigException("Problem unloading config: " + configName, e);
}
}
-
- private void startConfiguration(Configuration configuration) throws InvalidConfigException {
- try {
- // start the gbeans
- Map gbeans = configuration.getGBeans();
- for (Iterator iterator = gbeans.keySet().iterator(); iterator.hasNext();) {
- ObjectName gbeanName = (ObjectName) iterator.next();
- if (kernel.isGBeanEnabled(gbeanName)) {
- kernel.startRecursiveGBean(gbeanName);
- }
- }
-
- // assure all of the gbeans are started
- for (Iterator iterator = gbeans.keySet().iterator(); iterator.hasNext();) {
- ObjectName gbeanName = (ObjectName) iterator.next();
- if (State.RUNNING_INDEX != kernel.getGBeanState(gbeanName)) {
- throw new InvalidConfigurationException("Configuration " + configuration.getId() + " failed to start because gbean " + gbeanName + " did not start");
- }
- }
- } catch (GBeanNotFoundException e) {
- throw new InvalidConfigException(e);
- }
- // todo clean up after failure
-
- }
-
- private void stopConfiguration(Configuration configuration) throws GBeanNotFoundException {
- Collection gbeans = configuration.getGBeans().values();
-
- // stop the gbeans
- for (Iterator iterator = gbeans.iterator(); iterator.hasNext();) {
- ObjectName gbeanName = (ObjectName) iterator.next();
- kernel.stopGBean(gbeanName);
- }
-
- // unload the gbeans
- for (Iterator iterator = gbeans.iterator(); iterator.hasNext();) {
- ObjectName gbeanName = (ObjectName) iterator.next();
- kernel.unloadGBean(gbeanName);
- }
- }
-
private List getStores() {
return new ArrayList(stores);
Modified: geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/config/ConfigurationManagerTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/config/ConfigurationManagerTest.java?rev=382257&r1=382256&r2=382257&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/config/ConfigurationManagerTest.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/config/ConfigurationManagerTest.java Wed Mar 1 19:07:21 2006
@@ -56,7 +56,7 @@
private ConfigurationManagerImpl configurationManager;
public void test() throws Exception {
- List list = configurationManager.loadRecursive(artifact3);
+ List list = configurationManager.loadConfiguration(artifact3);
assertTrue(list.contains(artifact3));
assertTrue(list.contains(artifact2));
assertTrue(list.contains(artifact1));
Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/CommandLine.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/CommandLine.java?rev=382257&r1=382256&r2=382257&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/CommandLine.java (original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/CommandLine.java Wed Mar 1 19:07:21 2006
@@ -133,11 +133,10 @@
try {
for (Iterator i = configurations.iterator(); i.hasNext();) {
Artifact configID = (Artifact) i.next();
- List list = configurationManager.loadRecursive(configID);
+ List list = configurationManager.loadConfiguration(configID);
for (Iterator iterator = list.iterator(); iterator.hasNext();) {
Artifact name = (Artifact) iterator.next();
- configurationManager.loadGBeans(name);
- configurationManager.start(name);
+ configurationManager.startConfiguration(name);
}
}
} finally {
Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/Daemon.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/Daemon.java?rev=382257&r1=382256&r2=382257&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/Daemon.java (original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/Daemon.java Wed Mar 1 19:07:21 2006
@@ -322,13 +322,12 @@
for (Iterator i = configs.iterator(); i.hasNext();) {
Artifact configID = (Artifact) i.next();
monitor.configurationLoading(configID);
- List list = configurationManager.loadRecursive(configID);
+ List list = configurationManager.loadConfiguration(configID);
monitor.configurationLoaded(configID);
monitor.configurationStarting(configID);
for (Iterator iterator = list.iterator(); iterator.hasNext();) {
Artifact name = (Artifact) iterator.next();
- configurationManager.loadGBeans(name);
- configurationManager.start(name);
+ configurationManager.startConfiguration(name);
}
monitor.configurationStarted(configID);
}
Modified: geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java?rev=382257&r1=382256&r2=382257&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java (original)
+++ geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java Wed Mar 1 19:07:21 2006
@@ -394,9 +394,8 @@
ConfigurationManager configurationManager = (ConfigurationManager) kernel.getProxyManager().createProxy(configurationManagerName, ConfigurationManager.class);
- configurationManager.load((Artifact) parentId.get(0));
- configurationManager.loadGBeans((Artifact) parentId.get(0));
- configurationManager.start((Artifact) parentId.get(0));
+ configurationManager.loadConfiguration((Artifact) parentId.get(0));
+ configurationManager.startConfiguration((Artifact) parentId.get(0));
serverInfoName = new ObjectName("geronimo.system:name=ServerInfo");
serverInfoGBean = new GBeanData(serverInfoName, BasicServerInfo.GBEAN_INFO);
Modified: geronimo/branches/1.1/plugins/geronimo-deployment-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StartServer.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/plugins/geronimo-deployment-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StartServer.java?rev=382257&r1=382256&r2=382257&view=diff
==============================================================================
--- geronimo/branches/1.1/plugins/geronimo-deployment-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StartServer.java (original)
+++ geronimo/branches/1.1/plugins/geronimo-deployment-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StartServer.java Wed Mar 1 19:07:21 2006
@@ -122,11 +122,10 @@
try {
for (Iterator i = configList.iterator(); i.hasNext();) {
Artifact configID = (Artifact) i.next();
- List list = configurationManager.loadRecursive(configID);
+ List list = configurationManager.loadConfiguration(configID);
for (Iterator iterator = list.iterator(); iterator.hasNext();) {
Artifact name = (Artifact) iterator.next();
- configurationManager.loadGBeans(name);
- configurationManager.start(name);
+ configurationManager.startConfiguration(name);
System.out.println("started gbean: " + name);
}
}
Modified: geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java?rev=382257&r1=382256&r2=382257&view=diff
==============================================================================
--- geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java (original)
+++ geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java Wed Mar 1 19:07:21 2006
@@ -270,16 +270,8 @@
for (int i = 0; i < deploymentConfig.length; i++) {
Artifact configName = deploymentConfig[i];
if (!configurationManager.isLoaded(configName)) {
- List configs = configurationManager.loadRecursive(configName);
- for (Iterator iterator = configs.iterator(); iterator.hasNext(); ) {
- Artifact ancestorConfigName = (Artifact) iterator.next();
- try {
- configurationManager.loadGBeans(ancestorConfigName);
- } catch (Throwable e) {
- throw new RuntimeException("Could not start configuration: " + configName, e);
- }
- }
- configurationManager.start(configName);
+ configurationManager.loadConfiguration(configName);
+ configurationManager.startConfiguration(configName);
}
}
} finally {