geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r384351 - in /geronimo/branches/1.1/modules: jetty-builder/src/java/org/apache/geronimo/jetty/deployment/ kernel/src/java/org/apache/geronimo/gbean/ kernel/src/java/org/apache/geronimo/gbean/runtime/ kernel/src/java/org/apache/geronimo/kern...
Date Wed, 08 Mar 2006 22:28:38 GMT
Author: djencks
Date: Wed Mar  8 14:28:35 2006
New Revision: 384351

URL: http://svn.apache.org/viewcvs?rev=384351&view=rev
Log:
resolve gbean dependencies and single valued references.  builds through j2ee-management.

Modified:
    geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractName.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractNameQuery.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanData.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/BasicDependencyManager.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/EditableConfigurationManager.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/EditableConfigurationManagerImpl.java
    geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/gbean/runtime/GBeanDependencyTest.java
    geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/GBeanBuilder.java
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/GBeanOverride.java
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ServerOverride.java
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/jmx/MBeanServerKernelBridge.java
    geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/ServerOverrideTest.java
    geronimo/branches/1.1/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
    geronimo/branches/1.1/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java

Modified: geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java?rev=384351&r1=384350&r2=384351&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
(original)
+++ geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
Wed Mar  8 14:28:35 2006
@@ -382,7 +382,7 @@
             //This is overkill, but allows for people not using java:comp context (even though
we don't support it)
             //and sidesteps the problem of circular references between ejbs.
             Set dependencies = findGBeanDependencies(earContext);
