|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.util.JBossObject
org.jboss.dependency.plugins.AbstractController
public class AbstractController
Abstract controller.
Field Summary |
---|
Fields inherited from class org.jboss.util.JBossObject |
---|
hashCode, log, toString |
Constructor Summary | |
---|---|
AbstractController()
Create an abstract controller |
Method Summary | ||
---|---|---|
void |
addAlias(Object alias,
Object original)
Add alias. |
|
protected
|
addCallback(Object name,
boolean isInstallPhase,
CallbackItem<T> callback)
Add callback item under demand name. |
|
boolean |
addController(AbstractController controller)
Add child controller. |
|
void |
addState(ControllerState state,
ControllerState before)
Add a state. |
|
protected boolean |
advance(ControllerContext context)
Whether we should advance the context |
|
void |
change(ControllerContext context,
ControllerState state)
Change a context to the given state |
|
protected void |
change(ControllerContext context,
ControllerState state,
boolean trace)
Change a context's state |
|
void |
checkShutdown()
Check whether the controller is shutdown |
|
protected Map<ControllerState,ControllerContextAction> |
createAliasActions()
Create alias controller context actions. |
|
void |
enableOnDemand(ControllerContext context)
Enable an on demand context |
|
protected void |
enableOnDemand(ControllerContext context,
boolean trace)
Enable an on demand context |
|
Set<ControllerContext> |
getAllContexts()
Get all the contexts. |
|
protected Set<CallbackItem<?>> |
getCallbacks(Object name,
boolean isInstallPhase)
Get the matching callbacks. |
|
protected Collection<Class<?>> |
getClassesImplemented(Object target)
Get implemented classes. |
|
ControllerContext |
getContext(Object name,
ControllerState state)
Get a context |
|
ControllerContext |
getContext(Object name,
ControllerState state,
SearchInfo info)
Get the context. |
|
protected void |
getContexts(Object name,
Set<ControllerContext> contexts)
Get all contexts by name, check child controllers as well. |
|
Set<ControllerContext> |
getContextsByState(ControllerState state)
Get the contexts in certain state |
|
Set<AbstractController> |
getControllers()
Get child controllers. |
|
protected Set<CallbackItem<?>> |
getDependencyCallbacks(ControllerContext context,
boolean isInstallPhase)
Get calbacks from context. |
|
protected Executor |
getExecutionEnvironment()
Get the executor internal w/o security check. |
|
Executor |
getExecutor()
Get the executor. |
|
protected String |
getId()
Get controller id - impl detail. |
|
ControllerContext |
getInstalledContext(Object name)
Get an installed context |
|
ControllerState |
getNextState(ControllerState state)
Get next state from state param or null if state param is the last. |
|
Set<ControllerContext> |
getNotInstalled()
Get the contexts not installed |
|
AbstractController |
getParentController()
Get the parent controller. |
|
ControllerState |
getPreviousState(ControllerState state)
Get previous state from state param or null if state param is the first. |
|
protected ControllerContext |
getRegisteredControllerContext(Object name,
boolean mustExist)
Get a registered context |
|
protected ControllerState |
getState(int index)
Get the controller state form index. |
|
protected int |
getStateIndex(ControllerState state)
Get the state index. |
|
protected int |
getStateIndex(ControllerState state,
boolean allowNotFound)
Get the state index. |
|
ControllerStateModel |
getStates()
Get the states model. |
|
protected void |
handleInstallLifecycleCallbacks(ControllerContext context,
ControllerState state)
Handle install lifecycle callbacks. |
|
protected void |
handleLifecycleCallbacks(ControllerContext context,
ControllerState state,
boolean install)
Handle lifecycle callbacks. |
|
protected void |
handleUninstallLifecycleCallbacks(ControllerContext context,
ControllerState state)
Handle uninstall lifecycle callbacks. |
|
protected boolean |
incrementState(ControllerContext context,
boolean trace)
Increment state |
|
void |
install(ControllerContext context)
Install a context |
|
protected void |
install(ControllerContext context,
boolean trace)
Install a context |
|
protected void |
install(ControllerContext context,
ControllerState fromState,
ControllerState toState)
Install a context |
|
boolean |
isActive()
Whether the controller has contexts |
|
boolean |
isAfterState(ControllerState state,
ControllerState reference)
Is state param after reference state param. |
|
boolean |
isBeforeState(ControllerState state,
ControllerState reference)
Is state param before reference state param. |
|
boolean |
isCollectStats()
Get the collectStats. |
|
boolean |
isShutdown()
Whether the controller is shutdown |
|
Iterator<ControllerState> |
iterator()
|
|
ListIterator<ControllerState> |
listIteraror()
Get the list iterator. |
|
String |
listStateTimes(boolean details)
List the state times |
|
protected void |
lockRead()
Lock for read |
|
protected void |
lockWrite()
Lock for write |
|
protected void |
preAliasInstall(ControllerContext aliasContext)
Apply pre install - e.g. |
|
protected void |
registerControllerContext(ControllerContext context)
Register a context and all its aliases |
|
protected void |
registerControllerContext(Object name,
ControllerContext context)
Register a context |
|
void |
removeAlias(Object alias)
Remove alias. |
|
protected
|
removeCallback(Object name,
boolean isInstallPhase,
CallbackItem<T> callback)
Remove callback item under demand name. |
|
boolean |
removeController(AbstractController controller)
Remove child controller. |
|
protected void |
resolveCallbacks(ControllerContext context,
ControllerState state,
boolean isInstallPhase)
Resolve callback items. |
|
protected void |
resolveCallbacks(Set<CallbackItem<?>> callbacks,
ControllerState state,
boolean execute,
boolean isInstallPhase,
boolean type)
Resolve callbacks. |
|
protected void |
resolveContexts(boolean trace)
Resolve unresolved contexts |
|
protected boolean |
resolveContexts(ControllerState fromState,
ControllerState toState,
boolean trace)
Resolve contexts |
|
protected Set<ControllerContext> |
resolveContexts(Set<ControllerContext> contexts,
ControllerState state,
boolean trace)
Resolve contexts |
|
void |
setCollectStats(boolean collectStats)
Set the collectStats. |
|
void |
setExecutor(Executor executor)
Set the executor. |
|
protected void |
setParentController(AbstractController parentController)
Set the parent controller. |
|
void |
shutdown()
Shutdown the controller |
|
protected void |
traverseClass(Class<?> clazz,
Set<Class<?>> classes)
Recurse over classes. |
|
protected void |
uninstall(ControllerContext context,
ControllerState fromState,
ControllerState toState)
Uninstall a context |
|
ControllerContext |
uninstall(Object name)
Uninstall a context |
|
protected ControllerContext |
uninstall(Object name,
int level)
Uninstall the context. |
|
protected void |
uninstallContext(ControllerContext context,
boolean trace)
Uninstall a context |
|
protected void |
uninstallContext(ControllerContext context,
ControllerState toState,
boolean trace)
Uninstall a context This method must be invoked with the write lock taken |
|
protected void |
unlockRead()
Unlock for read |
|
protected void |
unlockWrite()
Unlock for write |
|
protected void |
unregisterControllerContext(ControllerContext context)
Unregister a context and all its aliases |
|
protected void |
unregisterControllerContext(Object name)
Unregister a context |
Methods inherited from class org.jboss.util.JBossObject |
---|
cacheGetHashCode, cacheToString, clone, equals, flushJBossObjectCache, getClassShortName, getHashCode, hashCode, list, notEqual, toShortString, toShortString, toString, toString, toStringImplementation |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.jboss.util.JBossInterface |
---|
clone, toShortString, toShortString |
Constructor Detail |
---|
public AbstractController()
Method Detail |
---|
public void setExecutor(Executor executor)
executor
- the executorpublic Executor getExecutor()
protected Executor getExecutionEnvironment()
public boolean isShutdown()
Controller
isShutdown
in interface Controller
public void checkShutdown()
IllegalStateException
- when already shutdownpublic void shutdown()
Controller
shutdown
in interface Controller
public boolean isCollectStats()
public void setCollectStats(boolean collectStats)
collectStats
- the collectStats.public String listStateTimes(boolean details)
AbstractControllerMBean
listStateTimes
in interface AbstractControllerMBean
details
- whether to show details
public void addState(ControllerState state, ControllerState before)
Controller
addState
in interface Controller
state
- the state to addbefore
- the state to add before or null to add to the endpublic AbstractController getParentController()
protected void setParentController(AbstractController parentController)
parentController
- the parent controllerpublic Set<AbstractController> getControllers()
public boolean addController(AbstractController controller)
controller
- the child controller
public boolean removeController(AbstractController controller)
controller
- the child controller
public boolean isActive()
public ControllerContext getContext(Object name, ControllerState state, SearchInfo info)
GraphController
getContext
in interface GraphController
name
- the context namestate
- the required stateinfo
- the seatch info
public Set<ControllerContext> getAllContexts()
public ControllerContext getContext(Object name, ControllerState state)
Controller
getContext
in interface Controller
name
- the name of the componentstate
- the state (pass null for any state)
public ControllerContext getInstalledContext(Object name)
Controller
getInstalledContext
in interface Controller
name
- the name of the component
public Set<ControllerContext> getNotInstalled()
Controller
getNotInstalled
in interface Controller
public ControllerStateModel getStates()
Controller
getStates
in interface Controller
public Set<ControllerContext> getContextsByState(ControllerState state)
Controller
getContextsByState
in interface Controller
state
- controller state to get contexts for
public void install(ControllerContext context) throws Throwable
Controller
install
in interface Controller
context
- the context
Throwable
- for any errorpublic void change(ControllerContext context, ControllerState state) throws Throwable
Controller
change
in interface Controller
context
- the contextstate
- the state
Throwable
- for any errorpublic void enableOnDemand(ControllerContext context) throws Throwable
Controller
enableOnDemand
in interface Controller
context
- the context
Throwable
- for any errorpublic ControllerContext uninstall(Object name)
Controller
uninstall
in interface Controller
name
- the name of the component
protected String getId()
public void addAlias(Object alias, Object original) throws Throwable
Controller
addAlias
in interface Controller
alias
- the alias to addoriginal
- original name
Throwable
- for any errorprotected Map<ControllerState,ControllerContextAction> createAliasActions()
protected void preAliasInstall(ControllerContext aliasContext)
aliasContext
- the new alias contextpublic void removeAlias(Object alias)
Controller
removeAlias
in interface Controller
alias
- alias to removeprotected ControllerContext uninstall(Object name, int level)
name
- the context namelevel
- the controller level
protected void install(ControllerContext context, boolean trace) throws Throwable
context
- the contexttrace
- whether trace is enabled
Throwable
- for any errorprotected void change(ControllerContext context, ControllerState state, boolean trace) throws Throwable
context
- the contextstate
- the required statetrace
- whether trace is enabled
Throwable
- for any errorprotected void enableOnDemand(ControllerContext context, boolean trace) throws Throwable
context
- the contexttrace
- whether trace is enabled
Throwable
- for any errorprotected boolean incrementState(ControllerContext context, boolean trace)
This method must be invoked with the write lock taken.
context
- the contexttrace
- whether trace is enabled
protected void resolveContexts(boolean trace)
This method must be invoked with the write lock taken
trace
- whether trace is enabledprotected boolean resolveContexts(ControllerState fromState, ControllerState toState, boolean trace)
This method must be invoked with the write lock taken
fromState
- the from statetoState
- the to statetrace
- whether trace is enabled
protected Set<ControllerContext> resolveContexts(Set<ControllerContext> contexts, ControllerState state, boolean trace)
This method must be invoked with the write lock taken
contexts
- the contextsstate
- the statetrace
- whether trace is enabled
protected void uninstallContext(ControllerContext context, ControllerState toState, boolean trace)
context
- the context to uninstalltoState
- the target statetrace
- whether trace is enabledprotected void uninstallContext(ControllerContext context, boolean trace)
This method must be invoked with the write lock taken
context
- the context to uninstalltrace
- whether trace is enabledprotected void getContexts(Object name, Set<ControllerContext> contexts)
name
- the name of the contextcontexts
- found contextsprotected <T> void addCallback(Object name, boolean isInstallPhase, CallbackItem<T> callback)
T
- the callback item typename
- demand nameisInstallPhase
- install or uninstall phasecallback
- callback itemprotected <T> void removeCallback(Object name, boolean isInstallPhase, CallbackItem<T> callback)
T
- the callback item typename
- demand nameisInstallPhase
- install or uninstall phasecallback
- callback itemprotected Set<CallbackItem<?>> getDependencyCallbacks(ControllerContext context, boolean isInstallPhase)
context
- current contextisInstallPhase
- install or uninstall phase
protected Set<CallbackItem<?>> getCallbacks(Object name, boolean isInstallPhase)
name
- demand nameisInstallPhase
- install or uninstall phase
protected void resolveCallbacks(Set<CallbackItem<?>> callbacks, ControllerState state, boolean execute, boolean isInstallPhase, boolean type)
callbacks
- the callbacksstate
- current context stateexecute
- do execute callbackisInstallPhase
- install or uninstall phasetype
- install or uninstall typeprotected void resolveCallbacks(ControllerContext context, ControllerState state, boolean isInstallPhase)
context
- current contextstate
- current context stateisInstallPhase
- install or uninstall phaseprotected void handleInstallLifecycleCallbacks(ControllerContext context, ControllerState state) throws Throwable
context
- the contextstate
- the state
Throwable
- for any errorprotected void handleUninstallLifecycleCallbacks(ControllerContext context, ControllerState state) throws Throwable
context
- the contextstate
- the state
Throwable
- for any errorprotected void handleLifecycleCallbacks(ControllerContext context, ControllerState state, boolean install) throws Throwable
context
- the contextstate
- the stateinstall
- is it install or uninstall
Throwable
- for any errorprotected Collection<Class<?>> getClassesImplemented(Object target)
target
- target value / bean
protected void traverseClass(Class<?> clazz, Set<Class<?>> classes)
clazz
- current classclasses
- classes holder setprotected void install(ControllerContext context, ControllerState fromState, ControllerState toState) throws Throwable
This method must be invoked with NO locks taken
context
- the contextfromState
- the from statetoState
- the toState
Throwable
- for any errorprotected void uninstall(ControllerContext context, ControllerState fromState, ControllerState toState)
This method must be invoked with NO locks taken
context
- the contextfromState
- the from statetoState
- the to stateprotected boolean advance(ControllerContext context)
This method must be invoked with the write lock taken
context
- the context
protected void lockRead()
protected void unlockRead()
protected void lockWrite()
protected void unlockWrite()
protected ControllerContext getRegisteredControllerContext(Object name, boolean mustExist)
This method should be invoked with at least the read lock taken
name
- the name with which to register itmustExist
- whether to throw an error when the context does not exist
IllegalArgumentException
- for null parameters
IllegalStateException
- if the context if must exist is true and the context does not existprotected void registerControllerContext(ControllerContext context)
This method must be invoked with the write lock taken
context
- the context to register
IllegalArgumentException
- for null parameters
IllegalStateException
- if the context is already registered with that name or aliasprotected void unregisterControllerContext(ControllerContext context)
This method must be invoked with the write lock taken
context
- the context
IllegalArgumentException
- for null parameters
IllegalStateException
- if the context is not registeredprotected void registerControllerContext(Object name, ControllerContext context)
This method must be invoked with the write lock taken
NOTE: You probably want to use the
registerControllerContext(ControllerContext)
name
- the name with which to register itcontext
- the context to register
IllegalArgumentException
- for null parameters
IllegalStateException
- if the context is already registered with that nameprotected void unregisterControllerContext(Object name)
This method must be invoked with the write lock taken
NOTE: You probably want to use the
unregisterControllerContext(ControllerContext)
name
- the name it was registered with
IllegalArgumentException
- for null parameterspublic ListIterator<ControllerState> listIteraror()
ControllerStateModel
listIteraror
in interface ControllerStateModel
public ControllerState getPreviousState(ControllerState state)
ControllerStateModel
getPreviousState
in interface ControllerStateModel
state
- the current state
public ControllerState getNextState(ControllerState state)
ControllerStateModel
getNextState
in interface ControllerStateModel
state
- the current state
public boolean isBeforeState(ControllerState state, ControllerState reference)
ControllerStateModel
isBeforeState
in interface ControllerStateModel
state
- the state we are checkingreference
- the state we are checking against
public boolean isAfterState(ControllerState state, ControllerState reference)
ControllerStateModel
isAfterState
in interface ControllerStateModel
state
- the state we are checkingreference
- the state we are checking against
public Iterator<ControllerState> iterator()
iterator
in interface Iterable<ControllerState>
protected int getStateIndex(ControllerState state)
state
- the state
protected int getStateIndex(ControllerState state, boolean allowNotFound)
state
- the stateallowNotFound
- allow not found state
protected ControllerState getState(int index)
index
- the state index
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |