You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2006/03/13 11:07:58 UTC
svn commit: r385487 [3/3] - in /geronimo/branches/1.1:
applications/console-core/src/java/org/apache/geronimo/console/util/
modules/axis-builder/src/test/org/apache/geronimo/axis/builder/
modules/client-builder/src/java/org/apache/geronimo/client/build...
Modified: geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatManagerImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatManagerImpl.java?rev=385487&r1=385486&r2=385487&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatManagerImpl.java (original)
+++ geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatManagerImpl.java Mon Mar 13 02:07:53 2006
@@ -16,30 +16,27 @@
*/
package org.apache.geronimo.tomcat;
-import java.util.Set;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Hashtable;
-import javax.management.ObjectName;
-import javax.management.MalformedObjectNameException;
-import org.apache.geronimo.management.geronimo.WebManager;
-import org.apache.geronimo.gbean.GBeanQuery;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
import org.apache.geronimo.gbean.GBeanData;
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.gbean.AbstractName;
-import org.apache.geronimo.system.serverinfo.ServerInfo;
-import org.apache.geronimo.j2ee.management.impl.Util;
-import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.gbean.ReferencePatterns;
import org.apache.geronimo.kernel.GBeanNotFoundException;
import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.kernel.config.EditableConfigurationManager;
import org.apache.geronimo.kernel.config.ConfigurationUtil;
-import org.apache.geronimo.kernel.config.Configuration;
+import org.apache.geronimo.kernel.config.EditableConfigurationManager;
import org.apache.geronimo.kernel.config.InvalidConfigException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.management.geronimo.WebManager;
+import org.apache.geronimo.system.serverinfo.ServerInfo;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
/**
* Tomcat implementation of the WebManager management API. Knows how to
@@ -72,21 +69,15 @@
* @return The ObjectName of the new connector.
*/
public AbstractName addConnector(AbstractName containerName, String uniqueName, String protocol, String host, int port) {
- ObjectName container;
- try {
- container = ObjectName.getInstance(containerName);
- } catch (MalformedObjectNameException e) {
- throw new IllegalArgumentException("Invalid web container ObjectName '"+containerName +"'");
- }
- ObjectName name = getConnectorName(container, protocol, uniqueName);
+ AbstractName name = NameFactory.getChildName(containerName, NameFactory.GERONIMO_SERVICE, "TomcatWebConnector-" + protocol + "-" + uniqueName, null);
GBeanData connector;
if(protocol.equals(PROTOCOL_HTTP)) {
connector = new GBeanData(name, ConnectorGBean.GBEAN_INFO);
} else if(protocol.equals(PROTOCOL_HTTPS)) {
connector = new GBeanData(name, HttpsConnectorGBean.GBEAN_INFO);
- GBeanQuery query = new GBeanQuery(null, ServerInfo.class.getName());
+ AbstractNameQuery query = new AbstractNameQuery(ServerInfo.class.getName());
Set set = kernel.listGBeans(query);
- connector.setReferencePattern("ServerInfo", (ObjectName)set.iterator().next());
+ connector.setReferencePattern("ServerInfo", (AbstractName)set.iterator().next());
//todo: default HTTPS settings
} else if(protocol.equals(PROTOCOL_AJP)) {
connector = new GBeanData(name, ConnectorGBean.GBEAN_INFO);
@@ -98,14 +89,13 @@
connector.setAttribute("port", new Integer(port));
connector.setAttribute("maxThreads", new Integer(50));
connector.setAttribute("acceptQueueSize", new Integer(100));
- connector.setReferencePattern(ConnectorGBean.CONNECTOR_CONTAINER_REFERENCE, container);
+ connector.setReferencePattern(ConnectorGBean.CONNECTOR_CONTAINER_REFERENCE, containerName);
connector.setAttribute("name", uniqueName);
EditableConfigurationManager mgr = ConfigurationUtil.getEditableConfigurationManager(kernel);
if(mgr != null) {
try {
- ObjectName config = Util.getConfiguration(kernel, container);
- mgr.addGBeanToConfiguration(Configuration.getConfigurationID(config), connector, false);
- return name.getCanonicalName();
+ mgr.addGBeanToConfiguration(containerName.getArtifact(), connector, false);
+ return name;
} catch (InvalidConfigException e) {
log.error("Unable to add GBean", e);
return null;
@@ -121,16 +111,10 @@
/**
* Gets the network containers.
*/
- public String[] getContainers() {
- GBeanQuery query = new GBeanQuery(null, TomcatWebContainer.class.getName());
+ public AbstractName[] getContainers() {
+ AbstractNameQuery query = new AbstractNameQuery(TomcatWebContainer.class.getName());
Set names = kernel.listGBeans(query);
- String[] result = new String[names.size()];
- int i = 0;
- for (Iterator it = names.iterator(); it.hasNext();) {
- ObjectName name = (ObjectName) it.next();
- result[i++] = name.getCanonicalName();
- }
- return result;
+ return (AbstractName[]) names.toArray(new AbstractName[names.size()]);
}
/**
@@ -146,30 +130,23 @@
* @param connectorName
*/
public void removeConnector(AbstractName connectorName) {
- ObjectName name = null;
try {
- name = ObjectName.getInstance(connectorName);
- } catch (MalformedObjectNameException e) {
- throw new IllegalArgumentException("Invalid object name '"+connectorName +"': "+e.getMessage());
- }
- try {
- GBeanInfo info = kernel.getGBeanInfo(name);
+ GBeanInfo info = kernel.getGBeanInfo(connectorName);
boolean found = false;
Set intfs = info.getInterfaces();
for (Iterator it = intfs.iterator(); it.hasNext();) {
String intf = (String) it.next();
- if(intf.equals(TomcatWebConnector.class.getName())) {
+ if (intf.equals(TomcatWebConnector.class.getName())) {
found = true;
}
}
- if(!found) {
- throw new GBeanNotFoundException(name);
+ if (!found) {
+ throw new GBeanNotFoundException(connectorName);
}
- ObjectName config = Util.getConfiguration(kernel, name);
EditableConfigurationManager mgr = ConfigurationUtil.getEditableConfigurationManager(kernel);
if(mgr != null) {
try {
- mgr.removeGBeanFromConfiguration(Configuration.getConfigurationID(config), name);
+ mgr.removeGBeanFromConfiguration(connectorName.getArtifact(), connectorName);
} catch (InvalidConfigException e) {
log.error("Unable to add GBean", e);
} finally {
@@ -179,7 +156,7 @@
log.warn("The ConfigurationManager in the kernel does not allow editing");
}
} catch (GBeanNotFoundException e) {
- log.warn("No such GBean '"+connectorName +"'"); //todo: what if we want to remove a failed GBean?
+ log.warn("No such GBean '" + connectorName + "'"); //todo: what if we want to remove a failed GBean?
} catch (Exception e) {
log.error(e);
}
@@ -190,155 +167,101 @@
*
* @param protocol A protocol as returned by getSupportedProtocols
*/
- public String[] getConnectors(String protocol) {
- GBeanQuery query = new GBeanQuery(null, TomcatWebConnector.class.getName());
+ public AbstractName[] getConnectors(String protocol) {
+ AbstractNameQuery query = new AbstractNameQuery(TomcatWebConnector.class.getName());
Set names = kernel.listGBeans(query);
List result = new ArrayList();
for (Iterator it = names.iterator(); it.hasNext();) {
- ObjectName name = (ObjectName) it.next();
+ AbstractName name = (AbstractName) it.next();
try {
- if(kernel.getAttribute(name, "protocol").equals(protocol)) {
- result.add(name.getCanonicalName());
+ if (kernel.getAttribute(name, "protocol").equals(protocol)) {
+ result.add(name);
}
} catch (Exception e) {
log.error("Unable to check the protocol for a connector", e);
}
}
- return (String[]) result.toArray(new String[result.size()]);
+ return (AbstractName[]) result.toArray(new AbstractName[result.size()]);
}
- public String getAccessLog(String containerObjectName) {
- GBeanQuery query = new GBeanQuery(null, TomcatLogManager.class.getName());
+ public AbstractName getAccessLog(String containerObjectName) {
+ AbstractNameQuery query = new AbstractNameQuery(TomcatLogManager.class.getName());
Set names = kernel.listGBeans(query);
if(names.size() == 0) {
return null;
} else if(names.size() > 1) {
- throw new IllegalStateException("Should not be more than one Tomcat access log manager");
+ throw new IllegalStateException("Should not be more than one Jetty access log manager");
}
- return ((ObjectName)names.iterator().next()).getCanonicalName();
+ return (AbstractName)names.iterator().next();
}
/**
* Gets the ObjectNames of any existing connectors associated with this network technology.
*/
- public String[] getConnectors() {
- GBeanQuery query = new GBeanQuery(null, TomcatWebConnector.class.getName());
+ public AbstractName[] getConnectors() {
+ AbstractNameQuery query = new AbstractNameQuery(TomcatWebConnector.class.getName());
Set names = kernel.listGBeans(query);
- String[] result = new String[names.size()];
- int i=0;
- for (Iterator it = names.iterator(); it.hasNext();) {
- ObjectName name = (ObjectName) it.next();
- result[i++] = name.getCanonicalName();
- }
- return result;
+ return (AbstractName[]) names.toArray(new AbstractName[names.size()]);
}
/**
* Gets the ObjectNames of any existing connectors for the specified container for the specified protocol.
*
+ * @param containerName
* @param protocol A protocol as returned by getSupportedProtocols
*/
- public String[] getConnectorsForContainer(String containerObjectName, String protocol) {
+ public AbstractName[] getConnectorsForContainer(AbstractName containerName, String protocol) {
if(protocol == null) {
- return getConnectorsForContainer(containerObjectName);
+ return getConnectorsForContainer(containerName);
}
try {
- ObjectName containerName = ObjectName.getInstance(containerObjectName);
List results = new ArrayList();
- GBeanQuery query = new GBeanQuery(null, TomcatWebConnector.class.getName());
+ AbstractNameQuery query = new AbstractNameQuery(TomcatWebConnector.class.getName());
Set set = kernel.listGBeans(query); // all Jetty connectors
for (Iterator it = set.iterator(); it.hasNext();) {
- ObjectName name = (ObjectName) it.next(); // a single Jetty connector
+ AbstractName name = (AbstractName) it.next(); // a single Jetty connector
GBeanData data = kernel.getGBeanData(name);
- Set refs = data.getReferencePatterns(ConnectorGBean.CONNECTOR_CONTAINER_REFERENCE);
- for (Iterator refit = refs.iterator(); refit.hasNext();) {
- ObjectName ref = (ObjectName) refit.next();
- boolean match = false;
- if(ref.isPattern()) {
- Set matches = kernel.listGBeans(ref);
- if(matches.size() != 1) {
- log.error("Unable to compare a connector->container reference that's a pattern to a fixed container name: "+ref.getCanonicalName());
- } else {
- ref = (ObjectName)matches.iterator().next();
- if(ref.equals(containerName)) {
- match = true;
- }
- }
- } else {
- if(ref.equals(containerName)) {
- match = true;
+ ReferencePatterns refs = data.getReferencePatterns(ConnectorGBean.CONNECTOR_CONTAINER_REFERENCE);
+ //TODO configid need to verify that the refpattern is resolved
+ if(containerName.equals(refs.getAbstractName())) {
+ try {
+ String testProtocol = (String) kernel.getAttribute(name, "protocol");
+ if(testProtocol != null && testProtocol.equals(protocol)) {
+ results.add(name);
}
+ } catch (Exception e) {
+ log.error("Unable to look up protocol for connector '"+name+"'",e);
}
- if(match) {
- try {
- String testProtocol = (String) kernel.getAttribute(name, "protocol");
- if(testProtocol != null && testProtocol.equals(protocol)) {
- results.add(name.getCanonicalName());
- }
- } catch (Exception e) {
- log.error("Unable to look up protocol for connector '"+name+"'",e);
- }
- break;
- }
+ break;
}
}
- return (String[]) results.toArray(new String[results.size()]);
+ return (AbstractName[]) results.toArray(new AbstractName[results.size()]);
} catch (Exception e) {
- throw new IllegalArgumentException("Unable to look up connectors for Jetty container '"+containerObjectName+"': "+e);
+ throw new IllegalArgumentException("Unable to look up connectors for Jetty container '"+containerName +"': "+e);
}
}
/**
* Gets the ObjectNames of any existing connectors for the specified container.
+ * @param containerName
*/
- public String[] getConnectorsForContainer(String containerObjectName) {
+ public AbstractName[] getConnectorsForContainer(AbstractName containerName) {
try {
- ObjectName containerName = ObjectName.getInstance(containerObjectName);
List results = new ArrayList();
- GBeanQuery query = new GBeanQuery(null, TomcatWebConnector.class.getName());
+ AbstractNameQuery query = new AbstractNameQuery(TomcatWebConnector.class.getName());
Set set = kernel.listGBeans(query); // all Jetty connectors
for (Iterator it = set.iterator(); it.hasNext();) {
- ObjectName name = (ObjectName) it.next(); // a single Jetty connector
+ AbstractName name = (AbstractName) it.next(); // a single Jetty connector
GBeanData data = kernel.getGBeanData(name);
- Set refs = data.getReferencePatterns(ConnectorGBean.CONNECTOR_CONTAINER_REFERENCE);
- for (Iterator refit = refs.iterator(); refit.hasNext();) {
- ObjectName ref = (ObjectName) refit.next();
- if(ref.isPattern()) {
- Set matches = kernel.listGBeans(ref);
- if(matches.size() != 1) {
- log.error("Unable to compare a connector->container reference that's a pattern to a fixed container name: "+ref.getCanonicalName());
- } else {
- ref = (ObjectName)matches.iterator().next();
- if(ref.equals(containerName)) {
- results.add(name.getCanonicalName());
- break;
- }
- }
- } else {
- if(ref.equals(containerName)) {
- results.add(name.getCanonicalName());
- break;
- }
- }
+ ReferencePatterns refs = data.getReferencePatterns(ConnectorGBean.CONNECTOR_CONTAINER_REFERENCE);
+ //TODO configid need to verify that the refpattern is resolved
+ if (containerName.equals(refs.getAbstractName())) {
+ results.add(name);
}
}
- return (String[]) results.toArray(new String[results.size()]);
+ return (AbstractName[]) results.toArray(new AbstractName[results.size()]);
} catch (Exception e) {
- throw new IllegalArgumentException("Unable to look up connectors for Jetty container '"+containerObjectName+"': "+e);
- }
- }
-
- private ObjectName getConnectorName(ObjectName container, String protocol, String uniqueName) {
- Hashtable table = new Hashtable();
- table.put(NameFactory.J2EE_APPLICATION, container.getKeyProperty(NameFactory.J2EE_APPLICATION));
- table.put(NameFactory.J2EE_SERVER, container.getKeyProperty(NameFactory.J2EE_SERVER));
- table.put(NameFactory.J2EE_MODULE, container.getKeyProperty(NameFactory.J2EE_MODULE));
- table.put(NameFactory.J2EE_TYPE, container.getKeyProperty(NameFactory.J2EE_TYPE));
- table.put(NameFactory.J2EE_NAME, "TomcatWebConnector-"+protocol+"-"+uniqueName);
- try {
- return ObjectName.getInstance(container.getDomain(), table);
- } catch (MalformedObjectNameException e) {
- throw new IllegalStateException("Never should have failed: "+e.getMessage());
+ throw new IllegalArgumentException("Unable to look up connectors for Jetty container '"+containerName +"': "+e);
}
}
Modified: geronimo/branches/1.1/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java?rev=385487&r1=385486&r2=385487&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java (original)
+++ geronimo/branches/1.1/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java Mon Mar 13 02:07:53 2006
@@ -19,6 +19,7 @@
import org.apache.geronimo.common.DeploymentException;
import org.apache.geronimo.deployment.util.DeploymentUtil;
import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.gbean.AbstractName;
import org.apache.geronimo.j2ee.deployment.EARContext;
import org.apache.geronimo.j2ee.deployment.Module;
import org.apache.geronimo.j2ee.deployment.ModuleBuilder;
@@ -102,14 +103,14 @@
}
public Module createModule(File plan, JarFile moduleFile) throws DeploymentException {
- return createModule(plan, moduleFile, "war", null, true, null);
+ return createModule(plan, moduleFile, "war", null, true, null, null);
}
- public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo) throws DeploymentException {
- return createModule(plan, moduleFile, targetPath, specDDUrl, false, (String) moduleContextInfo);
+ public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName) throws DeploymentException {
+ return createModule(plan, moduleFile, targetPath, specDDUrl, false, (String) moduleContextInfo, earName);
}
- protected abstract Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, boolean standAlone, String contextRoot) throws DeploymentException;
+ protected abstract Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, boolean standAlone, String contextRoot, AbstractName earName) throws DeploymentException;
/**
* Some servlets will have multiple url patterns. However, webservice servlets
@@ -185,7 +186,7 @@
environment,
ConfigurationModuleType.WAR,
kernel,
- earContext.getJ2EEApplicationName(),
+ module.getModuleName(),
earContext.getTransactionContextManagerObjectName(),
earContext.getConnectionTrackerObjectName(),
earContext.getTransactedTimerName(),
Modified: geronimo/branches/1.1/plugins/geronimo-packaging-plugin/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/plugins/geronimo-packaging-plugin/project.xml?rev=385487&r1=385486&r2=385487&view=diff
==============================================================================
--- geronimo/branches/1.1/plugins/geronimo-packaging-plugin/project.xml (original)
+++ geronimo/branches/1.1/plugins/geronimo-packaging-plugin/project.xml Mon Mar 13 02:07:53 2006
@@ -42,6 +42,14 @@
<packaging.classpath>true</packaging.classpath>
</properties>
</dependency>
+ <dependency>
+ <groupId>geronimo</groupId>
+ <artifactId>geronimo-j2ee</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ <properties>
+ <packaging.classpath>true</packaging.classpath>
+ </properties>
+ </dependency>
<dependency>
<groupId>cglib</groupId>
Modified: geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenAttributeStore.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenAttributeStore.java?rev=385487&r1=385486&r2=385487&view=diff
==============================================================================
--- geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenAttributeStore.java (original)
+++ geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenAttributeStore.java Mon Mar 13 02:07:53 2006
@@ -21,6 +21,8 @@
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoBuilder;
import org.apache.geronimo.gbean.GReferenceInfo;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.ReferencePatterns;
import org.apache.geronimo.kernel.config.ManageableAttributeStore;
import org.apache.geronimo.kernel.repository.Artifact;
@@ -40,16 +42,13 @@
return datas;
}
- public void setValue(String configurationName, ObjectName gbean, GAttributeInfo attribute, Object value) {
+ public void setValue(String configurationName, AbstractName gbean, GAttributeInfo attribute, Object value) {
}
- public void setReferencePattern(String configurationName, ObjectName gbean, GReferenceInfo reference, ObjectName pattern) {
+ public void setReferencePatterns(String configurationName, AbstractName gbean, GReferenceInfo reference, ReferencePatterns patterns) {
}
- public void setReferencePatterns(String configurationName, ObjectName gbean, GReferenceInfo reference, Set patterns) {
- }
-
- public void setShouldLoad(String configurationName, ObjectName gbean, boolean load) {
+ public void setShouldLoad(String configurationName, AbstractName gbean, boolean load) {
}
public void addGBean(String configurationName, GBeanData gbeanData) {
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=385487&r1=385486&r2=385487&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 Mon Mar 13 02:07:53 2006
@@ -21,6 +21,7 @@
import org.apache.geronimo.gbean.GBeanData;
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GReferenceInfo;
+import org.apache.geronimo.gbean.AbstractName;
import org.apache.geronimo.kernel.Kernel;
import org.apache.geronimo.kernel.KernelFactory;
import org.apache.geronimo.kernel.KernelRegistry;
@@ -30,6 +31,7 @@
import org.apache.geronimo.kernel.repository.Artifact;
import org.apache.geronimo.kernel.repository.DefaultArtifactManager;
import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
import org.apache.log4j.BasicConfigurator;
import javax.management.MalformedObjectNameException;
@@ -39,6 +41,8 @@
import java.util.Iterator;
import java.util.List;
import java.util.Set;
+import java.util.Map;
+import java.util.HashMap;
/**
* JellyBean that builds a Geronimo Configuration using the local Mavem
@@ -54,23 +58,23 @@
/**
* The name of the GBean that will load dependencies from the Maven repository.
*/
- private static final ObjectName REPOSITORY_NAME;
- private static final ObjectName ARTIFACT_MANAGER_NAME;
- private static final ObjectName ARTIFACT_RESOLVER_NAME;
+ private static final AbstractName REPOSITORY_NAME;
+ private static final AbstractName ARTIFACT_MANAGER_NAME;
+ private static final AbstractName ARTIFACT_RESOLVER_NAME;
/**
* The name of the GBean that will load Configurations from the Maven repository.
*/
- private static final ObjectName CONFIGSTORE_NAME;
+ private static final AbstractName CONFIGSTORE_NAME;
/**
* The name of the GBean that will manage Configurations.
*/
- private static final ObjectName CONFIGMANAGER_NAME;
+ private static final AbstractName CONFIGMANAGER_NAME;
/**
* The name of the GBean that will provide values for managed attributes.
*/
- private static final ObjectName ATTRIBUTESTORE_NAME;
+ private static final AbstractName ATTRIBUTESTORE_NAME;
/**
* Reference to the kernel that will last the lifetime of this classloader.
@@ -90,16 +94,23 @@
};
static {
+ Artifact artifact = new Artifact("geronimo", "packaging", "fixed", "car");
+ Map nameMap = new HashMap();
+ nameMap.put("type", "plugin");
+ nameMap.put("name", "packaging");
+ ObjectName objectName;
try {
- REPOSITORY_NAME = new ObjectName(KERNEL_NAME + ":name=Repository,j2eeType=Repository");
- ARTIFACT_MANAGER_NAME = new ObjectName(KERNEL_NAME + ":name=ArtifactManager");
- ARTIFACT_RESOLVER_NAME = new ObjectName(KERNEL_NAME + ":name=ArtifactResolver");
- CONFIGSTORE_NAME = new ObjectName(KERNEL_NAME + ":name=PackageBuilderConfigStore,j2eeType=ConfigurationStore");
- CONFIGMANAGER_NAME = new ObjectName(KERNEL_NAME + ":name=ConfigurationManager,j2eeType=ConfigurationManager");
- ATTRIBUTESTORE_NAME = new ObjectName(KERNEL_NAME + ":name=ManagedAttributeStore");
+ objectName = ObjectName.getInstance(KERNEL_NAME + "j2eeType=plugin,name=packaging");
} catch (MalformedObjectNameException e) {
- throw new ExceptionInInitializerError(e.getMessage());
+ throw (IllegalArgumentException)new IllegalArgumentException("Could not construct a fixed object name").initCause(e);
}
+ AbstractName rootName = new AbstractName(artifact, nameMap, objectName);
+ REPOSITORY_NAME = NameFactory.getChildName(rootName, "Repository", "Repository", null);
+ ARTIFACT_MANAGER_NAME = NameFactory.getChildName(rootName, "ArtifactManager", "ArtifactManager", null);
+ ARTIFACT_RESOLVER_NAME = NameFactory.getChildName(rootName, "ArtifactResolver", "ArtifactResolver", null);
+ CONFIGSTORE_NAME = NameFactory.getChildName(rootName, "ConfigurationStore", "PackageBuilderConfigStore", null);
+ CONFIGMANAGER_NAME = NameFactory.getChildName(rootName, "ConfigurationManager", "ConfigurationManager", null);
+ ATTRIBUTESTORE_NAME = NameFactory.getChildName(rootName, "ManagedAttributeStore", "ManagedAttributeStore", null);
}
private String repositoryClass;
@@ -285,7 +296,7 @@
invokeDeployer(kernel, deployer);
System.out.println("Generated package " + packageFile);
} catch (Exception e) {
- log.error(e.getClass().getName()+": "+e.getMessage(), e);
+ log.error(e.getClass().getName() + ": " + e.getMessage(), e);
throw e;
}
}
@@ -387,7 +398,7 @@
private List invokeDeployer(Kernel kernel, ObjectName deployer) throws Exception {
boolean isExecutable = mainClass != null;
- Object[] args = {planFile, moduleFile, isExecutable? packageFile: null, Boolean.valueOf(!isExecutable), mainClass, classPath, endorsedDirs, extensionDirs};
+ Object[] args = {planFile, moduleFile, isExecutable ? packageFile : null, Boolean.valueOf(!isExecutable), mainClass, classPath, endorsedDirs, extensionDirs};
return (List) kernel.invoke(deployer, "deploy", args, ARG_TYPES);
}
}