org.apache.uima.util.impl
Class ProcessTrace_impl

java.lang.Object
  extended by org.apache.uima.util.impl.ProcessTrace_impl
All Implemented Interfaces:
java.io.Serializable, ProcessTrace

public class ProcessTrace_impl
extends java.lang.Object
implements ProcessTrace

Reference implementation of ProcessTrace.

See Also:
Serialized Form

Constructor Summary
ProcessTrace_impl()
          Create a ProcessTrace_impl using the framework's default timer.
ProcessTrace_impl(java.util.Properties aPerformanceTuningSettings)
          Create a ProcessTrace_impl using the framework's default timer.
ProcessTrace_impl(UimaTimer aTimer)
          Create a ProcessTrace_impl with a custom timer.
ProcessTrace_impl(UimaTimer aTimer, java.util.Properties aPerformanceTuningSettings)
          Create a ProcessTrace_impl with a custom timer.
 
Method Summary
 void addAll(java.util.List<ProcessTraceEvent> aEventList)
          Adds a list of completed event objects to this ProcessTrace.
 void addEvent(ProcessTraceEvent aEvent)
          Adds a completed event object to this ProcessTrace.
 void addEvent(java.lang.String aComponentName, java.lang.String aType, java.lang.String aDescription, int aDuration, java.lang.String aResultMsg)
          Adds an event with the specified parameters to this ProcessTrace.
 void aggregate(ProcessTrace aProcessTrace)
          Aggregates the information in another ProcessTrace with this one.
protected  void aggregateEvent(ProcessTraceEvent_impl aDest, ProcessTraceEvent_impl aSrc)
          Utility method used by aggregate(ProcessTrace)
 void clear()
          Resets this ProcessTrace by removing all events.
 void endEvent(java.lang.String aComponentName, java.lang.String aEventType, java.lang.String aResultMessage)
          Records the end of an event.
protected
<T extends ProcessTraceEvent>
T
findCorrespondingEvent(java.util.List<T> aEventList, T aEvent)
          Utility method used by aggregate(ProcessTrace)
protected  ProcessTraceEvent getEvent(java.util.List<ProcessTraceEvent> aEvents, java.lang.String aComponentName, java.lang.String aType)
           
 ProcessTraceEvent getEvent(java.lang.String aComponentName, java.lang.String aType)
          Get a specified event.
 java.util.List<ProcessTraceEvent> getEvents()
          Gets a list of ProcessTraceEvents, in the order in which they were created.
protected  void getEventsByComponentName(ProcessTraceEvent aEvent, java.lang.String aComponentName, boolean aRecurseAfterMatch, java.util.List<ProcessTraceEvent> aResultList)
          Utility method used by getEventsByComponentName(String)
 java.util.List<ProcessTraceEvent> getEventsByComponentName(java.lang.String aComponentName, boolean aRecurseAfterMatch)
          Gets all events that have the given Component name.
protected  void getEventsByType(ProcessTraceEvent aEvent, java.lang.String aType, boolean aRecurseAfterMatch, java.util.List<ProcessTraceEvent> aResultList)
          Utility method used by getEventsByType(String)
 java.util.List<ProcessTraceEvent> getEventsByType(java.lang.String aType, boolean aRecurseAfterMatch)
          Gets all events that have the given type
 void startEvent(java.lang.String aComponentName, java.lang.String aEventType, java.lang.String aDescription)
          Records the start of an event.
 java.lang.String toString()
          Generates a user-readable representation of all events in this ProcessTrace.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProcessTrace_impl

public ProcessTrace_impl()
Create a ProcessTrace_impl using the framework's default timer.


ProcessTrace_impl

public ProcessTrace_impl(java.util.Properties aPerformanceTuningSettings)
Create a ProcessTrace_impl using the framework's default timer.

Parameters:
aPerformanceTuningSettings - performance tuning settings. One of the settings allows the ProcessTrace to be disabled.

