public class CM_Auto extends CM_Data
Modifier and Type | Field and Description |
---|---|
protected AutonomicManager |
autoManager
The service's autonomic manager
|
protected boolean |
isBusy
True if currently busy
|
allDatasets, evaluator, rnd, serviceIDs
dm
passwordHandler, service, serviceType
jarFile, syncOn, uuid
Constructor and Description |
---|
CM_Auto(Service service,
PasswordHandler pHandler)
Creates a new instance of CM_Auto.
|
Modifier and Type | Method and Description |
---|---|
void |
evaluateBehaviour()
Main method to execute the behaviour and evaluate the result, where the input
message used is the first message on the autonomic manager's message queue.
|
MessageInfo |
evaluateBehaviour(MessageInfo messageInfo)
Evaluate a behaviour, initialised by an input
messageInfo , with the evaluation logic
written in a behaviourAction method. |
AutoEngine |
getAutoEngine()
Get the auto engine.
|
java.lang.Object |
invokeBehaviour(MessageInfo messageInfo)
This can be used to execute a single invocation of the service's
evaluateBehaviour method. |
void |
setAutonomicManager(AutonomicManager autoMan)
Set the autonomic manager, which is usually set later.
|
getAllData, getDataRandomID, getServiceIDs, receiveDataXML, resetValues, sendDataXML, setAllData
getServerPassword, setDataModule
canAccess, canAccessTemp, getPasswordHandler, getPasswordHandler, getServicePassword, getServiceType, isAdminKey, setServiceDetails, setServiceType
getJarFile, getUUID, loadObject, setJarFile, setUUID, threadAliveState
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getUUID, setJarFile, setUUID
protected boolean isBusy
protected AutonomicManager autoManager
public CM_Auto(Service service, PasswordHandler pHandler) throws java.lang.Exception
service
- the parent service.pHandler
- the parent password handler.java.lang.Exception
- any error.public void setAutonomicManager(AutonomicManager autoMan)
autoMan
- the autonomic manager.public void evaluateBehaviour() throws ServiceException, java.lang.Exception
null
parameter. This default version will probably
work for general cases. It is based on retrieving the next message on the message queue,
performing an action on that, and then monitoring the result by sending the reply
through the AutonomicManager
control loop. The control loop is empty
by default, but all of these classes have been added to integrate the process
with the normal running of the system. Any derived class can override this method
or related parts, to change the behaviour and evaluation control loop.ServiceException
- probably for password or service not found.java.lang.Exception
- any error.public java.lang.Object invokeBehaviour(MessageInfo messageInfo) throws ServiceException, java.lang.Exception
evaluateBehaviour
method.
This is correct if the service is waiting to be invoked and is not running on a thread.
This version runs each invocation in a separate thread and also passes the message
reply through the autonomic manager.messageInfo
- the message with data to evaluate. This is only the values
related to the evaluation result, not the whole set of service values.evaluateBehaviour
MessageInfo
reply object. If this is not one of the basic types, a parser needs to be added to parse
the complex object to/from XML.ServiceException
- if this service's main thread is currently running.java.lang.Exception
- any other error.public MessageInfo evaluateBehaviour(MessageInfo messageInfo) throws ServiceException, java.lang.Exception
messageInfo
, with the evaluation logic
written in a behaviourAction
method.messageInfo
- the message with initial behaviour details.ServiceException
- probably for password or service not found.java.lang.Exception
- and error.public AutoEngine getAutoEngine()