com.eventgnosis.config
Class EmmlConfig

java.lang.Object
  extended bycom.eventgnosis.config.EmmlObject
      extended bycom.eventgnosis.config.EmmlConfig

public class EmmlConfig
extends com.eventgnosis.config.EmmlObject

Creates and holds an emml system object configuration which is build from parsing specific section of an ECA.
This configuration object provides access to attributes, parameters and variables which can be used to configure a system object.


Field Summary
static int ACTIVE
           
static int INACTIVE
           
 
Constructor Summary
EmmlConfig(com.eventgnosis.config.EmmlObjectId objId, int state, org.w3c.dom.Element elem, com.eventgnosis.config.EmmlType type, java.util.ArrayList parmList, java.util.ArrayList varList, java.util.Properties attrs)
           
 
Method Summary
static EmmlConfig build(Log log, com.eventgnosis.config.ConfigurationManager configMgr, java.lang.String emaName, java.lang.String namePreamble, org.w3c.dom.Element elem, boolean stdoutReq)
          Builds an EmmlConfig based on a section of emml inside the ECA.
static java.util.Properties createAttributes(Log log, java.lang.String emaName, java.lang.String namePreamble, org.w3c.dom.Element elem, boolean stdoutReq)
          Create attributes list for current system object.
static java.util.ArrayList createParms(Log log, com.eventgnosis.config.ConfigurationManager configMgr, java.lang.String emaName, java.lang.String objName, org.w3c.dom.NodeList nodeList)
          Create parameters list for current system object.
static java.util.ArrayList createVariables(Log log, com.eventgnosis.config.ConfigurationManager configMgr, java.lang.String namePreamble, org.w3c.dom.NodeList nodeList)
          Not currently used.
 java.lang.String getAttribute(java.lang.String name)
          Gets the specific attribute for this emml configuration
 com.eventgnosis.config.NamedEmmlTuple getParm(java.lang.String type, int idx)
          Gets the ith parameter of the specified type
 java.lang.Object getParmObject(java.lang.String type, int idx)
          Gets the specified Object for a system object emml config given it's type and occurrence index.
 java.util.ArrayList getParmObjects(java.lang.String type)
          Gets parameter(s) objects by specified type
 java.util.ArrayList getParms(java.lang.String type)
          Gets parameter(s) by specified type
 com.eventgnosis.config.EmmlType getType()
          Returns EmmlType for this configuration.
 java.util.ArrayList getVariableNames()
          Not currently used.
Gets all contained variables in an EmmlConfig
 boolean hasLockedParm()
          Determines if ANY parameter has a locked attribute set to true
 void setAttribute(java.lang.String name, java.lang.String value)
          Sets a named attribute to a value (for debugging only).
 
Methods inherited from class com.eventgnosis.config.EmmlObject
getObjectId, getObjectName, getParentName, setObjectId, setParentName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACTIVE

public static final int ACTIVE
See Also:
Constant Field Values

INACTIVE

public static final int INACTIVE
See Also:
Constant Field Values
Constructor Detail

EmmlConfig

public EmmlConfig(com.eventgnosis.config.EmmlObjectId objId,
                  int state,
                  org.w3c.dom.Element elem,
                  com.eventgnosis.config.EmmlType type,
                  java.util.ArrayList parmList,
                  java.util.ArrayList varList,
                  java.util.Properties attrs)
Parameters:
objId - globally unique object identifier
state - initial state of object
elem -
type - variable type reference
parmList - list of created parameters (in order) as Objects
varList -
attrs -
Method Detail

build

public static EmmlConfig build(Log log,
                               com.eventgnosis.config.ConfigurationManager configMgr,
                               java.lang.String emaName,
                               java.lang.String namePreamble,
                               org.w3c.dom.Element elem,
                               boolean stdoutReq)
Builds an EmmlConfig based on a section of emml inside the ECA. Automatically called by the framework when ECA is initialized on system startup.

