org.licas.meta

## Class MetaFactoryAI

- java.lang.Object
- - org.licas.meta.MetaFactoryAI

-     public class MetaFactoryAI
      extends java.lang.Object

  This class can create metadata parts that can be used as part of AI scripts. The script creation is now very closely linked to the `query_process` scripting package.
  Author:
    Kieran Greer

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MetaFactoryAI()` Create a new instance of MetaFactoryAI

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `org.licas_xml.abs.Element` | `createAM_Module(java.lang.String moduleType, java.lang.String className, java.lang.String jarFile, org.licas_xml.abs.Element policy)` Create an XML element that can be used to define one of the `AutonomicManager` modules.
    `org.licas_xml.abs.Element` | `createAutonomicManager(java.lang.String className, java.lang.String jarFile)` Create an XML element that can be used as the base part of a script to define an `AutonomicManager` setup.
    `org.licas_xml.abs.Element` | `createAutonomicManagerDefault()` Create an XML element that can be used as the base part of a script to define an `AutonomicManagerDefault` setup.
    `org.licas_xml.abs.Element` | `createDataAction(java.lang.String dataType, java.lang.Object infoData, java.lang.String actionType)` Create an XML element that can be used as part of a script to define a data resource.
    `org.licas_xml.abs.Element` | `createSolver(java.util.HashMap<java.lang.String,java.lang.String> typeValue)` Create an XML element that can be used as part of an admin script to initialise a service that is used with the problem solving classes.

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

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

- - ### Constructor Detail

    - #### MetaFactoryAI

          public MetaFactoryAI()

      Create a new instance of MetaFactoryAI

  - ### Method Detail

    - #### createAutonomicManager

          public org.licas_xml.abs.Element createAutonomicManager(java.lang.String className,
                                                                  java.lang.String jarFile)

      Create an XML element that can be used as the base part of a script to define an `AutonomicManager` setup. Both parameters can be null, when this script is still useful, as you can then add specific AM module descriptions to it.
      Parameters:
        `className` - the class name of the autonomic manager to load. This can be null, when the default `AutonomicManagerDefault` version will be used instead.
        `jarFile` - the main jar file if the manager is from an external source. The system should try to also retrieve the jars from an associated `lib` folder, but it is better to pack all new classes in a single jar and make that available. This can also be null if the jar already exists or the default version is used.
      Returns:
        an XML element that defines the service to load. This might look like: `<Autonomic_Manager><Class_Name>Optional AM class name</Class_Name> <Jar_File>Optional AM jar file path</Jar_File></Autonomic_Manager>`

    - #### createAutonomicManagerDefault

          public org.licas_xml.abs.Element createAutonomicManagerDefault()

      Create an XML element that can be used as the base part of a script to define an `AutonomicManagerDefault` setup. The classes used are the default ones and so do not need to be entered.
      Returns:
        an XML element that defines the service to load. This might look like: `<Autonomic_Manager><Class_Name>AutonomicManagerDefault</Class_Name> <Jar_File>Null as licas package</Jar_File></Autonomic_Manager>`

    - #### createAM_Module

          public org.licas_xml.abs.Element createAM_Module(java.lang.String moduleType,
                                                           java.lang.String className,
                                                           java.lang.String jarFile,
                                                           org.licas_xml.abs.Element policy)

      Create an XML element that can be used to define one of the `AutonomicManager` modules. This should then be added directly to the AM script root element.
      Parameters:
        `moduleType` - the module type. Can be `AiConst.MONITOR`, `AiConst.ANALYZE`, `AiConst.PLAN`, or `AiConst.EXECUTE`.
        `className` - the class name of the autonomic module to load. This can be null, when the default version will be used instead.
        `jarFile` - the jar file path if the manager is from an external source. This can also be null if the jar already exists or the default version is used.
        `policy` - the policy script that defines what the module should evaluate and how the module should respond. This is required, but you can use `MetaFactory`.`createPolicy` to create an empty one.
      Returns:
        an XML element that defines the service to load. This might look like: `<Module_Type><Class_Name>Optional module class name</Class_Name> <Jar_File>Optional module jar file path</Jar_File><Policy>Policy script here</Policy></Module_Type>`

    - #### createDataAction

          public org.licas_xml.abs.Element createDataAction(java.lang.String dataType,
                                                            java.lang.Object infoData,
                                                            java.lang.String actionType)
                                                     throws java.lang.Exception

      Create an XML element that can be used as part of a script to define a data resource. This would be the admin script `Data` section and it stores a description of a data type, value and specific action. It is used to initialise an `InformationService` class, for example. The related `Resource` object that stores and retrieves the information gets created from it and might be a best match guess. If the action is known, then the resource can perform a different type of storage, for example. The returned value is `<Data><DataType>dataType</DataType><Value>String or XML infoData</Value> <ActionType>actionType</ActionType></Data>`.
      Parameters:
        `dataType` - the data type of the value, or its class name.
        `infoData` - the data itself, can be a String or XML element.
        `actionType` - the type of action to take, if it is an option.
      Returns:
        an XML element that defines the service to load.
      Throws:
        `java.lang.Exception` - any error.

    - #### createSolver

          public org.licas_xml.abs.Element createSolver(java.util.HashMap<java.lang.String,java.lang.String> typeValue)

      Create an XML element that can be used as part of an admin script to initialise a service that is used with the problem solving classes. The variable input is simple a list of variable types with values, rather like a properties file. Each key-value pair is then made into an XML element and added to a root `MetaConst.AISOLVER` element.
      Parameters:
        `typeValue` - the variable list. Key is variable name and value is variable value, both of type String.
      Returns:
        an XML element that defines the initialisation parameters.