com.eventgnosis.system
Class SystemObject

java.lang.Object
  extended bycom.eventgnosis.system.SystemObject
Direct Known Subclasses:
EventDestinationBase, EventSourceListenerBase, FilterBase

public class SystemObject
extends java.lang.Object

This is the base class for objects that form the runtime hierarchy which allow for either management of other system objects (hierarchy) or event processing.
The system object hierarchy is a rooted tree with managers at the top and event processing nodes bellow.
Much common functionality has been refactored into base class providing tremendous code reuse across the system.
Major object attributes are following:
  1. name: guaranteed to be unique across a system, in format host:/ecs/eca/object
  2. myMgr: parent in the object hierarchy, null if root.
  3. members: list of child nodes.
  4. eCfg - EmmlConfig: the specific event management markup language (xml) configuration for this object.
  5. destination: if the object processes events stdOut destination.
  6. eventProcessor: if the object processes events, contained mechanism for processing events; otherwisenull.
Null destination and eventProcessor imply manager node.


Field Summary
static java.lang.String CONFIG_MGR
           
static java.lang.String DEST_CREATION_MGR
           
static java.lang.String DEST_MGR
           
static int DOWN
           
static int ERROR
           
static java.lang.String FILTER_STACK_MGR
           
static java.lang.String HIER_SEP
           
static int INITIALIZING
           
static int MAX_LEVELS
           
static java.lang.String QUEUE_MGR
           
static int SHUTTINGDOWN
           
static java.lang.String SRC_ADAPTER_MGR
           
static java.lang.String SRC_LISTENER_MGR
           
static int STARTED
           
static java.util.ArrayList statusMap
           
static int UNKNOWN
           
static int UP
           
 
Constructor Summary
SystemObject()
           
SystemObject(Log log, java.lang.String name, SystemObject myMgr, com.eventgnosis.config.ConfigurationManager configMgr)
           
 
Method Summary
 boolean addMember(SystemObject so)
          Adds a system object to list of members if doesn't yet exist.
 boolean checkForLock()
           
 boolean continueOperation()
           
 SystemObject createDestination(Event ev)
          Must be overridden for each of the base types of system objects.
This method finds successor system object for event flow based on emml configuration(called destination name).
 java.lang.String doWork(long timeout)
          Do work for all child members as a generic default.
Each SystemObject can have its own member children, thread, and/or event processors.
If object is not yet started, starts it up.
static SystemObject findObject(java.lang.String objId, SystemObject parent, int level)
           
 boolean getCanDelete()
           
 EmmlConfig getConfig()
           
 com.eventgnosis.config.ConfigurationManager getConfigMgr()
           
 java.lang.String getConfigXml()
          Returns the XML that corresponds to object's initial setup (emml configuration)
 SystemObject getDestination(Event ev)
          Gets the destination SystemObject, if destination attribute is unknown (null) finds that destination based on it's emml config destination name.
Calls overridden createDestination(Event).
 java.lang.String getDestinationInfo()
           
 java.lang.String getDestinationName()
           
 java.lang.String getDestName()
           
 java.lang.String getEventStatisticsXml()
          Get event statistics XML for this object
 com.eventgnosis.system.EventStatistics getEventStats()
           
 java.lang.String getEventStream(java.lang.String sessionId, com.eventgnosis.types.StreamHeader strHdr, java.lang.String accessPt)
           
 Log getLog()
           
 SystemObject getMember(int idx)
          Gets a specific indexed member of this object.
 SystemObject getMember(java.lang.String name)
          Gets a specific named member of this object.
 SystemObject getMyManager()
           
 java.lang.String getName()
           
 int getNumMembers()
           
 com.eventgnosis.config.EmmlObjectId getObjectId()
           
 java.lang.String getQueueStatisticsXml()
          Get queue statistics XML for this object
 java.lang.String getRuntimeXml()
          Returns the XML of this object for any non-configuration, runtime state information.
 long getShutdownTime()
           
 long getStartTime()
           
 int getStatus()
           
static java.lang.String getStatusAsString(int status)
           
 java.lang.String getSummaryXml()
          Get the summary XML of for this and member objects
 java.lang.String getThreadName()
           
 java.lang.String getToString()
           
 SystemObject installChildByName(java.lang.String childName, EmmlConfig eCfg)
           
 boolean isDisabled()
           
 boolean isLocked()
           
 void kill()
          Signals dependent processes on impending death, stops any independent threads and destroys any resources, returning them to the system.
static SystemObject locateObject(SystemObject root, java.lang.String objId)
           
 java.util.ArrayList processEvent(Event ev)
          This method needs to be reimplemented for each filter system object that processes events, according to it's required behavior.
