You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jb...@apache.org on 2004/02/12 19:20:24 UTC
cvs commit: incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/config Configuration.java
jboynes 2004/02/12 10:20:24
Modified: modules/kernel/src/java/org/apache/geronimo/kernel/config
Configuration.java
Log:
Add ParentID as persistent attribute
Used during deployment process to resolve dependencies
Revision Changes Path
1.10 +24 -5 incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
Index: Configuration.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Configuration.java 10 Feb 2004 22:34:04 -0000 1.9
+++ Configuration.java 12 Feb 2004 18:20:24 -0000 1.10
@@ -72,6 +72,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.Arrays;
import javax.management.AttributeNotFoundException;
import javax.management.InvalidAttributeValueException;
import javax.management.MBeanException;
@@ -127,6 +128,7 @@
private static final Log log = LogFactory.getLog(Configuration.class);
private final URI id;
+ private final URI parentID;
private final ConfigurationParent parent;
private final List classPath;
private final List dependencies;
@@ -150,8 +152,9 @@
* @param repositories a Collection<Repository> of repositories used to resolve dependencies
* @param dependencies a List<URI> of dependencies
*/
- public Configuration(URI id, ConfigurationParent parent, List classPath, byte[] gbeanState, Collection repositories, List dependencies) {
+ public Configuration(URI id, URI parentID, ConfigurationParent parent, List classPath, byte[] gbeanState, Collection repositories, List dependencies) {
this.id = id;
+ this.parentID = parentID;
this.parent = parent;
this.gbeanState = gbeanState;
this.classPath = classPath;
@@ -187,6 +190,7 @@
urls[idx++] = new URL(baseURL, uri.toString());
}
assert idx == urls.length;
+ log.debug("ClassPath for " + id + " resolved to " + Arrays.asList(urls));
if (parent == null) {
classLoader = new URLClassLoader(urls);
@@ -198,17 +202,22 @@
gbeans = loadGBeans(gbeanState, classLoader);
// register all the GBeans
+ MBeanServer mbServer = context.getServer();
for (Iterator i = gbeans.entrySet().iterator(); i.hasNext();) {
Map.Entry entry = (Map.Entry) i.next();
ObjectName name = (ObjectName) entry.getKey();
GBeanMBean gbean = (GBeanMBean) entry.getValue();
- MBeanServer mbServer = context.getServer();
+ log.trace("Registering GBean " + name);
mbServer.registerMBean(gbean, name);
mbServer.invoke(Kernel.DEPENDENCY_SERVICE, "addDependency", new Object[]{name, context.getObjectName()}, new String[]{ObjectName.class.getName(), ObjectName.class.getName()});
}
+
+ log.info("Started configuration " + id);
}
public void doStop() {
+ log.info("Stopping configuration " + id);
+
// unregister all GBeans
MBeanServer mbServer = context.getServer();
for (Iterator i = gbeans.keySet().iterator(); i.hasNext();) {
@@ -220,6 +229,7 @@
log.warn("Could not remove dependency for child " + name, e);
}
try {
+ log.trace("Unregistering GBean " + name);
mbServer.unregisterMBean(name);
} catch (Exception e) {
// ignore
@@ -240,6 +250,14 @@
}
/**
+ * Return the unique ID of this Configuration's parent
+ * @return the unique ID of the parent, or null if it does not have one
+ */
+ public URI getParentID() {
+ return parentID;
+ }
+
+ /**
* Return the unique ID
* @return the unique ID
*/
@@ -381,6 +399,7 @@
static {
GBeanInfoFactory infoFactory = new GBeanInfoFactory(Configuration.class);
infoFactory.addAttribute(new GAttributeInfo("ID", true));
+ infoFactory.addAttribute(new GAttributeInfo("ParentID", true));
infoFactory.addAttribute(new GAttributeInfo("ClassPath", true));
infoFactory.addAttribute(new GAttributeInfo("Dependencies", true));
infoFactory.addAttribute(new GAttributeInfo("GBeanState", true));
@@ -391,8 +410,8 @@
infoFactory.addReference(new GReferenceInfo("Parent", ConfigurationParent.class));
infoFactory.addReference(new GReferenceInfo("Repositories", Repository.class));
infoFactory.setConstructor(new GConstructorInfo(
- new String[]{"ID", "Parent", "ClassPath", "GBeanState", "Repositories", "Dependencies"},
- new Class[]{URI.class, ConfigurationParent.class, List.class, byte[].class, Collection.class, List.class}
+ new String[]{"ID", "ParentID", "Parent", "ClassPath", "GBeanState", "Repositories", "Dependencies"},
+ new Class[]{URI.class, URI.class, ConfigurationParent.class, List.class, byte[].class, Collection.class, List.class}
));
GBEAN_INFO = infoFactory.getBeanInfo();
}