org.licas.autonomic

## Class AM_MonitorDefault

- java.lang.Object
- - org.licas.autonomic.AM_Module
  - - org.licas.autonomic.AM_MonitorDefault

-     public class AM_MonitorDefault
      extends AM_Module

  This class is an example of a default autonomic manager monitor. It can provide limited information, based on the number of messages/transactions that pass through the manager, that gets added to its `Metrics` object. Each separate message can also be processed by the auto engine, using the monitor's policy script.
  Author:
    Kieran Greer

- - ### Field Summary

    - ### Fields inherited from class org.licas.autonomic.AM_Module

      `adminKey, autoEngine, autoMan, evaluationMessage, passwordHandler, policy`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AM_MonitorDefault(Service serviceObj, PasswordHandler passwordHandler)` Create a new instance of AM_MonitorDefault.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected java.util.ArrayList<KeyValue>` | `process(MessageInfo messageInfo)` Process the data and return the result.
    `void` | `resetValues()` Reset some values

    - ### Methods inherited from class org.licas.autonomic.AM_Module

      `evaluationMessage, setAutonomicManager, setPolicy`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AM_MonitorDefault

          public AM_MonitorDefault(Service serviceObj,
                                   PasswordHandler passwordHandler)

      Create a new instance of AM_MonitorDefault. You can only use the `AutoEngine` if the `AutonomicManager` wraps a licas `Service`-derived object.
      Parameters:
        `serviceObj` - the service object wrapped by the autonomic manager.
        `passwordHandler` - the service's password handler, for the auto script engine.

  - ### Method Detail

    - #### resetValues

          public void resetValues()

      Reset some values

    - #### process

          protected java.util.ArrayList<KeyValue> process(MessageInfo messageInfo)
                                                   throws java.lang.Exception

      Process the data and return the result. This default version will evaluate the message, using the `autoEngine` and declared process script, to determine a message result. The process is also defined as the module's policy (script). As this is only one monitoring possibility, it is likely that you will need to override this method to implement a more application-specific one, but this version can provide some flexibility, as it can be configured through the `AutoEngine.setEventRuleAction` method, for example.
      Specified by:
        `process` in class `AM_Module`
      Parameters:
        `messageInfo` - the message to evaluate. This should be indexed in a script with the key name of `AiConst`.`MI_OBJECT`.
      Returns:
        the result of the monitoring. Note that this should not change the input message and is a list of actions to carry out in sequence. Each action is a list of `KeyValue` objects that can include a `Const`.`REPLY` object and `AiConst`.`EFFECTOR` method XML description, or other objects. These are typically all included with each action message, where they have to be identified by the related key value.
      Throws:
        `java.lang.Exception` - any error.