Parameters:
log - logger instance for tracking error, warning and info messages.
configMgr - holds configuration data structure used to properly configure runtime setup based on input ECA(s).
emaName - last part of globally unique ECA name
namePreamble - first part of globally unique ECA name
elem - emml(dom) node to be parsed
stdoutReq - true if standardOut required
Returns:
EmmlConfig instance

createAttributes

public static java.util.Properties createAttributes(Log log,
                                                    java.lang.String emaName,
                                                    java.lang.String namePreamble,
                                                    org.w3c.dom.Element elem,
                                                    boolean stdoutReq)
Create attributes list for current system object. If mandatory attributes are invalid or missing the object can not be created and null is returned. Mandatory attributes are objectId, type and stdout(if stdoutReq value is true).

Parameters:
log - logger instance for tracking error, warning and info messages.
emaName - last part of globally unique ECA name
namePreamble - first part of globally unique ECA name
elem - emml(dom) node to be parsed
stdoutReq - true if standardOut required
Returns:
attributes list if mandatory attributes are valid; otherwise null

createParms

public static java.util.ArrayList createParms(Log log,
                                              com.eventgnosis.config.ConfigurationManager configMgr,
                                              java.lang.String emaName,
                                              java.lang.String objName,
                                              org.w3c.dom.NodeList nodeList)
Create parameters list for current system object.

Parameters:
log - logger instance for tracking error, warning and info messages.
configMgr - holds configuration data structure used to properly configure runtime setup based on input ECA(s).
emaName - last part of globally unique ECA name
objName - name of system object to whom this parameters belong
nodeList - a list of dom elements containing emml for parameters in this configuration
Returns:

createVariables

public static java.util.ArrayList createVariables(Log log,
                                                  com.eventgnosis.config.ConfigurationManager configMgr,
                                                  java.lang.String namePreamble,
                                                  org.w3c.dom.NodeList nodeList)
Not currently used.


getAttribute

public java.lang.String getAttribute(java.lang.String name)
Gets the specific attribute for this emml configuration

Parameters:
name - attribute name
Returns:
String value for specified attribute name, if requested attribute does not exists returns null.

getParm

public com.eventgnosis.config.NamedEmmlTuple getParm(java.lang.String type,
                                                     int idx)
Gets the ith parameter of the specified type

Parameters:
type - type of parameter to return
idx - specifies which occurrence (starts at 0)

getParmObject

public java.lang.Object getParmObject(java.lang.String type,
                                      int idx)
Gets the specified Object for a system object emml config given it's type and occurrence index. There can be more then one instance of given emml config type in a system object's emml configuration.

Parameters:
type - emml - defined type of parameter to return.
idx - which occurrence of type parameter for this configuration(0 based).
Returns:
requested configuration object as a generic Object that will be typecasted to the expected Java type

getParmObjects

public java.util.ArrayList getParmObjects(java.lang.String type)
Gets parameter(s) objects by specified type

Parameters:
type - type of parameter(s) to return (in order)
Returns:
ArrayList of Object (inside NamedEmmlTuple container)

getParms

public java.util.ArrayList getParms(java.lang.String type)
Gets parameter(s) by specified type

Parameters:
type - type of parameter(s) to return (in order)
Returns:
ArrayList of NamedEmmlTuple

getType

public com.eventgnosis.config.EmmlType getType()
Returns EmmlType for this configuration.

Returns:
EmmlType

getVariableNames

public java.util.ArrayList getVariableNames()
Not currently used.
Gets all contained variables in an EmmlConfig

Returns:
ArrayList of absolute names as String's
Note: only need to hold a reference to a variable (its name) in this object, because all variables are named in a globally-unique manner and have their values in the global map, and can be retrieved via ConfigMgr.getVar(name).

hasLockedParm

public boolean hasLockedParm()
Determines if ANY parameter has a locked attribute set to true


setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.String value)
Sets a named attribute to a value (for debugging only).

Parameters:
name - attribute name
value - attribute value