geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r351546 - in /geronimo/trunk: modules/kernel/src/java/org/apache/geronimo/gbean/ modules/kernel/src/java/org/apache/geronimo/kernel/config/ modules/system/src/java/org/apache/geronimo/system/configuration/ modules/system/src/test/org/apache...
Date Fri, 02 Dec 2005 01:03:58 GMT
Author: dain
Date: Thu Dec  1 17:03:52 2005
New Revision: 351546

URL: http://svn.apache.org/viewcvs?rev=351546&view=rev
Log:
Add support for declaring new GBeans in the config.xml file
Add support for overriding reference patterns in the config.xml file

Added:
    geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/InvalidAttributeException.java   (with props)
    geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/configuration/LocalAttributeManagerTest.java   (with props)
Modified:
    geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanInfo.java
    geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
    geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ManageableAttributeStore.java
    geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/GBeanOverride.java
    geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
    geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/configuration/ServerOverrideTest.java
    geronimo/trunk/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenAttributeStore.java

Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanInfo.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanInfo.java?rev=351546&r1=351545&r2=351546&view=diff
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanInfo.java (original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanInfo.java Thu Dec  1 17:03:52 2005
@@ -78,6 +78,7 @@
     private final Set operations;
     private final Set notifications;
     private final Set references;
+    private final Map referencesByName;
     private final Set interfaces;
 
     /**
@@ -141,7 +142,14 @@
         }
         if (references == null) {
             this.references = Collections.EMPTY_SET;
+            this.referencesByName = Collections.EMPTY_MAP;
         } else {
+            Map map = new HashMap();
+            for (Iterator iterator = references.iterator(); iterator.hasNext();) {
+                GReferenceInfo reference = (GReferenceInfo) iterator.next();
+                map.put(reference.getName(), reference);
+            }
+            this.referencesByName = Collections.unmodifiableMap(map);
             this.references = Collections.unmodifiableSet(new HashSet(references));
         }
         if (interfaces == null) {
@@ -230,6 +238,10 @@
 
     public Set getReferences() {
         return references;
+    }
+
+    public GReferenceInfo getReference(String name) {
+        return (GReferenceInfo) referencesByName.get(name);
     }
 
     public Set getInterfaces() {

Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java?rev=351546&r1=351545&r2=351546&view=diff
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java (original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java Thu Dec  1 17:03:52 2005
@@ -303,7 +303,7 @@
             // create and initialize GBeans
             Collection gbeans = loadGBeans();
             if (attributeStore != null) {
-                gbeans = attributeStore.setAttributes(id, gbeans);
+                gbeans = attributeStore.setAttributes(id, gbeans, configurationClassLoader);
             }
 
             // register all the GBeans

Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ManageableAttributeStore.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ManageableAttributeStore.java?rev=351546&r1=351545&r2=351546&view=diff
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ManageableAttributeStore.java (original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ManageableAttributeStore.java Thu Dec  1 17:03:52 2005
@@ -18,11 +18,13 @@
 
 import org.apache.geronimo.gbean.GAttributeInfo;
 import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GReferenceInfo;
 
 import javax.management.ObjectName;
 import java.io.IOException;
 import java.net.URI;
 import java.util.Collection;
+import java.util.Set;
 
 /**
  * Able to retrieve the values of certain "manageable" attributes from a
@@ -43,10 +45,11 @@
      * @param configurationName The configuration in question
      * @param datas             The initial GBeanData's for all the GBeans in
      *                          the configuration
+     * @param classLoader
      * @return                  The modified GBeanData's
      * @throws InvalidConfigException If something bad happens
      */
-    public Collection setAttributes(URI configurationName, Collection datas) throws InvalidConfigException;
+    public Collection setAttributes(URI configurationName, Collection datas, ClassLoader classLoader) throws InvalidConfigException;
 
     /**
      * Sets the stored value for a particular attribute.  The attribute is
@@ -65,6 +68,32 @@
      * @param value The value to save, or null if no value should be saved
      */
     public void setValue(String configurationName, ObjectName gbean, GAttributeInfo attribute, Object value);
+
+    /**
+     * Sets the pattern for a GBean reference. The reference is
+     * identified by the configuration name, GBean ObjectName, and reference
+     * information.
+     *
+     * To "null-out" the reference use setReferencePatterns(configurationName, gbean, reference, Collections.EMPTY_SET).
+     *
+     * @param configurationName the name of the configuration holding the GBean in question
+     * @param gbean the ObjectName of the GBean
+     * @param reference the attribute information
+     * @param pattern new object name pattern for this reference
+     */
+    public void setReferencePattern(String configurationName, ObjectName gbean, GReferenceInfo reference, ObjectName pattern);
+
+    /**
+     * Sets the patterns for a GBean reference. The reference is
+     * identified by the configuration name, GBean ObjectName, and reference
+     * information.
+     *
+     * @param configurationName the name of the configuration holding the GBean in question
+     * @param gbean the ObjectName of the GBean
+     * @param reference the attribute information
+     * @param patterns new object name patterns for this reference; must not be null
+     */
+    public void setReferencePatterns(String configurationName, ObjectName gbean, GReferenceInfo reference, Set patterns);
 
     /**
      * Sets whether a particular GBean should be loaded for this configuration.

Modified: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/GBeanOverride.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/GBeanOverride.java?rev=351546&r1=351545&r2=351546&view=diff
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/GBeanOverride.java (original)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/GBeanOverride.java Thu Dec  1 17:03:52 2005
@@ -16,19 +16,24 @@
  */
 package org.apache.geronimo.system.configuration;
 
+import org.apache.geronimo.common.propertyeditor.PropertyEditors;
+import org.apache.geronimo.gbean.GAttributeInfo;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GBeanInfo;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
-import org.apache.geronimo.gbean.GBeanData;
 
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
+import java.beans.PropertyEditor;
 import java.io.PrintWriter;
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.Set;
-import java.util.Collections;
 
 /**
  * @version $Rev$ $Date$
@@ -38,27 +43,42 @@
     private boolean load;
     private final Map attributes = new LinkedHashMap();
     private final Map references = new LinkedHashMap();
-    private final String gbeanInfoSource;
+    private final String gbeanInfo;
 
     public GBeanOverride(String name, boolean load) {
         this.name = name;
         this.load = load;
-        gbeanInfoSource = null;
+        gbeanInfo = null;
     }
 
     public GBeanOverride(ObjectName name, boolean load) {
         this.name = name;
         this.load = load;
-        gbeanInfoSource = null;
+        gbeanInfo = null;
     }
 
-    public GBeanOverride(GBeanData gbeanData) {
-        gbeanInfoSource = gbeanData.getGBeanInfo().getSourceClass();
-        if (gbeanInfoSource == null) {
+    public GBeanOverride(GBeanData gbeanData) throws InvalidAttributeException {
+        GBeanInfo gbeanInfo = gbeanData.getGBeanInfo();
+        this.gbeanInfo = gbeanInfo.getSourceClass();
+        if (this.gbeanInfo == null) {
             throw new IllegalArgumentException("GBeanInfo must have a source class set");
         }
         name = gbeanData.getName();
-        attributes.putAll(gbeanData.getAttributes());
+        load = true;
+
+        // set attributes
+        for (Iterator iterator = gbeanData.getAttributes().entrySet().iterator(); iterator.hasNext();) {
+            Map.Entry entry = (Map.Entry) iterator.next();
+            String attributeName = (String) entry.getKey();
+            GAttributeInfo attributeInfo = gbeanInfo.getAttribute(attributeName);
+            if (attributeInfo == null) {
+                throw new InvalidAttributeException("No attribute: " + attributeName + " for gbean: " + gbeanData.getName());
+            }
+            Object attributeValue = entry.getValue();
+            setAttribute(attributeName, attributeValue, attributeInfo.getType());
+        }
+
+        // references can be coppied in blind
         references.putAll(gbeanData.getReferences());
     }
 
@@ -70,33 +90,73 @@
             name = nameString;
         }
 
-        gbeanInfoSource = gbean.getAttribute("gbeanInfo");
+        String gbeanInfoString = gbean.getAttribute("gbeanInfo");
+        if (gbeanInfoString.length() > 0) {
+            gbeanInfo = gbeanInfoString;
+        } else {
+            gbeanInfo = null;
+        }
+        if (gbeanInfo != null && !(name instanceof ObjectName)) {
+            throw new MalformedObjectNameException("A gbean element using the gbeanInfo attribute must be specified using a full ObjectName: name=" + nameString);
+        }
 
         String loadString = gbean.getAttribute("load");
         load = !"false".equals(loadString);
 
+        // attributes
         NodeList attributes = gbean.getElementsByTagName("attribute");
         for (int a = 0; a < attributes.getLength(); a++) {
             Element attribute = (Element) attributes.item(a);
-            String attName = attribute.getAttribute("name");
-            String value = "";
-            NodeList text = attribute.getChildNodes();
-            for (int t = 0; t < text.getLength(); t++) {
-                Node n = text.item(t);
-                if (n.getNodeType() == Node.TEXT_NODE) {
-                    value += n.getNodeValue();
+
+            String attributeName = attribute.getAttribute("name");
+            String attributeValue = getContentsAsText(attribute);
+            setAttribute(attributeName, attributeValue);
+        }
+
+        // references
+        NodeList references = gbean.getElementsByTagName("reference");
+        for (int r = 0; r < references.getLength(); r++) {
+            Element reference = (Element) references.item(r);
+
+            String referenceName = reference.getAttribute("name");
+
+            Set objectNamePatterns = new LinkedHashSet();
+            NodeList patterns = reference.getElementsByTagName("pattern");
+            for (int p = 0; p < references.getLength(); p++) {
+                Element pattern = (Element) patterns.item(p);
+                NodeList gbeanNames = pattern.getElementsByTagName("gbean-name");
+                if (gbeanNames.getLength() != 1) {
+                    throw new MalformedObjectNameException("pattern does not contain a valid gbean-name:" +
+                            " name=" + nameString +
+                            " referenceName=" + referenceName);
                 }
+                String value = getContentsAsText((Element)gbeanNames.item(0));
+                ObjectName objectNamePattern = new ObjectName(value);
+                objectNamePatterns.add(objectNamePattern);
+            }
+
+            setReferencePatterns(referenceName, objectNamePatterns);
+        }
+    }
+
+    private static String getContentsAsText(Element element) {
+        String value = "";
+        NodeList text = element.getChildNodes();
+        for (int t = 0; t < text.getLength(); t++) {
+            Node n = text.item(t);
+            if (n.getNodeType() == Node.TEXT_NODE) {
+                value += n.getNodeValue();
             }
-            setAttribute(attName, value.trim());
         }
+        return value.trim();
     }
 
     public Object getName() {
         return name;
     }
 
-    public String getGbeanInfoSource() {
-        return gbeanInfoSource;
+    public String getGBeanInfo() {
+        return gbeanInfo;
     }
 
     public boolean isLoad() {
@@ -115,6 +175,10 @@
         return (String) attributes.get(attributeName);
     }
 
+    public void setAttribute(String attributeName, Object attributeValue, String attributeType) throws InvalidAttributeException {
+        String stringValue = getAsText(attributeValue, attributeType);
+        attributes.put(attributeName, stringValue);
+    }
     public void setAttribute(String attributeName, String attributeValue) {
         attributes.put(attributeName, attributeValue);
     }
@@ -144,8 +208,8 @@
         }
 
         out.print("    <gbean name=\"" + gbeanName + "\"");
-        if (gbeanInfoSource != null) {
-            out.print(" gbeanInfoSource=\"" + gbeanInfoSource + "\"");
+        if (gbeanInfo != null) {
+            out.print(" gbeanInfo=\"" + gbeanInfo + "\"");
         }
         
         if (!load) {
@@ -153,14 +217,48 @@
         }
         out.println(">");
 
-        // Attribute values
-        for (Iterator att = attributes.entrySet().iterator(); att.hasNext();) {
-            Map.Entry attribute = (Map.Entry) att.next();
-            out.print("      <attribute name=\"" + attribute.getKey() + "\">");
-            out.print((String) attribute.getValue());
-            out.println("</attribute>");
+        // attributes
+        for (Iterator iterator = attributes.entrySet().iterator(); iterator.hasNext();) {
+            Map.Entry entry = (Map.Entry) iterator.next();
+            String name = (String) entry.getKey();
+            String value = (String) entry.getValue();
+            out.println("      <attribute name=\"" + name + "\">" +  value + "</attribute>");
+        }
+
+        // references
+        for (Iterator iterator = references.entrySet().iterator(); iterator.hasNext();) {
+            Map.Entry entry = (Map.Entry) iterator.next();
+            String name = (String) entry.getKey();
+            Set patterns = (Set) entry.getValue();
+
+            out.println("      <reference name=\"" + name + "\">");
+            for (Iterator patternIterator = patterns.iterator(); patternIterator.hasNext();) {
+                ObjectName pattern = (ObjectName) patternIterator.next();
+                out.print("          <pattern><gbean-name>");
+                out.print(pattern.getCanonicalName());
+                out.println("</gbean-name></pattern>");
+            }
+            out.println("      </reference>");
         }
 
         out.println("    </gbean>");
+    }
+
+    public static String getAsText(Object value, String type) throws InvalidAttributeException {
+        try {
+            String attributeStringValue = null;
+            if (value != null) {
+                PropertyEditor editor = PropertyEditors.findEditor(type, GBeanOverride.class.getClassLoader());
+                if (editor == null) {
+                    throw new InvalidAttributeException("Unable to format attribute of type " + type + "; no editor found");
+                }
+                editor.setValue(value);
+                attributeStringValue = editor.getAsText();
+            }
+            return attributeStringValue;
+        } catch (ClassNotFoundException e) {
+            //todo: use the Configuration's ClassLoader to load the attribute, if this ever becomes an issue
+            throw new InvalidAttributeException("Unable to store attribute type " + type);
+        }
     }
 }

Added: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/InvalidAttributeException.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/InvalidAttributeException.java?rev=351546&view=auto
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/InvalidAttributeException.java (added)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/InvalidAttributeException.java Thu Dec  1 17:03:52 2005
@@ -0,0 +1,37 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.system.configuration;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class InvalidAttributeException extends Exception {
+    public InvalidAttributeException() {
+    }
+
+    public InvalidAttributeException(String message) {
+        super(message);
+    }
+
+    public InvalidAttributeException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public InvalidAttributeException(Throwable cause) {
+        super(cause);
+    }
+}

Propchange: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/InvalidAttributeException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/InvalidAttributeException.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Id"

Modified: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java?rev=351546&r1=351545&r2=351546&view=diff
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java (original)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java Thu Dec  1 17:03:52 2005
@@ -16,27 +16,6 @@
  */
 package org.apache.geronimo.system.configuration;
 
-import java.beans.PropertyEditor;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Timer;
-import java.util.TimerTask;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.common.propertyeditor.PropertyEditors;
@@ -45,6 +24,7 @@
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.gbean.GReferenceInfo;
 import org.apache.geronimo.kernel.config.InvalidConfigException;
 import org.apache.geronimo.kernel.config.ManageableAttributeStore;
 import org.apache.geronimo.kernel.config.PersistentConfigurationList;
@@ -54,6 +34,29 @@
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import java.beans.PropertyEditor;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.Set;
+
 /**
  * Stores managed attributes in an XML file on the local filesystem.
  *
@@ -86,30 +89,60 @@
         this.configFile = System.getProperty(CONFIG_FILE_PROPERTY, configFile);
         this.readOnly = readOnly;
         this.serverInfo = serverInfo;
+        serverOverride = new ServerOverride();
     }
 
     public boolean isReadOnly() {
         return readOnly;
     }
 
-    public synchronized Collection setAttributes(URI configurationName, Collection datas) throws InvalidConfigException {
+    public synchronized Collection setAttributes(URI configurationName, Collection gbeanDatas, ClassLoader classLoader) throws InvalidConfigException {
+        // clone the datas since we will be modifying this collection
+        gbeanDatas = new ArrayList(gbeanDatas);
+
         String configName = configurationName.toString();
         ConfigurationOverride configuration = serverOverride.getConfiguration(configName);
-        if (configuration != null) {
-            if (configuration.isLoad()) {
-                // todo add new gbeans here
-                for (Iterator iterator = datas.iterator(); iterator.hasNext();) {
-                    GBeanData data = (GBeanData) iterator.next();
-                    boolean load = setAttributes(data, configuration, configName);
-                    if (!load) {
-                        iterator.remove();
-                    }
+        if (configuration == null) {
+            return gbeanDatas;
+        }
+        if (!configuration.isLoad()) {
+            return Collections.EMPTY_LIST;
+        }
+
+        // index the incoming datas
+        Map datasByName = new HashMap();
+        for (Iterator iterator = gbeanDatas.iterator(); iterator.hasNext();) {
+            GBeanData gbeanData = (GBeanData) iterator.next();
+            datasByName.put(gbeanData.getName(), gbeanData);
+        }
+
+        // add the new GBeans
+        for (Iterator iterator = configuration.getGBeans().entrySet().iterator(); iterator.hasNext();) {
+            Map.Entry entry = (Map.Entry) iterator.next();
+            Object name = entry.getKey();
+            GBeanOverride gbean = (GBeanOverride) entry.getValue();
+            if (!datasByName.containsKey(name) && gbean.getGBeanInfo() != null && gbean.isLoad()) {
+                if (!(name instanceof ObjectName)) {
+                    throw new InvalidConfigException("New GBeans must be specified with a full objectName:" +
+                            " configuration=" + configName +
+                            " gbeanName=" + name);
                 }
-            } else {
-                return Collections.EMPTY_LIST;
+                ObjectName objectName = (ObjectName) name;
+                GBeanInfo gbeanInfo = GBeanInfo.getGBeanInfo(gbean.getGBeanInfo(), classLoader);
+                GBeanData gBeanData = new GBeanData(objectName, gbeanInfo);
+                gbeanDatas.add(gBeanData);
+            }
+        }
+
+        // set the attributes
+        for (Iterator iterator = gbeanDatas.iterator(); iterator.hasNext();) {
+            GBeanData data = (GBeanData) iterator.next();
+            boolean load = setAttributes(data, configuration, configName, classLoader);
+            if (!load) {
+                iterator.remove();
             }
         }
-        return datas;
+        return gbeanDatas;
     }
 
     /**
@@ -118,45 +151,66 @@
      * @param data
      * @param configuration
      * @param configName
+     * @param classLoader
      * @return true if the gbean should be loaded, false otherwise.
      * @throws org.apache.geronimo.kernel.config.InvalidConfigException
      */
-    private synchronized boolean setAttributes(GBeanData data, ConfigurationOverride configuration, String configName) throws InvalidConfigException {
+    private synchronized boolean setAttributes(GBeanData data, ConfigurationOverride configuration, String configName, ClassLoader classLoader) throws InvalidConfigException {
         ObjectName gbeanName = data.getName();
-        GBeanInfo gBeanInfo = data.getGBeanInfo();
         GBeanOverride gbean = configuration.getGBean(gbeanName);
         if (gbean == null) {
             gbean = configuration.getGBean(gbeanName.getKeyProperty("name"));
         }
-        if (gbean != null) {
-            if (gbean.isLoad()) {
-                for (Iterator iterator = gbean.getAttributes().entrySet().iterator(); iterator.hasNext();) {
-                    Map.Entry entry = (Map.Entry) iterator.next();
-                    String attributeName = (String) entry.getKey();
-                    GAttributeInfo attributeInfo = gBeanInfo.getAttribute(attributeName);
-                    if (attributeInfo == null) {
-                        throw new InvalidConfigException("No attribute: " + attributeName + " for gbean: " + data.getName());
-                    }
-                    String valueString = (String) entry.getValue();
-                    Object value = getValue(attributeInfo, valueString, configName, gbeanName);
-                    data.setAttribute(attributeName, value);
-                }
-                return true;
-            } else {
-                return false;
+
+        if (gbean == null) {
+            //no attr info, load by default
+            return true;
+        }
+
+        if (!gbean.isLoad()) {
+            return false;
+        }
+
+        GBeanInfo gbeanInfo = data.getGBeanInfo();
+
+        // set attributes
+        for (Iterator iterator = gbean.getAttributes().entrySet().iterator(); iterator.hasNext();) {
+            Map.Entry entry = (Map.Entry) iterator.next();
+            String attributeName = (String) entry.getKey();
+            GAttributeInfo attributeInfo = gbeanInfo.getAttribute(attributeName);
+            if (attributeInfo == null) {
+                throw new InvalidConfigException("No attribute: " + attributeName + " for gbean: " + data.getName());
+            }
+            String valueString = (String) entry.getValue();
+            Object value = getValue(attributeInfo, valueString, configName, gbeanName, classLoader);
+            data.setAttribute(attributeName, value);
+        }
+
+        // set references
+        for (Iterator iterator = gbean.getReferences().entrySet().iterator(); iterator.hasNext();) {
+            Map.Entry entry = (Map.Entry) iterator.next();
+
+            String referenceName = (String) entry.getKey();
+            GReferenceInfo referenceInfo = gbeanInfo.getReference(referenceName);
+            if (referenceInfo == null) {
+                throw new InvalidConfigException("No reference: " + referenceName + " for gbean: " + data.getName());
             }
+
+            Set referencePatterns = (Set) entry.getValue();
+
+            data.setReferencePatterns(referenceName, referencePatterns);
         }
-        //no attr info, load by default
         return true;
     }
 
 
-    private synchronized Object getValue(GAttributeInfo attribute, String value, String configurationName, ObjectName gbeanName) {
+    private synchronized Object getValue(GAttributeInfo attribute, String value, String configurationName, ObjectName gbeanName, ClassLoader classLoader) {
         if (value == null) {
             return null;
         }
+
         try {
-            PropertyEditor editor = PropertyEditors.findEditor(attribute.getType(), getClass().getClassLoader());
+            PropertyEditor editor = PropertyEditors.findEditor(attribute.getType(), classLoader);
             if (editor == null) {
                 log.debug("Unable to parse attribute of type " + attribute.getType() + "; no editor found");
                 return null;
@@ -165,7 +219,6 @@
             log.debug("Setting value for " + configurationName + "/" + gbeanName + "/" + attribute.getName() + " to value " + value);
             return editor.getValue();
         } catch (ClassNotFoundException e) {
-            //todo: use the Configuration's ClassLoader to load the attribute, if this ever becomes an issue
             log.error("Unable to load attribute type " + attribute.getType());
             return null;
         }
@@ -184,26 +237,38 @@
                 configuration.addGBean(gbeanName, gbean);
             }
         }
+
         try {
-            String string = null;
-            if (value != null) {
-                PropertyEditor editor = PropertyEditors.findEditor(attribute.getType(), getClass().getClassLoader());
-                if (editor == null) {
-                    log.error("Unable to format attribute of type " + attribute.getType() + "; no editor found");
-                    return;
-                }
-                editor.setValue(value);
-                string = editor.getAsText();
-            }
-            Map attrMap = gbean.getAttributes();
-            attrMap.put(attribute.getName(), string);
+            gbean.setAttribute(attribute.getName(), value, attribute.getType());
             attributeChanged();
-        } catch (ClassNotFoundException e) {
-            //todo: use the Configuration's ClassLoader to load the attribute, if this ever becomes an issue
-            log.error("Unable to store attribute type " + attribute.getType());
+        } catch (InvalidAttributeException e) {
+            // attribute can not be represented as a string
+            log.error(e.getMessage());
+            return;
         }
     }
 
+    public synchronized void setReferencePattern(String configurationName, ObjectName gbeanName, GReferenceInfo reference, ObjectName pattern) {
+        setReferencePatterns(configurationName, gbeanName, reference, Collections.singleton(pattern));
+    }
+
+    public synchronized void setReferencePatterns(String configurationName, ObjectName gbeanName, GReferenceInfo reference, Set patterns) {
+        if (readOnly) {
+            return;
+        }
+
+        ConfigurationOverride configuration = serverOverride.getConfiguration(configurationName, true);
+        GBeanOverride gbean = configuration.getGBean(gbeanName);
+        if (gbean == null) {
+            gbean = configuration.getGBean(gbeanName.getKeyProperty("name"));
+            if (gbean == null) {
+                gbean = new GBeanOverride(gbeanName, true);
+                configuration.addGBean(gbeanName, gbean);
+            }
+        }
+        gbean.setReferencePatterns(reference.getName(), patterns);
+    }
+
     public synchronized void setShouldLoad(String configurationName, ObjectName gbeanName, boolean load) {
         if (readOnly) {
             return;
@@ -232,9 +297,17 @@
         ConfigurationOverride configuration = serverOverride.getConfiguration(configurationName);
         if (configuration == null) {
             log.debug("Can not add GBean; Configuration not found " + configurationName);
+            return;
+        }
+        try {
+            GBeanOverride gbean = new GBeanOverride(gbeanData);
+            configuration.addGBean(gbean);
+            attributeChanged();
+        } catch (InvalidAttributeException e) {
+            // attribute can not be represented as a string
+            log.error(e.getMessage());
+            return;
         }
-        GBeanOverride gbean = new GBeanOverride(gbeanData);
-        configuration.addGBean(gbean);
     }
 
     public synchronized void load() throws IOException {
@@ -400,17 +473,19 @@
         if (currentTask != null) {
             currentTask.cancel();
         }
-        currentTask = new TimerTask() {
+        if (timer != null) {
+            currentTask = new TimerTask() {
 
-            public void run() {
-                try {
-                    LocalAttributeManager.this.save();
-                } catch (IOException e) {
-                    log.error("Error saving attributes", e);
+                public void run() {
+                    try {
+                        LocalAttributeManager.this.save();
+                    } catch (IOException e) {
+                        log.error("Error saving attributes", e);
+                    }
                 }
-            }
-        };
-        timer.schedule(currentTask, SAVE_BUFFER_MS);
+            };
+            timer.schedule(currentTask, SAVE_BUFFER_MS);
+        }
     }
 
     public static final GBeanInfo GBEAN_INFO;

Added: geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/configuration/LocalAttributeManagerTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/configuration/LocalAttributeManagerTest.java?rev=351546&view=auto
==============================================================================
--- geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/configuration/LocalAttributeManagerTest.java (added)
+++ geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/configuration/LocalAttributeManagerTest.java Thu Dec  1 17:03:52 2005
@@ -0,0 +1,207 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.system.configuration;
+
+import junit.framework.TestCase;
+import org.apache.geronimo.gbean.GAttributeInfo;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GReferenceInfo;
+import org.apache.geronimo.system.serverinfo.BasicServerInfo;
+
+import javax.management.ObjectName;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
+import java.util.LinkedHashSet;
+import java.util.Arrays;
+import java.util.HashSet;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class LocalAttributeManagerTest extends TestCase {
+    private static final String basedir = System.getProperties().getProperty("basedir", ".");
+
+    private LocalAttributeManager localAttributeManager;
+    private URI configurationName;
+    private ObjectName gbeanName;
+    private GAttributeInfo attributeInfo;
+    private GReferenceInfo referenceInfo;
+
+    public void testConfigurationShouldLoad() throws Exception {
+        // should load by default
+        Set originalDatas = new HashSet();
+        GBeanData gbeanData = new GBeanData(gbeanName, GBEAN_INFO);
+        originalDatas.add(gbeanData);
+
+        Set newDatas;
+        newDatas = new HashSet(localAttributeManager.setAttributes(configurationName, originalDatas, getClass().getClassLoader()));
+        assertEquals(1, newDatas.size());
+        assertEquals(originalDatas, newDatas);
+
+        // declare an attribute value so this configuration will exist in the store
+        String attributeValue = "attribute value";
+        localAttributeManager.addConfiguration(configurationName.toString());
+        localAttributeManager.setValue(configurationName.toString(), gbeanName, attributeInfo, attributeValue);
+
+        // should still load
+        newDatas = new HashSet(localAttributeManager.setAttributes(configurationName, originalDatas, getClass().getClassLoader()));
+        assertEquals(1, newDatas.size());
+        assertEquals(originalDatas, newDatas);
+
+        // remove the configuration from the store
+        localAttributeManager.removeConfiguration(configurationName.toString());
+
+        // should not load
+        newDatas = new HashSet(localAttributeManager.setAttributes(configurationName, originalDatas, getClass().getClassLoader()));
+        assertEquals(0, newDatas.size());
+    }
+
+    public void testGBeanShouldLoad() throws Exception {
+        ObjectName gbeanName2 = ObjectName.getInstance(":name=gbean2");
+
+        // should load by default
+        Set originalDatas = new HashSet();
+        GBeanData gbeanData = new GBeanData(gbeanName, GBEAN_INFO);
+        GBeanData gbeanData2 = new GBeanData(gbeanName2, GBEAN_INFO);
+        originalDatas.add(gbeanData);
+        originalDatas.add(gbeanData2);
+
+        Set newDatas;
+        newDatas = new HashSet(localAttributeManager.setAttributes(configurationName, originalDatas, getClass().getClassLoader()));
+        assertEquals(2, newDatas.size());
+        assertEquals(originalDatas, newDatas);
+
+        // declare an attribute value so this configuration will exist in the store
+        String attributeValue = "attribute value";
+        localAttributeManager.addConfiguration(configurationName.toString());
+        localAttributeManager.setValue(configurationName.toString(), gbeanName, attributeInfo, attributeValue);
+
+        // should still load
+        newDatas = new HashSet(localAttributeManager.setAttributes(configurationName, originalDatas, getClass().getClassLoader()));
+        assertEquals(2, newDatas.size());
+        assertEquals(originalDatas, newDatas);
+
+        // set the gbean to not load
+        localAttributeManager.setShouldLoad(configurationName.toString(), gbeanName, false);
+
+        // should not load
+        newDatas = new HashSet(localAttributeManager.setAttributes(configurationName, originalDatas, getClass().getClassLoader()));
+        assertEquals(1, newDatas.size());
+        GBeanData newGBeanData = (GBeanData) newDatas.iterator().next();
+        assertSame(gbeanData2, newGBeanData);
+        assertEquals(attributeValue, gbeanData.getAttribute(attributeInfo.getName()));
+    }
+
+    public void testSetAtrribute() throws Exception {
+        String attributeValue = "attribute value";
+        localAttributeManager.setValue(configurationName.toString(), gbeanName, attributeInfo, attributeValue);
+        Collection gbeanDatas = new ArrayList();
+        GBeanData gbeanData = new GBeanData(gbeanName, GBEAN_INFO);
+        gbeanDatas.add(gbeanData);
+        gbeanDatas = localAttributeManager.setAttributes(configurationName, gbeanDatas, getClass().getClassLoader());
+        assertEquals(attributeValue, gbeanData.getAttribute(attributeInfo.getName()));
+    }
+
+    public void testSetReference() throws Exception {
+        ObjectName referencePattern = new ObjectName(":name=referencePattern,*");
+        localAttributeManager.setReferencePattern(configurationName.toString(), gbeanName, referenceInfo, referencePattern);
+        Collection gbeanDatas = new ArrayList();
+        GBeanData gbeanData = new GBeanData(gbeanName, GBEAN_INFO);
+        gbeanDatas.add(gbeanData);
+        gbeanDatas = localAttributeManager.setAttributes(configurationName, gbeanDatas, getClass().getClassLoader());
+        assertEquals(Collections.singleton(referencePattern), gbeanData.getReferencePatterns(referenceInfo.getName()));
+    }
+
+    public void testSetReferences() throws Exception {
+        ObjectName referencePattern1 = new ObjectName(":name=referencePattern1,*");
+        ObjectName referencePattern2 = new ObjectName(":name=referencePattern2,*");
+        Set referencePatterns = new LinkedHashSet(Arrays.asList(new ObjectName[] {referencePattern1, referencePattern2}));
+        localAttributeManager.setReferencePatterns(configurationName.toString(), gbeanName, referenceInfo, referencePatterns);
+        Collection gbeanDatas = new ArrayList();
+        GBeanData gbeanData = new GBeanData(gbeanName, GBEAN_INFO);
+        gbeanDatas.add(gbeanData);
+        gbeanDatas = localAttributeManager.setAttributes(configurationName, gbeanDatas, getClass().getClassLoader());
+        assertEquals(referencePatterns, gbeanData.getReferencePatterns(referenceInfo.getName()));
+    }
+
+    public void testAddGBean() throws Exception {
+        String attributeValue = "attribute value";
+        ObjectName referencePattern = new ObjectName(":name=referencePattern,*");
+
+        GBeanData gbeanData = new GBeanData(gbeanName, GBEAN_INFO);
+        gbeanData.setAttribute(attributeInfo.getName(), attributeValue);
+        gbeanData.setReferencePattern(referenceInfo.getName(), referencePattern);
+        localAttributeManager.addConfiguration(configurationName.toString());
+        localAttributeManager.addGBean(configurationName.toString(), gbeanData);
+
+
+        Collection gbeanDatas = new ArrayList();
+        gbeanDatas = localAttributeManager.setAttributes(configurationName, gbeanDatas, getClass().getClassLoader());
+        assertEquals(1, gbeanDatas.size());
+        GBeanData newGBeanData = (GBeanData) gbeanDatas.iterator().next();
+
+        assertNotSame(gbeanData, newGBeanData);
+        assertSame(gbeanData.getGBeanInfo(), newGBeanData.getGBeanInfo());
+        assertSame(gbeanData.getName(), newGBeanData.getName());
+        assertEquals(Collections.singleton(referencePattern), newGBeanData.getReferencePatterns(referenceInfo.getName()));
+        assertEquals(attributeValue, newGBeanData.getAttribute(attributeInfo.getName()));
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        localAttributeManager = new LocalAttributeManager("target/test-config.xml", false, new BasicServerInfo(basedir));
+        configurationName = URI.create("configuration/name");
+        gbeanName = ObjectName.getInstance(":name=gbean");
+        attributeInfo = GBEAN_INFO.getAttribute("attribute");
+        referenceInfo = GBEAN_INFO.getReference("reference");
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        localAttributeManager = null;
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(LocalAttributeManagerTest.class);
+        infoFactory.addReference("reference", String.class);
+        infoFactory.addAttribute("attribute", String.class, true);
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+    public String getAttribute() {
+        throw new UnsupportedOperationException("Fake method for gbean info");
+    }
+
+    public void setAttribute(String attribute) {
+        throw new UnsupportedOperationException("Fake method for gbean info");
+    }
+
+    public void setReference(String reference) {
+        throw new UnsupportedOperationException("Fake method for gbean info");
+    }
+}

Propchange: geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/configuration/LocalAttributeManagerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/configuration/LocalAttributeManagerTest.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Id"

Modified: geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/configuration/ServerOverrideTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/configuration/ServerOverrideTest.java?rev=351546&r1=351545&r2=351546&view=diff
==============================================================================
--- geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/configuration/ServerOverrideTest.java (original)
+++ geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/configuration/ServerOverrideTest.java Thu Dec  1 17:03:52 2005
@@ -20,13 +20,18 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
+import javax.management.ObjectName;
 import javax.xml.parsers.DocumentBuilderFactory;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
 import java.io.PrintWriter;
-import java.io.ByteArrayOutputStream;
-import java.io.ByteArrayInputStream;
-import java.util.Map;
+import java.util.Arrays;
+import java.util.Collections;
 import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
 
 /**
  * @version $Rev$ $Date$
@@ -42,6 +47,15 @@
         pizza.setAttribute("cheese", "mozzarella");
         assertEquals("mozzarella", pizza.getAttribute("cheese"));
 
+        ObjectName pizzaOvenPattern = new ObjectName(":name=PizzaOven,j2eeType=oven,*");
+        pizza.setReferencePattern("oven", pizzaOvenPattern);
+        assertEquals(Collections.singleton(pizzaOvenPattern), pizza.getReferencePatterns("oven"));
+
+        ObjectName toasterOvenPattern = new ObjectName(":name=ToasterOven,j2eeType=oven,*");
+        Set ovenPatterns = new LinkedHashSet(Arrays.asList(new ObjectName[] {pizzaOvenPattern, toasterOvenPattern}));
+        pizza.setReferencePatterns("oven", ovenPatterns);
+        assertEquals(ovenPatterns, pizza.getReferencePatterns("oven"));
+
         ConfigurationOverride dinnerMenu = new ConfigurationOverride("Dinner Menu", true);
         assertTrue(dinnerMenu.isLoad());
 
@@ -68,6 +82,15 @@
 
         pizza.setAttribute("size", "x-large");
         assertCopyIdentical(pizza);
+
+        ObjectName pizzaOvenPattern = new ObjectName(":name=PizzaOven,j2eeType=oven,*");
+        pizza.setReferencePattern("oven", pizzaOvenPattern);
+        assertCopyIdentical(pizza);
+
+        ObjectName toasterOvenPattern = new ObjectName(":name=ToasterOven,j2eeType=oven,*");
+        Set ovenPatterns = new LinkedHashSet(Arrays.asList(new ObjectName[] {pizzaOvenPattern, toasterOvenPattern}));
+        pizza.setReferencePatterns("oven", ovenPatterns);
+        assertCopyIdentical(pizza);
     }
 
     public void testConfigurationXml() throws Exception {
@@ -80,10 +103,16 @@
         GBeanOverride pizza = new GBeanOverride("Pizza", false);
         pizza.setAttribute("cheese", "mozzarella");
         pizza.setAttribute("size", "x-large");
+        ObjectName pizzaOvenPattern = new ObjectName(":name=PizzaOven,j2eeType=oven,*");
+        ObjectName toasterOvenPattern = new ObjectName(":name=ToasterOven,j2eeType=oven,*");
+        pizza.setReferencePatterns("oven", new LinkedHashSet(Arrays.asList(new ObjectName[] {pizzaOvenPattern, toasterOvenPattern})));
+        assertCopyIdentical(dinnerMenu);
+
         dinnerMenu.addGBean(pizza);
         assertCopyIdentical(dinnerMenu);
 
         GBeanOverride garlicCheeseBread = new GBeanOverride("Garlic Cheese Bread", true);
+        garlicCheeseBread.setReferencePattern("oven", toasterOvenPattern);
         dinnerMenu.addGBean(garlicCheeseBread);
         assertCopyIdentical(dinnerMenu);
     }
@@ -93,18 +122,35 @@
         assertCopyIdentical(restaurant);
 
         ConfigurationOverride dinnerMenu = new ConfigurationOverride("Dinner Menu", false);
+        restaurant.addConfiguration(dinnerMenu);
         GBeanOverride pizza = new GBeanOverride("Pizza", false);
         pizza.setAttribute("cheese", "mozzarella");
         pizza.setAttribute("size", "x-large");
+        ObjectName pizzaOvenPattern = new ObjectName(":name=PizzaOven,j2eeType=oven,*");
+        ObjectName toasterOvenPattern = new ObjectName(":name=ToasterOven,j2eeType=oven,*");
+        pizza.setReferencePatterns("oven", new LinkedHashSet(Arrays.asList(new ObjectName[] {pizzaOvenPattern, toasterOvenPattern})));
         dinnerMenu.addGBean(pizza);
         GBeanOverride garlicCheeseBread = new GBeanOverride("Garlic Cheese Bread", true);
+        garlicCheeseBread.setReferencePattern("oven", toasterOvenPattern);
         dinnerMenu.addGBean(garlicCheeseBread);
         assertCopyIdentical(restaurant);
 
         ConfigurationOverride drinkMenu = new ConfigurationOverride("Drink Menu", false);
+        restaurant.addConfiguration(drinkMenu);
         GBeanOverride beer = new GBeanOverride("Beer", true);
+        pizza.setReferencePatterns("glass", new LinkedHashSet(Arrays.asList(new ObjectName[] {
+            new ObjectName(":name=PintGlass"),
+            new ObjectName(":name=BeerStein"),
+            new ObjectName(":name=BeerBottle"),
+            new ObjectName(":name=BeerCan")
+        })));
         drinkMenu.addGBean(beer);
         GBeanOverride wine = new GBeanOverride("Wine", true);
+        wine.setReferencePatterns("glass", new LinkedHashSet(Arrays.asList(new ObjectName[] {
+            new ObjectName(":name=WineGlass"),
+            new ObjectName(":name=WineBottle"),
+            new ObjectName(":name=BoxWine")
+        })));
         drinkMenu.addGBean(wine);
         assertCopyIdentical(restaurant);
     }
@@ -174,6 +220,8 @@
     private ServerOverride copy(ServerOverride server) throws Exception {
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         server.writeXml(new PrintWriter(out, true));
+        System.out.println();
+        System.out.println();
         System.out.println(new String(out.toByteArray()));
         ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
         Element element = parseXml(in);
@@ -184,6 +232,8 @@
     private ConfigurationOverride copy(ConfigurationOverride configuration) throws Exception {
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         configuration.writeXml(new PrintWriter(out, true));
+        System.out.println();
+        System.out.println();
         System.out.println(new String(out.toByteArray()));
         ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
         Element element = parseXml(in);
@@ -194,6 +244,9 @@
     private GBeanOverride copy(GBeanOverride gbean) throws Exception {
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         gbean.writeXml(new PrintWriter(out, true));
+        System.out.println();
+        System.out.println();
+        System.out.println(new String(out.toByteArray()));
         ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
         Element element = parseXml(in);
         GBeanOverride copy = new GBeanOverride(element);

Modified: geronimo/trunk/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenAttributeStore.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenAttributeStore.java?rev=351546&r1=351545&r2=351546&view=diff
==============================================================================
--- geronimo/trunk/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenAttributeStore.java (original)
+++ geronimo/trunk/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenAttributeStore.java Thu Dec  1 17:03:52 2005
@@ -19,12 +19,14 @@
 import java.io.IOException;
 import java.net.URI;
 import java.util.Collection;
+import java.util.Set;
 import javax.management.ObjectName;
 
 import org.apache.geronimo.gbean.GAttributeInfo;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GReferenceInfo;
 import org.apache.geronimo.kernel.config.ManageableAttributeStore;
 
 /**
@@ -34,11 +36,17 @@
     public MavenAttributeStore() {
     }
 
-    public Collection setAttributes(URI configurationName, Collection datas) {
+    public Collection setAttributes(URI configurationName, Collection datas, ClassLoader classLoader) {
         return datas;
     }
 
     public void setValue(String configurationName, ObjectName gbean, GAttributeInfo attribute, Object value) {
+    }
+
+    public void setReferencePattern(String configurationName, ObjectName gbean, GReferenceInfo reference, ObjectName pattern) {
+    }
+
+    public void setReferencePatterns(String configurationName, ObjectName gbean, GReferenceInfo reference, Set patterns) {
     }
 
     public void setShouldLoad(String configurationName, ObjectName gbean, boolean load) {



Mime
View raw message