Public Member Functions | |
LogEntryXML (String stackId, int stackLevel) throws DOMException | |
LogEntryXML (Random random) | |
LogEntryXML (Node log) throws DOMException | |
boolean | hasDatas () |
NodeList | getDatas () |
Node | getNode () |
String | getEntryTypeAsString () |
Object | getField (LogField f) |
LogTypeHelper | getType () |
boolean | isLogEntryMessageSimple () |
String | toString () |
String | toXMLString () |
Vector< AdditionalData > | getAdditionalData () |
void | addData (String name, String value) |
Static Public Member Functions | |
static LogEntryXML | generateRandomLog (Random random) |
static final boolean | isValidLogEntryType (int index) |
static void | printNode (Node logNode, int depth) |
Public Attributes | |
VectorNodeList | complexLogEntryMessage = null |
Protected Member Functions | |
void | setField (LogField field, Object value) |
This is the container class for generic Log Entries. Attributes, messages and Data(s) are obtained via public variables. Properties, used for management of LogEntries can be obtained via accessor and mutator methods. This class is used when parsing nodes. The class is used when a file is read or a node is received by the push consumer.
Note on reuse of equal Strings, Integers etc: The XML parser currently produces separate instances of the same Strings, so that a lot of memory would be used up unnecessarily. This class reuses String objects for its field values, but does not exchange the String instances that are referenced by the log Node
. That current design will only yield a memory advantage if the LogEntryXML
instance is not kept permanently in the application, but instead its fields are read and the values transfered (without the DOM Node) to an object of another class. Ale: please check if there are other Srings that could be reused based on stringPool
, and if we should use also a pool for Integers, at least for log levels since they are always the same few.
com.cosylab.logging.engine.log.LogEntryXML.LogEntryXML | ( | String | stackId, | |
int | stackLevel | |||
) | throws DOMException |
com.cosylab.logging.engine.log.LogEntryXML.LogEntryXML | ( | Random | random | ) |
This costructor is used only for testing purposes. It is called by com.cosylab.logging.engine.simulator.simulatorRemoteAccess It generates a random LogEntryXML
References com.cosylab.logging.engine.log.LogEntryXML.setField().
com.cosylab.logging.engine.log.LogEntryXML.LogEntryXML | ( | Node | log | ) | throws DOMException |
This constructor is called by the DOMParser.
log | org.w3c.Node |
void com.cosylab.logging.engine.log.LogEntryXML.addData | ( | String | name, | |
String | value | |||
) |
Add a data node to this log: <Data name="name">value</Data>
name | The name, i.e. the key of the pair | |
value | The value of the field |
Implements com.cosylab.logging.engine.log.ILogEntry.
static LogEntryXML com.cosylab.logging.engine.log.LogEntryXML.generateRandomLog | ( | Random | random | ) | [static] |
Vector<AdditionalData> com.cosylab.logging.engine.log.LogEntryXML.getAdditionalData | ( | ) |
The vector return contains only strings and it is formed in this way: name value name value name value... i.e. it is a plain representation of couples of values
Implements com.cosylab.logging.engine.log.ILogEntry.
References com.cosylab.logging.engine.VectorNodeList.item().
Referenced by com.cosylab.logging.engine.log.LogEntry.LogEntry().
NodeList com.cosylab.logging.engine.log.LogEntryXML.getDatas | ( | ) |
Data Nodes are returned as a org.w3c.dom.NodeList. If data(s) are not present, null is returned.
String com.cosylab.logging.engine.log.LogEntryXML.getEntryTypeAsString | ( | ) |
Returns the type of this Object as String. "Undeclared" id type is not specified.
Referenced by com.cosylab.logging.engine.log.LogEntryXML.toString(), and com.cosylab.logging.engine.log.LogEntryXML.toXMLString().
Object com.cosylab.logging.engine.log.LogEntryXML.getField | ( | LogField | f | ) |
Returns a specific field according to field name constants. Creation date: (11/21/2001 18:16:03)
fieldIndex | int index of the field to return |
Implements com.cosylab.logging.engine.log.ILogEntry.
Referenced by com.cosylab.logging.engine.log.LogEntryXML.getType(), com.cosylab.logging.engine.log.LogEntry.LogEntry(), com.cosylab.logging.engine.log.LogEntryXML.toString(), and com.cosylab.logging.engine.log.LogEntryXML.toXMLString().
Node com.cosylab.logging.engine.log.LogEntryXML.getNode | ( | ) |
LogTypeHelper com.cosylab.logging.engine.log.LogEntryXML.getType | ( | ) |
Implements com.cosylab.logging.engine.log.ILogEntry.
References com.cosylab.logging.engine.log.LogEntryXML.getField().
Referenced by com.cosylab.logging.engine.log.LogEntryXML.toXMLString().
boolean com.cosylab.logging.engine.log.LogEntryXML.hasDatas | ( | ) |
Check if the log entry has datas
Implements com.cosylab.logging.engine.log.ILogEntry.
boolean com.cosylab.logging.engine.log.LogEntryXML.isLogEntryMessageSimple | ( | ) |
This boolean tag specifies whether LogEntryMessage is simple or not:
logEntryMessageSimple = true
: Log message is a single String
. It is obtained via String logEntry.simpleLogEntryMessage
. Value is null if message is not present. logEntryMessageSimple = false
: Log message is more complex, it is an XML org.w3c.dom.NodeList
. It is obtained via org.w3c.dom.NodeList logEntry.complexLogEntryMessage
. Value is null if message is simple. static final boolean com.cosylab.logging.engine.log.LogEntryXML.isValidLogEntryType | ( | int | index | ) | [static] |
Insert the method's description here. Creation date: (12/4/2001 12:21:35)
index | int |
static void com.cosylab.logging.engine.log.LogEntryXML.printNode | ( | Node | logNode, | |
int | depth | |||
) | [static] |
Recursively prints the struct of the node
logNode | The node to print |
void com.cosylab.logging.engine.log.LogEntryXML.setField | ( | LogField | field, | |
Object | value | |||
) | [protected] |
Sets the specified field. This method is protected since the fields are not to be modified. The only time this is called is during initialization. Creation date: (11/21/2001 18:35:10)
field | The field | |
value | java.lang.Object value to set |
Referenced by com.cosylab.logging.engine.log.LogEntryXML.LogEntryXML().
String com.cosylab.logging.engine.log.LogEntryXML.toString | ( | ) |
Returns a String representation of the log.
Implements com.cosylab.logging.engine.log.ILogEntry.
References com.cosylab.logging.engine.log.LogEntryXML.getEntryTypeAsString(), and com.cosylab.logging.engine.log.LogEntryXML.getField().
String com.cosylab.logging.engine.log.LogEntryXML.toXMLString | ( | ) |
Return the object as XML string
Implements com.cosylab.logging.engine.log.ILogEntry.
References com.cosylab.logging.engine.log.LogEntryXML.getEntryTypeAsString(), com.cosylab.logging.engine.log.LogEntryXML.getField(), and com.cosylab.logging.engine.log.LogEntryXML.getType().