Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions

com.cosylab.logging.engine.log.LogEntryXML Class Reference

Inheritance diagram for com.cosylab.logging.engine.log.LogEntryXML:
com.cosylab.logging.engine.log.ILogEntry

List of all members.

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< AdditionalDatagetAdditionalData ()
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)

Detailed Description

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.


Constructor & Destructor Documentation

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.

Parameters:
log org.w3c.Node

Member Function Documentation

void com.cosylab.logging.engine.log.LogEntryXML.addData ( String  name,
String  value 
)

Add a data node to this log: <Data name="name">value</Data>

Parameters:
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

Returns:
a Vector of String with the key and value of each additional data If the log does not contain any additional data, returns null

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.

Returns:
String

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)

Returns:
java.lang.Object
Parameters:
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 (  ) 
boolean com.cosylab.logging.engine.log.LogEntryXML.hasDatas (  ) 

Check if the log entry has datas

Returns:
ture datas is not null

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)

Returns:
boolean
Parameters:
index int
static void com.cosylab.logging.engine.log.LogEntryXML.printNode ( Node  logNode,
int  depth 
) [static]

Recursively prints the struct of the node

Parameters:
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)

Parameters:
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 (  ) 

Member Data Documentation


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties