|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--org.eclipse.hyades.logging.events.cbe.util.EventHelpers
Miscellaneous routines to support functions such as validation, serialization and comparison.
| Constructor Summary | |
|---|---|
EventHelpers()
|
|
| Method Summary | |
|---|---|
static boolean |
compareEObject(java.lang.Object obj1,
java.lang.Object obj2)
Deep-comparison for two EMF objects. |
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 inDate)
|
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 |
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 inDateTime)
|
static void |
serializableRead(org.eclipse.emf.ecore.EObject o,
java.io.ObjectInputStream in)
Generic serialization routine for EMF object. |
static void |
serializableWrite(org.eclipse.emf.ecore.EObject o,
java.io.ObjectOutputStream out)
Generic serialization routine for EMF object. |
| 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 void serializableRead(org.eclipse.emf.ecore.EObject o,
java.io.ObjectInputStream in)
throws java.lang.ClassNotFoundException,
java.io.IOException
o - EMF object to be serializedin - Java IO input stream contained the serialized strem
java.lang.ClassNotFoundException - if the class of an object inside the stream cannot be found
in the classpath
java.io.IOException - if the input stream cannot be read for whatever reason
public static void serializableWrite(org.eclipse.emf.ecore.EObject o,
java.io.ObjectOutputStream out)
throws java.io.IOException
o - EMF object to be serializedout - Java IO stream to where the serialized object will be written.
java.io.IOException - if the object cannot be written to the output stream for
whatever reason.
public static boolean compareEObject(java.lang.Object obj1,
java.lang.Object obj2)
If the the two EMF objects are of the same type, it traverses their features recursively until a difference is found.
When comparing lists, this method ignores order.
This is a helper for implementing the equals method on EMF
objects, where obj1 is the object where
equals was called and obj2 is the parameter
for that call.
Therefore obj1 can never be null and when
obj2 is null, the result is
false.
obj1 - first element in the comparisonobj2 - second element in the comparison
true if the two objects are identical instancesor
false otherwise.public static long dateToLong(java.lang.String inDate)
inDate - The date in string format (CCYY-MM-DDThh:mm:ssZ)
java.lang.IllegalArgumentException - if the date paremeters does not follow the xsd:dateTime
convention.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:00public static java.lang.String longToDate(long inDateTime)
inDateTime - The date in milliseconds since 1970-01-01T00:00:00Z
Converts a long representing UTC in milliseconds to the XML Schema
datetime format (CCYY-MM-DDThh:mm:ssZ)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:
names (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's printStackTrace()
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.Throwables 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:
names (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's printStackTrace()
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.Throwables 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.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||