com.cometway.ak
Class ServiceManager

java.lang.Object
  extended by com.cometway.props.Props
      extended by com.cometway.ak.Agent
          extended by com.cometway.ak.ServiceManager
All Implemented Interfaces:
AgentInterface, HasStateMachineModel

public class ServiceManager
extends Agent

Reference implementation of the ServiceManagerInterface.


Nested Class Summary
 class ServiceManager.ServiceManagerImpl
           
 
Field Summary
protected  ServiceManagerInterface sm
           
 
Fields inherited from class com.cometway.ak.Agent
agent_id, agentController, CREATING_STATE, debugReporter, DESTROYED_STATE, DESTROYING_STATE, errorReporter, FAILED_STATE, printlnReporter, props, RUNNING_STATE, STARTING_STATE, STOPPED_STATE, STOPPING_STATE, warningReporter
 
Constructor Summary
ServiceManager()
           
 
Method Summary
static java.lang.Object getService(java.lang.String serviceName)
          Returns an implementation for the specified service name; null if none found.
static java.lang.Object getService(java.lang.String serviceName, java.lang.Object authorization)
          Returns an implementation for the specified service name if the service was found, and the authorization was accepted; null otherwise.
static ServiceManagerInterface getServiceManager()
          Returns a reference to the service manager.
static boolean register(java.lang.String serviceName, java.lang.Object serviceImpl)
          Registers a service implementation using the specified service name and returns true if successful; false otherwise.
static boolean register(java.lang.String serviceName, java.lang.Object serviceImpl, java.lang.Object authorization)
          Registers a service implementation using the specified service name and if authorization is accepted returns true; returns false otherwise.
static void setServiceManager(ServiceManagerInterface serviceManager)
          Sets the service manager returned by getServiceManager.
 void start()
          Starts the service manager.
 void stop()
          Stops the service manager.
static boolean unregister(java.lang.String serviceName, java.lang.Object serviceImpl)
          Unregisters a service implementation using the specified service name and returns true if successful; returns false otherwise.
static boolean unregister(java.lang.String serviceName, java.lang.Object serviceImpl, java.lang.Object authorization)
          Unregisters a service implementation using the specified service name and if authorization is accepted returns true; returns false otherwise.
 
Methods inherited from class com.cometway.ak.Agent
currentStateEquals, debug, destroy, error, error, getAgentController, getDateTimeStr, getProps, getServiceImpl, getStateMachineModel, initProps, println, register, registerService, setAgentController, setProps, toString, unregister, unregisterService, warning, warning
 
Methods inherited from class com.cometway.props.Props
addListener, append, copy, copyFrom, copyTo, decrementInteger, dump, enableListeners, enumerateKeys, format, getBoolean, getByteArray, getCharacter, getDate, getDate, getDateString, getDouble, getFloat, getHexString, getInteger, getKeys, getLong, getNextKey, getProperty, getProperty, getPropsContainer, getSize, getString, getString, getTokens, getTokens, getTrimmedString, getVector, hasProperty, incrementInteger, insertProps, loadProps, notifyPropsChanged, notifyPropsChangedIgnore, notifyPropsChangedIgnore, parse, propertyMatchesRegEx, readFromFile, regExPropertyMatches, removeAll, removeListener, removeProperty, resumeNotify, saveProps, set, setBoolean, setCharacter, setDefault, setDouble, setFloat, setInteger, setLong, setProperty, setProperty, setProperty, setPropsContainer, suspendNotify, writeToFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sm

protected ServiceManagerInterface sm
Constructor Detail

ServiceManager

public ServiceManager()
Method Detail

start

public void start()
Starts the service manager.

Specified by:
start in interface AgentInterface
Overrides:
start in class Agent

stop

public void stop()
Stops the service manager.

Specified by:
stop in interface AgentInterface
Overrides:
stop in class Agent

getServiceManager

public static ServiceManagerInterface getServiceManager()
Returns a reference to the service manager.


setServiceManager

public static void setServiceManager(ServiceManagerInterface serviceManager)
Sets the service manager returned by getServiceManager.


getService

public static java.lang.Object getService(java.lang.String serviceName)
Returns an implementation for the specified service name; null if none found.


getService

public static java.lang.Object getService(java.lang.String serviceName,
                                          java.lang.Object authorization)
Returns an implementation for the specified service name if the service was found, and the authorization was accepted; null otherwise.


register

public static boolean register(java.lang.String serviceName,
                               java.lang.Object serviceImpl)
Registers a service implementation using the specified service name and returns true if successful; false otherwise.


register

public static boolean register(java.lang.String serviceName,
                               java.lang.Object serviceImpl,
                               java.lang.Object authorization)
Registers a service implementation using the specified service name and if authorization is accepted returns true; returns false otherwise.


unregister

public static boolean unregister(java.lang.String serviceName,
                                 java.lang.Object serviceImpl)
Unregisters a service implementation using the specified service name and returns true if successful; returns false otherwise.


unregister

public static boolean unregister(java.lang.String serviceName,
                                 java.lang.Object serviceImpl,
                                 java.lang.Object authorization)
Unregisters a service implementation using the specified service name and if authorization is accepted returns true; returns false otherwise.