This is where specific processing/changes to events happen.
 void removeAllMembers()
          Removes all child objects from a parent, irrespective if object is deleteable or not
 SystemObject removeMember(java.lang.String name)
          Removes a system object from list of members
 void removeSelf()
           
 void setCanDelete(boolean del)
           
 void setConfigMgr(com.eventgnosis.config.ConfigurationManager configMgr)
           
 void setDestination(SystemObject dest)
           
 void setDestinationName(java.lang.String destName)
           
 void setLocked()
           
 void setStartupErrors(java.lang.String err)
           
 void setUnlocked()
           
 void setVars(Log log, java.lang.String name, SystemObject myMgr, com.eventgnosis.config.ConfigurationManager configMgr, EmmlConfig eCfg)
          This method is called after default constructor to set object variable values.
Also allows setting internal configuration values from properties list.
Initialize a system object per it's input params and emml configurations.
Every significant system object(source, destination, filter) should implement this method.
 void shutdown(long timeout)
          Halts any processing in orderly manner.
 boolean startupErrors()
           
 boolean submit(Event ev)
          Receive an event from an outside source and submit it to the event processor.
See event processor classes for blocking behaviour.
If event processor submit fails the event will be discarded.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONFIG_MGR

public static final java.lang.String CONFIG_MGR
See Also:
Constant Field Values

DEST_CREATION_MGR

public static final java.lang.String DEST_CREATION_MGR
See Also:
Constant Field Values

DEST_MGR

public static final java.lang.String DEST_MGR
See Also:
Constant Field Values

DOWN

public static final int DOWN
See Also:
Constant Field Values

ERROR

public static final int ERROR
See Also:
Constant Field Values

FILTER_STACK_MGR

public static final java.lang.String FILTER_STACK_MGR
See Also:
Constant Field Values

HIER_SEP

public static final java.lang.String HIER_SEP
See Also:
Constant Field Values

INITIALIZING

public static final int INITIALIZING
See Also:
Constant Field Values

MAX_LEVELS

public static final int MAX_LEVELS
See Also:
Constant Field Values

QUEUE_MGR

public static final java.lang.String QUEUE_MGR
See Also:
Constant Field Values

SHUTTINGDOWN

public static final int SHUTTINGDOWN
See Also:
Constant Field Values

SRC_ADAPTER_MGR

public static final java.lang.String SRC_ADAPTER_MGR
See Also:
Constant Field Values

SRC_LISTENER_MGR

public static final java.lang.String SRC_LISTENER_MGR
See Also:
Constant Field Values

STARTED

public static final int STARTED
See Also:
Constant Field Values

statusMap

public static java.util.ArrayList statusMap

UNKNOWN

public static final int UNKNOWN
See Also:
Constant Field Values

UP

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

SystemObject

public SystemObject()

SystemObject

public SystemObject(Log log,
                    java.lang.String name,
                    SystemObject myMgr,
                    com.eventgnosis.config.ConfigurationManager configMgr)
Method Detail

addMember

public boolean addMember(SystemObject so)
Adds a system object to list of members if doesn't yet exist.

Parameters:
so - specific Systemobject
Returns:
true if no duplicate name in list (successful add)

checkForLock

public boolean checkForLock()

continueOperation

public boolean continueOperation()

createDestination

public SystemObject createDestination(Event ev)
Must be overridden for each of the base types of system objects.
This method finds successor system object for event flow based on emml configuration(called destination name).

Parameters:
ev - Event - in case destination creation depends on event contents (dynamic destination creation). This is currently not supported.
Returns:
destination SystemObject on witch submit(event) will be called

doWork

public java.lang.String doWork(long timeout)
Do work for all child members as a generic default.
Each SystemObject can have its own member children, thread, and/or event processors.
If object is not yet started, starts it up.

Parameters:
timeout - The timeout in milliseconds by which the call it to return. This is an advisory number that is implementation specific.

findObject

public static SystemObject findObject(java.lang.String objId,
                                      SystemObject parent,
                                      int level)

getCanDelete

public boolean getCanDelete()

getConfig

public EmmlConfig getConfig()

getConfigMgr

public com.eventgnosis.config.ConfigurationManager getConfigMgr()

getConfigXml

public java.lang.String getConfigXml()
Returns the XML that corresponds to object's initial setup (emml configuration)

Returns:
xml string

getDestination

public SystemObject getDestination(Event ev)
Gets the destination SystemObject, if destination attribute is unknown (null) finds that destination based on it's emml config destination name.
Calls overridden createDestination(Event).

