geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdam...@apache.org
Subject svn commit: r645077 [2/3] - in /geronimo/server/trunk: assemblies/geronimo-boilerplate-minimal/ assemblies/geronimo-boilerplate-minimal/src/main/assembly/ framework/configs/j2ee-system/ framework/configs/jsr88-deploymentfactory/ framework/configs/onlin...
Date Sat, 05 Apr 2008 11:13:33 GMT
Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java?rev=645077&r1=645076&r2=645077&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java Sat Apr  5 04:13:30 2008
@@ -19,8 +19,6 @@
 
 import java.io.PrintWriter;
 import java.io.StringWriter;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
@@ -30,7 +28,6 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.Arrays;
 
 import javax.management.ObjectName;
 
@@ -53,10 +50,13 @@
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.NoSuchAttributeException;
 import org.apache.geronimo.kernel.NoSuchOperationException;
-import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.config.ManageableAttributeStore;
 import org.apache.geronimo.kernel.management.State;
 import org.apache.geronimo.kernel.management.StateManageable;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.xbean.recipe.ConstructionException;
+import org.apache.xbean.recipe.ObjectRecipe;
+import org.apache.xbean.recipe.Option;
 
 /**
  * A GBeanInstance is a J2EE Management Managed Object, and is standard base for Geronimo services.
@@ -98,9 +98,9 @@
     private final GBeanInstanceState gbeanInstanceState;
 
     /**
-     * The constructor used to create the instance
+     * The objectRecipe used to create the instance
      */
-    private final Constructor constructor;
+    private final ObjectRecipe objectRecipe;
 
     /**
      * A fast index based raw invoker for this GBean.
@@ -125,7 +125,7 @@
     /**
      * Attributes supported by this GBeanMBean by (String) name.
      */
-    private final Map attributeIndex = new HashMap();
+    private final Map<String, Integer> attributeIndex = new HashMap<String, Integer>();
 
     /**
      * References lookup table
@@ -135,7 +135,7 @@
     /**
      * References supported by this GBeanMBean by (String) name.
      */
-    private final Map referenceIndex = new HashMap();
+    private final Map<String, Integer> referenceIndex = new HashMap<String, Integer>();
 
     /**
      * Dependencies supported by this GBean.
@@ -150,7 +150,7 @@
     /**
      * Operations supported by this GBeanMBean by (GOperationSignature) name.
      */
