org.jboss.dependency.plugins
Class AbstractController

java.lang.Object
  extended by org.jboss.util.JBossObject
      extended by org.jboss.dependency.plugins.AbstractController
All Implemented Interfaces:
Cloneable, Controller, org.jboss.util.JBossInterface

public class AbstractController
extends org.jboss.util.JBossObject
implements Controller

Abstract controller.

Version:
$Revision: 1.10 $
Author:
Adrian Brock

Field Summary
protected  Map allContexts
          All contexts by name Map
protected  Map contextsByState
          The contexts by state Map>
protected  Set errorContexts
          The error contexts Set
protected  Set installing
          The contexts that are currently being installed
protected  boolean onDemandEnabled
          Whether an on demand context has been enabled
protected  List states
          The states in order List
 
Fields inherited from class org.jboss.util.JBossObject
hashCode, log, toString
 
Constructor Summary
AbstractController()
          Create an abstract controller
 
Method Summary
 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 enableOnDemand(ControllerContext context)
          Enable an on demand context
protected  void enableOnDemand(ControllerContext context, boolean trace)
          Enable an on demand context
 ControllerContext getContext(Object name, ControllerState state)
          Get a context
 ControllerContext getInstalledContext(Object name)
          Get an installed context
 Set getNotInstalled()
          Get the contexts not installed
 List getStates()
          Get the states.
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
protected  void resolveContexts(boolean trace)
          Resolve unresolved contexts
protected  boolean resolveContexts(ControllerState fromState, ControllerState toState, boolean trace)
          Resolve contexts
protected  Set resolveContexts(Set contexts, ControllerState state, boolean trace)
          Resolve contexts
protected  void uninstall(ControllerContext context, ControllerState fromState, ControllerState toState)
          Uninstall a context
 ControllerContext uninstall(Object name)
          Uninstall a context
protected  void uninstallContext(ControllerContext context, boolean trace)
          Uninstall a context
protected  void uninstallContext(ControllerContext context, ControllerState toState, boolean trace)
          Uninstall 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
 

Field Detail

states

protected List states
The states in order List


allContexts

protected Map allContexts
All contexts by name Map


contextsByState

protected Map contextsByState
The contexts by state Map>


errorContexts

protected Set errorContexts
The error contexts Set


installing

protected Set installing
The contexts that are currently being installed


onDemandEnabled

protected boolean onDemandEnabled
Whether an on demand context has been enabled

Constructor Detail

AbstractController

public AbstractController()
                   throws Exception
Create an abstract controller

Throws:
Exception - for any error
Method Detail

addState

public void addState(ControllerState state,
                     ControllerState before)
Description copied from interface: Controller
Add a state.

Specified by:
addState in interface Controller
Parameters:
state - the state to add
before - the state to add before or null to add to the end

getContext

public ControllerContext getContext(Object name,
                                    ControllerState state)
Description copied from interface: Controller
Get a context

Specified by:
getContext in interface Controller
Parameters:
name - the name of the component
state - the state (pass null for any state)
Returns:
the context

getInstalledContext

public ControllerContext getInstalledContext(Object name)
Description copied from interface: Controller
Get an installed context

Specified by:
getInstalledContext in interface Controller
Parameters:
name - the name of the component
Returns:
the context

getNotInstalled

public Set getNotInstalled()
Description copied from interface: Controller
Get the contexts not installed

Specified by:
getNotInstalled in interface Controller
Returns:
Set

getStates

public List getStates()
Description copied from interface: Controller
Get the states.

Specified by:
getStates in interface Controller
Returns:
the states in order

install

public void install(ControllerContext context)
             throws Throwable
Description copied from interface: Controller
Install a context

Specified by:
install in interface Controller
Parameters:
context - the context
Throws:
Throwable - for any error

change

public void change(ControllerContext context,
                   ControllerState state)
            throws Throwable
Description copied from interface: Controller
Change a context to the given state

Specified by:
change in interface Controller
Parameters:
context - the context
state - the state
Throws:
Throwable - for any error

enableOnDemand

public void enableOnDemand(ControllerContext context)
                    throws Throwable
Description copied from interface: Controller
Enable an on demand context

Specified by:
enableOnDemand in interface Controller
Parameters:
context - the context
Throws:
Throwable - for any error

uninstall

public ControllerContext uninstall(Object name)
Description copied from interface: Controller
Uninstall a context

Specified by:
uninstall in interface Controller
Parameters:
name - the name of the component
Returns:
the context

install

protected void install(ControllerContext context,
                       boolean trace)
                throws Throwable
Install a context

Parameters:
context - the context
trace - whether trace is enabled
Throws:
Throwable - for any error

change

protected void change(ControllerContext context,
                      ControllerState state,
                      boolean trace)
               throws Throwable
Change a context's state

Parameters:
context - the context
state - the required state
trace - whether trace is enabled
Throws:
Throwable - for any error

enableOnDemand

protected void enableOnDemand(ControllerContext context,
                              boolean trace)
                       throws Throwable
Enable an on demand context

Parameters:
context - the context
trace - whether trace is enabled
Throws:
Throwable - for any error

incrementState

protected boolean incrementState(ControllerContext context,
                                 boolean trace)
Increment state

Parameters:
context - the context
trace - whether trace is enabled
Returns:
whether the suceeded

resolveContexts

protected void resolveContexts(boolean trace)
Resolve unresolved contexts

Parameters:
trace - whether trace is enabled

resolveContexts

protected boolean resolveContexts(ControllerState fromState,
                                  ControllerState toState,
                                  boolean trace)
Resolve contexts

Parameters:
fromState - the from state
toState - the to state
trace - whether trace is enabled
Returns:
true when there were resolutions

resolveContexts

protected Set resolveContexts(Set contexts,
                              ControllerState state,
                              boolean trace)
Resolve contexts

Parameters:
contexts - the contexts
state - the state
trace - whether trace is enabled
Returns:
the set of resolved contexts

uninstallContext

protected void uninstallContext(ControllerContext context,
                                ControllerState toState,
                                boolean trace)
Uninstall a context

Parameters:
context - the context to uninstall
toState - the target state
trace - whether trace is enabled

uninstallContext

protected void uninstallContext(ControllerContext context,
                                boolean trace)
Uninstall a context

Parameters:
context - the context to uninstall
trace - whether trace is enabled

install

protected void install(ControllerContext context,
                       ControllerState fromState,
                       ControllerState toState)
                throws Throwable
Install a context

Parameters:
context - the context
fromState - the from state
toState - the toState
Throws:
Throwable - for any error

uninstall

protected void uninstall(ControllerContext context,
                         ControllerState fromState,
                         ControllerState toState)
Uninstall a context

Parameters:
context - the context
fromState - the from state
toState - the to state

advance

protected boolean advance(ControllerContext context)
Whether we should advance the context

Parameters:
context - the context
Returns:
true when we should advance the context


Copyright © 2004 JBoss Inc. All Rights Reserved.