Parameters:
ev - Event - in case destination creation depends on event contents (dynamic destination creation). This is currently not supported.
Returns:
destination SystemObject on witch submit(event) will be called.

getDestinationInfo

public java.lang.String getDestinationInfo()

getDestinationName

public java.lang.String getDestinationName()

getDestName

public java.lang.String getDestName()

getEventStatisticsXml

public java.lang.String getEventStatisticsXml()
Get event statistics XML for this object


getEventStats

public com.eventgnosis.system.EventStatistics getEventStats()

getEventStream

public java.lang.String getEventStream(java.lang.String sessionId,
                                       com.eventgnosis.types.StreamHeader strHdr,
                                       java.lang.String accessPt)

getLog

public Log getLog()

getMember

public SystemObject getMember(int idx)
Gets a specific indexed member of this object.

Parameters:
idx - index in members list
Returns:
SystemObject

getMember

public SystemObject getMember(java.lang.String name)
Gets a specific named member of this object.

Parameters:
name - system object unique name
Returns:
SystemObject

getMyManager

public SystemObject getMyManager()

getName

public java.lang.String getName()

getNumMembers

public int getNumMembers()

getObjectId

public com.eventgnosis.config.EmmlObjectId getObjectId()

getQueueStatisticsXml

public java.lang.String getQueueStatisticsXml()
Get queue statistics XML for this object


getRuntimeXml

public java.lang.String getRuntimeXml()
Returns the XML of this object for any non-configuration, runtime state information.

Returns:
xml string

getShutdownTime

public long getShutdownTime()

getStartTime

public long getStartTime()

getStatus

public int getStatus()

getStatusAsString

public static java.lang.String getStatusAsString(int status)

getSummaryXml

public java.lang.String getSummaryXml()
Get the summary XML of for this and member objects


getThreadName

public java.lang.String getThreadName()

getToString

public java.lang.String getToString()

installChildByName

public SystemObject installChildByName(java.lang.String childName,
                                       EmmlConfig eCfg)

isDisabled

public boolean isDisabled()

isLocked

public boolean isLocked()

kill

public void kill()
Signals dependent processes on impending death, stops any independent threads and destroys any resources, returning them to the system.


locateObject

public static SystemObject locateObject(SystemObject root,
                                        java.lang.String objId)

processEvent

public java.util.ArrayList processEvent(Event ev)
This method needs to be reimplemented for each filter system object that processes events, according to it's required behavior.
This is where specific processing/changes to events happen. Default implementation just obtains the destination and returns the event:destination routing information.

Parameters:
ev - The Event to be processed.
Returns:
ArrayList tuples of {Event/Destination} witch will be appropriately routed through the system (1,0 or more destinations)

removeAllMembers

public void removeAllMembers()
Removes all child objects from a parent, irrespective if object is deleteable or not


removeMember

public SystemObject removeMember(java.lang.String name)
Removes a system object from list of members

Parameters:
name - system object unique name
Returns:
SystemObject

removeSelf

public void removeSelf()

setCanDelete

public void setCanDelete(boolean del)

setConfigMgr

public void setConfigMgr(com.eventgnosis.config.ConfigurationManager configMgr)

setDestination

public void setDestination(SystemObject dest)

setDestinationName

public void setDestinationName(java.lang.String destName)

setLocked

public void setLocked()

setStartupErrors

public void setStartupErrors(java.lang.String err)

setUnlocked

public void setUnlocked()

setVars

public void setVars(Log log,
                    java.lang.String name,
                    SystemObject myMgr,
                    com.eventgnosis.config.ConfigurationManager configMgr,
                    EmmlConfig eCfg)
This method is called after default constructor to set object variable values.
Also allows setting internal configuration values from properties list.
Initialize a system object per it's input params and emml configurations.
Every significant system object(source, destination, filter) should implement this method.

Parameters:
log - logger instance for tracking error, warning and info messages.
name - unique name for an instance of system object.
myMgr - managing SystemObject who is responsible for the life-cycle (startup, run, shutdown) of this object.
configMgr - holds configuration data structure used to properly configure runtime setup based on input ECA(s).
eCfg - EmmlConfig instance - specifies the configuration/behavior of the object, witch can be quite complex.

shutdown

public void shutdown(long timeout)
Halts any processing in orderly manner.

Parameters:
timeout - The maximum amount of time in milliseconds for the operation to complete. This is an advisory number that is dependent on the implementation.

startupErrors

public boolean startupErrors()

submit

public boolean submit(Event ev)
Receive an event from an outside source and submit it to the event processor.
See event processor classes for blocking behaviour.
If event processor submit fails the event will be discarded.

Returns:
always returns true

toString

public java.lang.String toString()