|
TPTP 4.2.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 xsdDateTime)
Deprecated. As of TPTP V4.2.0, use LoggingCoreUtilities.convertXsdDateTimeToMilliseconds(String). |
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 milliseconds)
Deprecated. As of TPTP V4.2.0, use LoggingCoreUtilities.getFormattedDateString(long). |
static java.lang.String |
getFormattedDateString(long milliseconds,
java.lang.String dateFormatPattern)
Deprecated. As of TPTP V4.2.0, use LoggingCoreUtilities#getFormattedDateString(long, String)). |
static java.lang.String |
getFormattedDateString(java.lang.String xsdDateTime)
Deprecated. As of TPTP V4.2.0, use LoggingCoreUtilities#getFormattedDateString(String)). |
static java.lang.String |
getFormattedDateString(java.lang.String xsdDateTime,
java.lang.String dateFormatPattern)
Deprecated. As of TPTP V4.2.0, use LoggingCoreUtilities#getFormattedDateString(String, String))). |
static java.lang.String |
getString(java.lang.String key)
Deprecated. As of TPTP V4.2.0, use LoggingCoreResourceBundle.getString(String). |
static java.lang.String |
getString(java.lang.String key,
java.lang.Object argument)
Deprecated. As of TPTP V4.2.0, use LoggingCoreResourceBundle#getString(String, Object)). |
static java.lang.String |
getString(java.lang.String key,
java.lang.Object[] arguments)
Deprecated. As of TPTP V4.2.0, use LoggingCoreResourceBundle#getString(String, Object[])). |
static java.lang.String |
getString(java.lang.String key,
java.lang.Object argumentA,
java.lang.Object argumentB)
Deprecated. As of TPTP V4.2.0, use LoggingCoreResourceBundle#getString(String, Object, Object)). |
static java.lang.String |
getString(java.lang.String key,
java.lang.Object argumentA,
java.lang.Object argumentB,
java.lang.Object argumentC)
Deprecated. As of TPTP V4.2.0, use LoggingCoreResourceBundle#getString(String, Object, Object, Object)). |
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)
Deprecated. As of TPTP V4.2.0, use LoggingCoreResourceBundle#getString(String, Object, Object, Object, Object)). |
static java.lang.String |
longToDate(long milliseconds)
Deprecated. As of TPTP V4.2.0, use LoggingCoreUtilities.convertMillisecondsToXsdDateTime(long). |
| 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 xsdDateTime)
LoggingCoreUtilities.convertXsdDateTimeToMilliseconds(String).
The XSD dateTime time stamp represents a finite-length sequence
of characters following the following format pattern:
yyyy-MM-dd'T'HH:mm:ss[.SSSS]['Z'|Z]
For more information on the meaning of the individual symbols in the XSD
dateTime time stamp format pattern, see the class comment header
for SimpleDateFormat.
For example, March 14, 2006 11:32:01.001 AM UTC/GMT would be represented as:
2006-03-14T11:32:01.001Z
See the XSD dateTime primitive datatype documentation for more information.
The long time stamp represents the difference, measured in milliseconds, between the current time (Coordinated Universal Time (UTC) or Greenwich Mean Time (GMT)) and the standard base time. The standard base time is known as "the epoch", namely January 1, 1970 12:00:00 AM Coordinated Universal Time (UTC) or Greenwich Mean Time (GMT).
Note: Due to inconsistencies between XSD V1.0 and later versions of the XSD
specification on representing zero or negative XSD dateTime time stamps,
such as year 0 and year 1 Before Common Era (BCE or BC), this method will throw an
IllegalArgumentException for parameter XSD dateTime time stamps
before 0001-01-01T00:00:00.000Z or -62135769600000. See the
XSD dateTime note for more
information.
xsdDateTime - The XSD dateTime time stamp to be converted to a long (milliseconds) time stamp.
dateTime time stamp.
java.lang.IllegalArgumentException - If the parameter XSD dateTime time stamp is not a valid XSD dateTime time stamp.public static java.lang.String longToDate(long milliseconds)
LoggingCoreUtilities.convertMillisecondsToXsdDateTime(long).
The long time stamp represents the difference, measured in milliseconds, between the current time (Coordinated Universal Time (UTC) or Greenwich Mean Time (GMT)) and the standard base time. The standard base time is known as "the epoch", namely January 1, 1970 12:00:00 AM Coordinated Universal Time (UTC) or Greenwich Mean Time (GMT).
The XSD dateTime time stamp represents a finite-length sequence
of characters following the following format pattern:
yyyy-MM-dd'T'HH:mm:ss[.SSSS]['Z'|Z]
For more information on the meaning of the individual symbols in the XSD
dateTime time stamp format pattern, see the class comment header
for SimpleDateFormat.
For example, March 14, 2006 11:32:01.001 AM UTC/GMT would be represented as:
2006-03-14T11:32:01.001Z
See the XSD dateTime primitive datatype documentation for more information.
Note: Due to inconsistencies between XSD V1.0 and later versions of the XSD
specification on representing zero or negative XSD dateTime time stamps,
such as year 0 and year 1 Before Common Era (BCE or BC), this method will return a
positive XSD dateTime time stamp for parameter long (milliseconds) time
stamps before -62135769600000 or 0001-01-01T00:00:00.000Z.
See the XSD dateTime note for
more information.
milliseconds - The long (milliseconds) time stamp to be converted to an XSD dateTime time stamp.
dateTime time stamp representation of the parameter long (milliseconds) time stamp .
public static java.lang.String getFormattedDateString(long milliseconds)
throws java.lang.IllegalArgumentException
LoggingCoreUtilities.getFormattedDateString(long).
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.SimpleDateFormat.
The time zone of the returned string is Coordinated Universal Time (UTC), represented as Greenwich Mean Time (GMT).
milliseconds - 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.java.util.SimpleDateFormat
public static java.lang.String getFormattedDateString(long milliseconds,
java.lang.String dateFormatPattern)
throws java.lang.IllegalArgumentException
LoggingCoreUtilities#getFormattedDateString(long, String)).
When the International Components for Unicode (ICU) JAR(s)
are available on the class path at run-time, date formatting is done by the
SimpleDateFormat class using the ULocale (parameter Locale
converted to a ULocale - see ULocale.forLocale(Locale)),
GregorianCalendar and TimeZone (parameter time zone ID
converted to a TimeZone - see TimeZone.getTimeZone(String)) classes,
otherwise date formatting is done by the SimpleDateFormat class using the Locale,
GregorianCalendar and TimeZone classes. That is, if the
International Components for Unicode (ICU) JAR(s)
are available on the class path at run-time, the parameter date format pattern is based on the syntax and symbols
as specified in the class comment header of the SimpleDateFormat class, otherwise the
parameter date format pattern is based on the syntax and symbols as specified in the class comment header of the
java.util.SimpleDateFormat class.
The time zone of the returned string is Coordinated Universal Time (UTC), represented as Greenwich Mean Time (GMT).
milliseconds - A long representing a Coordinated Universal Time (UTC) time stamp in milliseconds.dateFormatPattern - The date format pattern.
java.lang.IllegalArgumentException - If the date format pattern invalid.SimpleDateFormat,
Locale,
GregorianCalendar,
TimeZone,
SimpleDateFormat,
ULocale,
GregorianCalendar,
TimeZone
public static java.lang.String getFormattedDateString(java.lang.String xsdDateTime)
throws java.lang.IllegalArgumentException
LoggingCoreUtilities#getFormattedDateString(String)).
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.SimpleDateFormat.
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.
xsdDateTime - 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.java.util.SimpleDateFormat
public static java.lang.String getFormattedDateString(java.lang.String xsdDateTime,
java.lang.String dateFormatPattern)
throws java.lang.IllegalArgumentException
LoggingCoreUtilities#getFormattedDateString(String, String))).
For more information on the XML Schema dateTime (e.g. yyyy-MM-ddTHH:mm:ss) date, see http://www.w3.org/TR/NOTE-datetime.
When the International Components for Unicode (ICU) JAR(s)
are available on the class path at run-time, date formatting is done by the
SimpleDateFormat class using the ULocale (parameter Locale
converted to a ULocale - see ULocale.forLocale(Locale)),
GregorianCalendar and TimeZone (parameter time zone ID
converted to a TimeZone - see TimeZone.getTimeZone(String)) classes,
otherwise date formatting is done by the SimpleDateFormat class using the Locale,
GregorianCalendar and TimeZone classes. That is, if the
International Components for Unicode (ICU) JAR(s)
are available on the class path at run-time, the parameter date format pattern is based on the syntax and symbols
as specified in the class comment header of the SimpleDateFormat class, otherwise the
parameter date format pattern is based on the syntax and symbols as specified in the class comment header of the
java.util.SimpleDateFormat class.
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.
xsdDateTime - A string representing an XML Schema dateTime (e.g. yyyy-MM-ddTHH:mm:ss) date.dateFormatPattern - The date format pattern.
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 is invalid.SimpleDateFormat,
Locale,
GregorianCalendar,
TimeZone,
SimpleDateFormat,
ULocale,
GregorianCalendar,
TimeZonepublic static java.lang.String getString(java.lang.String key)
LoggingCoreResourceBundle.getString(String).
key
from the plugin[_<language code>[_<country code>]].properties
resource bundle for the org.eclipse.hyades.logging.* classes.
If the key does not exist in the plugin[_<language code>[_<country code>]].properties
resource bundle for the org.eclipse.hyades.logging.* classes, the key is
returned.
Noteworthy, the resultant message is not formatted (e.g. no message parameter substitution).
key - The key of the message in the resource bundle.
key from the resource bundle, otherwise the key.
public static java.lang.String getString(java.lang.String key,
java.lang.Object argument)
LoggingCoreResourceBundle#getString(String, Object)).
key
and message parameter from the plugin[_<language code>[_<country code>]].properties
resource bundle for the org.eclipse.hyades.logging.* classes.
When the International Components for Unicode (ICU) JAR(s)
are available on the class path at run-time, message formatting is done by the
MessageFormat class using the ULocale class,
otherwise message formatting is done by the MessageFormat class using the Locale
class.
If the key does not exist in the plugin[_<language code>[_<country code>]].properties
resource bundle for the org.eclipse.hyades.logging.* classes, the key is
returned.
key - The key of the message in the resource bundle.argument - The first message parameter for formatting in the localized and formatted message.
key from the resource bundle, otherwise the key.MessageFormat,
Locale,
MessageFormat,
ULocale
public static java.lang.String getString(java.lang.String key,
java.lang.Object argumentA,
java.lang.Object argumentB)
LoggingCoreResourceBundle#getString(String, Object, Object)).
key
and message parameters from the plugin[_<language code>[_<country code>]].properties
resource bundle for the org.eclipse.hyades.logging.* classes.
When the International Components for Unicode (ICU) JAR(s)
are available on the class path at run-time, message formatting is done by the
MessageFormat class using the ULocale class,
otherwise message formatting is done by the MessageFormat class using the Locale
class.
If the key does not exist in the plugin[_<language code>[_<country code>]].properties
resource bundle for the org.eclipse.hyades.logging.* classes, the key is
returned.
key - The key of the message in the resource bundle.argumentA - The first message parameter for formatting in the localized and formatted message.argumentB - The second message parameter for formatting in the localized and formatted message.
key from the resource bundle, otherwise the key.MessageFormat,
Locale,
MessageFormat,
ULocale
public static java.lang.String getString(java.lang.String key,
java.lang.Object argumentA,
java.lang.Object argumentB,
java.lang.Object argumentC)
LoggingCoreResourceBundle#getString(String, Object, Object, Object)).
key
and message parameters from the plugin[_<language code>[_<country code>]].properties
resource bundle for the org.eclipse.hyades.logging.* classes.
When the International Components for Unicode (ICU) JAR(s)
are available on the class path at run-time, message formatting is done by the
MessageFormat class using the ULocale class,
otherwise message formatting is done by the MessageFormat class using the Locale
class.
If the key does not exist in the plugin[_<language code>[_<country code>]].properties
resource bundle for the org.eclipse.hyades.logging.* classes, the key is
returned.
key - The key of the message in the resource bundle.argumentA - The first message parameter for formatting in the localized and formatted message.argumentB - The second message parameter for formatting in the localized and formatted message.argumentC - The third message parameter for formatting in the localized and formatted message.
key from the resource bundle, otherwise the key.MessageFormat,
Locale,
MessageFormat,
ULocale
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)
LoggingCoreResourceBundle#getString(String, Object, Object, Object, Object)).
key
and message parameters from the plugin[_<language code>[_<country code>]].properties
resource bundle for the org.eclipse.hyades.logging.* classes.
When the International Components for Unicode (ICU) JAR(s)
are available on the class path at run-time, message formatting is done by the
MessageFormat class using the ULocale class,
otherwise message formatting is done by the MessageFormat class using the Locale
class.
If the key does not exist in the plugin[_<language code>[_<country code>]].properties
resource bundle for the org.eclipse.hyades.logging.* classes, the key is
returned.
key - The key of the message in the resource bundle.argumentA - The first message parameter for formatting in the localized and formatted message.argumentB - The second message parameter for formatting in the localized and formatted message.argumentC - The third message parameter for formatting in the localized and formatted message.argumentD - The fourth message parameter for formatting in the localized and formatted message.
key from the resource bundle, otherwise the key.MessageFormat,
Locale,
MessageFormat,
ULocale
public static java.lang.String getString(java.lang.String key,
java.lang.Object[] arguments)
LoggingCoreResourceBundle#getString(String, Object[])).
key
and message parameters from the plugin[_<language code>[_<country code>]].properties
resource bundle for the org.eclipse.hyades.logging.* classes.
When the International Components for Unicode (ICU) JAR(s)
are available on the class path at run-time, message formatting is done by the
MessageFormat class using the ULocale class,
otherwise message formatting is done by the MessageFormat class using the Locale
class.
If the key does not exist in the plugin[_<language code>[_<country code>]].properties
resource bundle for org.eclipse.hyades.logging.* classes, the key is
returned.
key - The key of the message in the resource bundle.arguments - The array of message parameters for formatting in the localized and formatted message.
key from the resource bundle, otherwise the key.MessageFormat,
Locale,
MessageFormat,
ULocalepublic 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 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.2.0 Platform Project Public API Specification |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||