-            webModuleData.getDependencies().addAll(dependencies);
+            webModuleData.addDependencies(dependencies);
 
             webModuleData.setAttribute("componentContext", compContext);
             webModuleData.setAttribute("userTransaction", userTransaction);

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractName.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractName.java?rev=384351&r1=384350&r2=384351&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractName.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractName.java
Wed Mar  8 14:28:35 2006
@@ -38,13 +38,15 @@
     private final ObjectName objectName;
 
     public AbstractName(Artifact artifact, Map name, String interfaceType, ObjectName objectName)
{
-        this.artifact = artifact;
-        this.name = name;
-        this.interfaceTypes = Collections.singleton(interfaceType);
-        this.objectName = objectName;
+        this(artifact, name, Collections.singleton(interfaceType), objectName);
+        assert interfaceType != null;
     }
 
     public AbstractName(Artifact artifact, Map name, Set interfaceTypes, ObjectName objectName)
{
+        assert artifact != null;
+        assert name != null;
+        assert interfaceTypes != null;
+        assert objectName != null;
         this.artifact = artifact;
         this.name = name;
         this.interfaceTypes = interfaceTypes;

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractNameQuery.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractNameQuery.java?rev=384351&r1=384350&r2=384351&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractNameQuery.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractNameQuery.java
Wed Mar  8 14:28:35 2006
@@ -31,42 +31,36 @@
  */
 public class AbstractNameQuery implements Serializable {
 
-    private final List artifacts;
+    private final Artifact artifact;
     private final Map name;
     private final Set interfaceTypes;
 
     public AbstractNameQuery(AbstractName abstractName) {
-        this.artifacts = Collections.singletonList(abstractName.getArtifact());
+        this.artifact = abstractName.getArtifact();
         this.name = abstractName.getName();
         this.interfaceTypes = abstractName.getInterfaceTypes();
     }
 
     public AbstractNameQuery(Artifact artifact, Map name, String interfaceType) {
-        this.artifacts = Collections.singletonList(artifact);
+        this.artifact = artifact;
         this.name = name;
         this.interfaceTypes = Collections.singleton(interfaceType);
     }
 
     public AbstractNameQuery(String interfaceType) {
-        this.artifacts = Collections.EMPTY_LIST;
+        this.artifact = null;
         this.name = Collections.EMPTY_MAP;
         this.interfaceTypes = Collections.singleton(interfaceType);
     }
 
-    public AbstractNameQuery(List artifacts, Map name, Set interfaceTypes) {
-        this.artifacts = artifacts;
-        this.name = name;
-        this.interfaceTypes = interfaceTypes;
-    }
-
     public AbstractNameQuery(Artifact artifact, Map name, Set interfaceTypes) {
-        this.artifacts = Collections.singletonList(artifact);
+        this.artifact = artifact;
         this.name = name;
         this.interfaceTypes = interfaceTypes;
     }
 
-    public List getArtifacts() {
-        return artifacts;
+    public Artifact getArtifact() {
+        return artifact;
     }
 
     public Map getName() {
@@ -78,13 +72,8 @@
     }
 
     public String toString() {
-        StringBuffer buf = new StringBuffer();
-        String separator = "";
-        for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
-            Artifact artifact = (Artifact) iterator.next();
-            buf.append(separator).append("artifact=").append(artifact);
-            separator = ",";
-        }
+        StringBuffer buf = new StringBuffer("artifact=");
+        buf.append(artifact);
         for (Iterator iterator = interfaceTypes.iterator(); iterator.hasNext();) {
             String interfaceType = (String) iterator.next();
             buf.append(",interface=").append(interfaceType);
@@ -102,7 +91,7 @@
 
         final AbstractNameQuery that = (AbstractNameQuery) o;
 
-        if (artifacts != null ? !artifacts.equals(that.artifacts) : that.artifacts != null)
return false;
+        if (artifact != null ? !artifact.equals(that.artifact) : that.artifact != null) return
false;
         if (interfaceTypes != null ? !interfaceTypes.equals(that.interfaceTypes) : that.interfaceTypes
!= null)
             return false;
         return !(name != null ? !name.equals(that.name) : that.name != null);
@@ -111,41 +100,12 @@
 
     public int hashCode() {
         int result;
-        result = (artifacts != null ? artifacts.hashCode() : 0);
+        result = (artifact != null ? artifact.hashCode() : 0);
         result = 29 * result + (name != null ? name.hashCode() : 0);
         result = 29 * result + (interfaceTypes != null ? interfaceTypes.hashCode() : 0);
         return result;
     }
 
-    /**
-     * determine if the supplied info is more specific and matches our patterns.  In this
method
-     * "this" is the query, the info parameter is the test specific info.
-     * @param info
-     * @return if the specific info supplied matches our patterns.
-     */
-    public boolean matches(AbstractNameQuery info) {
-        List artifacts = info.getArtifacts();
-        if (artifacts.size() != 1) {
-            throw new IllegalArgumentException("source info must have only one artifact");
-        }
-        if (!info.getName().entrySet().containsAll(name.entrySet())) {
-            return false;
-        }
-        if (!info.getInterfaceTypes().containsAll(interfaceTypes)) {
-            return false;
-        }
-        if (getArtifacts().isEmpty()) {
-            return true;
-        }
-        Artifact otherArtifact = (Artifact) artifacts.iterator().next();
-        for (Iterator iterator = getArtifacts().iterator(); iterator.hasNext();) {
-            Artifact artifact = (Artifact) iterator.next();
-            if (artifact.matches(otherArtifact)) {
-                return true;
-            }
-        }
-        return false;
-    }
 
     public boolean matches(AbstractName info) {
         if (!info.getName().entrySet().containsAll(name.entrySet())) {
@@ -154,16 +114,10 @@
         if (!info.getInterfaceTypes().containsAll(interfaceTypes)) {
             return false;
         }
-        if (getArtifacts().isEmpty()) {
+        if (artifact == null) {
             return true;
         }
         Artifact otherArtifact = info.getArtifact();
-        for (Iterator iterator = getArtifacts().iterator(); iterator.hasNext();) {
-            Artifact artifact = (Artifact) iterator.next();
-            if (artifact.matches(otherArtifact)) {
-                return true;
-            }
-        }
-        return false;
+        return artifact.matches(otherArtifact);
     }
 }

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanData.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanData.java?rev=384351&r1=384350&r2=384351&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanData.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanData.java
Wed Mar  8 14:28:35 2006
@@ -128,7 +128,28 @@
     }
 
     public Set getDependencies() {
-        return dependencies;
+        return new HashSet(dependencies);
+    }
+
+    public void setDependencies(Set dependencies) {
+        this.dependencies.clear();
+        this.dependencies.addAll(dependencies);
+    }
+
+    public void addDependencies(Set dependencies) {
+        this.dependencies.addAll(dependencies);
+    }
+
+    public void addDependency(ReferencePatterns dependency) {
+        this.dependencies.add(dependency);
+    }
+
+    public void addDependency(AbstractNameQuery refInfo) {
+        this.dependencies.add(new ReferencePatterns(Collections.singleton(refInfo)));
+    }
+
+    public void addDependency(AbstractName dependency) {
+        this.dependencies.add(new ReferencePatterns(dependency));
     }
 
     public void writeExternal(ObjectOutput out) throws IOException {
@@ -213,5 +234,6 @@
             throw new ClassNotFoundException("Unable to find class used in GBeanData " +
abstractName, e);
         }
     }
+
 }
 

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java?rev=384351&r1=384350&r2=384351&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java
Wed Mar  8 14:28:35 2006
@@ -262,7 +262,7 @@
 
         //dependencies
         for (Iterator iterator = gbeanData.getDependencies().iterator(); iterator.hasNext();)
{
-            AbstractName dependencyName = (AbstractName) iterator.next();
+            AbstractName dependencyName = ((ReferencePatterns) iterator.next()).getAbstractName();
             dependencySet.add(new GBeanDependency(this, dependencyName, kernel));
         }
 
@@ -771,7 +771,7 @@
             }
         }
         if (configName != null) {
-            manageableStore.setValue(configName, abstractName.getObjectName(), attribute.getAttributeInfo(),
value);
+            manageableStore.setValue(configName, abstractName, attribute.getAttributeInfo(),
value);
         } else {
             log.error("Unable to identify Configuration for GBean " + abstractName.getObjectName()
+ ".  Manageable attribute " + attribute.getName() + " was not updated in persistent store.");
         }

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/BasicDependencyManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/BasicDependencyManager.java?rev=384351&r1=384350&r2=384351&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/BasicDependencyManager.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/BasicDependencyManager.java
Wed Mar  8 14:28:35 2006
@@ -69,7 +69,7 @@
     public BasicDependencyManager(LifecycleMonitor lifecycleMonitor) throws Exception {
         assert lifecycleMonitor != null;
         this.lifecycleMonitor = lifecycleMonitor;
-        lifecycleMonitor.addLifecycleListener(lifecycleListener, new AbstractNameQuery(Collections.EMPTY_LIST,
Collections.EMPTY_MAP, Collections.EMPTY_SET));
+        lifecycleMonitor.addLifecycleListener(lifecycleListener, new AbstractNameQuery(null,
Collections.EMPTY_MAP, Collections.EMPTY_SET));
     }
 
     public synchronized void close() {

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java?rev=384351&r1=384350&r2=384351&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
Wed Mar  8 14:28:35 2006
@@ -25,6 +25,7 @@
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.gbean.ReferencePatterns;
 import org.apache.geronimo.kernel.DependencyManager;
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
@@ -441,6 +442,7 @@
         return Collections.unmodifiableMap(gbeans);
     }
 