ProcessTrace_impl

public ProcessTrace_impl(UimaTimer aTimer)
Create a ProcessTrace_impl with a custom timer.

Parameters:
aTimer - the timer to use for collecting performance stats

ProcessTrace_impl

public ProcessTrace_impl(UimaTimer aTimer,
                         java.util.Properties aPerformanceTuningSettings)
Create a ProcessTrace_impl with a custom timer.

Parameters:
aTimer - the timer to use for collecting performance stats
aPerformanceTuningSettings - performance tuning settings. One of the settings allows the ProcessTrace to be disabled.
Method Detail

startEvent

public void startEvent(java.lang.String aComponentName,
                       java.lang.String aEventType,
                       java.lang.String aDescription)
Description copied from interface: ProcessTrace
Records the start of an event. The event will be ended when there is a corresponding call to ProcessTrace.endEvent(String,String,String) with the same component name and event type. The duration of the event will be automatically computed from the difference in time between the start and end.

Specified by:
startEvent in interface ProcessTrace
Parameters:
aComponentName - name of the component generating the event
aEventType - type of the event. Standard types are defined as constants on the ProcessTraceEvent interface, but any string may be used.
aDescription - description of the event
See Also:
ProcessTrace.startEvent(java.lang.String, java.lang.String, java.lang.String)

endEvent

public void endEvent(java.lang.String aComponentName,
                     java.lang.String aEventType,
                     java.lang.String aResultMessage)
Description copied from interface: ProcessTrace
Records the end of an event. The event is identified by the component name and type. If there is no open event that matches those values, a UIMA_IllegalStateException will be thrown.

Specified by:
endEvent in interface ProcessTrace
Parameters:
aComponentName - name of the component generating the event
aEventType - type of the event. Standard types are defined as constants on the ProcessTraceEvent interface, but any string may be used.
aResultMessage - describes the result of the event
See Also:
ProcessTrace.endEvent(java.lang.String, java.lang.String, java.lang.String)

addEvent

public void addEvent(java.lang.String aComponentName,
                     java.lang.String aType,
                     java.lang.String aDescription,
                     int aDuration,
                     java.lang.String aResultMsg)
Description copied from interface: ProcessTrace
Adds an event with the specified parameters to this ProcessTrace.

Specified by:
addEvent in interface ProcessTrace
Parameters:
aComponentName - name of the component generating the event
aType - type of the event. Standard types are defined as constants on the ProcessTraceEvent interface, but any string may be used.
aDescription - description of the event
aDuration - duration of the event in milliseconds
aResultMsg - result message of event
See Also:
ProcessTrace.addEvent(String, String, String, int, String)

addEvent

public void addEvent(ProcessTraceEvent aEvent)
Description copied from interface: ProcessTrace
Adds a completed event object to this ProcessTrace. This method is useful for copying events from one ProcessTrace into another.

Specified by:
addEvent in interface ProcessTrace
Parameters:
aEvent - the event object to be added to this ProcessTrace
See Also:
ProcessTrace.addEvent(org.apache.uima.util.ProcessTraceEvent)

addAll

public void addAll(java.util.List<ProcessTraceEvent> aEventList)
Description copied from interface: ProcessTrace
Adds a list of completed event objects to this ProcessTrace. This method is useful for copying events from one ProcessTrace into another.

Specified by:
addAll in interface ProcessTrace
Parameters:
aEventList - a List of event object to be added to this ProcessTrace
See Also:
ProcessTrace.addAll(java.util.List)

getEvents

public java.util.List<ProcessTraceEvent> getEvents()
Description copied from interface: ProcessTrace
Gets a list of ProcessTraceEvents, in the order in which they were created. This is generally chronological order.

Specified by:
getEvents in interface ProcessTrace
Returns:
an unmodifiable List of ProcessTraceEvents
See Also:
ProcessTrace.getEvents()

getEventsByComponentName

