|
TPTP 4.1.0 Platform Project Public API Specification |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.eclipse.tptp.logging.events.cbe.util.EventHelpers
Miscellaneous routines to support functions such as validation, mapping and comparison.
| Constructor Summary | |
|---|---|
EventHelpers()
|
|
| Method Summary | |
|---|---|
static boolean |
compareUnorderedLists(java.util.List listOne,
java.util.List listTwo)
Compare two unordered List objects ignoring order. |
static void |
convertObjectToCommonBaseEvent(CommonBaseEvent commonBaseEvent,
java.lang.Object object,
int maxReferences)
Converts the parameter object to a CommonBaseEvent
based on the Common Base Event v1.0.1 schema and sets the Common
Base Event properties on the parameter Common Base Event. |
static CommonBaseEvent |
convertObjectToCommonBaseEvent(java.lang.Object object,
int maxReferences)
Converts the parameter object to a CommonBaseEvent
based on the Common Base Event v1.0.1 schema. |
static ExtendedDataElement |
convertToExtendedDataElement(java.lang.Throwable throwable)
Maps data of the parameter java.lang.Throwable object to
an Extended Data Element. |
static ExtendedDataElement |
convertToExtendedDataElement(java.lang.Throwable throwable,
java.lang.String name)
Maps data of the parameter java.lang.Throwable object to
an Extended Data Element with the parameter name. |
static long |
dateToLong(java.lang.String xsdDateTimeString)
Converts the creationTime from a string in XML Schema dateTime format (CCYY-MM-DDThh:mm:ss) to a long representing the milliseconds since 1970-01-01T00:00:00 |
static java.lang.String[] |
getExtendedDataElementValuesArray(java.lang.String values)
Convenience API to transpose a values string to a
values array, thereby ensuring the parameter
values string does not exceed the 1024 character limit, as
stated in the Common Base Event v1.0.1 specification. |
static java.lang.String |
getFormattedDateString(long dateInMillis)
Converts a long representing a coordinated universal time (UTC) date in milliseconds to a formatted string using the default date format pattern. |
static java.lang.String |
getFormattedDateString(long dateInMillis,
java.lang.String dateFormatPattern)
Converts a long representing a coordinated universal time (UTC) date in milliseconds to a formatted string using the parameter date format pattern. |
static java.lang.String |
getFormattedDateString(java.lang.String xsdDateTimeString)
Converts a string representing an XML Schema dateTime (e.g. |
static java.lang.String |
getFormattedDateString(java.lang.String xsdDateTimeString,
java.lang.String dateFormatPattern)
Converts a string representing an XML Schema dateTime (e.g. |
static java.lang.String |
getString(java.lang.String key)
|
static java.lang.String |
getString(java.lang.String key,
java.lang.Object argument)
|
static java.lang.String |
getString(java.lang.String key,
java.lang.Object[] arguments)
|
static java.lang.String |
getString(java.lang.String key,
java.lang.Object argumentA,
java.lang.Object argumentB)
|
static java.lang.String |
getString(java.lang.String key,
java.lang.Object argumentA,
java.lang.Object argumentB,
java.lang.Object argumentC)
|
static java.lang.String |
getString(java.lang.String key,
java.lang.Object argumentA,
java.lang.Object argumentB,
java.lang.Object argumentC,
java.lang.Object argumentD)
|
static java.lang.String |
longToDate(long dateInMillis)
Converts a long representing UTC in milliseconds to the XML Schema datetime format (CCYY-MM-DDThh:mm:ssZ) |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public EventHelpers()
| Method Detail |
public static long dateToLong(java.lang.String xsdDateTimeString)
xsdDateTimeString - A string representing an XML Schema dateTime (e.g.
yyyy-MM-ddTHH:mm:ss) date.
java.lang.IllegalArgumentException - If the string representing an XML Schema dateTime (e.g.
yyyy-MM-ddTHH:mm:ss) date is invalid.CommonBaseEvent.getCreationTimeAsLong()public static java.lang.String longToDate(long dateInMillis)
dateInMillis - A long representing a coordinated universal time (UTC) time
stamp in milliseconds.
java.lang.IllegalArgumentException - If the long representing a coordinated universal time (UTC)
time stamp in milliseconds is negative.CommonBaseEvent.setCreationTimeAsLong(long)public static java.lang.String getString(java.lang.String key)
public static java.lang.String getString(java.lang.String key,
java.lang.Object argument)
public static java.lang.String getString(java.lang.String key,
java.lang.Object argumentA,
java.lang.Object argumentB)
public static java.lang.String getString(java.lang.String key,
java.lang.Object argumentA,
java.lang.Object argumentB,
java.lang.Object argumentC)
public static java.lang.String getString(java.lang.String key,
java.lang.Object argumentA,
java.lang.Object argumentB,
java.lang.Object argumentC,
java.lang.Object argumentD)
public static java.lang.String getString(java.lang.String key,
java.lang.Object[] arguments)
public static ExtendedDataElement convertToExtendedDataElement(java.lang.Throwable throwable)
java.lang.Throwable object to
an Extended Data Element.
This API provides a structured representation of the parameter
java.lang.Throwable object as an Extended Data Element
with the following advantages:
name s (e.g.
"Throwable" and "Cause")java.lang.Throwables.
values.
NOTE: This API invoked in JRE 1.3.x and below run-time environments
parses the stack trace produced by the java.lang.Throwable
'sprintStackTrace() API (e.g. no causal
java.lang.Throwable (s)). Alternatively, this API invoked
in JRE 1.4.x and above run-time environments utilizes the
java.lang.Throwable's causal
java.lang.Throwable and StackTraceElement
(s) properties.
This API uses the following mapping to convert the parameter
java.lang.Throwable object to an Extended Data Element:
java.lang.Throwable's class
name>[: < java.lang.Throwable's localized
message>]java.lang.Throwable's
stackTraceElement[0...(m - (n + 1))]>java.lang.Throwable's cause>
This API uses the following mapping to convert the parameter
java.lang.Throwable object to an Extended Data Element if
the parameter java.lang.Throwable object is
null:
null
Causal java.lang.Throwable s are recursively converted to
Extended Data Elements using the following mapping:
...
NOTE: When the java.lang.Throwable's class name and
localized message are greater than 1024 characters, the resultant class
name and localized message string is segmented into a the first
1024-character elements of the values property. As such,
the java.lang.Throwable's stack trace elements are
transposed by the number of 1024-character elements in the
values property.
throwable - The java.lang.Throwable object to be converted
to an Extended Data Element.
java.lang.Throwable object.
public static ExtendedDataElement convertToExtendedDataElement(java.lang.Throwable throwable,
java.lang.String name)
java.lang.Throwable object to
an Extended Data Element with the parameter name.
This API provides a structured representation of the parameter
java.lang.Throwable object as an Extended Data Element
with the following advantages:
name s (e.g.
<name> and "Cause")java.lang.Throwables.
values.
NOTE: This API invoked in JRE 1.3.x and below run-time environments
parses the stack trace produced by the java.lang.Throwable
'sprintStackTrace() API (e.g. no causal
java.lang.Throwable (s)). Alternatively, this API invoked
in JRE 1.4.x and above run-time environments utilizes the
java.lang.Throwable's causal
java.lang.Throwable and StackTraceElement
(s) properties.
This API uses the following mapping to convert the parameter
java.lang.Throwable object to an Extended Data Element:
java.lang.Throwable's class
name>[: < java.lang.Throwable's localized
message>]java.lang.Throwable's
stackTraceElement[0...(m - (n + 1))]>java.lang.Throwable's cause>
This API uses the following mapping to convert the parameter
java.lang.Throwable object to an Extended Data Element if
the parameter java.lang.Throwable object is
null:
null
Causal java.lang.Throwable s are recursively converted to
Extended Data Elements using the following mapping:
...
NOTE: When the java.lang.Throwable's class name and
localized message are greater than 1024 characters, the resultant class
name and localized message string is segmented into a the first
1024-character elements of the values property. As such,
the java.lang.Throwable's stack trace elements are
transposed by the number of 1024-character elements in the
values property.
throwable - The java.lang.Throwable object to be converted
to an Extended Data Element.name - The name property of the Extended Data Element.
java.lang.Throwable object.public static java.lang.String[] getExtendedDataElementValuesArray(java.lang.String values)
values string to a
values array, thereby ensuring the parameter
values string does not exceed the 1024 character limit, as
stated in the Common Base Event v1.0.1 specification.
If the parameter values property is larger than 1024
characters, the string is segmented into a String array of 1024-character
elements. However, if the parameter values property is
1024 or less characters or null, the string is set
directly on the first element a String array.
values - The values string to be transposed to a values array.
public static java.lang.String getFormattedDateString(long dateInMillis)
throws java.lang.IllegalArgumentException
The default date format is:
MMMM d, yyyy h:mm:ss.SSS a z
For more information on the meaning of the individual symbols in the
default date format pattern, see the class comment header for
java.util.SimpleTimeZone.
The time zone of the returned string is coordinated universal time (UTC), represented as Greenwich Mean Time (GMT).
dateInMillis - A long representing a coordinated universal time (UTC) time
stamp in milliseconds.
java.lang.IllegalArgumentException - If the long representing a coordinated universal time (UTC)
time stamp in milliseconds is negative.SimpleTimeZone
public static java.lang.String getFormattedDateString(long dateInMillis,
java.lang.String dateFormatPattern)
throws java.lang.IllegalArgumentException
For more information on the syntax and meaning of the individual symbols
in the parameter date format pattern, see the class comment header for
java.util.SimpleTimeZone.
The time zone of the returned string is coordinated universal time (UTC), represented as Greenwich Mean Time (GMT).
dateInMillis - A long representing a coordinated universal time (UTC) time
stamp in milliseconds.dateFormatPattern - The date format pattern (see
java.util.SimpleTimeZone).
java.lang.IllegalArgumentException - If the long representing a coordinated universal time (UTC)
time stamp in milliseconds is negative or the date format
pattern (see java.util.SimpleTimeZone) is
null or invalid.SimpleTimeZone
public static java.lang.String getFormattedDateString(java.lang.String xsdDateTimeString)
throws java.lang.IllegalArgumentException
For more information on the XML Schema dateTime (e.g. yyyy-MM-ddTHH:mm:ss) date, see http://www.w3.org/TR/NOTE-datetime .
The default date format is:
MMMM d, yyyy h:mm:ss.SSS a z
For more information on the meaning of the individual symbols in the
default date format pattern, see the class comment header for
java.util.SimpleTimeZone.
If the parameter string representing an XML Schema dateTime (e.g. yyyy-MM-ddTHH:mm:ss) date does not contain any time zone information, the time zone of the returned string is coordinated universal time (UTC), represented as Greenwich Mean Time (GMT). Otherwise, the time zone of the returned string is represented as a signed offset from Greenwich Mean Time (GMT). For example, 'GMT-05:00' for Eastern Standard Time.
xsdDateTimeString - A string representing an XML Schema dateTime (e.g.
yyyy-MM-ddTHH:mm:ss) date.
java.lang.IllegalArgumentException - If the string representing an XML Schema dateTime (e.g.
yyyy-MM-ddTHH:mm:ss) date is invalid.SimpleTimeZone
public static java.lang.String getFormattedDateString(java.lang.String xsdDateTimeString,
java.lang.String dateFormatPattern)
throws java.lang.IllegalArgumentException
For more information on the XML Schema dateTime (e.g. yyyy-MM-ddTHH:mm:ss) date, see http://www.w3.org/TR/NOTE-datetime .
For more information on the syntax and meaning of the individual symbols
in the parameter date format pattern, see the class comment header for
java.util.SimpleTimeZone.
If the parameter string representing an XML Schema dateTime (e.g. yyyy-MM-ddTHH:mm:ss) date does not contain any time zone information, the time zone of the returned string is coordinated universal time (UTC), represented as Greenwich Mean Time (GMT). Otherwise, the time zone of the returned string is represented as a signed offset from Greenwich Mean Time (GMT). For example, 'GMT-05:00' for Eastern Standard Time.
xsdDateTimeString - A string representing an XML Schema dateTime (e.g.
yyyy-MM-ddTHH:mm:ss) date.dateFormatPattern - The date format pattern (see
java.util.SimpleTimeZone).
java.lang.IllegalArgumentException - If the string representing an XML Schema dateTime (e.g.
yyyy-MM-ddTHH:mm:ss) date is invalid or the date format
pattern (see java.util.SimpleTimeZone) is
null or invalid.SimpleTimeZone
public static boolean compareUnorderedLists(java.util.List listOne,
java.util.List listTwo)
List objects ignoring order.
listOne - The first list in the comparison.listTwo - The second list in the comparison.
public static CommonBaseEvent convertObjectToCommonBaseEvent(java.lang.Object object,
int maxReferences)
CommonBaseEvent
based on the Common Base Event v1.0.1 schema.
This method uses the following rules:
creationTime Common Base Event property is set to the current time.globalInstanceId Common Base Event property is set to a unique GUID.situation Common Base Event property is set to an internal, log and report situation.sourceComponentId Common Base Event property is set to a default component ID for the calling logging facility.value(s)
of a ExtendedDataElement with the package and class name of the object
as the 'name' property of the ExtendedDataElement.ExtendedDataElement(s)
of a ExtendedDataElement with the package and class name of the object
as the 'name' property of the ExtendedDataElement.Simple type of objects include:
If the parameter object is an instance of a CommonBaseEvent, it is cast to a
CommonBaseEvent and returned.
object - The object to be converted to a Common Base Event.maxReferences - The maximum number of referenced complex objects traversed.
public static void convertObjectToCommonBaseEvent(CommonBaseEvent commonBaseEvent,
java.lang.Object object,
int maxReferences)
CommonBaseEvent
based on the Common Base Event v1.0.1 schema and sets the Common
Base Event properties on the parameter Common Base Event.
This method uses the following rules:
creationTime Common Base Event property is set to the current time, if not previously set.globalInstanceId Common Base Event property is set to a unique GUID, if not previously set.situation Common Base Event property is set to an internal, log and report situation, if not previously set.sourceComponentId Common Base Event property is set to a default component ID for the calling logging facility, if not previously set.value(s)
of a ExtendedDataElement with the package and class name of the object
as the 'name' property of the ExtendedDataElement.ExtendedDataElement(s)
of a ExtendedDataElement with the package and class name of the object
as the 'name' property of the ExtendedDataElement.Simple type of objects include:
If the parameter object is an instance of a CommonBaseEvent, its properties are
set on the parameter CommonBaseEvent using the precedence rules defined
org.eclipse.hyades.logging.events.cbe.impl.TemplateContentHandlerImpl.
NOTE: The parameter CommonBaseEvent's existing ContentHandler,
if any, is preserved for future use.
commonBaseEvent - The Common Base Event generated from converting the parameter object.object - The object to be converted to a Common Base Event.maxReferences - The maximum number of referenced complex objects traversed.
|
TPTP 4.1.0 Platform Project Public API Specification |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||