wt.services
Class StandardManagerService

java.lang.Object
  extended bywt.services.StandardManager
      extended bywt.services.StandardManagerService
All Implemented Interfaces:
KeyedEventDispatcher, Manager, ManagerService, NetFactor, Serializable

public class StandardManagerService
extends StandardManager
implements ManagerService

A reference implementation of a ManagerService. A service which starts up, shuts down and provides access to, managers.

Use the newStandardManagerService static factory method(s), not the StandardManagerService constructor, to construct instances of this class. Instances must be constructed using the static factory(s), in order to ensure proper initialization of the instance.



Supported API: true

Extendable: false

See Also:
ManagerService, ManagerResources, Serialized Form

Field Summary
private static String CLASSNAME
           
private static String DEPTH_INDICATOR
           
private  StandardKeyedEventDispatcher eventDispatcher
           
private  ManagerResourceFactory factory
           
private  Vector keyedEventBranches
           
private static String RESOURCE
           
private  StartupHandler startupHandler
           
 
Fields inherited from class wt.services.StandardManager
 
Fields inherited from interface wt.services.Manager
MANAGER_SERVICE, STARTUP_AUTOMATIC, STARTUP_MANUAL, STATUS_EMERGENCY_SHUTDOWN, STATUS_EMERGENCY_SHUTTING_DOWN, STATUS_SHUTDOWN, STATUS_SHUTDOWN_ERRORS, STATUS_SHUTDOWN_FAILURE, STATUS_SHUTTING_DOWN, STATUS_STARTED, STATUS_STARTED_ERRORS, STATUS_STARTING_UP, STATUS_STARTUP_FAILURE
 
Fields inherited from interface wt.events.KeyedEventDispatcher
EVENT_KEY_DELIMITER, EVENT_KEY_ROOT
 
Constructor Summary
StandardManagerService()
           
 
Method Summary
 KeyedEventBranch addEventBranch(String eventKey, String eventClassName, String eventType)
          Create and register an event key branch.
 void addEventListener(KeyedEventListener listener, String eventKey)
          Add a synchronous "in thread/transaction" event listener.
 void dispatchEvent(Object event, String eventKey)
          Dispatch a non-vetoable single-object event to all listeners for the event key.
 void dispatchMultiObjectEvent(Object event, String eventKey)
          Dispatch a non-vetoable multi-object event to all listeners for the event key.
 void dispatchVetoableEvent(Object event, String eventKey)
          Dispatch a vetoable single-object event to all listeners for the event key.
 void dispatchVetoableMultiObjectEvent(Object event, String eventKey)
          Dispatch a vetoable multi-object event to all listeners for the event key.
 Enumeration getAllEventBranches()
          Return all event branches

Supported API: true
 String getConceptualClassname()
          Deprecated.  
 KeyedEventBranch getEventBranch(String eventKey)
          Return the event key branch which exactly matches the event key.
 Vector getKeyedEventBranches()
          Gets the object for the association that plays role: keyedEventBranches.
 Manager getManager(Class managerClass)
          Return the concrete instance of the manager for the specified abstract manager name.
 Manager getManager(Class aClass, Object managedObject)
          Return the concrete instance of the manager for the specified abstract manager name.
 boolean hasManager(Class aClass)
          Indicate whether an instance of the passed class is available.
 boolean hasManager(Class aClass, Object managedObject)
          Indicate whether an instance of the passed class is available.
protected  void initialize()
          

Supported API: false
 void intDispatchVetoableEvent(Object event, String eventKey, boolean isSingleObjectEvent)
           
static StandardManagerService newStandardManagerService()
          

Supported API: false
protected  void performShutdownProcess()
          Dummy method to be overridden by subclasses.
protected  void performStartupProcess()
          Dummy method to be overridden by subclasses.
 void printAllEventBranches()
          Print all event branches

Supported API: false
 KeyedEventBranch removeEventBranch(String eventKey)
          Locate and remove the event key branch which exactly matches the event key.
 void removeEventListener(KeyedEventListener listener, String eventKey)
          Remove an event listener.
 void setKeyedEventBranches(Vector a_KeyedEventBranches)
          Sets the object for the association that plays role: keyedEventBranches.
protected  String truncateEventKey(String eventKey)
          Utility used to "climb the event tree"; strips off the trailing key token yielding the event key of the parent branch.
protected  boolean waitForManagersToShutdown()
          

Supported API: false
protected  boolean waitForManagersToStartup()
          

Supported API: false
 