public java.util.List<ProcessTraceEvent> getEventsByComponentName(java.lang.String aComponentName,
                                                                  boolean aRecurseAfterMatch)
Description copied from interface: ProcessTrace
Gets all events that have the given Component name.

Specified by:
getEventsByComponentName in interface ProcessTrace
Parameters:
aComponentName - the component name to look for
aRecurseAfterMatch - if true, all events with the given component name will be returned. If false, this method will not recurse into the sub-events of a matching event.
Returns:
a List of ProcessTraceEvents having the given component name
See Also:
org.apache.uima.util.ProcessTrace#getEventsByComponentName(String)

getEventsByType

public java.util.List<ProcessTraceEvent> getEventsByType(java.lang.String aType,
                                                         boolean aRecurseAfterMatch)
Description copied from interface: ProcessTrace
Gets all events that have the given type

Specified by:
getEventsByType in interface ProcessTrace
Parameters:
aType - the type of event to look for
aRecurseAfterMatch - if true, all events with the given component name will be returned. If false, this method will not recurse into the sub-events of a matching event.
Returns:
a List of ProcessTraceEvents having the given type
See Also:
org.apache.uima.util.ProcessTrace#getEventsByType(String)

getEvent

public ProcessTraceEvent getEvent(java.lang.String aComponentName,
                                  java.lang.String aType)
Description copied from interface: ProcessTrace
Get a specified event.

Specified by:
getEvent in interface ProcessTrace
Parameters:
aComponentName - name of component producing desired event
aType - type of desired event
Returns:
the first ProcessTraceEvent matching the parameters, null if there is no such event.
See Also:
ProcessTrace.getEvent(String, String)

getEvent

protected ProcessTraceEvent getEvent(java.util.List<ProcessTraceEvent> aEvents,
                                     java.lang.String aComponentName,
                                     java.lang.String aType)

clear

public void clear()
Description copied from interface: ProcessTrace
Resets this ProcessTrace by removing all events.

Specified by:
clear in interface ProcessTrace
See Also:
ProcessTrace.clear()

aggregate

public void aggregate(ProcessTrace aProcessTrace)
Description copied from interface: ProcessTrace
Aggregates the information in another ProcessTrace with this one. Events that exist in both ProcessTraces will have their durations added together. This method is useful for collecting aggregate performance statistics for collection processing.

Specified by:
aggregate in interface ProcessTrace
Parameters:
aProcessTrace - the Process Trace object whose information will be combined with the information in this object
See Also:
ProcessTrace.aggregate(org.apache.uima.util.ProcessTrace)

toString

public java.lang.String toString()
Description copied from interface: ProcessTrace
Generates a user-readable representation of all events in this ProcessTrace.

Specified by:
toString in interface ProcessTrace
Overrides:
toString in class java.lang.Object
Returns:
the String representation of all events in this ProcessTrace.
See Also:
ProcessTrace.toString()

getEventsByComponentName

protected void getEventsByComponentName(ProcessTraceEvent aEvent,
                                        java.lang.String aComponentName,
                                        boolean aRecurseAfterMatch,
                                        java.util.List<ProcessTraceEvent> aResultList)
Utility method used by getEventsByComponentName(String)


getEventsByType

protected void getEventsByType(ProcessTraceEvent aEvent,
                               java.lang.String aType,
                               boolean aRecurseAfterMatch,
                               java.util.List<ProcessTraceEvent> aResultList)
Utility method used by getEventsByType(String)


findCorrespondingEvent

protected <T extends ProcessTraceEvent> T findCorrespondingEvent(java.util.List<T> aEventList,
                                                                 T aEvent)
Utility method used by aggregate(ProcessTrace)


aggregateEvent

protected void aggregateEvent(ProcessTraceEvent_impl aDest,
                              ProcessTraceEvent_impl aSrc)
Utility method used by aggregate(ProcessTrace)



Copyright © 2010 The Apache Software Foundation. All Rights Reserved.