edu.isi.pegasus.common.logging.format
Class SimpleEvent

java.lang.Object
  extended by edu.isi.pegasus.common.logging.format.SimpleEvent
All Implemented Interfaces:
Event, Cloneable

public class SimpleEvent
extends Object
implements Event

A Simple LogEvent implementation that is back by a StringBuffer.

Version:
$Revision: 2079 $
Author:
Karan Vahi

Field Summary
private  StringBuffer mEventBuffer
          The buffer that stores information about the event
private  StringBuffer mLogBuffer
          The buffer that stores information about the log message
private  String mProgram
          The name of the program.
 
Constructor Summary
SimpleEvent()
          The default constructor.
 
Method Summary
 Event add(String key, String value)
          Add to the log message.
 String createEntityHierarchyMessage(String parentType, String parentID, String childIdType, Collection<String> childIDs)
          Creates a log message that connects the parent entities with the children.
 String createLogMessage()
          Creates a log message with the contents of the internal log buffer.
 String createLogMessageAndReset()
          Creates a log message with the contents of the internal log buffer.
 String getEndEventMessage()
          Creates the end message for the event.
 String getEventName()
          Returns the name of event that is currently associated with the log messages.
 String getProgramName(String name)
          Returns the program name for the software whose log statement are logged.
 String getStartEventMessage()
          Creates the start message for the event.
 void reset()
          Reset the internal log message buffer associated with the event
 void setEvent(String name, Map<String,String> map)
          Adds the event that is to be associated with the log messages onto an internal stack
 void setEvent(String name, String entityName, String entityID)
          Set the event that is to be associated with the log messages.
 void setProgramName(String name)
          Sets the program name for the software whose log statement are logged.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mProgram

private String mProgram
The name of the program.


mEventBuffer

private StringBuffer mEventBuffer
The buffer that stores information about the event


mLogBuffer

private StringBuffer mLogBuffer
The buffer that stores information about the log message

Constructor Detail

SimpleEvent

public SimpleEvent()
The default constructor.

Method Detail

setProgramName

public void setProgramName(String name)
Sets the program name for the software whose log statement are logged.

Specified by:
setProgramName in interface Event
Parameters:
name -

getProgramName

public String getProgramName(String name)
Returns the program name for the software whose log statement are logged.

Specified by:
getProgramName in interface Event
Parameters:
name -
Returns:
program name

setEvent

public void setEvent(String name,
                     String entityName,
                     String entityID)
Set the event that is to be associated with the log messages.

Specified by:
setEvent in interface Event
Parameters:
name - the name of the event to be associated
entityName - the primary entity that is associated with the event e.g. workflow
entityID - the id of that entity.

setEvent

public void setEvent(String name,
                     Map<String,String> map)
Adds the event that is to be associated with the log messages onto an internal stack

Specified by:
setEvent in interface Event
Parameters:
name - the name of the event to be associated
map - Map of Entity Names with the entity identifiers.

getEventName

public String getEventName()
Returns the name of event that is currently associated with the log messages.

Specified by:
getEventName in interface Event
Returns:
the event to be associated

getStartEventMessage

public String getStartEventMessage()
Creates the start message for the event.

Specified by:
getStartEventMessage in interface Event
Returns:
start event message

getEndEventMessage

public String getEndEventMessage()
Creates the end message for the event.

Specified by:
getEndEventMessage in interface Event
Returns:
end event message

reset

public void reset()
Reset the internal log message buffer associated with the event

Specified by:
reset in interface Event

add

public Event add(String key,
                 String value)
Add to the log message.

Specified by:
add in interface Event
Parameters:
key -
value -
Returns:
Self-reference, so calls can be chained

createLogMessage

public String createLogMessage()
Creates a log message with the contents of the internal log buffer.

Specified by:
createLogMessage in interface Event
Returns:
the log message

createLogMessageAndReset

public String createLogMessageAndReset()
Creates a log message with the contents of the internal log buffer. It then resets the buffer before returning the log message

Specified by:
createLogMessageAndReset in interface Event
Returns:
the log message

createEntityHierarchyMessage

public String createEntityHierarchyMessage(String parentType,
                                           String parentID,
                                           String childIdType,
                                           Collection<String> childIDs)
Creates a log message that connects the parent entities with the children. For e.g. can we use to create the log messages connecting the jobs with the workflow they are part of.

Specified by:
createEntityHierarchyMessage in interface Event
Parameters:
parentType - the type of parent entity
parentID - the id of the parent entity
childIdType - the type of children entities
childIDs - Collection of children id's
Returns:
entity hierarchy message.


Copyright © 2011 The University of Southern California. All Rights Reserved.