org.jboss.kernel.plugins.dependency
Class AbstractKernelControllerContext

java.lang.Object
  extended by org.jboss.util.JBossObject
      extended by org.jboss.dependency.plugins.AbstractControllerContext
          extended by org.jboss.kernel.plugins.dependency.AbstractKernelControllerContext
All Implemented Interfaces:
Cloneable, ControllerContext, AttributeDispatchContext, InvokeDispatchContext, LifecycleDispatchContext, KernelControllerContext, KernelRegistryEntry, org.jboss.util.JBossInterface

public class AbstractKernelControllerContext
extends AbstractControllerContext
implements KernelControllerContext

Controller context.

Version:
$Revision: 90317 $
Author:
Adrian Brock, Ales Justin

Field Summary
 
Fields inherited from class org.jboss.util.JBossObject
hashCode, log, toString
 
Constructor Summary
AbstractKernelControllerContext(org.jboss.beans.info.spi.BeanInfo info, BeanMetaData metaData, Object target)
          Create an abstract controller context
 
Method Summary
 Object get(String name)
          Getter property / attribute
 AccessControlContext getAccessControlContext()
          Get the access control context of the code that created this context.
 org.jboss.beans.info.spi.BeanInfo getBeanInfo()
          Get the BeanInfo
 BeanMetaData getBeanMetaData()
          Get the metadata
 ClassLoader getClassLoader()
          Get context's classloader.
protected  org.jboss.beans.info.spi.BeanInfo getInfo()
           
 Kernel getKernel()
          Get the kernel
protected  void infoprocessMetaData()
          Preprocess the metadata for this context
protected  void initKernelScopeInfo()
           
protected  void initScopeInfo()
          Initialise the scope info
 Object invoke(String name, Object[] parameters, String[] signature)
          Invoke method / operation
 ControllerState lifecycleInvocation(String name, Object[] parameters, String[] signature)
          Is this invocation a lifecycle invocation.
protected  void preprocessMetaData()
          Preprocess the metadata for this context
 void set(String name, Object value)
          Setter property / attribute
 void setBeanInfo(org.jboss.beans.info.spi.BeanInfo info)
          Set the bean info
 void setController(Controller controller)
          Set the controller
 void toString(org.jboss.util.JBossStringBuilder buffer)
           
protected static boolean useLifecycleState(String name, String[] signature, LifecycleMetaData lmd, String defaultName)
          Get lifecycle state if it matches the parameters.
protected  void validateMethodValues(String name, String[] signature, Object[] paramaters)
          Validate method invocation.
 
Methods inherited from class org.jboss.dependency.plugins.AbstractControllerContext
getAliases, getController, getDependencyInfo, getError, getErrorHandlingMode, getMode, getName, getRequiredState, getScopeInfo, getState, getTarget, install, needsAnAlias, setAliases, setError, setErrorHandlingMode, setMode, setName, setRequiredState, setScopeInfo, setState, setTarget, toShortString, uninstall
 
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
 
Methods inherited from interface org.jboss.kernel.spi.dependency.KernelControllerContext
setTarget
 
Methods inherited from interface org.jboss.kernel.spi.registry.KernelRegistryEntry
setName
 
Methods inherited from interface org.jboss.dependency.spi.ControllerContext
getAliases, getController, getDependencyInfo, getError, getErrorHandlingMode, getMode, getName, getRequiredState, getScopeInfo, getState, getTarget, install, setError, setMode, setRequiredState, setState, uninstall
 
Methods inherited from interface org.jboss.util.JBossInterface
clone, toShortString, toShortString
 

Constructor Detail

AbstractKernelControllerContext

public AbstractKernelControllerContext(org.jboss.beans.info.spi.BeanInfo info,
                                       BeanMetaData metaData,
                                       Object target)
Create an abstract controller context

Parameters:
info - the bean info
metaData - the meta data
target - any target object
Method Detail

getKernel

public Kernel getKernel()
Description copied from interface: KernelControllerContext
Get the kernel

Specified by:
getKernel in interface KernelControllerContext
Returns:
the kernel

getBeanInfo

public org.jboss.beans.info.spi.BeanInfo getBeanInfo()
Description copied from interface: KernelControllerContext
Get the BeanInfo

