public class SM_Auto extends SM_Data
CM_Auto
class.cm, commID
passwordHandler, service, serviceType
jarFile, syncOn, uuid
Constructor and Description |
---|
SM_Auto(Service service,
PasswordHandler pHandler)
Creates a new instance of SM_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 inputMessage)
Evaluate a behaviour message by calling
behaviourAction and return the reply. |
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.
|
dataFromService, dataToService, getAllData, getDataQueue, getDataRandomID, getServiceIDs, resetValues, setAllData
getCommID, getServerPassword, setCommID, setControlModule, 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
public SM_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) throws java.lang.Exception
autoMan
- the autonomic manager.java.lang.Exception
- any error.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 inputMessage) throws ServiceException, java.lang.Exception
behaviourAction
and return the reply.inputMessage
- the data message to evaluate. This can be null
, depending on
your requirements, where the message queue is not accessed here.ServiceException
- probably for password or service not found.java.lang.Exception
- and error.public AutoEngine getAutoEngine()