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/02/08 04:00:07 UTC
svn commit: r375831 [3/3] - in /geronimo/branches/configid:
applications/console-standard/src/java/org/apache/geronimo/console/configmanager/
applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/
modules/axis-builde...
Modified: geronimo/branches/configid/modules/jetty-builder/src/schema/geronimo-jetty-1.1.xsd
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/jetty-builder/src/schema/geronimo-jetty-1.1.xsd?rev=375831&r1=375830&r2=375831&view=diff
==============================================================================
--- geronimo/branches/configid/modules/jetty-builder/src/schema/geronimo-jetty-1.1.xsd (original)
+++ geronimo/branches/configid/modules/jetty-builder/src/schema/geronimo-jetty-1.1.xsd Tue Feb 7 18:59:48 2006
@@ -36,12 +36,8 @@
<xs:complexType name="web-appType">
<xs:sequence>
-<!-- <xs:element ref="sys:parent" minOccurs="0" maxOccurs="unbounded"/>-->
-<!-- <xs:element ref="sys:dependency" minOccurs="0" maxOccurs="unbounded"/>-->
-<!-- <xs:element ref="sys:hidden-classes" minOccurs="0" maxOccurs="unbounded"/>-->
-<!-- <xs:element ref="sys:non-overridable-classes" minOccurs="0" maxOccurs="unbounded"/>-->
- <xs:group ref="sys:classloader-infoGroup"/>
-
+ <xs:element ref="sys:environment"/>
+
<xs:element name="context-root" type="xs:string" minOccurs="0"/>
<xs:element name="context-priority-classloader" type="xs:boolean" minOccurs="0"/>
<xs:element name="virtual-host" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
@@ -57,15 +53,6 @@
<xs:element ref="sys:gbean" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="configId" type="xs:string" use="required"/>
- <xs:attribute name="parentId" type="xs:string" use="optional"/>
- <xs:attribute name="inverseClassloading" type="xs:boolean" use="optional"/>
- </xs:complexType>
-
- <xs:complexType name="container-configType">
- <xs:sequence>
- <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
Modified: geronimo/branches/configid/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java?rev=375831&r1=375830&r2=375831&view=diff
==============================================================================
--- geronimo/branches/configid/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java (original)
+++ geronimo/branches/configid/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java Tue Feb 7 18:59:48 2006
@@ -39,6 +39,7 @@
import org.apache.geronimo.common.DeploymentException;
import org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinatorGBean;
import org.apache.geronimo.deployment.DeploymentContext;
+import org.apache.geronimo.deployment.Environment;
import org.apache.geronimo.deployment.util.UnpackedJarFile;
import org.apache.geronimo.gbean.GBeanData;
import org.apache.geronimo.gbean.GBeanInfo;
@@ -60,6 +61,7 @@
import org.apache.geronimo.jetty.connector.HTTPConnector;
import org.apache.geronimo.kernel.Kernel;
import org.apache.geronimo.kernel.KernelFactory;
+import org.apache.geronimo.kernel.repository.Artifact;
import org.apache.geronimo.kernel.config.Configuration;
import org.apache.geronimo.kernel.config.ConfigurationData;
import org.apache.geronimo.kernel.config.ConfigurationManager;
@@ -110,7 +112,7 @@
File path = new File(basedir, "src/test-resources/deployables/war4");
UnpackedJarFile jarFile = new UnpackedJarFile(path);
Module module = builder.createModule(null, jarFile);
- URI id = new URI("war4");
+ Environment id = new Environment();
EARContext earContext = createEARContext(outputPath, id);
ObjectName serverName = earContext.getServerObjectName();
GBeanData server = new GBeanData(serverName, J2EEServerImpl.GBEAN_INFO);
@@ -153,11 +155,10 @@
kernel.unloadGBean(configName);
}
- private EARContext createEARContext(File outputPath, URI id) throws MalformedObjectNameException, DeploymentException {
+ private EARContext createEARContext(File outputPath, Environment environment) throws MalformedObjectNameException, DeploymentException {
EARContext earContext = new EARContext(outputPath,
- id,
+ environment,
ConfigurationModuleType.WAR,
- parentId,
kernel,
moduleContext.getJ2eeApplicationName(),
tcmName,
@@ -265,9 +266,9 @@
kernel.startGBean(configurationManagerName);
ConfigurationManager configurationManager = (ConfigurationManager) kernel.getProxyManager().createProxy(configurationManagerName, ConfigurationManager.class);
- configurationManager.load((URI) parentId.get(0));
- configurationManager.loadGBeans((URI) parentId.get(0));
- configurationManager.start((URI) parentId.get(0));
+ configurationManager.load((Artifact) parentId.get(0));
+ configurationManager.loadGBeans((Artifact) parentId.get(0));
+ configurationManager.start((Artifact) parentId.get(0));
Collection defaultServlets = new HashSet();
Collection defaultFilters = new HashSet();
@@ -347,23 +348,18 @@
this.kernel = kernel;
}
- public URI install(URL source) throws IOException, InvalidConfigException {
+ public Artifact install(URL source) throws IOException, InvalidConfigException {
return null;
}
public void install(ConfigurationData configurationData, File source) throws IOException, InvalidConfigException {
}
- public void uninstall(URI configID) throws NoSuchConfigException, IOException {
+ public void uninstall(Artifact configID) throws NoSuchConfigException, IOException {
}
- public ObjectName loadConfiguration(URI configId) throws NoSuchConfigException, IOException, InvalidConfigException {
- ObjectName configurationObjectName = null;
- try {
- configurationObjectName = Configuration.getConfigurationObjectName(configId);
- } catch (MalformedObjectNameException e) {
- throw new InvalidConfigException(e);
- }
+ public ObjectName loadConfiguration(Artifact configId) throws NoSuchConfigException, IOException, InvalidConfigException {
+ ObjectName configurationObjectName = Configuration.getConfigurationObjectName(configId);
GBeanData configData = new GBeanData(configurationObjectName, Configuration.GBEAN_INFO);
configData.setAttribute("id", configId);
configData.setAttribute("domain", "test");
@@ -379,7 +375,7 @@
return configurationObjectName;
}
- public boolean containsConfiguration(URI configID) {
+ public boolean containsConfiguration(Artifact configID) {
return true;
}
Modified: geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java?rev=375831&r1=375830&r2=375831&view=diff
==============================================================================
--- geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java (original)
+++ geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java Tue Feb 7 18:59:48 2006
@@ -55,6 +55,7 @@
import org.apache.geronimo.kernel.management.State;
import org.apache.geronimo.kernel.repository.MissingDependencyException;
import org.apache.geronimo.kernel.repository.Repository;
+import org.apache.geronimo.kernel.repository.Artifact;
/**
* A Configuration represents a collection of runnable services that can be
@@ -91,6 +92,15 @@
public static ObjectName getConfigurationObjectName(URI configId) throws MalformedObjectNameException {
return new ObjectName("geronimo.config:name=" + ObjectName.quote(configId.toString()));
}
+ public static ObjectName getConfigurationObjectName(Artifact configId) throws InvalidConfigException {
+ try {
+ return new ObjectName("geronimo.config:name=" + ObjectName.quote(configId.toURI().toString()));
+ } catch (MalformedObjectNameException e) {
+ throw new InvalidConfigException("Could not construct object name for configuration", e);
+ } catch (URISyntaxException e) {
+ throw new InvalidConfigException("Could not construct uri for artifact for configuration", e);
+ }
+ }
public static boolean isConfigurationObjectName(ObjectName name) {
return name.getDomain().equals("geronimo.config") && name.getKeyPropertyList().size() == 1 && name.getKeyProperty("name") != null;
@@ -120,7 +130,7 @@
/**
* URI used to referr to this configuration in the configuration manager
*/
- private final URI id;
+ private final Artifact id;
/**
* Identifies the type of configuration (WAR, RAR et cetera)
@@ -130,15 +140,14 @@
/**
* The uri of the parent of this configuration. May be null.
*/
- private final URI[] parentId;
+ private final Artifact[] parentId;
private final List dependencies;
private final List classPath;
private final boolean inverseClassLoading;
private final String[] hiddenClasses;
private final String[] nonOverridableClasses;
- private final String domain;
- private final String server;
+ private final Map nameKeys;
/**
* The names of all GBeans contained in this configuration.
@@ -177,8 +186,7 @@
id = null;
moduleType = null;
parentId = null;
- domain = null;
- server = null;
+ nameKeys = null;
objectNames = null;
configurationClassLoader = null;
dependencies = null;
@@ -196,26 +204,26 @@
*
* @param id the unique id of this Configuration
* @param moduleType the module type identifier
+ * @param nameKeys
* @param classPath a List<URI> of locations that define the codebase for this Configuration
* @param gbeanState a byte array contain the Java Serialized form of the GBeans in this Configuration
* @param repositories a Collection<Repository> of repositories used to resolve dependencies
* @param dependencies a List<URI> of dependencies
*/
public Configuration(Kernel kernel,
- String objectName,
- URI id,
- ConfigurationModuleType moduleType,
- URL baseURL,
- URI[] parentId,
- String domain,
- String server,
- List classPath,
- boolean inverseClassLoading,
- String[] hiddenClasses,
- String[] nonOverridableClasses,
- byte[] gbeanState,
- Collection repositories,
- List dependencies) throws Exception {
+ String objectName,
+ Artifact id,
+ ConfigurationModuleType moduleType,
+ URL baseURL,
+ Artifact[] parentId,
+ Map nameKeys,
+ List classPath,
+ boolean inverseClassLoading,
+ String[] hiddenClasses,
+ String[] nonOverridableClasses,
+ byte[] gbeanState,
+ Collection repositories,
+ List dependencies) throws Exception {
this.kernel = kernel;
this.objectNameString = objectName;
@@ -248,8 +256,7 @@
this.dependencies = Collections.EMPTY_LIST;
}
- this.domain = domain;
- this.server = server;
+ this.nameKeys = nameKeys;
addParentDependencies(kernel, id, parentId);
}
@@ -257,12 +264,8 @@
return objectNameString;
}
- public String getDomain() {
- return domain;
- }
-
- public String getServer() {
- return server;
+ public Map getNameKeys() {
+ return nameKeys;
}
public void doStart() throws Exception {
@@ -274,9 +277,9 @@
// no explicit parent set, so use the class loader of this class as
// the parent... this class should be in the root geronimo classloader,
// which is normally the system class loader but not always, so be safe
- configurationClassLoader = new MultiParentClassLoader(id, urls, getClass().getClassLoader(), inverseClassLoading, hiddenClasses, nonOverridableClasses);
+ configurationClassLoader = new MultiParentClassLoader(id.toURI(), urls, getClass().getClassLoader(), inverseClassLoading, hiddenClasses, nonOverridableClasses);
} else {
- configurationClassLoader = new MultiParentClassLoader(id, urls, getClassLoaders(parentId), inverseClassLoading, hiddenClasses, nonOverridableClasses);
+ configurationClassLoader = new MultiParentClassLoader(id.toURI(), urls, getClassLoaders(parentId), inverseClassLoading, hiddenClasses, nonOverridableClasses);
}
log.debug("Started configuration " + id);
@@ -292,7 +295,11 @@
// create and initialize GBeans
Collection gbeans = loadGBeans();
if (attributeStore != null) {
- gbeans = attributeStore.setAttributes(id, gbeans, configurationClassLoader);
+ try {
+ gbeans = attributeStore.setAttributes(id.toURI(), gbeans, configurationClassLoader);
+ } catch (URISyntaxException e) {
+ throw new InvalidConfigException(e);
+ }
}
// register all the GBeans
@@ -332,13 +339,13 @@
}
}
- private void addParentDependencies(Kernel kernel, URI id, URI[] parentId) throws MalformedObjectNameException {
+ private void addParentDependencies(Kernel kernel, Artifact id, Artifact[] parentId) throws InvalidConfigException {
if (parentId != null && parentId.length > 0) {
ObjectName name = getConfigurationObjectName(id);
Set parentNames = new HashSet();
for (int i = 0; i < parentId.length; i++) {
- URI uri = parentId[i];
- ObjectName parentName = getConfigurationObjectName(uri);
+ Artifact artifact = parentId[i];
+ ObjectName parentName = getConfigurationObjectName(artifact);
parentNames.add(parentName);
}
DependencyManager dependencyManager = kernel.getDependencyManager();
@@ -346,10 +353,10 @@
}
}
- private ClassLoader[] getClassLoaders(URI[] parentId) throws Exception {
+ private ClassLoader[] getClassLoaders(Artifact[] parentId) throws Exception {
ClassLoader[] classLoaders = new ClassLoader[parentId.length];
for (int i = 0; i < parentId.length; i++) {
- URI uri = parentId[i];
+ Artifact uri = parentId[i];
ObjectName parentName = getConfigurationObjectName(uri);
classLoaders[i] = (ClassLoader) kernel.getAttribute(parentName, "configurationClassLoader");
}
@@ -442,7 +449,7 @@
*
* @return the unique id of the parent, or null if it does not have one
*/
- public URI[] getParentId() {
+ public Artifact[] getParentId() {
return parentId;
}
@@ -451,7 +458,7 @@
*
* @return the unique Id
*/
- public URI getId() {
+ public Artifact getId() {
return id;
}
@@ -630,11 +637,10 @@
GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(Configuration.class);//does not use jsr-77 naming
infoFactory.addAttribute("kernel", Kernel.class, false);
infoFactory.addAttribute("objectName", String.class, false);
- infoFactory.addAttribute("id", URI.class, true, false);
+ infoFactory.addAttribute("id", Artifact.class, true, false);
infoFactory.addAttribute("type", ConfigurationModuleType.class, true, false);
- infoFactory.addAttribute("parentId", URI[].class, true, false);
- infoFactory.addAttribute("domain", String.class, true, false);
- infoFactory.addAttribute("server", String.class, true, false);
+ infoFactory.addAttribute("parentId", Artifact[].class, true, false);
+ infoFactory.addAttribute("nameKeys", Map.class, true, false);
infoFactory.addAttribute("classPath", List.class, true, false);
infoFactory.addAttribute("inverseClassLoading", boolean.class, true, false);
infoFactory.addAttribute("hiddenClasses", String[].class, true, false);
@@ -662,8 +668,7 @@
"type",
"baseURL",
"parentId",
- "domain",
- "server",
+ "nameKeys",
"classPath",
"inverseClassLoading",
"hiddenClasses",
Modified: geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationData.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationData.java?rev=375831&r1=375830&r2=375831&view=diff
==============================================================================
--- geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationData.java (original)
+++ geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationData.java Tue Feb 7 18:59:48 2006
@@ -29,6 +29,7 @@
import java.util.HashMap;
import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.kernel.repository.Artifact;
/**
* @version $Rev$ $Date$
@@ -37,7 +38,7 @@
/**
* URI used to referr to this configuration in the configuration manager
*/
- private URI id;
+ private Artifact id;
/**
* Identifies the type of configuration (WAR, RAR et cetera)
@@ -84,7 +85,7 @@
* If true, then inverse the standard class loading delegation model.
*/
private boolean inverseClassLoading;
-
+
/**
* Class filters defining the classes hidden from the configuration.
*/
@@ -95,7 +96,7 @@
* override.
*/
private final Set nonOverridableClasses = new HashSet();
-
+
public ConfigurationData() {
}
@@ -114,11 +115,11 @@
nonOverridableClasses.addAll(configurationData.nonOverridableClasses);
}
- public URI getId() {
+ public Artifact getId() {
return id;
}
- public void setId(URI id) {
+ public void setId(Artifact id) {
this.id = id;
}
@@ -176,12 +177,12 @@
public void setDependencies(List dependencies) {
this.dependencies.clear();
for (Iterator iterator = dependencies.iterator(); iterator.hasNext();) {
- URI dependency = (URI) iterator.next();
+ Artifact dependency = (Artifact) iterator.next();
addDependency(dependency);
}
}
- public void addDependency(URI dependency) {
+ public void addDependency(Artifact dependency) {
assert dependency != null;
this.dependencies.add(dependency);
}
@@ -239,15 +240,15 @@
public boolean isInverseClassloading() {
return inverseClassLoading;
}
-
+
public void setInverseClassloading(boolean inverseClassLoading) {
this.inverseClassLoading = inverseClassLoading;
}
-
+
public Set getHiddenClasses() {
return hiddenClasses;
}
-
+
public Set getNonOverridableClasses() {
return nonOverridableClasses;
}
Modified: geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationInfo.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationInfo.java?rev=375831&r1=375830&r2=375831&view=diff
==============================================================================
--- geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationInfo.java (original)
+++ geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationInfo.java Tue Feb 7 18:59:48 2006
@@ -21,6 +21,7 @@
import javax.management.ObjectName;
import org.apache.geronimo.kernel.management.State;
+import org.apache.geronimo.kernel.repository.Artifact;
/**
*
@@ -29,11 +30,11 @@
*/
public class ConfigurationInfo implements Serializable {
private final ObjectName storeName;
- private final URI configID;
+ private final Artifact configID;
private final State state;
private final ConfigurationModuleType type;
- public ConfigurationInfo(ObjectName storeName, URI configID, State state, ConfigurationModuleType type) {
+ public ConfigurationInfo(ObjectName storeName, Artifact configID, State state, ConfigurationModuleType type) {
this.storeName = storeName;
this.configID = configID;
this.state = state;
@@ -44,16 +45,16 @@
return storeName;
}
- public URI getConfigID() {
+ public Artifact getConfigID() {
return configID;
}
public State getState() {
return state;
}
-
+
public ConfigurationModuleType getType() {
return type;
}
-
+
}
Modified: geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java?rev=375831&r1=375830&r2=375831&view=diff
==============================================================================
--- geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java (original)
+++ geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java Tue Feb 7 18:59:48 2006
@@ -16,6 +16,8 @@
*/
package org.apache.geronimo.kernel.config;
+import org.apache.geronimo.kernel.repository.Artifact;
+
import javax.management.ObjectName;
import java.io.IOException;
import java.net.URI;
@@ -32,7 +34,7 @@
* @param configID the name of the configuration
* @return true if the configuration has been loaded; false otherwise
*/
- boolean isLoaded(URI configID);
+ boolean isLoaded(Artifact configID);
/**
* Return a list of the stores this manager knows about.
@@ -58,7 +60,7 @@
* @throws IOException if there is a problem loading te configuration from the store
* @throws InvalidConfigException if the configuration is corrupt
*/
- ObjectName load(URI configID) throws NoSuchConfigException, IOException, InvalidConfigException;
+ ObjectName load(Artifact configID) throws NoSuchConfigException, IOException, InvalidConfigException;
/**
* Load the specified configuration and all parent configurations into the kernel. This does not
@@ -72,7 +74,7 @@
* @throws IOException if there is a problem loading te configuration from the store
* @throws InvalidConfigException if the configuration is corrupt
*/
- List loadRecursive(URI configID) throws NoSuchConfigException, IOException, InvalidConfigException;
+ List loadRecursive(Artifact configID) throws NoSuchConfigException, IOException, InvalidConfigException;
/**
* Unloads the gbeans of the specified configuration, stops the configuration gbean, and unloads the
@@ -81,7 +83,7 @@
* @param configID the name fo the configuration to remove
* @throws NoSuchConfigException if the configuration is now loaded into the kernel
*/
- void unload(URI configID) throws NoSuchConfigException;
+ void unload(Artifact configID) throws NoSuchConfigException;
/**
* Load the gbeans of the named configuration into the kernel, but do not start them.
@@ -91,7 +93,7 @@
* @param configID
* @throws InvalidConfigException
*/
- void loadGBeans(URI configID) throws InvalidConfigException;
+ void loadGBeans(Artifact configID) throws InvalidConfigException;
/**
* Start the gbeans in this configuration. You must have called loadGBeans before calling this method.
@@ -99,7 +101,7 @@
* @param configID
* @throws InvalidConfigException
*/
- void start(URI configID) throws InvalidConfigException;
+ void start(Artifact configID) throws InvalidConfigException;
/**
* Stop the gbeans in this configuration, but do not stop the configuration gbean.
@@ -107,5 +109,5 @@
* @param configID
* @throws InvalidConfigException
*/
- void stop(URI configID) throws InvalidConfigException;
+ void stop(Artifact configID) throws InvalidConfigException;
}
Modified: geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java?rev=375831&r1=375830&r2=375831&view=diff
==============================================================================
--- geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java (original)
+++ geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java Tue Feb 7 18:59:48 2006
@@ -27,11 +27,11 @@
import org.apache.geronimo.kernel.Kernel;
import org.apache.geronimo.kernel.jmx.JMXUtil;
import org.apache.geronimo.kernel.management.State;
+import org.apache.geronimo.kernel.repository.Artifact;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import java.io.IOException;
-import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
@@ -44,9 +44,8 @@
* you can save a lost configurations and stuff, but not change the set of
* GBeans included in a configuration.
*
- * @see EditableConfigurationManager
- *
* @version $Rev$ $Date$
+ * @see EditableConfigurationManager
*/
public class ConfigurationManagerImpl implements ConfigurationManager, GBeanLifecycle {
private static final Log log = LogFactory.getLog(ConfigurationManagerImpl.class);
@@ -94,50 +93,41 @@
throw new NoSuchStoreException("No such store: " + storeName);
}
- public boolean isLoaded(URI configID) {
+ public boolean isLoaded(Artifact configID) {
try {
ObjectName name = Configuration.getConfigurationObjectName(configID);
return kernel.isLoaded(name);
- } catch (MalformedObjectNameException e) {
+ } catch (InvalidConfigException e) {
+ //todo really?
return false;
}
}
- public ObjectName load(URI configID) throws NoSuchConfigException, IOException, InvalidConfigException {
+ public ObjectName load(Artifact configID) throws NoSuchConfigException, IOException, InvalidConfigException {
List storeSnapshot = getStores();
for (int i = 0; i < storeSnapshot.size(); i++) {
ConfigurationStore store = (ConfigurationStore) storeSnapshot.get(i);
if (store.containsConfiguration(configID)) {
- ObjectName configName = store.loadConfiguration(configID);
+ ObjectName configName = store.loadConfiguration(configID);
return configName;
}
}
throw new NoSuchConfigException("No configuration with id: " + configID);
}
- public void loadGBeans(URI configID) throws InvalidConfigException {
- ObjectName configName;
- try {
- configName = Configuration.getConfigurationObjectName(configID);
- } catch (MalformedObjectNameException e) {
- throw new InvalidConfigException("Cannot convert ID to ObjectName: ", e);
- }
+ public void loadGBeans(Artifact configID) throws InvalidConfigException {
+ ObjectName configName = Configuration.getConfigurationObjectName(configID);
try {
kernel.startGBean(configName);
- kernel.invoke(configName, "loadGBeans", new Object[] {attributeStore}, new String[] {ManageableAttributeStore.class.getName()});
+ kernel.invoke(configName, "loadGBeans", new Object[]{attributeStore}, new String[]{ManageableAttributeStore.class.getName()});
} catch (Exception e) {
throw new InvalidConfigException("Could not extract gbean data from configuration", e);
}
}
- public void start(URI configID) throws InvalidConfigException {
- ObjectName configName;
- try {
- configName = Configuration.getConfigurationObjectName(configID);
- } catch (MalformedObjectNameException e) {
- throw new InvalidConfigException("Cannot convert ID to ObjectName: ", e);
- }
+ public void start(Artifact configID) throws InvalidConfigException {
+ ObjectName configName = Configuration.getConfigurationObjectName(configID);
try {
kernel.invoke(configName, "startRecursiveGBeans");
} catch (Exception e) {
@@ -148,13 +138,8 @@
}
}
- public void stop(URI configID) throws InvalidConfigException {
- ObjectName configName;
- try {
- configName = Configuration.getConfigurationObjectName(configID);
- } catch (MalformedObjectNameException e) {
- throw new InvalidConfigException("Cannot convert ID to ObjectName: ", e);
- }
+ public void stop(Artifact configID) throws InvalidConfigException {
+ ObjectName configName = Configuration.getConfigurationObjectName(configID);
try {
kernel.invoke(configName, "stopGBeans");
} catch (Exception e) {
@@ -165,13 +150,13 @@
}
}
- public List loadRecursive(URI configID) throws NoSuchConfigException, IOException, InvalidConfigException {
+ public List loadRecursive(Artifact configID) throws NoSuchConfigException, IOException, InvalidConfigException {
LinkedList ancestors = new LinkedList();
Set preloaded = kernel.listGBeans(CONFIGURATION_NAME_QUERY);
for (Iterator it = preloaded.iterator(); it.hasNext();) {
ObjectName name = (ObjectName) it.next();
try {
- if(kernel.getGBeanState(name) != State.RUNNING_INDEX) {
+ if (kernel.getGBeanState(name) != State.RUNNING_INDEX) {
it.remove();
}
} catch (GBeanNotFoundException e) {
@@ -182,7 +167,7 @@
return ancestors;
}
- private void loadRecursive(URI 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);
if (preloaded.contains(name)) {
@@ -194,10 +179,10 @@
//put the earliest ancestors first, even if we have already started them.
ancestors.remove(configID);
ancestors.addFirst(configID);
- URI[] parents = (URI[]) kernel.getAttribute(name, "parentId");
+ Artifact[] parents = (Artifact[]) kernel.getAttribute(name, "parentId");
if (parents != null) {
for (int i = 0; i < parents.length; i++) {
- URI parent = parents[i];
+ Artifact parent = parents[i];
loadRecursive(parent, ancestors, preloaded);
}
}
@@ -212,12 +197,12 @@
}
}
- public void unload(URI configID) throws NoSuchConfigException {
+ public void unload(Artifact configID) throws NoSuchConfigException {
ObjectName configName;
try {
configName = Configuration.getConfigurationObjectName(configID);
- } catch (MalformedObjectNameException e) {
- throw new NoSuchConfigException("Cannot convert ID to ObjectName: ", e);
+ } catch (InvalidConfigException e) {
+ throw new NoSuchConfigException("Could not construct configuration object name", e);
}
try {
if (State.RUNNING_INDEX == kernel.getGBeanState(configName)) {
Modified: geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java?rev=375831&r1=375830&r2=375831&view=diff
==============================================================================
--- geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java (original)
+++ geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java Tue Feb 7 18:59:48 2006
@@ -26,6 +26,7 @@
import javax.management.ObjectName;
import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.kernel.repository.Artifact;
/**
* Interface to a store for Configurations.
@@ -40,7 +41,7 @@
* @throws IOException if the CAR could not be read
* @throws InvalidConfigException if there is a configuration problem with the CAR
*/
- URI install(URL source) throws IOException, InvalidConfigException;
+ Artifact install(URL source) throws IOException, InvalidConfigException;
/**
* Move the unpacked configuration directory into this store
@@ -58,7 +59,7 @@
* @throws NoSuchConfigException if the configuration is not contained in the store
* @throws IOException if a problem occurs during the removal
*/
- void uninstall(URI configID) throws NoSuchConfigException, IOException;
+ void uninstall(Artifact configID) throws NoSuchConfigException, IOException;
/**
* Loads the specified configuration into the kernel
@@ -68,7 +69,7 @@
* @throws IOException if a problem occurs loading the configuration from the store
* @throws InvalidConfigException if the configuration is corrupt
*/
- ObjectName loadConfiguration(URI configId) throws NoSuchConfigException, IOException, InvalidConfigException;
+ ObjectName loadConfiguration(Artifact configId) throws NoSuchConfigException, IOException, InvalidConfigException;
/**
* Determines if the store contains a configuration with the spedified ID.
@@ -76,7 +77,7 @@
* @param configID the unique ID of the configuration
* @return true if the store contains the configuration
*/
- boolean containsConfiguration(URI configID);
+ boolean containsConfiguration(Artifact configID);
/**
* Return the object name for the store.
Modified: geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Artifact.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Artifact.java?rev=375831&r1=375830&r2=375831&view=diff
==============================================================================
--- geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Artifact.java (original)
+++ geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Artifact.java Tue Feb 7 18:59:48 2006
@@ -19,11 +19,12 @@
import java.net.URI;
import java.net.URISyntaxException;
+import java.io.Serializable;
/**
* @version $Rev:$ $Date:$
*/
-public class Artifact implements Comparable {
+public class Artifact implements Comparable, Serializable {
private String groupId;
private String artifactId;
private Version version;
@@ -41,6 +42,14 @@
this.resolved = resolved;
}
+ public static Artifact create(String id) {
+ String[] parts = id.split("/");
+ if (parts.length != 4) {
+ throw new IllegalArgumentException("Invalid id: " + id);
+ }
+ return new Artifact(parts[0], parts[1], parts[2], parts[3], true);
+ }
+
public String getGroupId() {
return groupId;
}
@@ -114,12 +123,11 @@
* @throws URISyntaxException
*/
public URI toURI() throws URISyntaxException {
- String id = groupId + "/" + artifactId + "/" + version + "/" + type;
- return new URI(id);
+ return new URI(toString());
}
public String toString() {
- String id = groupId + "/" + artifactId + "/" + version + "/" + type;
- return id;
+ return groupId + "/" + artifactId + "/" + version + "/" + type;
}
+
}
Modified: geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Version.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Version.java?rev=375831&r1=375830&r2=375831&view=diff
==============================================================================
--- geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Version.java (original)
+++ geronimo/branches/configid/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Version.java Tue Feb 7 18:59:48 2006
@@ -16,6 +16,7 @@
package org.apache.geronimo.kernel.repository;
import java.util.StringTokenizer;
+import java.io.Serializable;
/**
* Default implementation of artifact versioning.
@@ -24,7 +25,7 @@
* @version $Id$
*/
// This code was lifted from Apache Maven
-public class Version implements Comparable {
+public class Version implements Comparable, Serializable {
private Integer majorVersion;
private Integer minorVersion;
Modified: geronimo/branches/configid/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java?rev=375831&r1=375830&r2=375831&view=diff
==============================================================================
--- geronimo/branches/configid/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java (original)
+++ geronimo/branches/configid/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java Tue Feb 7 18:59:48 2006
@@ -27,6 +27,7 @@
import org.apache.geronimo.kernel.config.Configuration;
import org.apache.geronimo.kernel.config.ManageableAttributeStore;
import org.apache.geronimo.kernel.management.State;
+import org.apache.geronimo.kernel.repository.Artifact;
/**
* @version $Rev$ $Date$
@@ -38,7 +39,7 @@
private ObjectName gbeanName2;
public void testOnlineConfig() throws Exception {
- URI id = new URI("test");
+ Artifact id = new Artifact("geronimo", "test", "1", "car", true);
ObjectName configName = Configuration.getConfigurationObjectName(id);
// create the config gbean data
@@ -94,7 +95,7 @@
}
public void testAddToConfig() throws Exception {
- URI id = new URI("test");
+ Artifact id = new Artifact("geronimo", "test", "1", "car", true);
ObjectName configName = Configuration.getConfigurationObjectName(id);
// create the config gbean data
Modified: geronimo/branches/configid/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java?rev=375831&r1=375830&r2=375831&view=diff
==============================================================================
--- geronimo/branches/configid/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java (original)
+++ geronimo/branches/configid/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java Tue Feb 7 18:59:48 2006
@@ -766,7 +766,7 @@
builder.addHandleDelegateReference(handleDelegateReference);
}
- URI moduleURI = module.getConfigId();
+ URI moduleURI = module.getModuleURI();
addEnvEntries(envEntries, builder, cl);
Modified: geronimo/branches/configid/modules/service-builder/src/java/org/apache/geronimo/deployment/service/EnvironmentBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/service-builder/src/java/org/apache/geronimo/deployment/service/EnvironmentBuilder.java?rev=375831&r1=375830&r2=375831&view=diff
==============================================================================
--- geronimo/branches/configid/modules/service-builder/src/java/org/apache/geronimo/deployment/service/EnvironmentBuilder.java (original)
+++ geronimo/branches/configid/modules/service-builder/src/java/org/apache/geronimo/deployment/service/EnvironmentBuilder.java Tue Feb 7 18:59:48 2006
@@ -38,7 +38,8 @@
public static Environment buildEnvironment(EnvironmentType environmentType) {
- Artifact configId = toArtifact(environmentType.getConfigid());
+ Environment environment = new Environment();
+ environment.setConfigId(toArtifact(environmentType.getConfigId()));
NameKeyType[] nameKeyArray = environmentType.getNameKeyArray();
Map nameKeyMap = new HashMap();
@@ -48,19 +49,21 @@
String value = nameKey.getValue().trim();
nameKeyMap.put(key, value);
}
+ environment.setNameKeys(nameKeyMap);
+ if (environmentType.isSetClassloader()) {
+ ClassloaderType classloaderType = environmentType.getClassloader();
+ environment.setImports(toArtifacts(classloaderType.getImportArray()));
+ environment.setDependencies(toArtifacts(classloaderType.getDependencyArray()));
+ environment.setIncludes(toArtifacts(classloaderType.getIncludeArray()));
- ClassloaderType classloaderType = environmentType.getClassloader();
- LinkedHashSet imports = toArtifacts(classloaderType.getImportArray());
- LinkedHashSet dependencies = toArtifacts(classloaderType.getDependencyArray());
- LinkedHashSet includes = toArtifacts(classloaderType.getIncludeArray());
-
- LinkedHashSet references = toArtifacts(environmentType.getReferenceArray());
- boolean inverseClassloading = classloaderType.isSetInverseClassloading();
- Set hiddenClasses = toFilters(classloaderType.getHiddenClassesArray());
- Set nonOverrideableClasses = toFilters(classloaderType.getNonOverridableClassesArray());
+ environment.setInverseClassloading(classloaderType.isSetInverseClassloading());
+ environment.setSuppressDefaultParentId(classloaderType.isSetSuppressDefaultParentId());
+ environment.setHiddenClasses(toFilters(classloaderType.getHiddenClassesArray()));
+ environment.setNonOverrideableClasses(toFilters(classloaderType.getNonOverridableClassesArray()));
+ }
+ environment.setReferences(toArtifacts(environmentType.getReferenceArray()));
- Environment environment = new Environment(configId, nameKeyMap, imports, references, dependencies, includes, hiddenClasses, nonOverrideableClasses, inverseClassloading);
return environment;
}
Modified: geronimo/branches/configid/modules/service-builder/src/schema/geronimo-config-1.1.xsd
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/service-builder/src/schema/geronimo-config-1.1.xsd?rev=375831&r1=375830&r2=375831&view=diff
==============================================================================
--- geronimo/branches/configid/modules/service-builder/src/schema/geronimo-config-1.1.xsd (original)
+++ geronimo/branches/configid/modules/service-builder/src/schema/geronimo-config-1.1.xsd Tue Feb 7 18:59:48 2006
@@ -42,6 +42,7 @@
</xs:complexType>
<xs:element name="environment" type="sys:environmentType">
+<!-- TODO figure out why this doesn't work
<xs:key name="name-key-key">
<xs:annotation>
<xs:documentation>
@@ -50,13 +51,14 @@
</xs:documentation>
</xs:annotation>
<xs:selector xpath="sys:name-key"/>
- <xs:field xpath="sys:name-key/name"/>
+ <xs:field xpath="sys:name-key/key"/>
</xs:key>
+-->
</xs:element>
<xs:complexType name="environmentType">
<xs:sequence>
- <xs:element name="configid" type="sys:artifactType">
+ <xs:element name="configId" type="sys:artifactType">
<xs:annotation>
<xs:documentation>
"configId" holds elements for the groupId, artifactId, and version of the configuration
@@ -65,7 +67,7 @@
</xs:annotation>
</xs:element>
<xs:element name="name-key" type="sys:name-keyType" minOccurs="0" maxOccurs="unbounded"/>
- <xs:element name="classloader" type="sys:classloaderType">
+ <xs:element name="classloader" type="sys:classloaderType" minOccurs="0">
<xs:annotation>
<xs:documentation>
"classloader" holds all classloader configuration information for the configuration
@@ -177,6 +179,7 @@
</xs:annotation>
</xs:element>
<xs:element name="inverse-classloading" type="sys:emptyType" minOccurs="0"/>
+ <xs:element name="suppress-default-parentId" type="sys:emptyType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
Modified: geronimo/branches/configid/modules/service-builder/src/test-resources/services/plan1.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/service-builder/src/test-resources/services/plan1.xml?rev=375831&r1=375830&r2=375831&view=diff
==============================================================================
--- geronimo/branches/configid/modules/service-builder/src/test-resources/services/plan1.xml (original)
+++ geronimo/branches/configid/modules/service-builder/src/test-resources/services/plan1.xml Tue Feb 7 18:59:48 2006
@@ -22,12 +22,12 @@
>
<environment>
- <configid>
+ <configId>
<groupId>geronimo</groupId>
<type>car</type>
<artifactId>foo4</artifactId>
<version>DEV</version>
- </configid>
+ </configId>
<name-key>
<key>domain</key>
<value>geronimo.server</value>
Modified: geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationDump.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationDump.java?rev=375831&r1=375830&r2=375831&view=diff
==============================================================================
--- geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationDump.java (original)
+++ geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationDump.java Tue Feb 7 18:59:48 2006
@@ -33,6 +33,7 @@
import org.apache.geronimo.gbean.GBeanData;
import org.apache.geronimo.kernel.Kernel;
import org.apache.geronimo.kernel.KernelFactory;
+import org.apache.geronimo.kernel.repository.Artifact;
import org.apache.geronimo.kernel.config.Configuration;
import org.apache.geronimo.kernel.config.ConfigurationInfo;
import org.apache.geronimo.kernel.config.ConfigurationModuleType;
@@ -101,7 +102,7 @@
List configurationInfos = configurationStore.listConfigurations();
for (Iterator iterator = configurationInfos.iterator(); iterator.hasNext();) {
ConfigurationInfo configurationInfo = (ConfigurationInfo) iterator.next();
- URI configID = configurationInfo.getConfigID();
+ Artifact configID = configurationInfo.getConfigID();
dumpConfiguration(kernel, configurationStore, configID, out);
}
@@ -122,17 +123,14 @@
}
}
- private static void dumpConfiguration(Kernel kernel, ConfigurationStore configurationStore, URI id, PrintWriter out) throws Exception {
+ private static void dumpConfiguration(Kernel kernel, ConfigurationStore configurationStore, Artifact id, PrintWriter out) throws Exception {
out.println("==================================================");
out.println("= " + id);
out.println("==================================================");
loadRecursive(kernel, configurationStore, id);
ObjectName name = null;
- try {
- name = Configuration.getConfigurationObjectName(id);
- } catch (MalformedObjectNameException e) {
- }
+ name = Configuration.getConfigurationObjectName(id);
out.println("objectName: " + name);
GBeanData config = kernel.getGBeanData(name);
@@ -263,7 +261,7 @@
}
}
- public static void loadRecursive(Kernel kernel, ConfigurationStore configurationStore, URI configID) throws Exception {
+ public static void loadRecursive(Kernel kernel, ConfigurationStore configurationStore, Artifact configID) throws Exception {
LinkedList ancestors = new LinkedList();
Set preloaded = kernel.listGBeans(CONFIGURATION_NAME_QUERY);
loadRecursive(kernel, configurationStore, configID, ancestors, preloaded);
@@ -275,7 +273,7 @@
}
}
- private static void loadRecursive(Kernel kernel, ConfigurationStore configurationStore, URI configID, LinkedList ancestors, Set preloaded) throws Exception {
+ private static void loadRecursive(Kernel kernel, ConfigurationStore configurationStore, Artifact configID, LinkedList ancestors, Set preloaded) throws Exception {
ObjectName name = Configuration.getConfigurationObjectName(configID);
if (preloaded.contains(name)) {
return;
@@ -286,10 +284,10 @@
//put the earliest ancestors first, even if we have already started them.
ancestors.remove(configID);
ancestors.addFirst(configID);
- URI[] parents = (URI[]) kernel.getAttribute(name, "parentId");
+ Artifact[] parents = (Artifact[]) kernel.getAttribute(name, "parentId");
if (parents != null) {
for (int i = 0; i < parents.length; i++) {
- URI parent = parents[i];
+ Artifact parent = parents[i];
loadRecursive(kernel, configurationStore, parent, ancestors, preloaded);
}
}
Modified: geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/configuration/ExecutableConfigurationUtil.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/configuration/ExecutableConfigurationUtil.java?rev=375831&r1=375830&r2=375831&view=diff
==============================================================================
--- geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/configuration/ExecutableConfigurationUtil.java (original)
+++ geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/configuration/ExecutableConfigurationUtil.java Tue Feb 7 18:59:48 2006
@@ -41,6 +41,7 @@
import org.apache.geronimo.kernel.config.Configuration;
import org.apache.geronimo.kernel.config.ConfigurationData;
import org.apache.geronimo.kernel.config.InvalidConfigException;
+import org.apache.geronimo.kernel.repository.Artifact;
/**
* @version $Rev$ $Date$
@@ -152,18 +153,17 @@
public static GBeanData getConfigurationGBeanData(ConfigurationData configurationData) throws InvalidConfigException {
try {
- URI id = configurationData.getId();
+ Artifact id = configurationData.getId();
GBeanData config = new GBeanData(Configuration.getConfigurationObjectName(id), Configuration.GBEAN_INFO);
config.setAttribute("id", id);
config.setAttribute("type", configurationData.getModuleType());
- //TODO configid this needs improvmement
+ //TODO configid this might need further improvmement
Map nameKeys = configurationData.getNameKeys();
- config.setAttribute("domain", nameKeys.get("domain"));
- config.setAttribute("server", nameKeys.get("J2EEServer"));
+ config.setAttribute("nameKeys", nameKeys);
List parentId = configurationData.getParentId();
if (parentId.size() > 0) {
- config.setAttribute("parentId", parentId.toArray(new URI[parentId.size()]));
+ config.setAttribute("parentId", parentId.toArray(new Artifact[parentId.size()]));
}
config.setAttribute("gBeanState", Configuration.storeGBeans(configurationData.getGBeans()));
@@ -175,7 +175,7 @@
config.setAttribute("hiddenClasses", set.toArray(new String[set.size()]));
set = configurationData.getNonOverridableClasses();
config.setAttribute("nonOverridableClasses", set.toArray(new String[set.size()]));
-
+
return config;
} catch (MalformedObjectNameException e) {
throw new InvalidConfigException(e);
Modified: geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/configuration/LocalConfigStore.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/configuration/LocalConfigStore.java?rev=375831&r1=375830&r2=375831&view=diff
==============================================================================
--- geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/configuration/LocalConfigStore.java (original)
+++ geronimo/branches/configid/modules/system/src/java/org/apache/geronimo/system/configuration/LocalConfigStore.java Tue Feb 7 18:59:48 2006
@@ -29,6 +29,7 @@
import java.io.OutputStream;
import java.net.URI;
import java.net.URL;
+import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Iterator;
@@ -46,6 +47,7 @@
import org.apache.geronimo.gbean.GBeanInfoBuilder;
import org.apache.geronimo.gbean.GBeanLifecycle;
import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.repository.Artifact;
import org.apache.geronimo.kernel.config.Configuration;
import org.apache.geronimo.kernel.config.ConfigurationData;
import org.apache.geronimo.kernel.config.ConfigurationInfo;
@@ -222,8 +224,8 @@
return configurationDir;
}
- public URI install(URL source) throws IOException, InvalidConfigException {
- return (URI) install2(source).getAttribute("id");
+ public Artifact install(URL source) throws IOException, InvalidConfigException {
+ return (Artifact) install2(source).getAttribute("id");
}
public GBeanData install2(URL source) throws IOException, InvalidConfigException {
@@ -239,12 +241,12 @@
is.close();
}
- URI configId;
+ Artifact configId;
GBeanData config;
try {
config = loadConfig(configurationDir);
- configId = (URI) config.getAttribute("id");
- index.setProperty(configId.toString(), configurationDir.getName());
+ configId = (Artifact) config.getAttribute("id");
+ index.setProperty(configId.toURI().toString(), configurationDir.getName());
} catch (Exception e) {
delete(configurationDir);
throw new InvalidConfigException("Unable to get ID from downloaded configuration", e);
@@ -277,8 +279,13 @@
log.debug("Installed configuration (file) " + configurationData.getId() + " in location " + source.getName());
}
- public void uninstall(URI configID) throws NoSuchConfigException, IOException {
- String id = configID.toString();
+ public void uninstall(Artifact configID) throws NoSuchConfigException, IOException {
+ String id = null;
+ try {
+ id = configID.toURI().toString();
+ } catch (URISyntaxException e) {
+ throw new NoSuchConfigException(e);
+ }
File configDir;
String storeID;
synchronized(this) {
@@ -307,15 +314,10 @@
}
}
- public synchronized ObjectName loadConfiguration(URI configId) throws NoSuchConfigException, IOException, InvalidConfigException {
+ public synchronized ObjectName loadConfiguration(Artifact configId) throws NoSuchConfigException, IOException, InvalidConfigException {
GBeanData config = loadConfig(getRoot(configId));
- ObjectName name;
- try {
- name = Configuration.getConfigurationObjectName(configId);
- } catch (MalformedObjectNameException e) {
- throw new InvalidConfigException("Cannot convert id to ObjectName: ", e);
- }
+ ObjectName name = Configuration.getConfigurationObjectName(configId);
config.setName(name);
config.setAttribute("baseURL", getRoot(configId).toURL());
@@ -335,7 +337,7 @@
synchronized (this) {
configs = new ArrayList(index.size());
for (Iterator i = index.keySet().iterator(); i.hasNext();) {
- URI configId = URI.create((String) i.next());
+ Artifact configId = Artifact.create((String) i.next());
try {
ObjectName configName = Configuration.getConfigurationObjectName(configId);
State state;
@@ -364,12 +366,22 @@
return configs;
}
- public synchronized boolean containsConfiguration(URI configID) {
- return index.getProperty(configID.toString()) != null;
+
+ public synchronized boolean containsConfiguration(Artifact configID) {
+ try {
+ return index.getProperty(configID.toURI().toString()) != null;
+ } catch (URISyntaxException e) {
+ return false;
+ }
}
- private synchronized File getRoot(URI configID) throws NoSuchConfigException {
- String id = index.getProperty(configID.toString());
+ private synchronized File getRoot(Artifact configID) throws NoSuchConfigException {
+ String id = null;
+ try {
+ id = index.getProperty(configID.toURI().toString());
+ } catch (URISyntaxException e) {
+
+ }
if (id == null) {
throw new NoSuchConfigException("No such config: " + configID);
}
Modified: geronimo/branches/configid/modules/system/src/test/org/apache/geronimo/system/configuration/LocalConfigStoreTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/system/src/test/org/apache/geronimo/system/configuration/LocalConfigStoreTest.java?rev=375831&r1=375830&r2=375831&view=diff
==============================================================================
--- geronimo/branches/configid/modules/system/src/test/org/apache/geronimo/system/configuration/LocalConfigStoreTest.java (original)
+++ geronimo/branches/configid/modules/system/src/test/org/apache/geronimo/system/configuration/LocalConfigStoreTest.java Tue Feb 7 18:59:48 2006
@@ -21,7 +21,6 @@
import java.io.File;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
-import java.net.URI;
import java.net.URL;
import java.util.jar.JarOutputStream;
import java.util.zip.ZipEntry;
@@ -32,10 +31,10 @@
import org.apache.geronimo.gbean.GBeanData;
import org.apache.geronimo.kernel.KernelFactory;
import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.repository.Artifact;
import org.apache.geronimo.kernel.config.ConfigurationManagerImpl;
import org.apache.geronimo.kernel.config.Configuration;
import org.apache.geronimo.kernel.config.ConfigurationManager;
-import org.apache.geronimo.kernel.management.State;
/**
*
@@ -46,7 +45,7 @@
private File root;
private URL source;
private File sourceFile;
- private URI uri;
+ private Artifact artifact;
private Kernel kernel;
private byte[] state;
private ObjectName gbeanName1;
@@ -106,9 +105,9 @@
kernel.startGBean(configurationManagerName);
configurationManager = (ConfigurationManager) kernel.getProxyManager().createProxy(configurationManagerName, ConfigurationManager.class);
- uri = new URI("test");
- GBeanData gbean = new GBeanData(Configuration.getConfigurationObjectName(uri), Configuration.GBEAN_INFO);
- gbean.setAttribute("id", uri);
+ artifact = new Artifact("group", "test", "1", "car", true);
+ GBeanData gbean = new GBeanData(Configuration.getConfigurationObjectName(artifact), Configuration.GBEAN_INFO);
+ gbean.setAttribute("id", artifact);
gbean.setAttribute("gBeanState", state);
Modified: geronimo/branches/configid/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java?rev=375831&r1=375830&r2=375831&view=diff
==============================================================================
--- geronimo/branches/configid/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java (original)
+++ geronimo/branches/configid/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java Tue Feb 7 18:59:48 2006
@@ -56,6 +56,7 @@
import org.apache.geronimo.deployment.xbeans.ClassFilterType;
import org.apache.geronimo.deployment.xbeans.DependencyType;
import org.apache.geronimo.deployment.xbeans.GbeanType;
+import org.apache.geronimo.deployment.Environment;
import org.apache.geronimo.gbean.GBeanData;
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoBuilder;
@@ -141,7 +142,7 @@
return createModule(plan, moduleFile, "war", null, true, null);
}
- public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, URI earConfigId, Object moduleContextInfo) throws DeploymentException {
+ 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);
}
@@ -213,7 +214,7 @@
}
}
- WebModule module = new WebModule(standAlone, configId, parentId, moduleFile, targetPath, webApp, tomcatWebApp, specDD, contextRoot, portMap, TOMCAT_NAMESPACE);
+ WebModule module = new WebModule(standAlone, configId, moduleFile, targetPath, webApp, tomcatWebApp, specDD, contextRoot, portMap, TOMCAT_NAMESPACE);
return module;
}
Modified: geronimo/branches/configid/modules/tomcat-builder/src/schema/geronimo-tomcat-1.1.xsd
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/tomcat-builder/src/schema/geronimo-tomcat-1.1.xsd?rev=375831&r1=375830&r2=375831&view=diff
==============================================================================
--- geronimo/branches/configid/modules/tomcat-builder/src/schema/geronimo-tomcat-1.1.xsd (original)
+++ geronimo/branches/configid/modules/tomcat-builder/src/schema/geronimo-tomcat-1.1.xsd Tue Feb 7 18:59:48 2006
@@ -25,7 +25,7 @@
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
- version="1.0">
+ version="1.1">
<xs:import namespace="http://geronimo.apache.org/xml/ns/naming-1.0" schemaLocation="geronimo-naming-1.0.xsd"/>
<xs:import namespace="http://geronimo.apache.org/xml/ns/security-1.1" schemaLocation="geronimo-security-1.1.xsd"/>
@@ -36,11 +36,7 @@
<xs:complexType name="web-appType">
<xs:sequence>
-<!-- <xs:element ref="sys:parent" minOccurs="0" maxOccurs="unbounded"/>-->
-<!-- <xs:element ref="sys:dependency" minOccurs="0" maxOccurs="unbounded"/>-->
-<!-- <xs:element ref="sys:hidden-classes" minOccurs="0" maxOccurs="unbounded"/>-->
-<!-- <xs:element ref="sys:non-overridable-classes" minOccurs="0" maxOccurs="unbounded"/>-->
- <xs:group ref="sys:classloader-infoGroup"/>
+ <xs:element ref="sys:environment"/>
<xs:element name="context-root" type="xs:string" minOccurs="0"/>
<xs:element name="context-priority-classloader" type="xs:boolean" minOccurs="0"/>
@@ -63,9 +59,6 @@
<xs:element ref="sys:gbean" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
- <xs:attribute name="configId" type="xs:string" use="required"/>
- <xs:attribute name="parentId" type="xs:string" use="optional"/>
- <xs:attribute name="inverseClassloading" type="xs:boolean" use="optional"/>
</xs:complexType>
<xs:complexType name="emptyType"/>
Modified: geronimo/branches/configid/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java?rev=375831&r1=375830&r2=375831&view=diff
==============================================================================
--- geronimo/branches/configid/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java (original)
+++ geronimo/branches/configid/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java Tue Feb 7 18:59:48 2006
@@ -44,6 +44,7 @@
import org.apache.geronimo.common.DeploymentException;
import org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinatorGBean;
import org.apache.geronimo.deployment.DeploymentContext;
+import org.apache.geronimo.deployment.Environment;
import org.apache.geronimo.deployment.util.UnpackedJarFile;
import org.apache.geronimo.gbean.GBeanData;
import org.apache.geronimo.gbean.GBeanInfo;
@@ -62,6 +63,7 @@
import org.apache.geronimo.j2ee.management.impl.J2EEServerImpl;
import org.apache.geronimo.kernel.Kernel;
import org.apache.geronimo.kernel.KernelFactory;
+import org.apache.geronimo.kernel.repository.Artifact;
import org.apache.geronimo.kernel.config.Configuration;
import org.apache.geronimo.kernel.config.ConfigurationData;
import org.apache.geronimo.kernel.config.ConfigurationManager;
@@ -220,10 +222,10 @@
kernel.unloadGBean(configName);
}
- private EARContext createEARContext(File outputPath, URI id)
+ private EARContext createEARContext(File outputPath, Environment environment)
throws MalformedObjectNameException, DeploymentException {
- EARContext earContext = new EARContext(outputPath, id,
- ConfigurationModuleType.WAR, parentId, kernel, moduleContext
+ EARContext earContext = new EARContext(outputPath, environment,
+ ConfigurationModuleType.WAR, kernel, moduleContext
.getJ2eeApplicationName(), tcmName, ctcName, null,
null, null, new RefContext(new EJBReferenceBuilder() {
@@ -369,9 +371,9 @@
kernel.startGBean(configurationManagerName);
ConfigurationManager configurationManager = (ConfigurationManager) kernel.getProxyManager().createProxy(configurationManagerName, ConfigurationManager.class);
- configurationManager.load((URI) parentId.get(0));
- configurationManager.loadGBeans((URI) parentId.get(0));
- configurationManager.start((URI) parentId.get(0));
+ configurationManager.load((Artifact) parentId.get(0));
+ configurationManager.loadGBeans((Artifact) parentId.get(0));
+ configurationManager.start((Artifact) parentId.get(0));
serverInfoName = new ObjectName("geronimo.system:name=ServerInfo");
serverInfoGBean = new GBeanData(serverInfoName, BasicServerInfo.GBEAN_INFO);
@@ -486,23 +488,18 @@
this.kernel = kernel;
}
- public URI install(URL source) throws IOException, InvalidConfigException {
+ public Artifact install(URL source) throws IOException, InvalidConfigException {
return null;
}
public void install(ConfigurationData configurationData, File source) throws IOException, InvalidConfigException {
}
- public void uninstall(URI configID) throws NoSuchConfigException, IOException {
+ public void uninstall(Artifact configID) throws NoSuchConfigException, IOException {
}
- public ObjectName loadConfiguration(URI configId) throws NoSuchConfigException, IOException, InvalidConfigException {
- ObjectName configurationObjectName = null;
- try {
- configurationObjectName = Configuration.getConfigurationObjectName(configId);
- } catch (MalformedObjectNameException e) {
- throw new InvalidConfigException(e);
- }
+ public ObjectName loadConfiguration(Artifact configId) throws NoSuchConfigException, IOException, InvalidConfigException {
+ ObjectName configurationObjectName = Configuration.getConfigurationObjectName(configId);
GBeanData configData = new GBeanData(configurationObjectName, Configuration.GBEAN_INFO);
configData.setAttribute("id", configId);
configData.setAttribute("domain", "test");
@@ -518,7 +515,7 @@
return configurationObjectName;
}
- public boolean containsConfiguration(URI configID) {
+ public boolean containsConfiguration(Artifact configID) {
return true;
}
Modified: geronimo/branches/configid/modules/web-builder/src/schema/geronimo-web-1.1.xsd
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/modules/web-builder/src/schema/geronimo-web-1.1.xsd?rev=375831&r1=375830&r2=375831&view=diff
==============================================================================
--- geronimo/branches/configid/modules/web-builder/src/schema/geronimo-web-1.1.xsd (original)
+++ geronimo/branches/configid/modules/web-builder/src/schema/geronimo-web-1.1.xsd Tue Feb 7 18:59:48 2006
@@ -36,11 +36,7 @@
<xs:complexType name="web-appType">
<xs:sequence>
-<!-- <xs:element ref="sys:parent" minOccurs="0" maxOccurs="unbounded"/>-->
-<!-- <xs:element ref="sys:dependency" minOccurs="0" maxOccurs="unbounded"/>-->
-<!-- <xs:element ref="sys:hidden-classes" minOccurs="0" maxOccurs="unbounded"/>-->
-<!-- <xs:element ref="sys:non-overridable-classes" minOccurs="0" maxOccurs="unbounded"/>-->
- <xs:group ref="sys:classloader-infoGroup"/>
+ <xs:element ref="sys:environment"/>
<xs:element name="context-root" type="xs:string" minOccurs="0"/>
<xs:element name="context-priority-classloader" type="xs:boolean" minOccurs="0"/>
@@ -57,8 +53,6 @@
<xs:element ref="sys:gbean" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
- <xs:attribute name="configId" type="xs:string" use="required"/>
- <xs:attribute name="parentId" type="xs:string" use="optional"/>
</xs:complexType>
<xs:complexType name="container-configType">
Modified: geronimo/branches/configid/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/configid/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java?rev=375831&r1=375830&r2=375831&view=diff
==============================================================================
--- geronimo/branches/configid/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java (original)
+++ geronimo/branches/configid/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java Tue Feb 7 18:59:48 2006
@@ -23,6 +23,7 @@
import java.net.URI;
import java.net.URL;
import java.net.URLDecoder;
+import java.net.URISyntaxException;
import java.util.List;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
@@ -37,6 +38,7 @@
import org.apache.geronimo.kernel.config.ConfigurationData;
import org.apache.geronimo.kernel.config.ManageableAttributeStore;
import org.apache.geronimo.kernel.repository.Repository;
+import org.apache.geronimo.kernel.repository.Artifact;
import org.apache.geronimo.kernel.Kernel;
import org.apache.geronimo.system.configuration.ExecutableConfigurationUtil;
@@ -64,13 +66,19 @@
return objectName.toString();
}
- public synchronized ObjectName loadConfiguration(URI configId) throws NoSuchConfigException, IOException, InvalidConfigException {
- if (!repository.hasURI(configId)) {
- throw new NoSuchConfigException("Configuration not found: " + configId);
+ public synchronized ObjectName loadConfiguration(Artifact configId) throws NoSuchConfigException, IOException, InvalidConfigException {
+ URI uri;
+ try {
+ uri = configId.toURI();
+ } catch (URISyntaxException e) {
+ throw new NoSuchConfigException("Configuration not found: " + configId, e);
}
+ if (!repository.hasURI(uri)) {
+ throw new NoSuchConfigException("Configuration not found: " + configId);
+ }
GBeanData config = new GBeanData();
- URL baseURL = new URL("jar:" + repository.getURL(configId).toString() + "!/");
+ URL baseURL = new URL("jar:" + repository.getURL(uri).toString() + "!/");
InputStream jis = null;
try {
URL stateURL = new URL(baseURL, "META-INF/config.ser");
@@ -85,12 +93,7 @@
}
}
- ObjectName name;
- try {
- name = Configuration.getConfigurationObjectName(configId);
- } catch (MalformedObjectNameException e) {
- throw new InvalidConfigException("Cannot convert id to ObjectName: ", e);
- }
+ ObjectName name = Configuration.getConfigurationObjectName(configId);
config.setName(name);
config.setAttribute("baseURL", baseURL);
@@ -104,8 +107,12 @@
}
- public boolean containsConfiguration(URI configID) {
- return repository.hasURI(configID);
+ public boolean containsConfiguration(Artifact configID) {
+ try {
+ return repository.hasURI(configID.toURI());
+ } catch (URISyntaxException e) {
+ return false;
+ }
}
public File createNewConfigurationDir() {
@@ -123,7 +130,7 @@
}
}
- public URI install(URL source) throws IOException, InvalidConfigException {
+ public Artifact install(URL source) throws IOException, InvalidConfigException {
throw new UnsupportedOperationException();
}
@@ -147,7 +154,7 @@
ExecutableConfigurationUtil.createExecutableConfiguration(configurationData, null, source, targetFile);
}
- public void uninstall(URI configID) throws NoSuchConfigException, IOException {
+ public void uninstall(Artifact configID) throws NoSuchConfigException, IOException {
throw new UnsupportedOperationException();
}