Methods inherited from class wt.services.StandardManager
emergencyShutdown, emergencyShutdownComplete, emergencyShuttingDown, getClassInfo, getManagerService, getManagerStatus, getName, getStartupType, init, initialize, isStarted, newStandardManager, newStandardManager, performEmergencyShutdownProcess, registerEvents, setManagerService, shutdown, shutdownFailure, shutdownSuccess, shuttingDown, started, startedErrors, startingUp, startup, startupFailure, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface wt.services.Manager
emergencyShutdown, getManagerService, getManagerStatus, getName, getStartupType, isStarted, registerEvents, setManagerService, shutdown, startup
 
Methods inherited from interface wt.fc.NetFactor
getClassInfo
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

DEPTH_INDICATOR

private static final String DEPTH_INDICATOR
See Also:
Constant Field Values

eventDispatcher

private StandardKeyedEventDispatcher eventDispatcher

startupHandler

private StartupHandler startupHandler

factory

private ManagerResourceFactory factory

keyedEventBranches

private Vector keyedEventBranches
Constructor Detail

StandardManagerService

public StandardManagerService()
Method Detail

getConceptualClassname

public String getConceptualClassname()
Deprecated.  

Returns the conceptual (modeled) name for the class.

Supported API: false

Specified by:
getConceptualClassname in interface NetFactor
Overrides:
getConceptualClassname in class StandardManager
Returns:
String

newStandardManagerService

public static StandardManagerService newStandardManagerService()
                                                        throws WTException


Supported API: false

Returns:
StandardManagerService
Throws:
WTException

waitForManagersToStartup

protected boolean waitForManagersToStartup()


Supported API: false

Returns:
boolean

waitForManagersToShutdown

protected boolean waitForManagersToShutdown()


Supported API: false

Returns:
boolean

performStartupProcess

protected void performStartupProcess()
                              throws ManagerException
Dummy method to be overridden by subclasses. Subclasses should override this method and provide startup processing.

Supported API: false

Overrides:
performStartupProcess in class StandardManager
Throws:
ManagerException

performShutdownProcess

protected void performShutdownProcess()
                               throws ManagerException
Dummy method to be overridden by subclasses. Subclasses should override this method and provide shutdown processing.

Supported API: false

Overrides:
performShutdownProcess in class StandardManager
Throws:
ManagerException

getManager

public Manager getManager(Class managerClass)
Return the concrete instance of the manager for the specified abstract manager name.

Supported API: false

Specified by:
getManager in interface ManagerService
Parameters:
managerClass -
Returns:
Manager

hasManager

public boolean hasManager(Class aClass)
Indicate whether an instance of the passed class is available.

Supported API: false

Specified by:
hasManager in interface ManagerService
Parameters:
aClass -
Returns:
boolean

getManager

public Manager getManager(Class aClass,
                          Object managedObject)
Return the concrete instance of the manager for the specified abstract manager name.

Supported API: false

Specified by:
getManager in interface ManagerService
Parameters:
aClass -
managedObject -
Returns:
Manager

hasManager

public boolean hasManager(Class aClass,
                          Object managedObject)
Indicate whether an instance of the passed class is available.

Supported API: false

Specified by:
hasManager in interface ManagerService
Parameters:
aClass -
managedObject -
Returns:
boolean

addEventBranch

public KeyedEventBranch addEventBranch(String eventKey,
                                       String eventClassName,
                                       String eventType)
                                throws IllegalArgumentException
Create and register an event key branch. If the branch already exists an InvalidArgumentException is thrown.

Supported API: true

Specified by:
addEventBranch in interface KeyedEventDispatcher
Parameters:
eventKey -
eventClassName -
eventType -
Returns:
KeyedEventBranch - a new or existing event key branch.
Throws:
IllegalArgumentException

getEventBranch

public KeyedEventBranch getEventBranch(String eventKey)
Return the event key branch which exactly matches the event key.

Supported API: true

Specified by:
getEventBranch in interface KeyedEventDispatcher
Parameters:
eventKey -
Returns:
KeyedEventBranch

removeEventBranch

public KeyedEventBranch removeEventBranch(String eventKey)
Locate and remove the event key branch which exactly matches the event key. All listeners are removed from the branch.

Supported API: true

Specified by:
removeEventBranch in interface KeyedEventDispatcher
Parameters:
eventKey -
Returns:
KeyedEventBranch

getAllEventBranches

public Enumeration getAllEventBranches()
Return all event branches

Supported API: true

Specified by:
getAllEventBranches in interface KeyedEventDispatcher
Returns:
Enumeration

addEventListener

public void addEventListener(KeyedEventListener listener,
                             String eventKey)
Add a synchronous "in thread/transaction" event listener. The listener is added to the list of listeners for the event key branch which matches the event key.

Supported API: false

Specified by:
addEventListener in interface KeyedEventDispatcher
Parameters:
listener - the listener to be added.
eventKey - the key which identifies the branch for listening.

removeEventListener