+    //TODO this is pretty much broken, it assumes everything is pre-resolved
     public synchronized void addGBean(GBeanData beanData, boolean start) throws InvalidConfigException,
GBeanAlreadyExistsException {
         ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
         try {
@@ -449,7 +451,7 @@
             log.trace("Registering GBean " + beanData.getName());
 
             // add a dependency on this configuration
-            beanData.getDependencies().add(abstractName);
+            beanData.addDependency(abstractName);
 
             // register the bean with the kernel
             kernel.loadGBean(beanData, configurationClassLoader);

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java?rev=384351&r1=384350&r2=384351&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java
Wed Mar  8 14:28:35 2006
@@ -27,6 +27,8 @@
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.InvalidConfigurationException;
+import org.apache.geronimo.gbean.GReferenceInfo;
+import org.apache.geronimo.gbean.ReferencePatterns;
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.InternalKernelException;
@@ -56,6 +58,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.HashSet;
 
 /**
  * The standard non-editable ConfigurationManager implementation.  That is,
@@ -336,13 +339,13 @@
         for (Iterator iterator = imports.iterator(); iterator.hasNext();) {
             Artifact artifact = (Artifact) iterator.next();
             AbstractName importName = Configuration.getConfigurationAbstractName(artifact);
-            gbeanData.getDependencies().add(importName);
+            gbeanData.addDependency(importName);
             importNames.add(new AbstractNameQuery(importName));
         }
         for (Iterator iterator = references.iterator(); iterator.hasNext();) {
             Artifact artifact = (Artifact) iterator.next();
             AbstractName referenceName = Configuration.getConfigurationAbstractName(artifact);
-            gbeanData.getDependencies().add(referenceName);
+            gbeanData.addDependency(referenceName);
         }
 
         // imports become the parents
@@ -383,6 +386,9 @@
             gbeans = attributeStore.applyOverrides(getConfigurationId(configuration), gbeans,
configuration.getConfigurationClassLoader());
         }
 
+        List ancestors = new ArrayList();
+        resolveAncestors(configuration, ancestors);
+
         // register all the GBeans
         AbstractName configurationName = Configuration.getConfigurationAbstractName(configuration.getId());
         ConfigurationStore configurationStore = configuration.getConfigurationStore();
@@ -392,6 +398,28 @@
             // copy the gbeanData object as not to mutate the original
             gbeanData = new GBeanData(gbeanData);
 
+            for (Iterator references = gbeanData.getReferencesNames().iterator(); references.hasNext();)
{
+                String referenceName = (String) references.next();
+                GReferenceInfo referenceInfo = gbeanData.getGBeanInfo().getReference(referenceName);
+                if (referenceInfo == null) {
+                    throw new InvalidConfigException("No reference named " + referenceName
+ " in gbean " + gbeanData.getAbstractName());
+                }
+                boolean isSingleValued = !referenceInfo.getProxyType().equals(Collection.class.getName());
+                if (isSingleValued) {
+                    ReferencePatterns referencePatterns = gbeanData.getReferencePatterns(referenceName);
+                    ReferencePatterns resolvedPatterns = resolveReferencePatterns(referencePatterns,
ancestors);
+                    gbeanData.setReferencePatterns(referenceName, resolvedPatterns);
+                }
+            }
+
+            Set newDependencies = new HashSet();
+            for (Iterator dependencies = gbeanData.getDependencies().iterator(); dependencies.hasNext();)
{
+                ReferencePatterns referencePatterns = (ReferencePatterns) dependencies.next();
+                ReferencePatterns resolvedPatterns = resolveReferencePatterns(referencePatterns,
ancestors);
+                newDependencies.add(resolvedPatterns);
+            }
+            gbeanData.setDependencies(newDependencies);
+
             // If the GBean has a configurationBaseUrl attribute, set it
             // todo remove this when web app cl are config. cl.
             GAttributeInfo attribute = gbeanData.getGBeanInfo().getAttribute("configurationBaseUrl");
@@ -401,7 +429,7 @@
             }
 
             // add a dependency from the gbean to the configuration
-            gbeanData.getDependencies().add(configurationName);
+            gbeanData.addDependency(configurationName);
 
             log.trace("Registering GBean " + gbeanData.getName());
 
@@ -410,6 +438,61 @@
             } catch (GBeanAlreadyExistsException e) {
                 throw new InvalidConfigException(e);
             }
+        }
+    }
+
+    private ReferencePatterns resolveReferencePatterns(ReferencePatterns referencePatterns,
List ancestors) throws InvalidConfigException {
+        ReferencePatterns result = null;
+        boolean first = true;
+        for (Iterator iterator = ancestors.iterator(); iterator.hasNext();) {
+            Configuration configuration = (Configuration) iterator.next();
+            ReferencePatterns match = resolve(referencePatterns, configuration);
+            if (first && match != null) {
+                return match;
+            }
+            first = false;
+            if (result != null) {
+                throw new InvalidConfigException("More than one match for referencePatterns
" + referencePatterns);
+            }
+            result = match;
+        }
+        if (result == null) {
+            throw new InvalidConfigException("No matches for referencePatterns: " + referencePatterns);
+        }
+        return result;
+    }
+
+    private ReferencePatterns resolve(ReferencePatterns referencePatterns, Configuration
configuration) throws InvalidConfigException {
+        if (referencePatterns.getAbstractName() != null) {
+            //this should not occur, but it means no further resolution is needed
+            return referencePatterns;
+        }
+        ReferencePatterns result = null;
+        Set gbeanNames = configuration.getGBeans().keySet();
+        for (Iterator abstractNameQueries = referencePatterns.getPatterns().iterator(); abstractNameQueries.hasNext();)
{
+            AbstractNameQuery abstractNameQuery =  (AbstractNameQuery) abstractNameQueries.next();
+            Artifact queryArtifact = abstractNameQuery.getArtifact();
+            //skip this configuration if we know it can't match.
+            if (queryArtifact == null || queryArtifact.matches(configuration.getId())) {
+                for (Iterator iterator = gbeanNames.iterator(); iterator.hasNext();) {
+                    AbstractName abstractName = (AbstractName) iterator.next();
+                    if (abstractNameQuery.matches(abstractName)) {
+                        if (result != null ) {
+                            throw new InvalidConfigException("More than one match to referencePatterns
" + referencePatterns + " in configuration " + configuration.getId());
+                        }
+                        result = new ReferencePatterns(abstractName);
+                    }
+                }
+            }
+        }
+        return result;
+    }
+
+    private void resolveAncestors(Configuration configuration, List ancestors) {
+        ancestors.add(configuration);
+        for (Iterator parents = configuration.getParents().iterator(); parents.hasNext();)
{
+            Configuration parent = (Configuration) parents.next();
+            resolveAncestors(parent, ancestors);
         }
     }
 

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java?rev=384351&r1=384350&r2=384351&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java
Wed Mar  8 14:28:35 2006
@@ -77,7 +77,7 @@
         // register all the GBeans
         for (Iterator i = gbeans.values().iterator(); i.hasNext();) {
             GBeanData gbeanData = (GBeanData) i.next();
-            gbeanData.getDependencies().add(configurationName);
+            gbeanData.addDependency(configurationName);
 
             // load the gbean into the kernel
             kernel.loadGBean(gbeanData, configurationClassLoader);

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/EditableConfigurationManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/EditableConfigurationManager.java?rev=384351&r1=384350&r2=384351&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/EditableConfigurationManager.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/EditableConfigurationManager.java
Wed Mar  8 14:28:35 2006
@@ -16,8 +16,7 @@
  */
 package org.apache.geronimo.kernel.config;
 
-import java.net.URI;
-import javax.management.ObjectName;
+import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.repository.Artifact;
@@ -44,5 +43,5 @@
      * @param configID  The configuration to remove the GBean from.
      * @param gbean     The ObjectName of the GBean to remove.
      */
-    void removeGBeanFromConfiguration(Artifact configID, ObjectName gbean) throws InvalidConfigException,
GBeanNotFoundException;
+    void removeGBeanFromConfiguration(Artifact configID, AbstractName gbean) throws InvalidConfigException,
GBeanNotFoundException;
 }

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/EditableConfigurationManagerImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/EditableConfigurationManagerImpl.java?rev=384351&r1=384350&r2=384351&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/EditableConfigurationManagerImpl.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/EditableConfigurationManagerImpl.java
Wed Mar  8 14:28:35 2006
@@ -27,6 +27,7 @@
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.AbstractName;
 
 /**
  * Standard implementation of an editable ConfigurationManager.
@@ -35,12 +36,12 @@
  */
 public class EditableConfigurationManagerImpl extends ConfigurationManagerImpl implements
EditableConfigurationManager {
     public EditableConfigurationManagerImpl(Kernel kernel,
-            Collection stores,
-            ManageableAttributeStore attributeStore,
-            PersistentConfigurationList configurationList,
-            ArtifactManager artifactManager,
-            ArtifactResolver artifactResolver,
-            ClassLoader classLoader) {
+                                            Collection stores,
+                                            ManageableAttributeStore attributeStore,
+                                            PersistentConfigurationList configurationList,
+                                            ArtifactManager artifactManager,
+                                            ArtifactResolver artifactResolver,
+                                            ClassLoader classLoader) {
         super(kernel, stores, attributeStore, configurationList, artifactManager, artifactResolver,
classLoader);
     }
 
@@ -55,7 +56,7 @@
         attributeStore.addGBean(configID.toString(), gbean);
     }
 
-    public void removeGBeanFromConfiguration(Artifact configID, ObjectName gbean) throws
GBeanNotFoundException, InvalidConfigException {
+    public void removeGBeanFromConfiguration(Artifact configID, AbstractName gbean) throws
GBeanNotFoundException, InvalidConfigException {
         // Make sure the specified configuration has the specified GBean
         try {
             ObjectName name = Configuration.getConfigurationObjectName(configID);

Modified: geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/gbean/runtime/GBeanDependencyTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/gbean/runtime/GBeanDependencyTest.java?rev=384351&r1=384350&r2=384351&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/gbean/runtime/GBeanDependencyTest.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/gbean/runtime/GBeanDependencyTest.java
Wed Mar  8 14:28:35 2006
@@ -43,7 +43,7 @@
         AbstractName parentName = buildAbstractName("parent", MockGBean.getGBeanInfo());
         GBeanData gbeanDataParent = new GBeanData(parentName, MockGBean.getGBeanInfo());
         GBeanData gbeanDataChild = new GBeanData(buildAbstractName("child", MockGBean.getGBeanInfo()),
MockGBean.getGBeanInfo());
-        gbeanDataChild.getDependencies().add(parentName);
+        gbeanDataChild.addDependency(new ReferencePatterns(parentName));
         kernel.loadGBean(gbeanDataChild, MockGBean.class.getClassLoader());
         kernel.startGBean(gbeanDataChild.getName());
         assertEquals(State.STARTING_INDEX, kernel.getGBeanState(gbeanDataChild.getName()));

Modified: geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/GBeanBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/GBeanBuilder.java?rev=384351&r1=384350&r2=384351&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/GBeanBuilder.java
(original)
+++ geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/GBeanBuilder.java
Wed Mar  8 14:28:35 2006
@@ -38,7 +38,6 @@
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
-import java.util.List;
 import java.util.Collections;
 
 /**
@@ -126,17 +125,17 @@
     public void setReference(String name, PatternType[] patterns, J2eeContext j2eeContext)
throws DeploymentException {
         Set patternNames = new HashSet(patterns.length);
         for (int i = 0; i < patterns.length; i++) {
-            patternNames.add(buildUnresolvedReferenceInfo(name, patterns[i]));
+            patternNames.add(buildAbstractNameQuery(name, patterns[i]));
         }
         gbean.setReferencePatterns(name, patternNames);
     }
 
     public void addDependency(PatternType patternType, J2eeContext j2eeContext) throws DeploymentException
{
-        AbstractNameQuery refInfo = buildUnresolvedReferenceInfo(null, patternType);
-        gbean.getDependencies().add(refInfo);
+        AbstractNameQuery refInfo = buildAbstractNameQuery(null, patternType);
+        gbean.addDependency(refInfo);
     }
 
-    private AbstractNameQuery buildUnresolvedReferenceInfo(String refName, PatternType pattern)
throws DeploymentException {
+    private AbstractNameQuery buildAbstractNameQuery(String refName, PatternType pattern)
throws DeploymentException {
 //        if (refName == null) {
 //            throw new DeploymentException("No type specified in dependency pattern " +
pattern + " for gbean " + gbean.getName());
 //        }
@@ -161,10 +160,7 @@
         String type = pattern.isSetType() ? pattern.getType().trim() : null;
         String name = pattern.getName().trim();
 
-        List artifacts = Collections.EMPTY_LIST;
-        if (artifactid != null) {
-            artifacts = Collections.singletonList(new Artifact(groupId, artifactid, version,
"car"));
-        }
+        Artifact artifact = artifactid != null? new Artifact(groupId, artifactid, version,
"car"): null;
         //get the type from the gbean info if not supplied explicitly
         if (type == null) {
             type = referenceInfo.getNameTypeName();
@@ -178,7 +174,7 @@
             nameMap.put("module", module);
         }
         String interfaceType = referenceInfo.getProxyType();
-        return new AbstractNameQuery(artifacts, nameMap, Collections.singleton(interfaceType));
+        return new AbstractNameQuery(artifact, nameMap, Collections.singleton(interfaceType));
     }
 
     public GBeanData getGBeanData() {

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/GBeanOverride.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/GBeanOverride.java?rev=384351&r1=384350&r2=384351&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/GBeanOverride.java
(original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/GBeanOverride.java
Wed Mar  8 14:28:35 2006
@@ -264,9 +264,8 @@
             for (Iterator patternIterator = patterns.getPatterns().iterator(); patternIterator.hasNext();)
{
                 AbstractNameQuery pattern = (AbstractNameQuery) patternIterator.next();
                 out.println("          <pattern>");
-                List artifacts = pattern.getArtifacts();
-                if (artifacts != null && !artifacts.isEmpty()) {
-                    Artifact artifact = (Artifact) artifacts.get(0);
+                Artifact artifact = pattern.getArtifact();
+                if (artifact != null) {
                     if (artifact.getGroupId() != null) {
                         out.println("              <groupId>" + artifact.getGroupId()
+ "</groupId>");
                     }

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java?rev=384351&r1=384350&r2=384351&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
(original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
Wed Mar  8 14:28:35 2006
@@ -31,6 +31,7 @@
 import org.apache.geronimo.kernel.config.ManageableAttributeStore;
 import org.apache.geronimo.kernel.config.PersistentConfigurationList;
 import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.InvalidGBeanException;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -320,6 +321,8 @@
         } catch (ParserConfigurationException e) {
             log.error("Unable to read saved manageable attributes", e);
         } catch (MalformedObjectNameException e) {
+            log.error("Unable to read saved manageable attributes", e);
+        } catch (InvalidGBeanException e) {
             log.error("Unable to read saved manageable attributes", e);
         }
     }

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ServerOverride.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ServerOverride.java?rev=384351&r1=384350&r2=384351&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ServerOverride.java
(original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ServerOverride.java
Wed Mar  8 14:28:35 2006
@@ -18,6 +18,7 @@
 
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
+import org.apache.geronimo.kernel.InvalidGBeanException;
 
 import javax.management.MalformedObjectNameException;
 import java.io.PrintWriter;
@@ -34,7 +35,7 @@
     public ServerOverride() {
     }
 
-    public ServerOverride(Element element) throws MalformedObjectNameException {
+    public ServerOverride(Element element) throws MalformedObjectNameException, InvalidGBeanException
{
         NodeList configs = element.getElementsByTagName("configuration");
         for (int i = 0; i < configs.getLength(); i++) {
             Element configurationElement = (Element) configs.item(i);

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/jmx/MBeanServerKernelBridge.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/jmx/MBeanServerKernelBridge.java?rev=384351&r1=384350&r2=384351&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/jmx/MBeanServerKernelBridge.java
(original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/jmx/MBeanServerKernelBridge.java
Wed Mar  8 14:28:35 2006
@@ -51,7 +51,7 @@
     private final HashMap registry = new HashMap();
     private final Kernel kernel;
     private final MBeanServer mbeanServer;
-    private static final AbstractNameQuery ALL = new AbstractNameQuery(Collections.EMPTY_LIST,
Collections.EMPTY_MAP, Collections.EMPTY_SET);
+    private static final AbstractNameQuery ALL = new AbstractNameQuery(null, Collections.EMPTY_MAP,
Collections.EMPTY_SET);
 
     public MBeanServerKernelBridge(Kernel kernel, String mbeanServerId) throws MBeanServerNotFound
{
         this.kernel = kernel;

Modified: geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/ServerOverrideTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/ServerOverrideTest.java?rev=384351&r1=384350&r2=384351&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/ServerOverrideTest.java
(original)
+++ geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/ServerOverrideTest.java
Wed Mar  8 14:28:35 2006
@@ -82,7 +82,7 @@
 
     private AbstractNameQuery getAbstractNameQuery(String pizzaOvenString) throws MalformedObjectNameException
{
         ObjectName pizzaOvenPattern = new ObjectName(pizzaOvenString);
-        return new AbstractNameQuery(Collections.EMPTY_LIST, pizzaOvenPattern.getKeyPropertyList(),
Collections.EMPTY_SET);
+        return new AbstractNameQuery(null, pizzaOvenPattern.getKeyPropertyList(), Collections.EMPTY_SET);
     }
 
     public void testGBeanXml() throws Exception {

Modified: geronimo/branches/1.1/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java?rev=384351&r1=384350&r2=384351&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
(original)
+++ geronimo/branches/1.1/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
Wed Mar  8 14:28:35 2006
@@ -311,7 +311,7 @@
             //This is overkill, but allows for people not using java:comp context (even though
we don't support it)
             //and sidesteps the problem of circular references between ejbs.
             Set dependencies = findGBeanDependencies(earContext);
-            webModuleData.getDependencies().addAll(dependencies);
+            webModuleData.addDependencies(dependencies);
 
             webModuleData.setAttribute("componentContext", compContext);
             webModuleData.setAttribute("userTransaction", userTransaction);

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=384351&r1=384350&r2=384351&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
Wed Mar  8 14:28:35 2006
@@ -94,6 +94,7 @@
 
     }
 
+    //TODO configid these need to be converted to ReferencePatterns
     protected Set findGBeanDependencies(EARContext earContext) {
         Set dependencies = new HashSet();
         dependencies.addAll(earContext.listGBeans(MANAGED_CONNECTION_FACTORY_PATTERN));



Mime
View raw message