org.licas.service

## Class ScriptService

- java.lang.Object
- - java.lang.Thread
  - - org.licas.module.LicasModule
    - - org.licas.module.FrameworkModule
      - - org.licas.module.ServiceModule
        - - org.licas.Service
          - - org.licas.service.DataService
            - - org.licas.Auto
              - - org.licas.AutoSecure
                - - org.licas.service.ScriptService

- All Implemented Interfaces:
    java.lang.AutoCloseable, java.lang.Runnable, DataServiceDef, ServiceDef

      public class ScriptService
      extends AutoSecure

  This service executes a single script process each behaviour invocation. An external script is not read, but the process is hard-coded into the `autoEvent` method of the `BM_Script` behaviour module. Note that this class also extends the most secure `AutoSecure` auto class and so will only have access to limited methods externaly and the message queue.
  Author:
    Kieran Greer

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class java.lang.Thread

      `java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler`

  - ### Field Summary

    - ### Fields inherited from class org.licas.Auto

      `autoEngine, autoManager, bm, iterations, sleepTime`

    - ### Fields inherited from class org.licas.service.DataService

      `dataCompare, dataMethod, resultObj`

    - ### Fields inherited from class org.licas.Service

      `canAccessMeta, canAccessNested, dm, finalised, isRemoteCall, messageStore, serviceAdmin, serviceGrade, serviceInitialise, serviceLinks, serviceState, sm, toLoadScript`

    - ### Fields inherited from class org.licas.module.ServiceModule

      `shutDown`

    - ### Fields inherited from class org.licas.module.FrameworkModule

      `passwordHandler, service, serviceType`

    - ### Fields inherited from class org.licas.module.LicasModule

      `jarFile, syncOn, uuid`

    - ### Fields inherited from class java.lang.Thread

      `MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ScriptService()` Creates a new instance of ScriptService.
    `ScriptService(java.lang.String thisPassword, java.lang.String thisAdminKey)` Creates a new instance of ScriptService.
    `ScriptService(java.lang.String thisPassword, java.lang.String thisAdminKey, org.licas_xml.abs.Element adminXml)` Creates a new instance of ScriptService.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected MessageInfo` | `behaviourAction(MessageInfo messageInfo)` This behaviour executes a script on the auto engine and returns the result.

    - ### Methods inherited from class org.licas.AutoSecure

      `canAccess, classNameOK, getInstanceValue, getPublicMethods, getSecureMethods, isSecureMethod, setInstanceValues, setSerializeValues`

    - ### Methods inherited from class org.licas.Auto

      `autoAction, autoQueueMessage, getAutoEngine, getMessageState, interrupt, invokeBehaviour, messageReply, removeCommunicationID, run, setAutoEngine, setAutonomicManager, setBehaviourModule, setProcessScript`

    - ### Methods inherited from class org.licas.service.DataService

      `createEvaluateData, createEvaluateData, dataTypeOK, dataXmlBM, dataXmlBM, dataXmlDH, dataXmlDH, evaluate, getData, getData, getDataType, getResultObj, resetValues, setData, setData, setFixedDataValue, setGenData, setResultObj`

    - ### Methods inherited from class org.licas.Service

      `addCommunicationID, addDefaultService, addDefaultService, addDefaultService, addDefaultService, addLinkFromService, addLinkToService, addMessageMetrics, addService, addService, addService, addService, addServiceAssociation, addServicePassword, addTempPassword, allowAddService, canAccess, canAccess, canAccess, canAccessMeta, canAccessNested, canAccessTemp, canRun, clearServiceLinks, clearServices, clearServices, close, createMetaForRepos, createMetaFull, createPermanentLinkTo, createServiceWrapper, defaultAdminToRemove, dynamicLinkQuery, dynamicLinksToPermanent, dynamicLinksToXml, dynamicLinksToXml, execute, finaliseInitialisation, finaliseInitialisation, finaliseModule, finaliseThisConfig, GET, getAllLinkToService, getAllowAddService, getAutonomicManagerConfig, getCommunicationClientURI, getDescription, getFullPath, getIsRemoteCall, getLinkFromService, getLinkToService, getLocalRemoteID, getParent, getParent, getPassword, getPassword, getPassword, getPasswordHandler, getPrivateMethods, getPublicServiceClassname, getServerPassword, getService, getService, getServiceAdmin, getServiceClasses, getServiceGrade, getServiceLinks, getServiceNames, getServiceNames, getServiceNames, getServiceNumber, getServiceOrWrapper, getServiceState, getServiceType, getServiceTypes, handshake, hasCommunicationID, hasLinkTo, hasServerPassword, hasService, hasServiceType, isCorrectPassword, isPrivateMethod, isPublicMethod, isStarted, linksToXml, passwordsStateToXml, permanentLinksToXml, reflectionMethods, reflectionObject, removeAllLinksTo, removeAllServices, removeAllServices, removeLinkFromService, removeLinkToService, removePermanentLinkTo, removeServiceAssociation, removeServiceID, removeServicePath, removeServicePath, removeTempPassword, serviceNegotiate, serviceToXml, serviceToXml, setAdminInfo, setCanAccessMeta, setCanAccessNested, setData, setDataModule, setDataModule, setDescription, setIsRemoteCall, setOtherMeta, setParent, setParent, setServerPassword, setServiceGrade, setServiceModule, setServiceState, startAllThreads, startThread, stopAllThreads, syncToAsync, syncToAsyncReply, syncToAsyncTransit, xmlToDynamicLinks, xmlToService`

    - ### Methods inherited from class org.licas.module.ServiceModule

      `getShutDown, setShutDown, setShutDown`

    - ### Methods inherited from class org.licas.module.FrameworkModule

      `canAccess, getPasswordHandler, getServicePassword, getServiceType, isAdminKey, setServiceDetails, setServiceType`

    - ### Methods inherited from class org.licas.module.LicasModule

      `getJarFile, getUUID, loadObject, setJarFile, setUUID, threadAliveState`

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

      `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, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield`

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

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

    - ### Methods inherited from interface org.licas.def.DataServiceDef

      `setData`

    - ### Methods inherited from interface org.licas.def.ServiceDef

      `getUUID, setJarFile, setUUID`

- - ### Constructor Detail

    - #### ScriptService

          public ScriptService()
                        throws java.lang.Exception

      Creates a new instance of ScriptService. Password and service key set to `anon` by default.
      Throws:
        `java.lang.Exception` - any error.

    - #### ScriptService

          public ScriptService(java.lang.String thisPassword,
                               java.lang.String thisAdminKey)
                        throws java.lang.Exception

      Creates a new instance of ScriptService.
      Parameters:
        `thisPassword` - password to invoke this service.
        `thisAdminKey` - admin key for this service.
      Throws:
        `java.lang.Exception` - any error.

    - #### ScriptService

          public ScriptService(java.lang.String thisPassword,
                               java.lang.String thisAdminKey,
                               org.licas_xml.abs.Element adminXml)
                        throws java.lang.Exception

      Creates a new instance of ScriptService.
      Parameters:
        `thisPassword` - password to invoke this service.
        `thisAdminKey` - admin key for this service.
        `adminXml` - the admin info or description of this service.
      Throws:
        `java.lang.Exception` - any error.

  - ### Method Detail

    - #### behaviourAction

          protected MessageInfo behaviourAction(MessageInfo messageInfo)
                                         throws java.lang.Exception

      This behaviour executes a script on the auto engine and returns the result.
      Specified by:
        `behaviourAction` in class `Auto`
      Parameters:
        `messageInfo` - the message to evaluate, but can be null.
      Returns:
        the result of executing the script.
      Throws:
        `java.lang.Exception` - any error.