[jboss-cvs] JBossAS SVN: r62476 - in projects/microcontainer/trunk: dependency/src/main/org/jboss/dependency/spi and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Apr 22 06:40:12 EDT 2007


Author: alesj
Date: 2007-04-22 06:40:12 -0400 (Sun, 22 Apr 2007)
New Revision: 62476

Modified:
   projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/AbstractCallbackItem.java
   projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/AttributeCallbackItem.java
   projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/NamedCallbackItem.java
   projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/SingleCallbackItem.java
   projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/spi/CallbackItem.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractCallbackMetaData.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/CollectionCallbackItem.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/CollectionCallbackItemFactory.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/ListCallbackItem.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/QueueCallbackItem.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/SetCallbackItem.java
Log:
Cardinality in CallbackItem.

Modified: projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/AbstractCallbackItem.java
===================================================================
--- projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/AbstractCallbackItem.java	2007-04-21 21:27:21 UTC (rev 62475)
+++ projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/AbstractCallbackItem.java	2007-04-22 10:40:12 UTC (rev 62476)
@@ -22,6 +22,7 @@
 package org.jboss.dependency.plugins;
 
 import org.jboss.dependency.spi.CallbackItem;
+import org.jboss.dependency.spi.Cardinality;
 import org.jboss.dependency.spi.Controller;
 import org.jboss.dependency.spi.ControllerContext;
 import org.jboss.dependency.spi.ControllerState;
@@ -38,19 +39,21 @@
    protected T name;
    protected ControllerState whenRequired = ControllerState.CONFIGURED;
    protected ControllerState dependentState = ControllerState.INSTALLED;
+   protected Cardinality cardinality;
 
    protected AbstractCallbackItem(T name)
    {
       this.name = name;
    }
 
-   protected AbstractCallbackItem(T name, ControllerState whenRequired, ControllerState dependentState)
+   protected AbstractCallbackItem(T name, ControllerState whenRequired, ControllerState dependentState, Cardinality cardinality)
    {
       this.name = name;
       if (whenRequired != null)
          this.whenRequired = whenRequired;
       if (dependentState != null)
          this.dependentState = dependentState;
+      this.cardinality = cardinality;
    }
 
    public void ownerCallback(Controller controller) throws Throwable
@@ -87,6 +90,11 @@
       return dependentState;
    }
 
+   public Cardinality getCardinality()
+   {
+      return cardinality;
+   }
+
    public void toShortString(JBossStringBuilder buffer)
    {
       buffer.append("name=").append(name);

Modified: projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/AttributeCallbackItem.java
===================================================================
--- projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/AttributeCallbackItem.java	2007-04-21 21:27:21 UTC (rev 62475)
+++ projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/AttributeCallbackItem.java	2007-04-22 10:40:12 UTC (rev 62476)
@@ -21,6 +21,7 @@
 */
 package org.jboss.dependency.plugins;
 
+import org.jboss.dependency.spi.Cardinality;
 import org.jboss.dependency.spi.ControllerContext;
 import org.jboss.dependency.spi.ControllerState;
 import org.jboss.dependency.spi.dispatch.AttributeDispatchContext;
@@ -38,12 +39,12 @@
 
    public AttributeCallbackItem(T name, AttributeDispatchContext owner, String attribute)
    {
-      this(name, null, null, owner, attribute);
+      this(name, null, null, null, owner, attribute);
    }
 
-   public AttributeCallbackItem(T name, ControllerState whenRequired, ControllerState dependentState, AttributeDispatchContext owner, String attribute)
+   public AttributeCallbackItem(T name, ControllerState whenRequired, ControllerState dependentState, Cardinality cardinality, AttributeDispatchContext owner, String attribute)
    {
-      super(name, whenRequired, dependentState);
+      super(name, whenRequired, dependentState, cardinality);
       init(owner, attribute);
    }
 

Modified: projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/NamedCallbackItem.java
===================================================================
--- projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/NamedCallbackItem.java	2007-04-21 21:27:21 UTC (rev 62475)
+++ projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/NamedCallbackItem.java	2007-04-22 10:40:12 UTC (rev 62476)
@@ -21,6 +21,7 @@
 */
 package org.jboss.dependency.plugins;
 
+import org.jboss.dependency.spi.Cardinality;
 import org.jboss.dependency.spi.ControllerState;
 import org.jboss.dependency.spi.dispatch.AttributeDispatchContext;
 
@@ -36,8 +37,8 @@
       super(name, owner, attribute);
    }
 
-   public NamedCallbackItem(Object name, ControllerState whenRequired, ControllerState dependentState, AttributeDispatchContext context, String attribute)
+   public NamedCallbackItem(Object name, ControllerState whenRequired, ControllerState dependentState, Cardinality cardinality, AttributeDispatchContext context, String attribute)
    {
-      super(name, whenRequired, dependentState, context, attribute);
+      super(name, whenRequired, dependentState, cardinality, context, attribute);
    }
 }

Modified: projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/SingleCallbackItem.java
===================================================================
--- projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/SingleCallbackItem.java	2007-04-21 21:27:21 UTC (rev 62475)
+++ projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/SingleCallbackItem.java	2007-04-22 10:40:12 UTC (rev 62476)
@@ -21,6 +21,7 @@
 */
 package org.jboss.dependency.plugins;
 
+import org.jboss.dependency.spi.Cardinality;
 import org.jboss.dependency.spi.ControllerContext;
 import org.jboss.dependency.spi.ControllerState;
 import org.jboss.dependency.spi.dispatch.InvokeDispatchContext;
@@ -44,17 +45,17 @@
 
    public SingleCallbackItem(Object name, InvokeDispatchContext owner, String method, String signature)
    {
-      this(name, null, null, owner, method, signature);
+      this(name, null, null, null, owner, method, signature);
    }
 
-   public SingleCallbackItem(Object name, ControllerState whenRequired, ControllerState dependentState, InvokeDispatchContext owner, String method)
+   public SingleCallbackItem(Object name, ControllerState whenRequired, ControllerState dependentState, Cardinality cardinality, InvokeDispatchContext owner, String method)
    {
-      this(name, whenRequired, dependentState, owner, method, null);
+      this(name, whenRequired, dependentState, cardinality, owner, method, null);
    }
 
-   public SingleCallbackItem(Object name, ControllerState whenRequired, ControllerState dependentState, InvokeDispatchContext owner, String method, String signature)
+   public SingleCallbackItem(Object name, ControllerState whenRequired, ControllerState dependentState, Cardinality cardinality, InvokeDispatchContext owner, String method, String signature)
    {
-      super(name, whenRequired, dependentState);
+      super(name, whenRequired, dependentState, cardinality);
       init(owner, method, signature);
    }
 

