public abstract class AutonomicManager extends ServiceWrapper
AM_Module
interface. In this case, separate modules should be
implemented to monitor, analyze, plan, or execute the plan, based on the input that
each module receives. Each module should be controlled by a policy that
can be entered as an XML document. On receiving its input, the module
will process the information based on the policy and return a MessageInfo
object
with the appropriate reply. If all of the modules implement this interface then
this process will be consistent through the whole control loop.Modifier and Type | Field and Description |
---|---|
protected AM_Module |
analyzer
Analysis module.
|
protected AutoEngine |
autoEngine |
protected static boolean |
CONVERSATIONEXISTS |
protected AM_Module |
executor
Execution module.
|
protected boolean |
isConfigured
Set to true when this manager has been configured.
|
protected MessageQueue |
messageQueue
List of messages received by this manager.
|
protected AM_Module |
monitor
Monitor module.
|
protected static boolean |
NEWCONVERSATION |
protected AM_Module |
planner
Planner module.
|
protected MessageQueue |
quarantineQueue
List of messages quarantined by this manager.
|
metrics, setStructures
shutDown
passwordHandler, service, serviceType
jarFile, syncOn, uuid
Constructor and Description |
---|
AutonomicManager(Auto theService)
Creates a new instance of AutonomicManager.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
addManagerModule(java.lang.String moduleType,
java.lang.String moduleClass,
java.util.ArrayList<java.lang.Object> params,
java.util.ArrayList<java.lang.String> theJarUris)
Add a new module to the manager - monitor, analyze, plan or execute.
|
void |
addMessage(MessageInfo messageInfo,
java.lang.String theAdminKey)
Add a message to the queue for a particular communication thread.
|
abstract void |
addPolicy(java.lang.String policyType,
org.licas_xml.abs.Element document)
Add a new policy to the auto manager.
|
protected boolean |
checkCommID(java.lang.String commID,
java.lang.Object clientURI,
boolean tryNew)
Check if the communication ID can be added as new, or if it already exists.
|
protected java.lang.Object |
getClientURI(java.lang.String communicationID)
Get the client URI associated with a communication ID.
|
MessageQueue |
getMessageQueue(java.lang.String theAdminKey)
Get the message queue.
|
MessageInfo |
getNextMessage(java.lang.String theAdminKey,
boolean remove)
Get the next message in the queue.
|
MessageQueue |
getQuarantineMessageQueue(java.lang.String theAdminKey)
Get the quarantined message queue.
|
void |
interrupt()
This method is re-implemented here to allow the thread to be shut down.
|
boolean |
isAuto()
Return true if the stored object is derived from the licas
Auto object. |
boolean |
isService()
Return true if the stored object is derived from the licas
Service object. |
abstract void |
monitor(MessageInfo theMessage,
java.lang.String theAdminKey)
Monitor the first message of a conversation to check for irregular values.
|
protected abstract void |
monitorMessage(MessageInfo theMessage,
java.lang.String theAdminKey)
Monitor a message using a MAPE control loop.
|
protected void |
removeCommID(java.lang.String communicationID)
Remove the communication ID reference from the Service, or stored
obj reference. |
void |
returnLastMessage(java.lang.String theAdminKey,
MessageInfo nextMessage)
Return the message to the start of the message queue
and update all other message lists.
|
void |
setConfigured()
Call to indicate that the manager has now been configured
|
boolean |
storesLegacy()
Return true if the stored object is legacy code, false if a licas service.
|
addCommunicationID, addMetrics, canAccess, canAccess, canAccess, canAccessTemp, copyFromService, copyToService, execute, getDescription, getFullPath, getMetrics, getObjClass, getObjService, getPassword, getPassword, getPassword, getService, getService, getServiceGrade, getWorkInfo, interrupt, invokeObj, reflectionMethods, run, setObjService, setParent, setServerPassword, setServiceGrade, threadAliveState
getShutDown, setShutDown, setShutDown
getPasswordHandler, getPasswordHandler, getServerPassword, getServicePassword, getServiceType, isAdminKey, setServiceDetails, setServiceType
getJarFile, getUUID, loadObject, setJarFile, setUUID
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getServiceType, getUUID, isAdminKey, setJarFile, setServiceType, setUUID
protected static boolean NEWCONVERSATION
protected static boolean CONVERSATIONEXISTS
protected AM_Module monitor
protected AM_Module analyzer
protected AM_Module planner
protected AM_Module executor
protected MessageQueue messageQueue
protected MessageQueue quarantineQueue
protected AutoEngine autoEngine
protected boolean isConfigured
public AutonomicManager(Auto theService) throws java.lang.Exception
theService
- the service to monitor.java.lang.Exception
- any error.public abstract void monitor(MessageInfo theMessage, java.lang.String theAdminKey) throws PasswordException, LicasException, java.lang.Exception
theMessage
- the message that the service has produced / received.theAdminKey
- the admin key for the parent service.PasswordException
- if the admin key is incorrect.LicasException
- if the communication ID is not part of a current conversation.java.lang.Exception
- any error.protected abstract void monitorMessage(MessageInfo theMessage, java.lang.String theAdminKey) throws PasswordException, LicasException, java.lang.Exception
theMessage
- the message that the service has produced / received.theAdminKey
- the admin key for the parent service.PasswordException
- if the admin key is incorrect.LicasException
- if the communication ID is not part of a current conversation.java.lang.Exception
- any error.public abstract void addManagerModule(java.lang.String moduleType, java.lang.String moduleClass, java.util.ArrayList<java.lang.Object> params, java.util.ArrayList<java.lang.String> theJarUris) throws java.lang.Exception
moduleType
- the type of module.moduleClass
- the class name of the module to be loaded.params
- initialisation parameters.theJarUris
- uris from which the remote object can be loaded, only if needed.java.lang.Exception
- any error.public abstract void addPolicy(java.lang.String policyType, org.licas_xml.abs.Element document) throws java.lang.Exception
policyType
- the type of policy.document
- the policy document.java.lang.Exception
- any error.public boolean isService()
Service
object.public boolean isAuto()
Auto
object.public boolean storesLegacy()
storesLegacy
in interface ServiceWrapperDef
storesLegacy
in class ServiceWrapper
public void addMessage(MessageInfo messageInfo, java.lang.String theAdminKey) throws PasswordException, LicasException, java.lang.Exception
null
, then an exception is thrown. If it new, then the
message is added to a quarantine list and an exception is thrown.messageInfo
- the message to add.theAdminKey
- the admin key for the parent service.PasswordException
- if the admin key is incorrect.LicasException
- if the comm ID is not already stored, as it is then
not part of a conversation.java.lang.Exception
- any error.public MessageInfo getNextMessage(java.lang.String theAdminKey, boolean remove)
theAdminKey
- the admin key for the parent service.remove
- if true also remove the message.public void returnLastMessage(java.lang.String theAdminKey, MessageInfo nextMessage)
nextMessage
- the message to add again.theAdminKey
- the service's service key.public MessageQueue getMessageQueue(java.lang.String theAdminKey)
theAdminKey
- the admin key for the parent service.public MessageQueue getQuarantineMessageQueue(java.lang.String theAdminKey)
theAdminKey
- the admin key for the parent service.protected java.lang.Object getClientURI(java.lang.String communicationID)
communicationID
- the communication ID.protected void removeCommID(java.lang.String communicationID)
obj
reference.communicationID
- the communication ID.protected boolean checkCommID(java.lang.String commID, java.lang.Object clientURI, boolean tryNew) throws java.lang.Exception
tryNew
parameter sets the condition with the following rules:Service
or Fault
and is allowed for any case.commID
- the communication ID to check.clientURI
- the client URI representation.tryNew
- true if check for new entry, or false for an existing conversation.java.lang.Exception
- any error.public void setConfigured()
public void interrupt()
interrupt
in class java.lang.Thread