Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

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

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

Inheritance graph
[legend]
Collaboration diagram for com::cosylab::logging::engine::log::LogEntryXML:

Collaboration graph
[legend]
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 (Field f)
LogTypeHelper getType ()
boolean isLogEntryMessageSimple ()
String toString ()
String toXMLString ()
Vector< AdditionalData > getAdditionalData ()
void addData (String name, String value)

Static Public Member Functions

LogEntryXML generateRandomLog (Random random)
final boolean isValidLogEntryType (int index)
void printNode (Node logNode, int depth)

Public Attributes

VectorNodeList complexLogEntryMessage = null

Protected Member Functions

void setField (Field field, Object value)

Private Member Functions

void initAttributes (Node log) throws DOMException
void initBody (Node log) throws DOMException
void initialize (Node log) throws DOMException
void initLogEntryType (Node log) throws DOMException
StringBuffer getXMLDatas ()

Private Attributes

VectorNodeList datas = null
final Object[] fields = new Object[Field.values().length]
Node log = null
boolean isLogEntrySimple = true
SimpleDateFormat dateFormat = new IsoDateFormat()

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 [inline]
 

com::cosylab::logging::engine::log::LogEntryXML::LogEntryXML Random  random  )  [inline]
 

This costructor is used only for testing purposes. It is called by com.cosylab.logging.engine.simulator.simulatorRemoteAccess It generates a random LogEntryXML

com::cosylab::logging::engine::log::LogEntryXML::LogEntryXML Node  log  )  throws DOMException [inline]
 

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
[inline]
 

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.

LogEntryXML com::cosylab::logging::engine::log::LogEntryXML::generateRandomLog Random  random  )  [inline, static]
 

Vector<AdditionalData> com::cosylab::logging::engine::log::LogEntryXML::getAdditionalData  )  [inline]
 

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.

NodeList com::cosylab::logging::engine::log::LogEntryXML::getDatas  )  [inline]
 

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  )  [inline]
 

Returns the type of this Object as String. "Undeclared" id type is not specified.

Returns:
String

Object com::cosylab::logging::engine::log::LogEntryXML::getField Field  f  )  [inline]
 

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.

Node com::cosylab::logging::engine::log::LogEntryXML::getNode  )  [inline]
 

LogTypeHelper com::cosylab::logging::engine::log::LogEntryXML::getType  )  [inline]
 

See also:
ILogEntry

Implements com::cosylab::logging::engine::log::ILogEntry.

StringBuffer com::cosylab::logging::engine::log::LogEntryXML::getXMLDatas  )  [inline, private]
 

boolean com::cosylab::logging::engine::log::LogEntryXML::hasDatas  )  [inline]
 

Check if the log entry has datas

Returns:
ture datas is not null

Implements com::cosylab::logging::engine::log::ILogEntry.

void com::cosylab::logging::engine::log::LogEntryXML::initAttributes Node  log  )  throws DOMException [inline, private]
 

void com::cosylab::logging::engine::log::LogEntryXML::initBody Node  log  )  throws DOMException [inline, private]
 

void com::cosylab::logging::engine::log::LogEntryXML::initialize Node  log  )  throws DOMException [inline, private]
 

void com::cosylab::logging::engine::log::LogEntryXML::initLogEntryType Node  log  )  throws DOMException [inline, private]
 

boolean com::cosylab::logging::engine::log::LogEntryXML::isLogEntryMessageSimple  )  [inline]
 

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.

final boolean com::cosylab::logging::engine::log::LogEntryXML::isValidLogEntryType int  index  )  [inline, static]
 

Insert the method's description here. Creation date: (12/4/2001 12:21:35)

Returns:
boolean
Parameters:
index int

void com::cosylab::logging::engine::log::LogEntryXML::printNode Node  logNode,
int  depth
[inline, static]
 

Recursively prints the struct of the node

Parameters:
logNode The node to print

void com::cosylab::logging::engine::log::LogEntryXML::setField Field  field,
Object  value
[inline, 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

String com::cosylab::logging::engine::log::LogEntryXML::toString  )  [inline]
 

Returns a String representation of the log.

Implements com::cosylab::logging::engine::log::ILogEntry.

String com::cosylab::logging::engine::log::LogEntryXML::toXMLString  )  [inline]
 

Return the object as XML string

Implements com::cosylab::logging::engine::log::ILogEntry.


Member Data Documentation

VectorNodeList com::cosylab::logging::engine::log::LogEntryXML::complexLogEntryMessage = null
 

VectorNodeList com::cosylab::logging::engine::log::LogEntryXML::datas = null [private]
 

SimpleDateFormat com::cosylab::logging::engine::log::LogEntryXML::dateFormat = new IsoDateFormat() [private]
 

final Object [] com::cosylab::logging::engine::log::LogEntryXML::fields = new Object[Field.values().length] [private]
 

boolean com::cosylab::logging::engine::log::LogEntryXML::isLogEntrySimple = true [private]
 

Node com::cosylab::logging::engine::log::LogEntryXML::log = null [private]
 


The documentation for this class was generated from the following file:
Generated on Thu Apr 30 03:13:13 2009 for ACS Java API by doxygen 1.3.8