Modified: projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/spi/CallbackItem.java
===================================================================
--- projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/spi/CallbackItem.java	2007-04-21 21:27:21 UTC (rev 62475)
+++ projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/spi/CallbackItem.java	2007-04-22 10:40:12 UTC (rev 62476)
@@ -54,6 +54,13 @@
    ControllerState getDependentState();
 
    /**
+    * Get the cardinality.
+    *
+    * @return cardinality
+    */
+   Cardinality getCardinality();
+
+   /**
     * Execute callback when item added to controller.
     *
     * @param controller the controller

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractCallbackMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractCallbackMetaData.java	2007-04-21 21:27:21 UTC (rev 62475)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractCallbackMetaData.java	2007-04-22 10:40:12 UTC (rev 62476)
@@ -168,7 +168,7 @@
          if (typeInfos.length != 1)
             throw new IllegalArgumentException("Illegal size of actual type arguments: " + info);
          Class clazz = typeInfos[0].getType();
-         return CollectionCallbackItemFactory.createCollectionCallbackItem(info.getType(), clazz, whenRequired, dependentState, context, attribute);
+         return CollectionCallbackItemFactory.createCollectionCallbackItem(info.getType(), clazz, whenRequired, dependentState, cardinality, context, attribute);
       }
       else
          throw new IllegalArgumentException("Unable to determine collection element class type: " + this);
@@ -194,7 +194,7 @@
             if (info.isCollection())
                callback = createCollectionCallback(info, context, property);
             else
-               callback = new NamedCallbackItem(info.getType(), whenRequired, dependentState, context, property);
+               callback = new NamedCallbackItem(info.getType(), whenRequired, dependentState, cardinality, context, property);
          }
          else if (methodName != null)
          {
@@ -208,7 +208,7 @@
             else
             {
                Class clazz = info.getType();
-               callback = new SingleCallbackItem(clazz, whenRequired, dependentState, context, methodName, clazz.getName());   
+               callback = new SingleCallbackItem(clazz, whenRequired, dependentState, cardinality, context, methodName, clazz.getName());
             }
          }
          else
@@ -218,14 +218,6 @@
          // demand name is Class in this case
          if (cardinality != null)
          {
-/*
-            Controller controller = vistor.getControllerContext().getController();
-            List<ControllerState> states = controller.getStates();
-            int whenIndex = states.indexOf(whenRequired);
-            if (whenIndex < 0 || whenIndex + 1 == states.size())
-               throw new IllegalArgumentException("Illegal whenRequired state - check cardinality dependency: " + whenRequired);
-            ControllerState dependencyWhenRequired = states.get(whenIndex + 1);
-*/
             vistor.addDependency(new CallbackDependencyItem(context.getName(), (Class)callback.getIDependOn(), whenRequired, dependentState, cardinality));
          }
       }

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/CollectionCallbackItem.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/CollectionCallbackItem.java	2007-04-21 21:27:21 UTC (rev 62475)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/CollectionCallbackItem.java	2007-04-22 10:40:12 UTC (rev 62476)
@@ -25,6 +25,7 @@
 import java.util.Set;
 
 import org.jboss.dependency.plugins.AttributeCallbackItem;
+import org.jboss.dependency.spi.Cardinality;
 import org.jboss.dependency.spi.Controller;
 import org.jboss.dependency.spi.ControllerContext;
 import org.jboss.dependency.spi.ControllerState;
@@ -45,9 +46,9 @@
       super(name, owner, attribute);
    }
 
