You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by da...@apache.org on 2006/03/17 18:48:34 UTC

svn commit: r386675 - /geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanInfoBuilder.java

Author: dain
Date: Fri Mar 17 09:48:31 2006
New Revision: 386675

URL: http://svn.apache.org/viewcvs?rev=386675&view=rev
Log:
Constructor args are now automatically declared as persistent

Modified:
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanInfoBuilder.java

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanInfoBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanInfoBuilder.java?rev=386675&r1=386674&r2=386675&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanInfoBuilder.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanInfoBuilder.java Fri Mar 17 09:48:31 2006
@@ -29,6 +29,7 @@
 import java.util.Arrays;
 
 import org.apache.geronimo.kernel.ClassLoading;
+import org.apache.geronimo.kernel.Kernel;
 
 /**
  * @version $Rev$ $Date$
@@ -212,6 +213,10 @@
             String attributeName = persistentAttributes[i];
             GAttributeInfo attribute = (GAttributeInfo) attributes.get(attributeName);
             if (attribute != null) {
+                if (isMagicAttribute(attribute)) {
+                    // magic attributes can't be persistent
+                    continue;
+                }
                 attributes.put(attributeName,
                         new GAttributeInfo(attributeName,
                                 attribute.getType(),
@@ -239,6 +244,14 @@
         }
     }
 
+    private boolean isMagicAttribute(GAttributeInfo attributeInfo) {
+        String name = attributeInfo.getName();
+        String type = attributeInfo.getType();
+        return ("kernel".equals(name) && Kernel.class.getName().equals(type)) ||
+                ("classLoader".equals(name) && ClassLoader.class.getName().equals(type)) ||
+                ("objectName".equals(name) && String.class.getName().equals(type));
+    }
+
     public void addInterface(Class intf) {
         addInterface(intf, new String[0]);
     }
@@ -347,10 +360,13 @@
     public void setConstructor(GConstructorInfo constructor) {
         assert constructor != null;
         this.constructor = constructor;
+        List names = constructor.getAttributeNames();
+        setPersistentAttributes((String[]) names.toArray(new String[names.size()]));
     }
 
     public void setConstructor(String[] names) {
         constructor = new GConstructorInfo(names);
+        setPersistentAttributes(names);
     }
 
     public void addOperation(GOperationInfo operationInfo) {