public void removeEventListener(KeyedEventListener listener,
                                String eventKey)
Remove an event listener. The listener is removed from the list of listeners for the event key branch which matches the event key.

Supported API: true

Specified by:
removeEventListener in interface KeyedEventDispatcher
Parameters:
listener - the listener to be removed
eventKey - the key which identifies the branch from wihch to remove

dispatchEvent

public void dispatchEvent(Object event,
                          String eventKey)
Dispatch a non-vetoable single-object event to all listeners for the event key. The listener may not object to the event.

Perform a synchronous "in thread/transaction" notification of each event listener for the event branch identified by the event key. Call the notifyEvent operation on each subscriber. If a multi-object notifyMultiObjectEvent exists for a subscriber, convert the single-object event to an multi-object event and call the multi-object subscriber's notifyMultiObjectEvent.

Supported API: true

Specified by:
dispatchEvent in interface KeyedEventDispatcher
Parameters:
event - the event to be dispatched
eventKey - the key of the event branch which has the subscribers

dispatchVetoableEvent

public void dispatchVetoableEvent(Object event,
                                  String eventKey)
                           throws WTException
Dispatch a vetoable single-object event to all listeners for the event key. If the listener objects to the event the listener may throw an exception.

Perform a synchronous "in thread/transaction" notification of each event listener for the event branch identified by the event key. Call the notifyVetoableEvent operation on each subscriber. If a multi-object notifyVetoableMultiObjectEvent exists for a subscriber, convert the single-object event to an multi-object event and call the multi-object subscriber's notifyVetoableMultiObjectEvent. If the subscriber objects to the event is may throw an excpetion which will be returned to the operation invoker. It is upto the dispatch invoker and the exception thrower to agree on what exception is to be thrown.

Supported API: true

Specified by:
dispatchVetoableEvent in interface KeyedEventDispatcher
Parameters:
event -
eventKey -
Throws:
WTException

dispatchMultiObjectEvent

public void dispatchMultiObjectEvent(Object event,
                                     String eventKey)
Dispatch a non-vetoable multi-object event to all listeners for the event key. The listener may not object to the event.

Perform a synchronous "in thread/transaction" notification of each event listener for the event branch identified by the event key. Call the notifyMultiObjectEvent operation on each subscriber. If a single-object notifyEvent exists for a subscriber, convert the multi-object event to an array of single-object events and loop over the single-object subscriber's notifyEvent.

Supported API: true

Specified by:
dispatchMultiObjectEvent in interface KeyedEventDispatcher
Parameters:
event - the event to be dispatched
eventKey - the key of the event branch which has the subscribers

dispatchVetoableMultiObjectEvent

public void dispatchVetoableMultiObjectEvent(Object event,
                                             String eventKey)
                                      throws WTException
Dispatch a vetoable multi-object event to all listeners for the event key. If the listener objects to the event the listener may throw an exception.

Perform a synchronous "in thread/transaction" notification of each event listener for the event branch identified by the event key. Call the notifyVetoableMultiObjectEvent operation on each subscriber. If a single-object notifyVetoabelEvent exists for a subscriber, convert the multi-object event to an array of single-object events and loop over the single-object subscriber's notifyVetoableEvent. If the subscriber objects to the event is may throw an excpetion which will be returned to the operation invoker. It is upto the dispatch invoker and the exception thrower to agree on what exception is to be thrown.

Supported API: true

Specified by:
dispatchVetoableMultiObjectEvent in interface KeyedEventDispatcher
Parameters:
event -
eventKey -
Throws:
WTException

printAllEventBranches

public void printAllEventBranches()
Print all event branches

Supported API: false

Specified by:
printAllEventBranches in interface KeyedEventDispatcher

truncateEventKey

protected String truncateEventKey(String eventKey)
Utility used to "climb the event tree"; strips off the trailing key token yielding the event key of the parent branch.

Supported API: false

Parameters:
eventKey -
Returns:
String

getKeyedEventBranches

public Vector getKeyedEventBranches()
Gets the object for the association that plays role: keyedEventBranches.

Supported API: false

Returns:
Vector

setKeyedEventBranches

public void setKeyedEventBranches(Vector a_KeyedEventBranches)
                           throws WTPropertyVetoException
Sets the object for the association that plays role: keyedEventBranches.

Supported API: false

Parameters:
a_KeyedEventBranches -
Throws:
WTPropertyVetoException

initialize

protected void initialize()
                   throws WTException
Description copied from class: StandardManager


Supported API: false

Overrides:
initialize in class StandardManager
Throws:
WTException

intDispatchVetoableEvent

public void intDispatchVetoableEvent(Object event,
                                     String eventKey,
                                     boolean isSingleObjectEvent)
                              throws WTException
Throws:
WTException