Specified by:
getBeanInfo in interface KernelControllerContext
Returns:
the bean info

setBeanInfo

public void setBeanInfo(org.jboss.beans.info.spi.BeanInfo info)
Set the bean info

Specified by:
setBeanInfo in interface KernelControllerContext
Parameters:
info - the bean info

getBeanMetaData

public BeanMetaData getBeanMetaData()
Description copied from interface: KernelControllerContext
Get the metadata

Specified by:
getBeanMetaData in interface KernelControllerContext
Returns:
the bean metadata

toString

public void toString(org.jboss.util.JBossStringBuilder buffer)
Overrides:
toString in class AbstractControllerContext

setController

public void setController(Controller controller)
Description copied from interface: ControllerContext
Set the controller

Specified by:
setController in interface ControllerContext
Overrides:
setController in class AbstractControllerContext
Parameters:
controller - the controller

initScopeInfo

protected void initScopeInfo()
Description copied from class: AbstractControllerContext
Initialise the scope info

Overrides:
initScopeInfo in class AbstractControllerContext

initKernelScopeInfo

protected void initKernelScopeInfo()

preprocessMetaData

protected void preprocessMetaData()
Preprocess the metadata for this context


infoprocessMetaData

protected void infoprocessMetaData()
Preprocess the metadata for this context


getAccessControlContext

public AccessControlContext getAccessControlContext()
Get the access control context of the code that created this context.

This will be null when there is no security manager.

Returns:
any access control context

getInfo

protected org.jboss.beans.info.spi.BeanInfo getInfo()

get

public Object get(String name)
           throws Throwable
Description copied from interface: AttributeDispatchContext
Getter property / attribute

Specified by:
get in interface AttributeDispatchContext
Parameters:
name - property / attribute name
Returns:
target's property / attribute instance
Throws:
Throwable - for any error

set

public void set(String name,
                Object value)
         throws Throwable
Description copied from interface: AttributeDispatchContext
Setter property / attribute

Specified by:
set in interface AttributeDispatchContext
Parameters:
name - property / attribute name
value - set target's property / attribute instance
Throws:
Throwable - for any error

invoke

public Object invoke(String name,
                     Object[] parameters,
                     String[] signature)
              throws Throwable
Description copied from interface: InvokeDispatchContext
Invoke method / operation

Specified by:
invoke in interface InvokeDispatchContext
Parameters:
name - method name
parameters - parameter values
signature - method's parameter types / signatures
Returns:
inovocation's return object
Throws:
Throwable - for any error

getClassLoader

public ClassLoader getClassLoader()
                           throws Throwable
Description copied from interface: InvokeDispatchContext
Get context's classloader. Used when determining type info for parameter and getting the parameter actual value.

Specified by:
getClassLoader in interface InvokeDispatchContext
Returns:
context's classloader
Throws:
Throwable - for any error

lifecycleInvocation

public ControllerState lifecycleInvocation(String name,
                                           Object[] parameters,
                                           String[] signature)
                                    throws Throwable
Description copied from interface: LifecycleDispatchContext
Is this invocation a lifecycle invocation. Return state value to which this context should be moved or return current state if we're already past the lifecycle state or null if the invocation is actually not a lifecycle invocation.

Specified by:
lifecycleInvocation in interface LifecycleDispatchContext
Parameters:
name - method name
parameters - parameter values
signature - method's parameter types / signatures
Returns:
state to which we should move this context, or null if this is not lifecycle invocation
Throws:
Throwable - for any error

useLifecycleState

protected static boolean useLifecycleState(String name,
                                           String[] signature,
                                           LifecycleMetaData lmd,
                                           String defaultName)
Get lifecycle state if it matches the parameters.

Parameters:
name - the method name
signature - the signature
lmd - the lifecycle metadata
defaultName - the default name
Returns:
true if lifecycle matches, false otherwise

validateMethodValues

protected void validateMethodValues(String name,
                                    String[] signature,
                                    Object[] paramaters)
                             throws Throwable
Validate method invocation. Use jsr303 constraints.

Parameters:
name - the method name
signature - the method signature
paramaters - the parameter values
Throws:
Throwable - for any error


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