-   public CollectionCallbackItem(Class name, ControllerState whenRequired, ControllerState dependentState, InvokeDispatchContext context, String attribute)
+   public CollectionCallbackItem(Class name, ControllerState whenRequired, ControllerState dependentState, Cardinality cardinality, InvokeDispatchContext context, String attribute)
    {
-      super(name, whenRequired, dependentState, context, attribute);
+      super(name, whenRequired, dependentState, cardinality, context, attribute);
    }
 
    /**

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/CollectionCallbackItemFactory.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/CollectionCallbackItemFactory.java	2007-04-21 21:27:21 UTC (rev 62475)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/CollectionCallbackItemFactory.java	2007-04-22 10:40:12 UTC (rev 62476)
@@ -26,6 +26,7 @@
 import java.util.HashSet;
 import java.util.LinkedList;
 
+import org.jboss.dependency.spi.Cardinality;
 import org.jboss.dependency.spi.ControllerState;
 import org.jboss.dependency.spi.dispatch.InvokeDispatchContext;
 
@@ -42,7 +43,7 @@
          InvokeDispatchContext context,
          String attribute)
    {
-      return createCollectionCallbackItem(parameterClass, name, null, null, context, attribute);
+      return createCollectionCallbackItem(parameterClass, name, null, null, null, context, attribute);
    }
 
    public static CollectionCallbackItem createCollectionCallbackItem(
@@ -50,6 +51,7 @@
          Class name,
          ControllerState whenRequired,
          ControllerState dependentState,
+         Cardinality cardinality,
          InvokeDispatchContext context,
          String attribute)
    {
@@ -57,11 +59,11 @@
          throw new IllegalArgumentException("Null parameter class!");
 
       if (parameterClass.isAssignableFrom(ArrayList.class))
-         return new ListCallbackItem(name, whenRequired, dependentState, context, attribute);
+         return new ListCallbackItem(name, whenRequired, dependentState, cardinality, context, attribute);
       else if (parameterClass.isAssignableFrom(HashSet.class))
-         return new SetCallbackItem(name, whenRequired, dependentState, context, attribute);
+         return new SetCallbackItem(name, whenRequired, dependentState, cardinality, context, attribute);
       else if (parameterClass.isAssignableFrom(LinkedList.class))
-         return new QueueCallbackItem(name, whenRequired, dependentState, context, attribute);
+         return new QueueCallbackItem(name, whenRequired, dependentState, cardinality, context, attribute);
       else
          throw new IllegalArgumentException("No matching callback impl for parameter type: " + parameterClass);
    }

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/ListCallbackItem.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/ListCallbackItem.java	2007-04-21 21:27:21 UTC (rev 62475)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/ListCallbackItem.java	2007-04-22 10:40:12 UTC (rev 62476)
@@ -24,6 +24,7 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.jboss.dependency.spi.Cardinality;
 import org.jboss.dependency.spi.ControllerState;
 import org.jboss.dependency.spi.dispatch.InvokeDispatchContext;
 
@@ -39,9 +40,9 @@
       super(name, owner, attribute);
    }
 
-   public ListCallbackItem(Class name, ControllerState whenRequired, ControllerState dependentState, InvokeDispatchContext context, String attribute)
+   public ListCallbackItem(Class name, ControllerState whenRequired, ControllerState dependentState, Cardinality cardinality, InvokeDispatchContext context, String attribute)
    {
-      super(name, whenRequired, dependentState, context, attribute);
+      super(name, whenRequired, dependentState, cardinality, context, attribute);
    }
 
    protected List<Object> getCollectionParameterHolder()

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/QueueCallbackItem.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/QueueCallbackItem.java	2007-04-21 21:27:21 UTC (rev 62475)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/QueueCallbackItem.java	2007-04-22 10:40:12 UTC (rev 62476)
@@ -24,6 +24,7 @@
 import java.util.LinkedList;
 import java.util.Queue;
 
+import org.jboss.dependency.spi.Cardinality;
 import org.jboss.dependency.spi.ControllerState;
 import org.jboss.dependency.spi.dispatch.InvokeDispatchContext;
 
@@ -39,9 +40,9 @@
       super(name, owner, attribute);
    }
 
-   public QueueCallbackItem(Class name, ControllerState whenRequired, ControllerState dependentState, InvokeDispatchContext context, String attribute)
+   public QueueCallbackItem(Class name, ControllerState whenRequired, ControllerState dependentState, Cardinality cardinality, InvokeDispatchContext context, String attribute)
    {
-      super(name, whenRequired, dependentState, context, attribute);
+      super(name, whenRequired, dependentState, cardinality, context, attribute);
    }
 
    protected Queue<Object> getCollectionParameterHolder()

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/SetCallbackItem.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/SetCallbackItem.java	2007-04-21 21:27:21 UTC (rev 62475)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/SetCallbackItem.java	2007-04-22 10:40:12 UTC (rev 62476)
@@ -24,6 +24,7 @@
 import java.util.HashSet;
 import java.util.Set;
 
+import org.jboss.dependency.spi.Cardinality;
 import org.jboss.dependency.spi.ControllerState;
 import org.jboss.dependency.spi.dispatch.InvokeDispatchContext;
 
@@ -39,9 +40,9 @@
       super(name, owner, attribute);
    }
 
-   public SetCallbackItem(Class name, ControllerState whenRequired, ControllerState dependentState, InvokeDispatchContext context, String attribute)
+   public SetCallbackItem(Class name, ControllerState whenRequired, ControllerState dependentState, Cardinality cardinality, InvokeDispatchContext context, String attribute)
    {
-      super(name, whenRequired, dependentState, context, attribute);
+      super(name, whenRequired, dependentState, cardinality, context, attribute);
    }
 
    protected Set<Object> getCollectionParameterHolder()




More information about the jboss-cvs-commits mailing list