-    private final Map operationIndex = new HashMap();
+    private final Map<GOperationSignature, Integer> operationIndex = new HashMap<GOperationSignature, Integer>();
 
     /**
      * The classloader used for all invocations and creating targets.
@@ -232,66 +232,37 @@
 
         name = gbeanInfo.getName();
 
-        //
-        Set constructorArgs = new HashSet(gbeanInfo.getConstructor().getAttributeNames());
-
         // interfaces
         interfaces = (String[]) gbeanInfo.getInterfaces().toArray(new String[0]);
 
         // attributes
-        Map attributesMap = new HashMap();
-        for (Iterator iterator = gbeanInfo.getAttributes().iterator(); iterator.hasNext();) {
-            GAttributeInfo attributeInfo = (GAttributeInfo) iterator.next();
-            attributesMap.put(attributeInfo.getName(), new GBeanAttribute(this, attributeInfo, constructorArgs.contains(attributeInfo.getName())));
-        }
-        addManagedObjectAttributes(attributesMap);
-        attributes = (GBeanAttribute[]) attributesMap.values().toArray(new GBeanAttribute[attributesMap.size()]);
+        attributes = buildAttributes(gbeanInfo);
         for (int i = 0; i < attributes.length; i++) {
             attributeIndex.put(attributes[i].getName(), new Integer(i));
         }
 
         // references
-        Set referencesSet = new HashSet();
-        Set dependencySet = new HashSet();
-        // add the references
-        Map dataReferences = gbeanData.getReferences();
-        for (Iterator iterator = gbeanInfo.getReferences().iterator(); iterator.hasNext();) {
-            GReferenceInfo referenceInfo = (GReferenceInfo) iterator.next();
-            String referenceName = referenceInfo.getName();
-            ReferencePatterns referencePatterns = (ReferencePatterns) dataReferences.remove(referenceName);
-            if (referenceInfo.getProxyType().equals(Collection.class.getName())) {
-                referencesSet.add(new GBeanCollectionReference(this, referenceInfo, kernel, referencePatterns));
+        Set<GBeanReference> referencesSet = new HashSet<GBeanReference>();
+        Set<GBeanDependency> dependencySet = new HashSet<GBeanDependency>();
+        buildReferencesAndDependencies(gbeanData, gbeanInfo, referencesSet, dependencySet);
 
-            } else {
-                referencesSet.add(new GBeanSingleReference(this, referenceInfo, kernel, referencePatterns));
-                if (referencePatterns != null) {
-                    dependencySet.add(new GBeanDependency(this, referencePatterns.getAbstractName(), kernel));
-                }
-            }
-        }
-        if (!dataReferences.isEmpty()) {
-            throw new IllegalStateException("Attempting to set unknown references: " + dataReferences.keySet());
-        }
-
-        references = (GBeanReference[]) referencesSet.toArray(new GBeanReference[referencesSet.size()]);
+        references = referencesSet.toArray(new GBeanReference[referencesSet.size()]);
         for (int i = 0; i < references.length; i++) {
             referenceIndex.put(references[i].getName(), new Integer(i));
         }
 
         //dependencies
-        for (Iterator iterator = gbeanData.getDependencies().iterator(); iterator.hasNext();) {
-            AbstractName dependencyName = ((ReferencePatterns) iterator.next()).getAbstractName();
+        for (ReferencePatterns referencePatterns : gbeanData.getDependencies()) {
+            AbstractName dependencyName = referencePatterns.getAbstractName();
             dependencySet.add(new GBeanDependency(this, dependencyName, kernel));
         }
-
-        dependencies = (GBeanDependency[]) dependencySet.toArray(new GBeanDependency[dependencySet.size()]);
+        dependencies = dependencySet.toArray(new GBeanDependency[dependencySet.size()]);
 
         // framework operations -- all framework operations have currently been removed
 
         // operations
-        Map operationsMap = new HashMap();
-        for (Iterator iterator = gbeanInfo.getOperations().iterator(); iterator.hasNext();) {
-            GOperationInfo operationInfo = (GOperationInfo) iterator.next();
+        Map<GOperationSignature, GBeanOperation> operationsMap = new HashMap<GOperationSignature, GBeanOperation>();
+        for (GOperationInfo operationInfo : gbeanInfo.getOperations()) {
             GOperationSignature signature = new GOperationSignature(operationInfo.getName(), operationInfo.getParameterList());
             // do not allow overriding of framework operations
             if (!operationsMap.containsKey(signature)) {
@@ -301,82 +272,21 @@
         }
         operations = new GBeanOperation[operationsMap.size()];
         int opCounter = 0;
-        for (Iterator iterator = operationsMap.entrySet().iterator(); iterator.hasNext();) {
-            Map.Entry entry = (Map.Entry) iterator.next();
-            operations[opCounter] = (GBeanOperation) entry.getValue();
+        for (Map.Entry<GOperationSignature, GBeanOperation> entry : operationsMap.entrySet()) {
+            operations[opCounter] = entry.getValue();
             operationIndex.put(entry.getKey(), new Integer(opCounter));
             opCounter++;
         }
-
-        // get the constructor
-        List arguments = gbeanInfo.getConstructor().getAttributeNames();
-        Class[] parameterTypes = new Class[arguments.size()];
-        for (int i = 0; i < parameterTypes.length; i++) {
-            String argumentName = (String) arguments.get(i);
-            if (referenceIndex.containsKey(argumentName)) {
-                Integer index = (Integer) referenceIndex.get(argumentName);
-                GBeanReference reference = references[index.intValue()];
-                parameterTypes[i] = reference.getProxyType();
-            } else if (attributeIndex.containsKey(argumentName)) {
-                Integer index = (Integer) attributeIndex.get(argumentName);
-                GBeanAttribute attribute = attributes[index.intValue()];
-                parameterTypes[i] = attribute.getType();
-            } 
-        }
-        try {
-            constructor = type.getConstructor(parameterTypes);
-        } catch (NoSuchMethodException e) {
-            StringBuffer buf = new StringBuffer("Could not find a valid constructor for GBean: ").append(gbeanInfo.getName()).append("\n");
-            buf.append("ParameterTypes: ").append(Arrays.asList(parameterTypes)).append("\n");
-            Constructor[] constructors = type.getConstructors();
-            for (int i = 0; i < constructors.length; i++) {
-                Constructor testConstructor = constructors[i];
-                buf.append("constructor types: ").append(Arrays.asList(testConstructor.getParameterTypes())).append("\n");
-                if (testConstructor.getParameterTypes().length == parameterTypes.length) {
-                    Class[] testParameterTypes = testConstructor.getParameterTypes();
-                    for (int k = 0; k < testParameterTypes.length; k++) {
-                        Class testParameterType = testParameterTypes[k];
-                        if (parameterTypes[k].getName().equals(testParameterType.getName())) {
-                            if (parameterTypes[k].getClassLoader() != testParameterType.getClassLoader()) {
-                                buf.append("different classloaders in position: ").append(k).append(" class name: ").append(testParameterType.getName()).append("\n");
-                                buf.append("parameter type classloader: ").append(parameterTypes[k].getClassLoader()).append("\n");
-                                buf.append("constructor type classloader: ").append(testParameterType.getClassLoader()).append("\n");
-                            }
-                        } else {
-                            buf.append("different type in position: ").append(k).append("\n");
-                        }
-                    }
-                }
-            }
-            throw new InvalidConfigurationException(buf.toString());
-        } catch (NoClassDefFoundError e) {
-            throw new InvalidConfigurationException(e);
-        }
-
+        
         // rebuild the gbean info based on the current attributes, operations, and references because
         // the above code add new attributes and operations
         this.gbeanInfo = rebuildGBeanInfo(gbeanInfo.getConstructor(), gbeanInfo.getJ2eeType());
 
+        objectRecipe = newObjectRecipe(gbeanData);
+
         // create the raw invokers
         rawInvoker = new RawInvoker(this);
 
-        // set the initial attribute values
-        try {
-            // set the attributes
-            Map dataAttributes = gbeanData.getAttributes();
-            for (Iterator iterator = dataAttributes.entrySet().iterator(); iterator.hasNext();) {
-                Map.Entry entry = (Map.Entry) iterator.next();
-                String attributeName = (String) entry.getKey();
-                Object attributeValue = entry.getValue();
-                    if (entry.getValue() != null) {
-                        setAttribute(attributeName, attributeValue, false);
-                    }
-            }
-
-        } catch (Exception e) {
-            throw new InvalidConfigurationException("Could not inject configuration data into the GBean " + abstractName, e);
-        }
-
         //Add the reference to all applicable reference collections before possibly starting the gbean having an
         //explicit reference to the reference.
         for (int i = 0; i < references.length; i++) {
@@ -387,6 +297,78 @@
         }
     }
 
+    protected ObjectRecipe newObjectRecipe(GBeanData gbeanData) {
+        GBeanInfo beanInfo = gbeanData.getGBeanInfo();
+        List<String> cstrNames = beanInfo.getConstructor().getAttributeNames();
+        Class[] cstrTypes = new Class[cstrNames.size()];
+        for (int i = 0; i < cstrTypes.length; i++) {
+            String argumentName = (String) cstrNames.get(i);
+            if (referenceIndex.containsKey(argumentName)) {
+                Integer index = (Integer) referenceIndex.get(argumentName);
+                GBeanReference reference = references[index.intValue()];
+                cstrTypes[i] = reference.getProxyType();
+            } else if (attributeIndex.containsKey(argumentName)) {
+                Integer index = (Integer) attributeIndex.get(argumentName);
+                GBeanAttribute attribute = attributes[index.intValue()];
+                cstrTypes[i] = attribute.getType();
+            }
+        }
+        ObjectRecipe objectRecipe = new ObjectRecipe(type, cstrNames.toArray(new String[0]), cstrTypes);
+
+        // set the initial attribute values
+        Map<String, Object> dataAttributes = gbeanData.getAttributes();
+        for (GAttributeInfo attributeInfo : beanInfo.getAttributes()) {
+            Integer integer = attributeIndex.get(attributeInfo.getName());
+            GBeanAttribute attribute = attributes[integer];
+            String attributeName = attribute.getName();
+            if (attribute.isPersistent() || attribute.isDynamic()) {
+                Object attributeValue = dataAttributes.get(attributeName);
+                if (null != attributeValue) {
+                    attribute.setPersistentValue(attributeValue);
+                }
+                if (attribute.isPersistent() && null != attributeValue && !attribute.isDynamic()) {
+                    objectRecipe.setProperty(attributeName, attribute.getPersistentValue());
+                }
+            } else if (attribute.isSpecial() && (attribute.isWritable() || cstrNames.contains(attributeName))) {
+                objectRecipe.setProperty(attributeName, attribute.getPersistentValue());
+            }
+        }
+        
+        return objectRecipe;
+    }
+
+    protected void buildReferencesAndDependencies(GBeanData gbeanData,
+        GBeanInfo gbeanInfo,
+        Set<GBeanReference> referencesSet,
+        Set<GBeanDependency> dependencySet) {
+        Map<String, ReferencePatterns> dataReferences = gbeanData.getReferences();
+        for (GReferenceInfo referenceInfo : gbeanInfo.getReferences()) {
+            String referenceName = referenceInfo.getName();
+            ReferencePatterns referencePatterns = dataReferences.remove(referenceName);
+            if (referenceInfo.getProxyType().equals(Collection.class.getName())) {
+                referencesSet.add(new GBeanCollectionReference(this, referenceInfo, kernel, referencePatterns));
+            } else {
+                referencesSet.add(new GBeanSingleReference(this, referenceInfo, kernel, referencePatterns));
+                if (referencePatterns != null) {
+                    dependencySet.add(new GBeanDependency(this, referencePatterns.getAbstractName(), kernel));
+                }
+            }
+        }
+        if (!dataReferences.isEmpty()) {
+            throw new IllegalStateException("Attempting to set unknown references: " + dataReferences.keySet());
+        }
+    }
+
+    protected GBeanAttribute[] buildAttributes(GBeanInfo gbeanInfo) {
+        Map<String, GBeanAttribute> attributesMap = new HashMap<String, GBeanAttribute>();
+        for (GAttributeInfo attributeInfo : gbeanInfo.getAttributes()) {
+            attributesMap.put(attributeInfo.getName(), new GBeanAttribute(this, attributeInfo));
+        }
+        addManagedObjectAttributes(attributesMap);
+        
+        return attributesMap.values().toArray(new GBeanAttribute[attributesMap.size()]);
+    }
+
     public void die() throws GBeanNotFoundException {
         synchronized (this) {
             if (dead) {
@@ -867,14 +849,6 @@
         return operation.invoke(instance, arguments);
     }
 
-    private GBeanReference getReferenceByName(String name) {
-        Integer index = (Integer) referenceIndex.get(name);
-        if (index == null) {
-            throw new IllegalArgumentException("Unknown reference " + name);
-        }
-        return references[index.intValue()];
-    }
-
     boolean createInstance() throws Exception {
         synchronized (this) {
             // first check we are still in the correct state to start
@@ -920,34 +894,21 @@
             startTime = System.currentTimeMillis();
         }
 
+        for (GBeanReference reference : references) {
+            Object value = reference.getProxy();
+            if (null != value) {
+                objectRecipe.setProperty(reference.getName(), value);
+            }
+        }
+
         ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
         Thread.currentThread().setContextClassLoader(classLoader);
         Object instance = null;
         try {
-            GConstructorInfo constructorInfo = gbeanInfo.getConstructor();
-            Class[] parameterTypes = constructor.getParameterTypes();
-
-            // create constructor parameter array
-            Object[] parameters = new Object[parameterTypes.length];
-            Iterator names = constructorInfo.getAttributeNames().iterator();
-            for (int i = 0; i < parameters.length; i++) {
-                String name = (String) names.next();
-                if (referenceIndex.containsKey(name)) {
-                    parameters[i] = getReferenceByName(name).getProxy();
-                } else if (attributeIndex.containsKey(name)) {
-                    GBeanAttribute attribute = getAttributeByName(name);
-                    parameters[i] = attribute.getPersistentValue();
-                } else {
-                    stateReason = "the service constructor definition contained the name '" + name + "' which is not a known attribute or reference of the service.";
-                    throw new InvalidConfigurationException("Unknown attribute or reference name in constructor: referenceName=" + name + ", gbean=" + abstractName);
-                }
-            }
-
-            // create instance
             try {
-                instance = constructor.newInstance(parameters);
-            } catch (InvocationTargetException e) {
-                Throwable targetException = e.getTargetException();
+                instance = objectRecipe.create(classLoader);
+            } catch (ConstructionException e) {
+                Throwable targetException = e.getCause();
                 if (targetException instanceof Exception) {
                     stateReason = "the service constructor threw an exception. \n" + printException(targetException);
                     throw (Exception) targetException;
@@ -957,12 +918,8 @@
                 }
                 stateReason = "the service constructor threw an exception. \n" + printException(e);
                 throw e;
-            } catch (IllegalArgumentException e) {
-                stateReason = "the service constructor threw an exception due to a parameter type mismatch. \n" + printException(e);
-                log.warn("Constructor mismatch for " + abstractName, e);
-                throw e;
             }
-
+            
             // write the target variable in a synchronized block so it is available to all threads
             // we do this before calling the setters or start method so the bean can be called back
             // from a setter start method
@@ -971,27 +928,19 @@
             }
 
             // inject the persistent attribute value into the new instance
-            for (int i = 0; i < attributes.length; i++) {
+            for (GBeanAttribute attribute : attributes) {
                 checkIfShouldFail();
-                try {
-                    attributes[i].inject(instance);
-                } catch (Exception e) {
-                    stateReason = "the setter for attribute '" + attributes[i].getName() + "' threw an exception. \n" + printException(e);
-                    throw e;
+                if (!attribute.isDynamic()) {
+                    continue;
                 }
-            }
-
-            // inject the proxies into the new instance
-            for (int i = 0; i < references.length; i++) {
-                checkIfShouldFail();
                 try {
-                    references[i].inject(instance);
+                    attribute.inject(target);
                 } catch (Exception e) {
-                    stateReason = "the setter for reference '" + references[i].getName() + "' threw an exception. \n" + printException(e);
+                    stateReason = "the setter for attribute '" + attribute.getName() + "' threw an exception. \n" + printException(e);
                     throw e;
                 }
             }
-
+            
             if (instance instanceof GBeanLifecycle) {
                 checkIfShouldFail();
                 try {
@@ -1198,7 +1147,7 @@
         return true;
     }
 
-    private void addManagedObjectAttributes(Map attributesMap) {
+    private void addManagedObjectAttributes(Map<String, GBeanAttribute> attributesMap) {
         //
         //  Special attributes
         //
@@ -1233,22 +1182,22 @@
     }
 
     private GBeanInfo rebuildGBeanInfo(GConstructorInfo constructor, String j2eeType) {
-        Set attributeInfos = new HashSet();
+        Set<GAttributeInfo> attributeInfos = new HashSet<GAttributeInfo>();
         for (int i = 0; i < attributes.length; i++) {
             GBeanAttribute attribute = attributes[i];
             attributeInfos.add(attribute.getAttributeInfo());
         }
-        Set operationInfos = new HashSet();
+        Set<GOperationInfo> operationInfos = new HashSet<GOperationInfo>();
         for (int i = 0; i < operations.length; i++) {
             operationInfos.add(operations[i].getOperationInfo());
         }
 
-        Set referenceInfos = new HashSet();
+        Set<GReferenceInfo> referenceInfos = new HashSet<GReferenceInfo>();
         for (int i = 0; i < references.length; i++) {
             referenceInfos.add(references[i].getReferenceInfo());
         }
 
-        Set interfaceInfos = new HashSet();
+        Set<String> interfaceInfos = new HashSet<String>();
         for (int i = 0; i < interfaces.length; i++) {
             interfaceInfos.add(interfaces[i]);
         }

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanReference.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanReference.java?rev=645077&r1=645076&r2=645077&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanReference.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanReference.java Sat Apr  5 04:13:30 2008
@@ -39,6 +39,4 @@
     void stop();
 
     Object getProxy();
-
-    void inject(Object target) throws Exception;
 }

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/xstream/GBeanDataConverter.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/xstream/GBeanDataConverter.java?rev=645077&r1=645076&r2=645077&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/xstream/GBeanDataConverter.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/xstream/GBeanDataConverter.java Sat Apr  5 04:13:30 2008
@@ -33,6 +33,8 @@
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoFactory;
+import org.apache.geronimo.gbean.MultiGBeanInfoFactory;
 import org.apache.geronimo.gbean.ReferencePatterns;
 
 /**
@@ -40,9 +42,16 @@
  */
 public class GBeanDataConverter implements Converter {
     private final Mapper mapper;
+    private final GBeanInfoFactory infoFactory;
 
     public GBeanDataConverter(Mapper mapper) {
         this.mapper = mapper;
+        
+        infoFactory = newGBeanInfoFactory();
+    }
+
+    protected GBeanInfoFactory newGBeanInfoFactory() {
+        return new MultiGBeanInfoFactory();
     }
 
     public boolean canConvert(Class clazz) {
@@ -125,7 +134,7 @@
         GBeanInfo gbeanInfo = null;
         String sourceClass = reader.getAttribute("sourceClass");
         if (sourceClass != null) {
-            gbeanInfo = GBeanInfo.getGBeanInfo(sourceClass, classLoader);
+            gbeanInfo = infoFactory.getGBeanInfo(sourceClass, classLoader);
         }
 
         Set dependencies = new LinkedHashSet();

Added: geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/gbean/annotation/AnnotationGBeanInfoBuilderTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/gbean/annotation/AnnotationGBeanInfoBuilderTest.java?rev=645077&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/gbean/annotation/AnnotationGBeanInfoBuilderTest.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/gbean/annotation/AnnotationGBeanInfoBuilderTest.java Sat Apr  5 04:13:30 2008
@@ -0,0 +1,186 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.gbean.annotation;
+
+import java.util.Collection;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.geronimo.gbean.GAttributeInfo;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GConstructorInfo;
+import org.apache.geronimo.gbean.GReferenceInfo;
+import org.apache.geronimo.gbean.annotation.AnnotationGBeanInfoBuilder;
+import org.apache.geronimo.gbean.annotation.GBeanAnnotationException;
+
+
+
+/**
+ *
+ * @version $Rev:$ $Date:$
+ */
+public class AnnotationGBeanInfoBuilderTest extends TestCase {
+
+    public void testSmoke() throws Exception {
+        AnnotationGBeanInfoBuilder builder = new AnnotationGBeanInfoBuilder(SmokeGBean.class);
+        GBeanInfo beanInfo = builder.buildGBeanInfo();
+        
+        assertEquals(SmokeGBean.class.getSimpleName(), beanInfo.getName());
+        assertEquals("GBean", beanInfo.getJ2eeType());
+        
+        assertEquals(123, beanInfo.getPriority());
+
+        GConstructorInfo constructor = beanInfo.getConstructor();
+        List<String> cstrNames = constructor.getAttributeNames();
+        assertEquals(4, cstrNames.size());
+        assertEquals("classLoader", cstrNames.get(0));
+        assertEquals("name", cstrNames.get(1));
+        assertEquals("Name", cstrNames.get(2));
+        assertEquals("Collection", cstrNames.get(3));
+        
+        GAttributeInfo nameAttribute = beanInfo.getAttribute("name");
+        assertNotNull(nameAttribute);
+        assertEquals(String.class.getName(), nameAttribute.getType());
+
+        GReferenceInfo nameReference = beanInfo.getReference("Name");
+        assertNotNull(nameReference);
+        assertEquals(Runnable.class.getName(), nameReference.getProxyType());
+        
+        GReferenceInfo collectionReference = beanInfo.getReference("Collection");
+        assertNotNull(collectionReference);
+        assertEquals(Collection.class.getName(), collectionReference.getProxyType());
+        assertEquals(Runnable.class.getName(), collectionReference.getReferenceType());
+        
+        GAttributeInfo setterAttribute = beanInfo.getAttribute("setterAttribute");
+        assertNotNull(setterAttribute);
+        assertEquals(String.class.getName(), setterAttribute.getType());
+        assertEquals(true, setterAttribute.isPersistent());
+        assertEquals(true, setterAttribute.isManageable());
+
+        GAttributeInfo setterNotManageableAttribute = beanInfo.getAttribute("setterNotManageableAttribute");
+        assertNotNull(setterNotManageableAttribute);
+        assertEquals(String.class.getName(), setterNotManageableAttribute.getType());
+        assertEquals(true, setterNotManageableAttribute.isPersistent());
+        assertEquals(false, setterNotManageableAttribute.isManageable());
+        
+        GReferenceInfo setterReference = beanInfo.getReference("SetterReference");
+        assertNotNull(setterReference);
+        assertEquals(Runnable.class.getName(), setterReference.getProxyType());
+
+        GReferenceInfo setterCollectionReference = beanInfo.getReference("SetterCollectionReference");
+        assertNotNull(setterCollectionReference);
+        assertEquals(Collection.class.getName(), setterCollectionReference.getProxyType());
+        assertEquals(Runnable.class.getName(), setterCollectionReference.getReferenceType());
+    }
+    
+    public void testDefaultConstructorGBean() throws Exception {
+        AnnotationGBeanInfoBuilder builder = new AnnotationGBeanInfoBuilder(DefaultConstructorGBean.class);
+        GBeanInfo beanInfo = builder.buildGBeanInfo();
+        
+        assertTrue(beanInfo.getConstructor().getAttributeNames().isEmpty());
+    }
+
+    public void testMissingDefaultConstructorThrowsGBAE() throws Exception {
+        executeThrowGBAETest(MissingDefaultConstructorGBean.class);
+    }
+    
+    public void testMissingConstructorAnnotationThrowsGBAE() throws Exception {
+        executeThrowGBAETest(MissingConstructorAnnotationGBean.class);
+    }
+    
+    public void testPersistentOnNonSetterThrowsGBAE() throws Exception {
+        executeThrowGBAETest(PersistentOnNonSetterGBean.class);
+    }
+    
+    public void testReferenceOnNonSetterThrowsGBAE() throws Exception {
+        executeThrowGBAETest(ReferenceOnNonSetterGBean.class);
+    }
+    
+    public void testCollectionIsNotGenerifiedThrowsGBAE() throws Exception {
+        executeThrowGBAETest(CollectionNotGenerifiedGBean.class);
+    }
+
+    private void executeThrowGBAETest(Class gbeanClass) {
+        try {
+            AnnotationGBeanInfoBuilder builder = new AnnotationGBeanInfoBuilder(gbeanClass);
+            builder.buildGBeanInfo();
+            fail();
+        } catch (GBeanAnnotationException e) {
+        }
+    }
+
+    @Priority(priority=123)
+    public static class SmokeGBean {
+        public SmokeGBean(@ParamSpecial(type = SpecialAttributeType.classLoader) ClassLoader classLoader,
+            @ParamAttribute(name = "name") String name,
+            @ParamReference(name = "Name") Runnable runnable,
+            @ParamReference(name = "Collection") Collection<Runnable> runnables) {
+        }
+        
+        @Persistent
+        public void setSetterAttribute(String value) {
+        }
+        
+        @Persistent(manageable=false)
+        public void setSetterNotManageableAttribute(String value) {
+        }
+        
+        @Reference
+        public void setSetterReference(Runnable value) {
+        }
+
+        @Reference
+        public void setSetterCollectionReference(Collection<Runnable> value) {
+        }
+    }
+
+    public static class DefaultConstructorGBean {
+    }
+
+    public static class MissingDefaultConstructorGBean {
+        public MissingDefaultConstructorGBean(String name) {
+        }
+    }
+    
+    public static class MissingConstructorAnnotationGBean {
+        public MissingConstructorAnnotationGBean(@ParamAttribute(name = "name") String name,
+            Runnable runnable) {
+        }
+    }
+    
+    public static class PersistentOnNonSetterGBean {
+        @Persistent
+        public void run() {
+        }
+    }
+
+    public static class ReferenceOnNonSetterGBean {
+        @Reference
+        public void run() {
+        }
+    }
+ 
+    public static class CollectionNotGenerifiedGBean {
+        public CollectionNotGenerifiedGBean(@ParamReference(name = "Collection") Collection runnables) {
+        }
+    }
+    
+}

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/gbean/runtime/GBeanAttributeTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/gbean/runtime/GBeanAttributeTest.java?rev=645077&r1=645076&r2=645077&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/gbean/runtime/GBeanAttributeTest.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/gbean/runtime/GBeanAttributeTest.java Sat Apr  5 04:13:30 2008
@@ -78,7 +78,7 @@
 
     public final void testGBeanAttributeInfoClass() {
         try {
-            new GBeanAttribute(null, null, false);
+            new GBeanAttribute(null, null);
             fail("IllegalArgumentException expected");
         } catch (IllegalArgumentException expected) {
         }
@@ -87,30 +87,22 @@
         // GBeanAttribute ctor doesn't check if readable/writable are
         // null's
         try {
-            new GBeanAttribute(gbeanInstance, attributeInfo, false);
+            new GBeanAttribute(gbeanInstance, attributeInfo);
             // till Dain sorts out the question of ctor
             // fail("InvalidConfigurationException expected");
         } catch (InvalidConfigurationException expected) {
         }
 
-        try {
-            GAttributeInfo invalidAttributeInfo = new GAttributeInfo(attributeName, String.class.getName(), false, false, null, null);
-
-            new GBeanAttribute(gbeanInstance, invalidAttributeInfo, false);
-            fail("InvalidConfigurationException expected");
-        } catch (InvalidConfigurationException expected) {
-        }
-
         {
             final GAttributeInfo attributeInfo = new GAttributeInfo(attributeName, String.class.getName(), false, false, true, false, null, null);
-            GBeanAttribute attribute = new GBeanAttribute(gbeanInstance, attributeInfo, false);
+            GBeanAttribute attribute = new GBeanAttribute(gbeanInstance, attributeInfo);
             assertTrue(attribute.isReadable());
             assertFalse(attribute.isWritable());
         }
 
         {
             final GAttributeInfo attributeInfo = new GAttributeInfo(persistentPrimitiveAttributeName, int.class.getName(), false, false, false, true, null, null);
-            GBeanAttribute attribute = new GBeanAttribute(gbeanInstance, attributeInfo, false);
+            GBeanAttribute attribute = new GBeanAttribute(gbeanInstance, attributeInfo);
             assertFalse(attribute.isReadable());
             assertTrue(attribute.isWritable());
         }
@@ -120,14 +112,14 @@
             // exist.
             // getYetAnotherFinalInt doesn't exist
             final GAttributeInfo attributeInfo = new GAttributeInfo("YetAnotherFinalInt", int.class.getName(), true, false, "getFinalInt", null);
-            GBeanAttribute attribute = new GBeanAttribute(gbeanInstance, attributeInfo, false);
+            GBeanAttribute attribute = new GBeanAttribute(gbeanInstance, attributeInfo);
             assertNotNull(attribute);
         }
 
         {
             final GAttributeInfo attributeInfo = new GAttributeInfo("YetAnotherFinalInt", int.class.getName(), true, false, null, "setCharAsYetAnotherFinalInt");
             try {
-                new GBeanAttribute(gbeanInstance, attributeInfo, false);
+                new GBeanAttribute(gbeanInstance, attributeInfo);
                 fail("Expected InvalidConfigurationException due to invalid setter parameter type");
             } catch (InvalidConfigurationException expected) {
             }
@@ -136,7 +128,7 @@
         {
             final GAttributeInfo attributeInfo = new GAttributeInfo("YetAnotherFinalInt", int.class.getName(), true, false, null, "setBooleanAsYetAnotherFinalInt");
             try {
-                new GBeanAttribute(gbeanInstance, attributeInfo, false);
+                new GBeanAttribute(gbeanInstance, attributeInfo);
                 fail("Expected InvalidConfigurationException due to invalid setter parameter type");
             } catch (InvalidConfigurationException expected) {
             }
@@ -145,7 +137,7 @@
         {
             final GAttributeInfo attributeInfo = new GAttributeInfo("YetAnotherFinalInt", int.class.getName(), true, false, null, "setByteAsYetAnotherFinalInt");
             try {
-                new GBeanAttribute(gbeanInstance, attributeInfo, false);
+                new GBeanAttribute(gbeanInstance, attributeInfo);
                 fail("Expected InvalidConfigurationException due to invalid setter parameter type");
             } catch (InvalidConfigurationException expected) {
             }
@@ -154,7 +146,7 @@
         {
             final GAttributeInfo attributeInfo = new GAttributeInfo("YetAnotherFinalInt", int.class.getName(), true, false, null, "setShortAsYetAnotherFinalInt");
             try {
-                new GBeanAttribute(gbeanInstance, attributeInfo, false);
+                new GBeanAttribute(gbeanInstance, attributeInfo);
                 fail("Expected InvalidConfigurationException due to invalid setter parameter type");
             } catch (InvalidConfigurationException expected) {
             }
@@ -163,7 +155,7 @@
         {
             final GAttributeInfo attributeInfo = new GAttributeInfo("YetAnotherFinalInt", int.class.getName(), true, false, null, "setLongAsYetAnotherFinalInt");
             try {
-                new GBeanAttribute(gbeanInstance, attributeInfo, false);
+                new GBeanAttribute(gbeanInstance, attributeInfo);
                 fail("Expected InvalidConfigurationException due to invalid setter parameter type");
             } catch (InvalidConfigurationException expected) {
             }
@@ -172,7 +164,7 @@
         {
             final GAttributeInfo attributeInfo = new GAttributeInfo("YetAnotherFinalInt", int.class.getName(), true, false, null, "setFloatAsYetAnotherFinalInt");
             try {
-                new GBeanAttribute(gbeanInstance, attributeInfo, false);
+                new GBeanAttribute(gbeanInstance, attributeInfo);
                 fail("Expected InvalidConfigurationException due to invalid setter parameter type");
             } catch (InvalidConfigurationException expected) {
             }
@@ -181,7 +173,7 @@
         {
             final GAttributeInfo attributeInfo = new GAttributeInfo("YetAnotherFinalInt", int.class.getName(), true, false, null, "setDoubleAsYetAnotherFinalInt");
             try {
-                new GBeanAttribute(gbeanInstance, attributeInfo, false);
+                new GBeanAttribute(gbeanInstance, attributeInfo);
                 fail("Expected InvalidConfigurationException due to invalid setter parameter type");
             } catch (InvalidConfigurationException expected) {
             }
@@ -190,7 +182,7 @@
         {
             final GAttributeInfo attributeInfo = new GAttributeInfo("YetAnotherFinalInt", int.class.getName(), true, false, "getVoidGetterOfFinalInt", null);
             try {
-                new GBeanAttribute(gbeanInstance, attributeInfo, false);
+                new GBeanAttribute(gbeanInstance, attributeInfo);
                 fail("Getter method not found on target; InvalidConfigurationException expected");
             } catch (InvalidConfigurationException expected) {
             }
@@ -199,7 +191,7 @@
         {
             final GAttributeInfo attributeInfo = new GAttributeInfo("YetAnotherFinalInt", int.class.getName(), true, false, null, "setThatDoesntExist");
             try {
-                new GBeanAttribute(gbeanInstance, attributeInfo, false);
+                new GBeanAttribute(gbeanInstance, attributeInfo);
                 fail("Setter method not found on target; InvalidConfigurationException expected");
             } catch (InvalidConfigurationException expected) {
             }
@@ -247,7 +239,7 @@
         // 2. (offline) attribute that is of primitive type, writable and
         // persistent, but not readable
         {
-            final GBeanAttribute persistentAttribute = new GBeanAttribute(gbeanInstance, persistentPrimitiveAttributeInfo, false);
+            final GBeanAttribute persistentAttribute = new GBeanAttribute(gbeanInstance, persistentPrimitiveAttributeInfo);
             try {
                 persistentAttribute.setValue(gbeanInstance, null);
                 fail("Cannot assign null to a primitive attribute; exception expected");
@@ -272,7 +264,7 @@
 
         // 4. (online) attribute that is mutable and of primitive type
         {
-            final GBeanAttribute mutablePersistentAttribute = new GBeanAttribute(gbeanInstance, persistentPrimitiveAttributeInfo, false);
+            final GBeanAttribute mutablePersistentAttribute = new GBeanAttribute(gbeanInstance, persistentPrimitiveAttributeInfo);
 
             try {
                 gbeanInstance.start();
@@ -288,7 +280,7 @@
         // 4a. @todo BUG: It's possible to set a value to a persistent
         // attribute while online; IllegalStateException expected
         {
-            final GBeanAttribute mutablePersistentAttribute = new GBeanAttribute(gbeanInstance, persistentPrimitiveAttributeInfo, false);
+            final GBeanAttribute mutablePersistentAttribute = new GBeanAttribute(gbeanInstance, persistentPrimitiveAttributeInfo);
 
             try {
                 gbeanInstance.start();

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/ConfigTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/ConfigTest.java?rev=645077&r1=645076&r2=645077&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/ConfigTest.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/ConfigTest.java Sat Apr  5 04:13:30 2008
@@ -40,7 +40,6 @@
     private AbstractName gbeanName2;
     private ConfigurationData configurationData;
     private EditableConfigurationManager configurationManager;
-//    private final String BASE_NAME = "test:J2EEServer=geronimo";
 
     public void testConfigLifecycle() throws Exception {
         Artifact configurationId = configurationData.getId();

Modified: geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/GBeanBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/GBeanBuilder.java?rev=645077&r1=645076&r2=645077&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/GBeanBuilder.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/GBeanBuilder.java Sat Apr  5 04:13:30 2008
@@ -40,6 +40,8 @@
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GBeanInfoFactory;
+import org.apache.geronimo.gbean.MultiGBeanInfoFactory;
 import org.apache.geronimo.gbean.ReferenceMap;
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
 import org.apache.geronimo.kernel.repository.Environment;
@@ -53,6 +55,7 @@
 public class GBeanBuilder implements NamespaceDrivenBuilder {
     protected Map attrRefMap;
     protected Map refRefMap;
+    private final GBeanInfoFactory infoFactory;
     public static final QName SERVICE_QNAME = ServiceDocument.type.getDocumentElementName();
     private static final QName GBEAN_QNAME = GbeanDocument.type.getDocumentElementName();
     private static final QNameSet GBEAN_QNAME_SET = QNameSet.singleton(GBEAN_QNAME);
@@ -81,6 +84,12 @@
         }
         EnvironmentBuilder environmentBuilder = new EnvironmentBuilder();
         attrRefMap.put(environmentBuilder.getNamespace(), environmentBuilder);
+        
+        infoFactory = newGBeanInfoFactory();
+    }
+
+    protected GBeanInfoFactory newGBeanInfoFactory() {
+        return new MultiGBeanInfoFactory();
     }
 
     public void buildEnvironment(XmlObject container, Environment environment) throws DeploymentException {
@@ -100,7 +109,7 @@
     }
 
     private AbstractName addGBeanData(GbeanType gbean, AbstractName moduleName, ClassLoader cl, DeploymentContext context) throws DeploymentException {
-        GBeanInfo gBeanInfo = GBeanInfo.getGBeanInfo(gbean.getClass1(), cl);
+        GBeanInfo gBeanInfo = infoFactory.getGBeanInfo(gbean.getClass1(), cl);
         String namePart = gbean.getName();
         String j2eeType = gBeanInfo.getJ2eeType();
         AbstractName abstractName = context.getNaming().createChildName(moduleName, namePart, j2eeType);

Modified: geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java?rev=645077&r1=645076&r2=645077&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java Sat Apr  5 04:13:30 2008
@@ -16,16 +16,16 @@
  */
 package org.apache.geronimo.system.configuration;
 
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.Writer;
-import java.io.Reader;
 import java.io.FileReader;
-import java.io.BufferedReader;
 import java.io.FileWriter;
-import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -36,8 +36,8 @@
 import java.util.Timer;
 import java.util.TimerTask;
 
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.bind.JAXBException;
+import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.stream.XMLStreamException;
 
 import org.apache.commons.logging.Log;
@@ -47,8 +47,10 @@
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GBeanInfoFactory;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.gbean.GReferenceInfo;
+import org.apache.geronimo.gbean.MultiGBeanInfoFactory;
 import org.apache.geronimo.gbean.ReferencePatterns;
 import org.apache.geronimo.kernel.InvalidGBeanException;
 import org.apache.geronimo.kernel.config.Configuration;
@@ -58,8 +60,8 @@
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.system.configuration.condition.JexlExpressionParser;
 import org.apache.geronimo.system.configuration.condition.ParserUtils;
-import org.apache.geronimo.system.plugin.model.GbeanType;
 import org.apache.geronimo.system.plugin.model.AttributesType;
+import org.apache.geronimo.system.plugin.model.GbeanType;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
 import org.xml.sax.SAXException;
 
@@ -98,6 +100,7 @@
     private File configSubstitutionsFile;
     private Properties localConfigSubstitutions;
     private String resolvedPropertiesFile;
+    private final GBeanInfoFactory infoFactory;
 
     public LocalAttributeManager(String configFile, String configSubstitutionsFileName, String configSubstitutionsPrefix, boolean readOnly, ServerInfo serverInfo) {
         this.configFile = System.getProperty(CONFIG_FILE_PROPERTY, configFile);
@@ -111,6 +114,11 @@
         this.serverInfo = serverInfo;
         serverOverride = new ServerOverride();
         log.debug("setting configSubstitutionsFile to " + configSubstitutionsFile + ".");
+        infoFactory = newGBeanInfoFactory();
+    }
+
+    protected GBeanInfoFactory newGBeanInfoFactory() {
+        return new MultiGBeanInfoFactory();
     }
 
     public boolean isReadOnly() {
@@ -166,7 +174,7 @@
                     message.append(" gbeanName=").append(name);
                     throw new InvalidConfigException(message.toString());
                 }
-                GBeanInfo gbeanInfo = GBeanInfo.getGBeanInfo(gbean.getGBeanInfo(), classLoader);
+                GBeanInfo gbeanInfo = infoFactory.getGBeanInfo(gbean.getGBeanInfo(), classLoader);
                 AbstractName abstractName = (AbstractName) name;
                 GBeanData gBeanData = new GBeanData(abstractName, gbeanInfo);
                 gbeanDatas.add(gBeanData);

Modified: geronimo/server/trunk/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/BasicWADICluster.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/BasicWADICluster.java?rev=645077&r1=645076&r2=645077&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/BasicWADICluster.java (original)
+++ geronimo/server/trunk/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/BasicWADICluster.java Sat Apr  5 04:13:30 2008
@@ -21,13 +21,10 @@
 import java.util.IdentityHashMap;
 import java.util.Set;
 
-import org.apache.geronimo.clustering.Cluster;
 import org.apache.geronimo.clustering.ClusterListener;
 import org.apache.geronimo.clustering.Node;
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
-import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.gbean.annotation.ParamReference;
 import org.codehaus.wadi.group.Peer;
 
 /**
@@ -43,7 +40,8 @@
     
     private org.codehaus.wadi.group.Cluster cluster;
     
-    public BasicWADICluster(Node node, DispatcherHolder dispatcherHolder) {
+    public BasicWADICluster(@ParamReference(name=GBEAN_REF_NODE) Node node,
+        @ParamReference(name=GBEAN_REF_DISPATCHER_HOLDER) DispatcherHolder dispatcherHolder) {
         this(node, dispatcherHolder, new NodeProxyFactory());
     }
 
@@ -172,28 +170,6 @@
         
     }
     
-    public static final GBeanInfo GBEAN_INFO;
-
     public static final String GBEAN_REF_NODE = "Node";
     public static final String GBEAN_REF_DISPATCHER_HOLDER = "DispatcherHolder";
-
-    static {
-        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic("WADI Cluster",
-            BasicWADICluster.class,
-            NameFactory.GERONIMO_SERVICE);
-
-        infoBuilder.addReference(GBEAN_REF_NODE, Node.class, NameFactory.GERONIMO_SERVICE);
-        infoBuilder.addReference(GBEAN_REF_DISPATCHER_HOLDER, DispatcherHolder.class, NameFactory.GERONIMO_SERVICE);
-
-        infoBuilder.addInterface(Cluster.class);
-
-        infoBuilder.setConstructor(new String[] { GBEAN_REF_NODE, GBEAN_REF_DISPATCHER_HOLDER });
-
-        GBEAN_INFO = infoBuilder.getBeanInfo();
-    }
-
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
-    
 }

Modified: geronimo/server/trunk/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/BasicWADISessionManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/BasicWADISessionManager.java?rev=645077&r1=645076&r2=645077&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/BasicWADISessionManager.java (original)
+++ geronimo/server/trunk/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/BasicWADISessionManager.java Sat Apr  5 04:13:30 2008
@@ -33,10 +33,11 @@
 import org.apache.geronimo.clustering.SessionListener;
 import org.apache.geronimo.clustering.SessionManager;
 import org.apache.geronimo.clustering.SessionManagerListener;
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
-import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamReference;
+import org.apache.geronimo.gbean.annotation.ParamSpecial;
+import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
 import org.codehaus.wadi.aop.replication.AOPStackContext;
 import org.codehaus.wadi.core.assembler.StackContext;
 import org.codehaus.wadi.core.manager.Manager;
@@ -71,11 +72,11 @@
     private SessionMonitor sessionMonitor;
     private ServiceSpace serviceSpace;
     
-    public BasicWADISessionManager(ClassLoader cl,
-        WADISessionManagerConfigInfo configInfo,
-        WADICluster cluster,
-        BackingStrategyFactory backingStrategyFactory,
-        Collection<ClusteredServiceHolder> serviceHolders) {
+    public BasicWADISessionManager(@ParamSpecial(type=SpecialAttributeType.classLoader) ClassLoader cl,
+        @ParamAttribute(name=GBEAN_ATTR_WADI_CONFIG_INFO) WADISessionManagerConfigInfo configInfo,
+        @ParamReference(name=GBEAN_REF_CLUSTER) WADICluster cluster,
+        @ParamReference(name=GBEAN_REF_BACKING_STRATEGY_FACTORY) BackingStrategyFactory backingStrategyFactory,
+        @ParamReference(name=GBEAN_REF_SERVICE_HOLDERS) Collection<ClusteredServiceHolder> serviceHolders) {
         if (null == cl) {
             throw new IllegalArgumentException("cl is required");
         } else if (null == configInfo) {
@@ -294,41 +295,8 @@
         }
     }
     
-    public static final GBeanInfo GBEAN_INFO;
-
     public static final String GBEAN_ATTR_WADI_CONFIG_INFO = "wadiConfigInfo";
-
     public static final String GBEAN_REF_CLUSTER = "Cluster";
     public static final String GBEAN_REF_BACKING_STRATEGY_FACTORY = "BackingStrategyFactory";
     public static final String GBEAN_REF_SERVICE_HOLDERS = "ServiceHolders";
-
-
-    static {
-        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic("WADI Session Manager",
-                BasicWADISessionManager.class, NameFactory.GERONIMO_SERVICE);
-
-        infoBuilder.addAttribute("classLoader", ClassLoader.class, false);
-        infoBuilder.addAttribute(GBEAN_ATTR_WADI_CONFIG_INFO, WADISessionManagerConfigInfo.class, true);
-
-        infoBuilder.addReference(GBEAN_REF_CLUSTER, WADICluster.class, NameFactory.GERONIMO_SERVICE);
-        infoBuilder.addReference(GBEAN_REF_BACKING_STRATEGY_FACTORY, BackingStrategyFactory.class,
-                NameFactory.GERONIMO_SERVICE);
-        infoBuilder.addReference(GBEAN_REF_SERVICE_HOLDERS, ClusteredServiceHolder.class, NameFactory.GERONIMO_SERVICE);
-
-        infoBuilder.addInterface(SessionManager.class);
-        infoBuilder.addInterface(WADISessionManager.class);
-
-        infoBuilder.setConstructor(new String[] { "classLoader", 
-                GBEAN_ATTR_WADI_CONFIG_INFO,
-                GBEAN_REF_CLUSTER, 
-                GBEAN_REF_BACKING_STRATEGY_FACTORY,
-                GBEAN_REF_SERVICE_HOLDERS});
-
-        GBEAN_INFO = infoBuilder.getBeanInfo();
-    }
-
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
-
 }

Modified: geronimo/server/trunk/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/RoundRobinBackingStrategyFactoryGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/RoundRobinBackingStrategyFactoryGBean.java?rev=645077&r1=645076&r2=645077&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/RoundRobinBackingStrategyFactoryGBean.java (original)
+++ geronimo/server/trunk/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/RoundRobinBackingStrategyFactoryGBean.java Sat Apr  5 04:13:30 2008
@@ -16,10 +16,8 @@
  */
 package org.apache.geronimo.clustering.wadi;
 
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
-import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
 import org.codehaus.wadi.replication.strategy.BackingStrategy;
 import org.codehaus.wadi.replication.strategy.BackingStrategyFactory;
 import org.codehaus.wadi.replication.strategy.RoundRobinBackingStrategyFactory;
@@ -35,7 +33,7 @@
     private BackingStrategyFactory strategyFactory;
     private ServiceSpace serviceSpace;
     
-    public RoundRobinBackingStrategyFactoryGBean(int nbReplica) {
+    public RoundRobinBackingStrategyFactoryGBean(@ParamAttribute(name=GBEAN_ATTR_NB_REPLICA) int nbReplica) {
         this.nbReplica = nbReplica;
     }
 
@@ -59,25 +57,5 @@
         strategyFactory = null;
     }
 
-    
-    public static final GBeanInfo GBEAN_INFO;
-    
     public static final String GBEAN_ATTR_NB_REPLICA = "nbReplica";
-    
-    static {
-        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(RoundRobinBackingStrategyFactoryGBean.class, 
-                NameFactory.GERONIMO_SERVICE);
-        
-        infoBuilder.addAttribute(GBEAN_ATTR_NB_REPLICA, int.class, true);
-        
-        infoBuilder.addInterface(BackingStrategyFactory.class);
-
-        infoBuilder.setConstructor(new String[] {GBEAN_ATTR_NB_REPLICA});
-        
-        GBEAN_INFO = infoBuilder.getBeanInfo();
-    }
-    
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
 }

Modified: geronimo/server/trunk/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/TribesDispatcherHolder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/TribesDispatcherHolder.java?rev=645077&r1=645076&r2=645077&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/TribesDispatcherHolder.java (original)
+++ geronimo/server/trunk/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/TribesDispatcherHolder.java Sat Apr  5 04:13:30 2008
@@ -23,10 +23,11 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.clustering.LocalNode;
 import org.apache.geronimo.clustering.Node;
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
-import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamReference;
+import org.apache.geronimo.gbean.annotation.ParamSpecial;
+import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
 import org.codehaus.wadi.core.reflect.base.DeclaredMemberFilter;
 import org.codehaus.wadi.core.reflect.jdk.JDKClassIndexerRegistry;
 import org.codehaus.wadi.core.util.SimpleStreamer;
@@ -54,8 +55,10 @@
     private TribesDispatcher dispatcher;
     private AdminServiceSpace adminServiceSpace;
 
-
-    public TribesDispatcherHolder(ClassLoader cl, URI endPointURI, String clusterName, LocalNode node) {
+    public TribesDispatcherHolder(@ParamSpecial(type=SpecialAttributeType.classLoader) ClassLoader cl,
+        @ParamAttribute(name=GBEAN_ATTR_END_POINT_URI) URI endPointURI,
+        @ParamAttribute(name=GBEAN_ATTR_CLUSTER_NAME) String clusterName,
+        @ParamReference(name=GBEAN_REF_NODE) LocalNode node) {
         if (null == endPointURI) {
             throw new IllegalArgumentException("endPointURI is required");
         } else if (null == clusterName) {
@@ -129,35 +132,8 @@
         nodeServiceHelper.registerNodeService(new BasicNodeService(node));
     }
     
-    public static final GBeanInfo GBEAN_INFO;
-    
     public static final String GBEAN_ATTR_END_POINT_URI = "endPointURI";
     public static final String GBEAN_ATTR_CLUSTER_NAME = "clusterName";
     public static final String GBEAN_ATTR_CLUSTER_URI = "clusterUri";
-
     public static final String GBEAN_REF_NODE = "Node";
-
-    static {
-        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(TribesDispatcherHolder.class, 
-                NameFactory.GERONIMO_SERVICE);
-        
-        infoBuilder.addAttribute("classLoader", ClassLoader.class, false);
-        infoBuilder.addAttribute(GBEAN_ATTR_END_POINT_URI, URI.class, true);
-        infoBuilder.addAttribute(GBEAN_ATTR_CLUSTER_NAME, String.class, true);
-        
-        infoBuilder.addReference(GBEAN_REF_NODE, LocalNode.class, NameFactory.GERONIMO_SERVICE);
-
-        infoBuilder.addInterface(DispatcherHolder.class);
-        
-        infoBuilder.setConstructor(new String[] {"classLoader",
-                GBEAN_ATTR_END_POINT_URI,
-                GBEAN_ATTR_CLUSTER_NAME,
-                GBEAN_REF_NODE });
-        
-        GBEAN_INFO = infoBuilder.getBeanInfo();
-    }
-
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
 }

Modified: geronimo/server/trunk/plugins/clustering/geronimo-clustering/src/main/java/org/apache/geronimo/clustering/BasicLocalNode.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/clustering/geronimo-clustering/src/main/java/org/apache/geronimo/clustering/BasicLocalNode.java?rev=645077&r1=645076&r2=645077&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/clustering/geronimo-clustering/src/main/java/org/apache/geronimo/clustering/BasicLocalNode.java (original)
+++ geronimo/server/trunk/plugins/clustering/geronimo-clustering/src/main/java/org/apache/geronimo/clustering/BasicLocalNode.java Sat Apr  5 04:13:30 2008
@@ -18,6 +18,8 @@
 
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamReference;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.jmxremoting.JMXConnectorInfo;
 
@@ -28,7 +30,8 @@
 public class BasicLocalNode extends AbstractNode implements LocalNode {
     private final JMXConnectorInfo connectorInfo;
     
-    public BasicLocalNode(String name, JMXConnectorInfo connectorInfo) {
+    public BasicLocalNode(@ParamAttribute(name=GBEAN_ATTR_NODE_NAME) String name,
+        @ParamReference(name=GBEAN_REF_JMX_CONNECTOR) JMXConnectorInfo connectorInfo) {
         super(name);
         if (null == connectorInfo) {
             throw new IllegalArgumentException("connectorInfo is required");
@@ -50,28 +53,6 @@
         return connectorInfo.getPort();
     }
     
-    public static final GBeanInfo GBEAN_INFO;
-    
     public static final String GBEAN_ATTR_NODE_NAME = "nodeName";
     public static final String GBEAN_REF_JMX_CONNECTOR = "JMXConnector";
-    
-    static {
-        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(BasicLocalNode.class, NameFactory.GERONIMO_SERVICE);
-        
-        infoBuilder.addAttribute(GBEAN_ATTR_NODE_NAME, String.class, true);
-        
-        infoBuilder.addReference(GBEAN_REF_JMX_CONNECTOR, JMXConnectorInfo.class, NameFactory.GERONIMO_SERVICE);
-        
-        infoBuilder.addInterface(LocalNode.class);
-        
-        infoBuilder.setConstructor(new String[] { GBEAN_ATTR_NODE_NAME,
-            GBEAN_REF_JMX_CONNECTOR });
-        
-        GBEAN_INFO = infoBuilder.getBeanInfo();
-    }
-
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
-
 }

Modified: geronimo/server/trunk/plugins/jetty/geronimo-jetty6-clustering-builder-wadi/src/main/java/org/apache/geronimo/jetty6/cluster/wadi/builder/WADIJettyClusteringBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty/geronimo-jetty6-clustering-builder-wadi/src/main/java/org/apache/geronimo/jetty6/cluster/wadi/builder/WADIJettyClusteringBuilder.java?rev=645077&r1=645076&r2=645077&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty/geronimo-jetty6-clustering-builder-wadi/src/main/java/org/apache/geronimo/jetty6/cluster/wadi/builder/WADIJettyClusteringBuilder.java (original)
+++ geronimo/server/trunk/plugins/jetty/geronimo-jetty6-clustering-builder-wadi/src/main/java/org/apache/geronimo/jetty6/cluster/wadi/builder/WADIJettyClusteringBuilder.java Sat Apr  5 04:13:30 2008
@@ -33,8 +33,8 @@
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.GBeanData;
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.jetty6.JettyWebAppContext;
 import org.apache.geronimo.jetty6.cluster.ClusteredSessionHandlerFactory;
@@ -56,6 +56,7 @@
  *
  * @version $Rev$ $Date$
  */
+@GBean(name="WADIJettyClusteringBuilder", j2eeType=NameFactory.MODULE_BUILDER)
 public class WADIJettyClusteringBuilder implements NamespaceDrivenBuilder {
     private static final QName CLUSTERING_WADI_QNAME = GerClusteringWadiDocument.type.getDocumentElementName();
     private static final QNameSet CLUSTERING_WADI_QNAME_SET = QNameSet.singleton(CLUSTERING_WADI_QNAME);
@@ -72,11 +73,11 @@
     private final AbstractNameQuery defaultClusterName;
     private final Environment defaultEnvironment;
 
-    public WADIJettyClusteringBuilder(int defaultSweepInterval,
-            int defaultNumPartitions,
-            AbstractNameQuery defaultBackingStrategyFactoryName,
-            AbstractNameQuery defaultClusterName,
-            Environment defaultEnvironment) {
+    public WADIJettyClusteringBuilder(@ParamAttribute(name=GBEAN_ATTR_DFT_SWEEP_INTERVAL) int defaultSweepInterval,
+        @ParamAttribute(name=GBEAN_ATTR_DFT_NUM_PARTITIONS) int defaultNumPartitions,
+        @ParamAttribute(name=GBEAN_ATTR_DFT_BACKING_STRATEGY_FACTORY_NAME) AbstractNameQuery defaultBackingStrategyFactoryName,
+        @ParamAttribute(name=GBEAN_ATTR_DFT_CLUSTER_NAME) AbstractNameQuery defaultClusterName,
+        @ParamAttribute(name=GBEAN_ATTR_DFT_ENVIRONMENT) Environment defaultEnvironment) {
         if (defaultSweepInterval < 1) {
             throw new IllegalArgumentException("defaultSweepInterval is lower than 1");
         } else if (defaultNumPartitions < 1) {
@@ -150,7 +151,7 @@
         AbstractName name = moduleContext.getNaming().createChildName(moduleContext.getModuleName(),
                 "WADISessionManager", NameFactory.GERONIMO_SERVICE);
 
-        GBeanData beanData = new GBeanData(name, BasicWADISessionManager.GBEAN_INFO);
+        GBeanData beanData = new GBeanData(name, BasicWADISessionManager.class);
 
         setConfigInfo(clustering, webModuleData, beanData);
         setCluster(clustering, beanData);
@@ -246,7 +247,7 @@
         AbstractName name = moduleContext.getNaming().createChildName(moduleContext.getModuleName(),
                 "WADIClusteredPreHandlerFactory", NameFactory.GERONIMO_SERVICE);
 
-        GBeanData beanData = new GBeanData(name, WADIClusteredPreHandlerFactory.GBEAN_INFO);
+        GBeanData beanData = new GBeanData(name, WADIClusteredPreHandlerFactory.class);
         beanData.setReferencePattern(WADIClusteredPreHandlerFactory.GBEAN_REF_WADI_SESSION_MANAGER, sessionManagerName);
 
         webModuleData.setReferencePattern(JettyWebAppContext.GBEAN_REF_PRE_HANDLER_FACTORY, name);
@@ -261,7 +262,7 @@
         AbstractName name = moduleContext.getNaming().createChildName(moduleContext.getModuleName(),
                 "ClusteredSessionHandlerFactory", NameFactory.GERONIMO_SERVICE);
 
-        GBeanData beanData = new GBeanData(name, ClusteredSessionHandlerFactory.GBEAN_INFO);
+        GBeanData beanData = new GBeanData(name, ClusteredSessionHandlerFactory.class);
         beanData.setReferencePattern(ClusteredSessionHandlerFactory.GBEAN_REF_SESSION_MANAGER, sessionManagerName);
 
         webModuleData.setReferencePattern(JettyWebAppContext.GBEAN_REF_SESSION_HANDLER_FACTORY, name);
@@ -278,36 +279,9 @@
         }
     }
 
-    public static final GBeanInfo GBEAN_INFO;
-
     public static final String GBEAN_ATTR_DFT_SWEEP_INTERVAL = "defaultSweepInterval";
     public static final String GBEAN_ATTR_DFT_NUM_PARTITIONS = "defaultNumPartitions";
     public static final String GBEAN_ATTR_DFT_BACKING_STRATEGY_FACTORY_NAME = "defaultBackingStrategyFactoryName";
     public static final String GBEAN_ATTR_DFT_CLUSTER_NAME = "defaultClusterName";
     public static final String GBEAN_ATTR_DFT_ENVIRONMENT = "defaultEnvironment";
-
-    static {
-        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic("WADI Session Manager",
-                WADIJettyClusteringBuilder.class,
-                NameFactory.MODULE_BUILDER);
-
-        infoBuilder.addAttribute(GBEAN_ATTR_DFT_SWEEP_INTERVAL, int.class, true);
-        infoBuilder.addAttribute(GBEAN_ATTR_DFT_NUM_PARTITIONS, int.class, true);
-        infoBuilder.addAttribute(GBEAN_ATTR_DFT_BACKING_STRATEGY_FACTORY_NAME, AbstractNameQuery.class, true);
-        infoBuilder.addAttribute(GBEAN_ATTR_DFT_CLUSTER_NAME, AbstractNameQuery.class, true);
-        infoBuilder.addAttribute(GBEAN_ATTR_DFT_ENVIRONMENT, Environment.class, true);
-
-        infoBuilder.setConstructor(new String[]{GBEAN_ATTR_DFT_SWEEP_INTERVAL,
-                GBEAN_ATTR_DFT_NUM_PARTITIONS,
-                GBEAN_ATTR_DFT_BACKING_STRATEGY_FACTORY_NAME,
-                GBEAN_ATTR_DFT_CLUSTER_NAME,
-                GBEAN_ATTR_DFT_ENVIRONMENT});
-
-        GBEAN_INFO = infoBuilder.getBeanInfo();
-    }
-
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
-
 }

Modified: geronimo/server/trunk/plugins/jetty/geronimo-jetty6-clustering-wadi/src/main/java/org/apache/geronimo/jetty6/cluster/ClusteredSessionHandlerFactory.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty/geronimo-jetty6-clustering-wadi/src/main/java/org/apache/geronimo/jetty6/cluster/ClusteredSessionHandlerFactory.java?rev=645077&r1=645076&r2=645077&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty/geronimo-jetty6-clustering-wadi/src/main/java/org/apache/geronimo/jetty6/cluster/ClusteredSessionHandlerFactory.java (original)
+++ geronimo/server/trunk/plugins/jetty/geronimo-jetty6-clustering-wadi/src/main/java/org/apache/geronimo/jetty6/cluster/ClusteredSessionHandlerFactory.java Sat Apr  5 04:13:30 2008
@@ -17,9 +17,7 @@
 package org.apache.geronimo.jetty6.cluster;
 
 import org.apache.geronimo.clustering.SessionManager;
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.gbean.annotation.ParamReference;
 import org.apache.geronimo.jetty6.PreHandler;
 import org.apache.geronimo.jetty6.SessionHandlerFactory;
 import org.mortbay.jetty.servlet.SessionHandler;
@@ -31,7 +29,7 @@
 public class ClusteredSessionHandlerFactory implements SessionHandlerFactory {
     private final SessionManager sessionManager;
 
-    public ClusteredSessionHandlerFactory(SessionManager sessionManager) {
+    public ClusteredSessionHandlerFactory(@ParamReference(name=GBEAN_REF_SESSION_MANAGER) SessionManager sessionManager) {
         this.sessionManager = sessionManager;
     }
 
@@ -40,24 +38,5 @@
         return new ClusteredSessionHandler(clusteredSessionManager, preHandler);
     }
 
-    public static final GBeanInfo GBEAN_INFO;
-
     public static final String GBEAN_REF_SESSION_MANAGER = "SessionManager";
-
-    static {
-        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Clustered Web Application Handler Factory",
-                ClusteredSessionHandlerFactory.class, NameFactory.GERONIMO_SERVICE);
-
-        infoFactory.addReference(GBEAN_REF_SESSION_MANAGER, SessionManager.class, NameFactory.GERONIMO_SERVICE);
-
-        infoFactory.addInterface(SessionHandlerFactory.class);
-
-        infoFactory.setConstructor(new String[]{GBEAN_REF_SESSION_MANAGER});
-
-        GBEAN_INFO = infoFactory.getBeanInfo();
-    }
-
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
 }

Modified: geronimo/server/trunk/plugins/jetty/geronimo-jetty6-clustering-wadi/src/main/java/org/apache/geronimo/jetty6/cluster/wadi/WADIClusteredPreHandlerFactory.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty/geronimo-jetty6-clustering-wadi/src/main/java/org/apache/geronimo/jetty6/cluster/wadi/WADIClusteredPreHandlerFactory.java?rev=645077&r1=645076&r2=645077&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty/geronimo-jetty6-clustering-wadi/src/main/java/org/apache/geronimo/jetty6/cluster/wadi/WADIClusteredPreHandlerFactory.java (original)
+++ geronimo/server/trunk/plugins/jetty/geronimo-jetty6-clustering-wadi/src/main/java/org/apache/geronimo/jetty6/cluster/wadi/WADIClusteredPreHandlerFactory.java Sat Apr  5 04:13:30 2008
@@ -17,10 +17,8 @@
 package org.apache.geronimo.jetty6.cluster.wadi;
 
 import org.apache.geronimo.clustering.wadi.WADISessionManager;
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
-import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.gbean.annotation.ParamReference;
 import org.apache.geronimo.jetty6.PreHandler;
 import org.apache.geronimo.jetty6.PreHandlerFactory;
 import org.codehaus.wadi.core.manager.Manager;
@@ -35,7 +33,7 @@
     private final WADISessionManager sessionManager;
     private Manager wadiManager;
 
-    public WADIClusteredPreHandlerFactory(WADISessionManager sessionManager) {
+    public WADIClusteredPreHandlerFactory(@ParamReference(name=GBEAN_REF_WADI_SESSION_MANAGER) WADISessionManager sessionManager) {
         if (null == sessionManager) {
             throw new IllegalArgumentException("sessionManager is required");
         }
@@ -56,25 +54,5 @@
         return new WADIClusteredPreHandler(wadiManager);
     }
     
-    public static final GBeanInfo GBEAN_INFO;
     public static final String GBEAN_REF_WADI_SESSION_MANAGER = "WADISessionManager";
-
-    static {
-        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("WADI Pre-Handler Factory",
-                WADIClusteredPreHandlerFactory.class, NameFactory.GERONIMO_SERVICE);
-
-        infoFactory.addReference(GBEAN_REF_WADI_SESSION_MANAGER, WADISessionManager.class, 
-                NameFactory.GERONIMO_SERVICE);
-
-        infoFactory.addInterface(PreHandlerFactory.class);
-
-        infoFactory.setConstructor(new String[]{GBEAN_REF_WADI_SESSION_MANAGER});
-
-        GBEAN_INFO = infoFactory.getBeanInfo();
-    }
-
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
-
 }

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/WADIOpenEJBClusteringBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/WADIOpenEJBClusteringBuilder.java?rev=645077&r1=645076&r2=645077&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/WADIOpenEJBClusteringBuilder.java (original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/WADIOpenEJBClusteringBuilder.java Sat Apr  5 04:13:30 2008
@@ -239,7 +239,7 @@
         DeploymentContext moduleContext) throws DeploymentException {
         AbstractName name = newGBeanName(moduleContext, "WADISessionManager");
 
-        GBeanData beanData = new GBeanData(name, BasicWADISessionManager.GBEAN_INFO);
+        GBeanData beanData = new GBeanData(name, BasicWADISessionManager.class);
 
         setConfigInfo(clustering, ejbModule, beanData);
         setCluster(clustering, beanData);

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-clustering-builder-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/wadi/builder/WADITomcatClusteringBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-clustering-builder-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/wadi/builder/WADITomcatClusteringBuilder.java?rev=645077&r1=645076&r2=645077&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-clustering-builder-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/wadi/builder/WADITomcatClusteringBuilder.java (original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-clustering-builder-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/wadi/builder/WADITomcatClusteringBuilder.java Sat Apr  5 04:13:30 2008
@@ -36,8 +36,8 @@
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.GBeanData;
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
@@ -58,6 +58,7 @@
  *
  * @version $Rev:$ $Date:$
  */
+@GBean(name="WADITomcatClusteringBuilder", j2eeType=NameFactory.MODULE_BUILDER)
 public class WADITomcatClusteringBuilder implements NamespaceDrivenBuilder {
     private static final QName CLUSTERING_WADI_QNAME = GerTomcatClusteringWadiDocument.type.getDocumentElementName();
     private static final QNameSet CLUSTERING_WADI_QNAME_SET = QNameSet.singleton(CLUSTERING_WADI_QNAME);
@@ -75,12 +76,13 @@
     private final AbstractNameQuery defaultClusterName;
     private final Environment defaultEnvironment;
 
-    public WADITomcatClusteringBuilder(int defaultSweepInterval,
-            int defaultSessionTimeout,
-            int defaultNumPartitions,
-            AbstractNameQuery defaultBackingStrategyFactoryName,
-            AbstractNameQuery defaultClusterName,
-            Environment defaultEnvironment) {
+    
+    public WADITomcatClusteringBuilder(@ParamAttribute(name=GBEAN_ATTR_DFT_SWEEP_INTERVAL) int defaultSweepInterval,
+        @ParamAttribute(name=GBEAN_ATTR_DFT_SESSION_TIMEOUT) int defaultSessionTimeout,
+        @ParamAttribute(name=GBEAN_ATTR_DFT_NUM_PARTITIONS) int defaultNumPartitions,
+        @ParamAttribute(name=GBEAN_ATTR_DFT_BACKING_STRATEGY_FACTORY_NAME) AbstractNameQuery defaultBackingStrategyFactoryName,
+        @ParamAttribute(name=GBEAN_ATTR_DFT_CLUSTER_NAME) AbstractNameQuery defaultClusterName,
+        @ParamAttribute(name=GBEAN_ATTR_DFT_ENVIRONMENT) Environment defaultEnvironment) {
         if (defaultSweepInterval < 1) {
             throw new IllegalArgumentException("defaultSweepInterval is lower than 1");
         } else if (defaultSessionTimeout < 1) {
@@ -160,7 +162,7 @@
             DeploymentContext moduleContext) throws GBeanAlreadyExistsException {
         AbstractName name = newGBeanName(moduleContext, "WADISessionManager");
 
-        GBeanData beanData = new GBeanData(name, BasicWADISessionManager.GBEAN_INFO);
+        GBeanData beanData = new GBeanData(name, BasicWADISessionManager.class);
 
         setConfigInfo(clustering, webModuleData, beanData);
         setCluster(clustering, beanData);
@@ -253,7 +255,7 @@
             AbstractName sessionManagerName) throws GBeanAlreadyExistsException {
         AbstractName name = newGBeanName(moduleContext, "WADIClusteredValveRetriever");
 
-        GBeanData beanData = new GBeanData(name, WADIClusteredValveRetriever.GBEAN_INFO);
+        GBeanData beanData = new GBeanData(name, WADIClusteredValveRetriever.class);
         beanData.setReferencePattern(WADIClusteredValveRetriever.GBEAN_REF_WADI_SESSION_MANAGER, sessionManagerName);
 
         webModuleData.setReferencePattern(TomcatWebAppContext.GBEAN_REF_CLUSTERED_VALVE_RETRIEVER, name);
@@ -268,7 +270,7 @@
             AbstractName sessionManagerName) throws GBeanAlreadyExistsException {
         AbstractName name = newGBeanName(moduleContext, "ClusteredManagerRetriever");
 
-        GBeanData beanData = new GBeanData(name, ClusteredManagerRetriever.GBEAN_INFO);
+        GBeanData beanData = new GBeanData(name, ClusteredManagerRetriever.class);
         beanData.setReferencePattern(ClusteredManagerRetriever.GBEAN_REF_SESSION_MANAGER, sessionManagerName);
 
         webModuleData.setReferencePattern(TomcatWebAppContext.GBEAN_REF_MANAGER_RETRIEVER, name);
@@ -293,39 +295,10 @@
         patterns.add(query);
     }
 
-    public static final GBeanInfo GBEAN_INFO;
-
     public static final String GBEAN_ATTR_DFT_SWEEP_INTERVAL = "defaultSweepInterval";
     public static final String GBEAN_ATTR_DFT_SESSION_TIMEOUT = "defaultSessionTimeout";
     public static final String GBEAN_ATTR_DFT_NUM_PARTITIONS = "defaultNumPartitions";
     public static final String GBEAN_ATTR_DFT_BACKING_STRATEGY_FACTORY_NAME = "defaultBackingStrategyFactoryName";
     public static final String GBEAN_ATTR_DFT_CLUSTER_NAME = "defaultClusterName";
     public static final String GBEAN_ATTR_DFT_ENVIRONMENT = "defaultEnvironment";
-
-    static {
-        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic("WADI Session Manager",
-                WADITomcatClusteringBuilder.class,
-                NameFactory.MODULE_BUILDER);
-
-        infoBuilder.addAttribute(GBEAN_ATTR_DFT_SWEEP_INTERVAL, int.class, true);
-        infoBuilder.addAttribute(GBEAN_ATTR_DFT_SESSION_TIMEOUT, int.class, true);
-        infoBuilder.addAttribute(GBEAN_ATTR_DFT_NUM_PARTITIONS, int.class, true);
-        infoBuilder.addAttribute(GBEAN_ATTR_DFT_BACKING_STRATEGY_FACTORY_NAME, AbstractNameQuery.class, true);
-        infoBuilder.addAttribute(GBEAN_ATTR_DFT_CLUSTER_NAME, AbstractNameQuery.class, true);
-        infoBuilder.addAttribute(GBEAN_ATTR_DFT_ENVIRONMENT, Environment.class, true);
-
-        infoBuilder.setConstructor(new String[]{GBEAN_ATTR_DFT_SWEEP_INTERVAL,
-                GBEAN_ATTR_DFT_SESSION_TIMEOUT,
-                GBEAN_ATTR_DFT_NUM_PARTITIONS,
-                GBEAN_ATTR_DFT_BACKING_STRATEGY_FACTORY_NAME,
-                GBEAN_ATTR_DFT_CLUSTER_NAME,
-                GBEAN_ATTR_DFT_ENVIRONMENT});
-
-        GBEAN_INFO = infoBuilder.getBeanInfo();
-    }
-
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
-
 }

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/ClusteredManagerRetriever.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/ClusteredManagerRetriever.java?rev=645077&r1=645076&r2=645077&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/ClusteredManagerRetriever.java (original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/ClusteredManagerRetriever.java Sat Apr  5 04:13:30 2008
@@ -20,9 +20,7 @@
 package org.apache.geronimo.tomcat.cluster;
 
 import org.apache.geronimo.clustering.SessionManager;
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.gbean.annotation.ParamReference;
 import org.apache.geronimo.tomcat.ObjectRetriever;
 
 /**
@@ -32,7 +30,7 @@
 public class ClusteredManagerRetriever implements ObjectRetriever {
     private final SessionManager sessionManager;
 
-    public ClusteredManagerRetriever(SessionManager sessionManager) {
+    public ClusteredManagerRetriever(@ParamReference(name=GBEAN_REF_SESSION_MANAGER) SessionManager sessionManager) {
         if (null == sessionManager) {
             throw new IllegalArgumentException("sessionManager is required");
         }
@@ -43,25 +41,5 @@
         return new ClusteredManager(sessionManager);
     }
 
-    public static final GBeanInfo GBEAN_INFO;
     public static final String GBEAN_REF_SESSION_MANAGER = "SessionManager";
-
-    static {
-        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Clustered Manager Retriever",
-            ClusteredManagerRetriever.class,
-            NameFactory.GERONIMO_SERVICE);
-
-        infoFactory.addReference(GBEAN_REF_SESSION_MANAGER, SessionManager.class, NameFactory.GERONIMO_SERVICE);
-
-        infoFactory.addInterface(ObjectRetriever.class);
-
-        infoFactory.setConstructor(new String[]{GBEAN_REF_SESSION_MANAGER});
-
-        GBEAN_INFO = infoFactory.getBeanInfo();
-    }
-
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
-
 }



Mime
View raw message