|
WebObjects 5.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.webobjects.eocontrol.EOEvent
EOEvent is an abstract class that provides concrete subclasses with a structure for storing information about a logged event.
Subclasses of EOEvent don't need to override any inherited methods or implement any methods at all. You can customize the behavior if you want, but the default implementations are sufficient for most cases. Generally, to create a subclass of EOEvent, you declare it and create a description file that defines the events the subclass logs. The class itself usually declares no instance variables and implements no methods. The abstract implementation gets all the information it needs from the description file.
Most of the work involved in logging custom events is instrumenting the code.
eventTypeDescriptions(Class aClass)
,
EOEventCenter
, Serialized FormField Summary | |
static int |
BasicEventSignature
A possible signature type for use with the methods signatureOfType ,
aggregateEvents and groupEvents . |
static String |
EventGroupName
Key used in the dictionary returned by eventTypeDescriptions . |
Constructor Summary | |
EOEvent()
Creates a new event object. |
Method Summary | |
static NSArray |
aggregateEvents(NSArray events,
int tag)
Returns an array of aggregated events. |
static String |
classDescription(Class aClass)
Returns a description of the family of events represented by the class aClass . |
String |
comment()
Returns type-specific information about the event. |
int |
compare(EOEvent other)
Compares the receiver to other . |
String |
description()
Returns a String that includes the receiver's title, comment, and duration or start date (whichever is appropriate). |
String |
displayComponentName()
Returns the name of a WebObjects component to use to display the receiver's logging information. |
long |
duration()
Returns the duration of the receiver in milliseconds or 0 if the event is atomic (not a branch event) or if the branch is not yet closed. |
long |
durationWithoutSubevents()
Returns the duration of the receiver in milliseconds, not including the time spent in its subevents (if any). |
static NSDictionary |
eventTypeDescriptions(Class aClass)
Used to determine event types and descriptions for a family of events. |
static NSArray |
groupEvents(NSArray events,
int tag)
Returns an array of grouped events. |
Object |
info()
Returns the custom info for the receiver. |
void |
markAtomicWithInfo(Object info)
Initializes the receiver, a newly created event, as an atomic event that has an absolute start date (and not a duration), and sets its info to info . |
void |
markEnd()
Marks the end of a branch event, which has the side effect of setting the duration. |
void |
markStartWithInfo(Object info)
Initializes the receiver, a newly created event, to be a branch event (that possibly has nested subevents), and sets its info to info . |
EOEvent |
parentEvent()
Returns the parent event, if any, or null otherwise. |
void |
setInfo(Object info)
Sets the custom event information for the receiver. |
void |
setType(String type)
Sets the receiver's type. |
String |
signatureOfType(int tag)
Returns the requested receiver's signature, which can be used to group and aggregate the receiver with other events that have the same signature. |
NSTimestamp |
startDate()
Returns the date at which the receiver was logged. |
NSArray |
subevents()
Returns the receiver's immediate subevents (events that were logged with this event as their parent). |
String |
title()
Returns the event type description corresponding with the receiver's type. |
String |
toString()
Returns a String that includes the receiver's title, comment, and duration or start date (whichever is appropriate). |
String |
type()
Returns the receiver's type. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int BasicEventSignature
signatureOfType
,
aggregateEvents
and groupEvents
.signatureOfType(int)
,
aggregateEvents(NSArray, int)
,
groupEvents(NSArray, int)
public static final String EventGroupName
eventTypeDescriptions
.
The EventGroupName
entry provides the description of the family
of events represented by the event class.eventTypeDescriptions(Class)
Constructor Detail |
public EOEvent()
Method Detail |
public static NSArray aggregateEvents(NSArray events, int tag)
tag
from each EOEvent in events
and
aggregates the events with the same signature into a special, single
event. The resulting array has an event for each different signature.
The events in this array have a duration equal to the sum of the
durations of its aggregated events. The subevents of these special
events are the union of the subevents of its aggregated events.
This method is for use by the WOEventDisplay
page.events
- the array of EOEvents to grouptag
- the tag indicating the type of the eventpublic static String classDescription(Class aClass)
aClass
. EOEvent's implementation returns the event description
for the EOEvent.EventGroupName
key. For more information, see
the eventTypeDescriptions
method description.aClass
- the event class to be describedEventGroupName
,
eventTypeDescriptions(Class)
public String comment()
info()
public int compare(EOEvent other)
other
. If the receiver was logged before
the other event, this method returns NSComparator.OrderedAscending
.
If the receiver was logged after the other event, this method returns
NSComparator.OrderedDescending
. If the dates match, this method
returns NSComparator.OrderedSame
.other
- the EOEvent to be comparedNSComparator.OrderedAscending
,
NSComparator.OrderedDescending
, or NSComparator.OrderedSame
public String description()
public String displayComponentName()
WOEventRow
component, which is generally sufficient
for subclasses.public long duration()
public long durationWithoutSubevents()
public static NSDictionary eventTypeDescriptions(Class aClass)
Used to determine event types and descriptions for a family of events. The keys of this dictionary are event types and the corresponding values are descriptions of events of the types. Subclasses don't need to implement this method since EOEvent's implementation is generally sufficient for subclasses.
EOEvent's implementation reads the event types and their descriptions
from a file. To define the types the event class represents, create
a description file for the event and add it to the project's
resources. An event's description file defines the event
categories and subcategories used in the WOEventDisplay
page. The file's contents is a dictionary in plist format.
For example, consider a CustomAdaptorEvent
that would log
events for a custom database adaptor. CustomAdaptorEvent
would be
a subclass of EOEvent and use EOEvent's implementation of
eventTypeDescriptions
. The name of its description file would be
CustomAdaptorEvent.description
, and it would look like this:
{ EOEventGroupName = "Custom Adaptor Event"; connect = "Connect"; openChannel = "Open Channel"; evaluateExpression = "Evaluate Expression"; fetchRow = "Fetch Row"; commitTransaction = "Commit Transaction"; }
Using the EOEvent implementation, the EOEventGroupName entry is mandatory;
it describes the family of events logged by the event class. Any other keys
are defined by the event class itself. In the CustomAdaptorEvent
class, the other keys (connect
, openChannel
, and so
on) would be the types of the events CustomAdaptorEvent
logs.
If the file doesn't exist or if there's an error reading the
file, EOEvent creates a dictionary with a single entry; the entry's
key is EOEventGroupName
and the value is the name of the event class
(such as CustomAdaptorEvent
).
aClass
- the input event classEventGroupName
public static NSArray groupEvents(NSArray events, int tag)
tag
from each EOEvent in events
and
groups events with the same signature into a special, single event.
The resulting array has an event for each different signature. The
subevents of these special events are the grouped events.
This method is for use by the WOEventDisplay
page.events
- the array of EOEvents to grouptag
- the tag indicating the type of the eventpublic Object info()
public void markAtomicWithInfo(Object info)
Initializes the receiver, a newly created event, as an atomic event
that has an absolute start date (and not a duration), and sets its
info to info
. The new event object is usually created with the
EOEventCenter
method newEventOfClass
.
Note: Don't invoke this method directly. Use the
corresponding method defined in EOEventCenter
instead.
info
- the event's info objectinfo()
,
startDate()
,
duration()
,
markStartWithInfo(Object)
,
EOEventCenter.newEventOfClass(Class, String)
,
EOEventCenter.markAtomicEvent(EOEvent, Object)
public void markEnd()
Marks the end of a branch event, which has the side effect of setting the duration.
Note: Don't invoke this method directly. Use the
corresponding method defined in EOEventCenter
instead.
duration()
,
markStartWithInfo(Object)
,
EOEventCenter.markEndOfEvent(EOEvent)
public void markStartWithInfo(Object info)
Initializes the receiver, a newly created event, to be a branch event
(that possibly has nested subevents), and sets its info to info
.
The new event object is usually created with the EOEventCenter
method
newEventOfClass
.
Note: Don't invoke this method directly. Use the
corresponding method defined in EOEventCenter
instead.
info
- the event's info objectinfo()
,
markAtomicWithInfo(Object)
,
EOEventCenter.newEventOfClass(Class, String)
,
EOEventCenter.markStartOfEvent(EOEvent, Object)
public EOEvent parentEvent()
null
otherwise. Events
logged at the root level do not have a parent. Other events return the
event that was open at the time that they were started.null
if there isn't onepublic void setInfo(Object info)
WOEventDisplay
page. The info argument can be any kind of object that implements the
equals
and toString
methods.info
- the info objectpublic void setType(String type)
type
- the string describing the type of the receivereventTypeDescriptions(Class)
public String signatureOfType(int tag)
EOEvent.BasicEventSignature
, which has
the corresponding signature of the form "title-comment". If the specified
signature type is unknown, EOEvent's implementation returns null
.tag
- the tag indicating the type of the signatureBasicEventSignature
,
aggregateEvents(NSArray, int)
,
groupEvents(NSArray, int)
public NSTimestamp startDate()
public NSArray subevents()
public String title()
WOEventDisplay
. EOEvent's implementation returns the value
from the eventTypeDescriptions
dictionary for the receiver's type. If
there isn't an entry in the eventTypeDescriptions
dictionary for the
receiver's type, EOEvent's implementation returns the name of the receiver's class.type()
,
eventTypeDescriptions(Class)
public String toString()
toString
in class Object
public String type()
eventTypeDescriptions
method description.eventTypeDescriptions(Class)
|
Last updated Fri Feb 21 13:15:00 PST 2003. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |