org.jboss.kernel.plugins.dependency
Class CollectionCallbackItem<T extends Collection<Object>>

java.lang.Object
  extended by org.jboss.util.JBossObject
      extended by org.jboss.dependency.plugins.AbstractCallbackItem<T>
          extended by org.jboss.dependency.plugins.OwnerCallbackItem<Class<?>,InvokeDispatchContext>
              extended by org.jboss.kernel.plugins.dependency.CollectionCallbackItem<T>
Type Parameters:
T - expected collection type
All Implemented Interfaces:
Cloneable, CallbackItem<Class<?>>, org.jboss.util.JBossInterface
Direct Known Subclasses:
CollectionCreatorCallbackItem

public abstract class CollectionCallbackItem<T extends Collection<Object>>
extends OwnerCallbackItem<Class<?>,InvokeDispatchContext>

Collection callback item.

Author:
Ales Justin

Field Summary
protected  AttributeInfo attribute
           
protected  Cardinality cardinality
           
 
Fields inherited from class org.jboss.dependency.plugins.OwnerCallbackItem
owner
 
Fields inherited from class org.jboss.dependency.plugins.AbstractCallbackItem
attributeName, dependentState, name, whenRequired
 
Fields inherited from class org.jboss.util.JBossObject
hashCode, log, toString
 
Constructor Summary
CollectionCallbackItem(Class<?> name, ControllerState whenRequired, ControllerState dependentState, Cardinality cardinality, InvokeDispatchContext context, AttributeInfo attribute)
           
CollectionCallbackItem(Class<?> name, InvokeDispatchContext owner, AttributeInfo attribute)
           
 
Method Summary
 void changeCallback(Controller controller, ControllerContext context, boolean isInstallPhase)
          Execute callback with current changed context.
protected  DependencyItem createDependencyItem(ControllerContext owner)
          Create dependency - if it exists.
protected  void execute(T holder)
           
protected  T fillHolder(Controller controller)
          Fill collection impl with existing context targets.
protected abstract  T getCollectionParameterHolder()
          Create new collection impl instance - HashSet, ArrayList, ...
 void ownerCallback(Controller controller, boolean isInstallPhase)
          Execute callback when item added to controller.
protected  void removeUninstallingContext(T holder, ControllerContext context)
          Remove the uninstalling context from holder.
 
Methods inherited from class org.jboss.dependency.plugins.OwnerCallbackItem
addDependency, toString
 
Methods inherited from class org.jboss.dependency.plugins.AbstractCallbackItem
changeCallback, getAttributeName, getDependentState, getIDependOn, getWhenRequired, toShortString
 
Methods inherited from class org.jboss.util.JBossObject
cacheGetHashCode, cacheToString, clone, equals, flushJBossObjectCache, getClassShortName, getHashCode, hashCode, list, notEqual, toShortString, toString, toStringImplementation
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

cardinality

protected Cardinality cardinality

attribute

protected AttributeInfo attribute
Constructor Detail

CollectionCallbackItem

public CollectionCallbackItem(Class<?> name,
                              InvokeDispatchContext owner,
                              AttributeInfo attribute)

CollectionCallbackItem

public CollectionCallbackItem(Class<?> name,
                              ControllerState whenRequired,
                              ControllerState dependentState,
                              Cardinality cardinality,
                              InvokeDispatchContext context,
                              AttributeInfo attribute)
Method Detail

getCollectionParameterHolder

protected abstract T getCollectionParameterHolder()
Create new collection impl instance - HashSet, ArrayList, ...

Returns:
new collection impl instance

fillHolder

protected T fillHolder(Controller controller)
                                           throws Throwable
Fill collection impl with existing context targets.

Parameters:
controller - the controller
Returns:
collection holder with target beans
Throws:
Throwable - for any error

execute

protected void execute(T holder)
                throws Throwable
Throws:
Throwable

createDependencyItem

protected DependencyItem createDependencyItem(ControllerContext owner)
Description copied from class: OwnerCallbackItem
Create dependency - if it exists.

Overrides:
createDependencyItem in class OwnerCallbackItem<Class<?>,InvokeDispatchContext>
Parameters:
owner - if owner is controller context
Returns:
dependency or null if no such dependency exists

ownerCallback

public void ownerCallback(Controller controller,
                          boolean isInstallPhase)
                   throws Throwable
Description copied from interface: CallbackItem
Execute callback when item added to controller.

Specified by:
ownerCallback in interface CallbackItem<Class<?>>
Overrides:
ownerCallback in class AbstractCallbackItem<Class<?>>
Parameters:
controller - the controller
isInstallPhase - install or uninstall
Throws:
Throwable - for any error

changeCallback

public void changeCallback(Controller controller,
                           ControllerContext context,
                           boolean isInstallPhase)
                    throws Throwable
Description copied from interface: CallbackItem
Execute callback with current changed context.

Specified by:
changeCallback in interface CallbackItem<Class<?>>
Overrides:
changeCallback in class OwnerCallbackItem<Class<?>,InvokeDispatchContext>
Parameters:
controller - the controller
context - the new context
isInstallPhase - install or uninstall
Throws:
Throwable - for any error

removeUninstallingContext

protected void removeUninstallingContext(T holder,
                                         ControllerContext context)
Remove the uninstalling context from holder. Since the context is about to change state - not part of callback watched targets. Can be overridden for different remove behaviour.

Parameters:
holder - collection holder
context - current context


Copyright © 2010 JBoss, a division of Red Hat, Inc.. All Rights Reserved.