|
||||||||||
| 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)
|
|
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 |
|
void |
enableOnDemand(ControllerContext context)
Enable an on demand context |
|
protected void |
enableOnDemand(ControllerContext context,
boolean trace)
Enable an on demand context |
|
Set<ControllerContext> |
getAllContexts()
|
|
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 |
|
Set<ControllerContext> |
getContextsByState(ControllerState state)
Get the contexts in certain state |
|
Set<AbstractController> |
getControllers()
|
|
protected Set<CallbackItem<?>> |
getDependencyCallbacks(ControllerContext context,
boolean isInstallPhase)
Get calbacks from context. |
|
ControllerContext |
getInstalledContext(Object name)
Get an installed context |
|
Set<ControllerContext> |
getNotInstalled()
Get the contexts not installed |
|
protected AbstractController |
getParentController()
|
|
protected ControllerContext |
getRegisteredControllerContext(Object name,
boolean mustExist)
Get a registered context |
|
List<ControllerState> |
getStates()
Get the states. |
|
protected void |
handleInstallLifecycleCallbacks(ControllerContext context,
ControllerState state)
|
|
protected void |
handleLifecycleCallbacks(ControllerContext context,
ControllerState state,
boolean install)
|
|
protected void |
handleUninstallLifecycleCallbacks(ControllerContext context,
ControllerState state)
|
|
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 |
|
protected boolean |
isAutowireCandidate(ControllerContext context)
Can we use this context for autowiring. |
|
boolean |
isShutdown()
Whether the controller is shutdown |
|
protected void |
lockRead()
Lock for read |
|
protected void |
lockWrite()
Lock for write |
|
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)
|
|
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 |
|
protected void |
setParentController(AbstractController parentController)
|
|
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)
|
|
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 boolean isShutdown()
Controller
isShutdown in interface Controllerpublic void checkShutdown()
IllegalStateException - when already shutdownpublic void shutdown()
Controller
shutdown in interface Controller
public void addState(ControllerState state,
ControllerState before)
Controller
addState in interface Controllerstate - the state to addbefore - the state to add before or null to add to the endprotected AbstractController getParentController()
protected void setParentController(AbstractController parentController)
public Set<AbstractController> getControllers()
public boolean addController(AbstractController controller)
public boolean removeController(AbstractController controller)
public boolean isActive()
public Set<ControllerContext> getAllContexts()
public ControllerContext getContext(Object name,
ControllerState state)
Controller
getContext in interface Controllername - the name of the componentstate - the state (pass null for any state)
public ControllerContext getInstalledContext(Object name)
Controller
getInstalledContext in interface Controllername - the name of the component
public Set<ControllerContext> getNotInstalled()
Controller
getNotInstalled in interface Controllerpublic List<ControllerState> getStates()
Controller
getStates in interface Controllerpublic Set<ControllerContext> getContextsByState(ControllerState state)
Controller
getContextsByState in interface Controllerstate - controller state to get contexts for
public void install(ControllerContext context)
throws Throwable
Controller
install in interface Controllercontext - the context
Throwable - for any error
public void change(ControllerContext context,
ControllerState state)
throws Throwable
Controller
change in interface Controllercontext - the contextstate - the state
Throwable - for any error
public void enableOnDemand(ControllerContext context)
throws Throwable
Controller
enableOnDemand in interface Controllercontext - the context
Throwable - for any errorpublic ControllerContext uninstall(Object name)
Controller
uninstall in interface Controllername - the name of the component
public void addAlias(Object alias,
Object original)
throws Throwable
Controller
addAlias in interface Controlleralias - the alias to addoriginal - original name
Throwable - for any errorpublic void removeAlias(Object alias)
Controller
removeAlias in interface Controlleralias - alias to remove
protected ControllerContext uninstall(Object name,
int level)
protected void install(ControllerContext context,
boolean trace)
throws Throwable
context - the contexttrace - whether trace is enabled
Throwable - for any error
protected void change(ControllerContext context,
ControllerState state,
boolean trace)
throws Throwable
context - the contextstate - the required statetrace - whether trace is enabled
Throwable - for any error
protected void enableOnDemand(ControllerContext context,
boolean trace)
throws Throwable
context - the contexttrace - whether trace is enabled
Throwable - for any error
protected 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 enabled
protected 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 enabled
protected void uninstallContext(ControllerContext context,
boolean trace)
This method must be invoked with the write lock taken
context - the context to uninstalltrace - whether trace is enabled
protected <T> void addCallback(Object name,
boolean isInstallPhase,
CallbackItem<T> callback)
T - the callback item typename - demand nameisInstallPhase - install or uninstall phasecallback - callback item
protected <T> void removeCallback(Object name,
boolean isInstallPhase,
CallbackItem<T> callback)
T - the callback item typename - demand nameisInstallPhase - install or uninstall phasecallback - callback item
protected 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 type
protected void resolveCallbacks(ControllerContext context,
ControllerState state,
boolean isInstallPhase)
context - current contextstate - current context stateisInstallPhase - install or uninstall phase
protected void handleInstallLifecycleCallbacks(ControllerContext context,
ControllerState state)
throws Throwable
Throwable
protected void handleUninstallLifecycleCallbacks(ControllerContext context,
ControllerState state)
throws Throwable
Throwable
protected void handleLifecycleCallbacks(ControllerContext context,
ControllerState state,
boolean install)
throws Throwable
Throwableprotected boolean isAutowireCandidate(ControllerContext context)
context - the context
protected Collection<Class<?>> getClassesImplemented(Object target)
target - target value / bean
protected void traverseClass(Class<?> clazz,
Set<Class<?>> classes)
clazz - current classclasses - classes holder set
protected 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 error
protected 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 registered
protected 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 parameters
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||