com.eventgnosis.types
Class XmlRep

java.lang.Object
  extended bycom.eventgnosis.types.XmlRep
All Implemented Interfaces:
java.lang.Cloneable

public class XmlRep
extends java.lang.Object
implements java.lang.Cloneable

Widely-used Event representation holder.
Holds generic data in the most memory-efficient form that can be output in XML format.
Data is kept as an ArrayList of fieldname - value pairs(NameValuePair tuples).


Nested Class Summary
 class XmlRep.EventXmlHandler
           
 
Field Summary
static java.lang.String docHeader
           
static java.lang.String egAttr
           
static java.lang.String egSoapBodyEnd
           
static java.lang.String egSoapBodyStart
           
static java.lang.String egSoapNameSpace
           
static java.lang.String LEAF_INDIC
           
static java.lang.ThreadLocal saxParserFactoryHolder
           
static java.lang.ThreadLocal saxParserHolder
           
static java.lang.String soapBody
           
static java.lang.String soapEnv
           
static java.lang.String soapEnvEnd
           
static java.lang.String soapEnvStart
           
 
Constructor Summary
XmlRep(java.lang.String xmlStr)
          Constuctor for events created as xml string, should be used only for TCPIP protocol in the future
 
Method Summary
 void addField(java.lang.String name, java.lang.String value, java.lang.String nameAfter, boolean first)
          Adds a field.
 java.lang.Object clone()
           
 java.lang.String getAllFormatted(int tabSize)
          Gets XML as a formatted String.
 java.util.Properties getAllProperties(boolean forceNamesLC)
          Gets all fields from event representation as a linear properties set.
If multiple values of same property are within the specified context,
a single packed string is created which can be easily converted to an ArrayList
 java.util.ArrayList getPropertiesList(boolean forceNamesLC)
          Gets all fields from event representation as an ArrayList of NameValuePairs;
 java.lang.String getPropertyValue(java.lang.String propName)
          Gets a single valued property inside the entire representation (first occurrence).
static void main(java.lang.String[] args)
           
 void removeFields(java.util.ArrayList rmvFields)
          Remove 1st occurrence of each fieldName in entire representation.
 void renameField(java.lang.String fromName, java.lang.String toName)
          Renames the first field named "fromName" to "toName".
 void setField(java.lang.String name, java.lang.String value)
          Sets the value to a given field name or creates new field if a field with that name does not exist.
 boolean setProperty(java.lang.String name, java.lang.String value)
          Sets the property specified by name(first occurrence) to the value.
If the property doesn't exist it is created.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

docHeader

public static final java.lang.String docHeader
See Also:
Constant Field Values

egAttr

public static final java.lang.String egAttr
See Also:
Constant Field Values

egSoapBodyEnd

public static final java.lang.String egSoapBodyEnd
See Also:
Constant Field Values

egSoapBodyStart

public static final java.lang.String egSoapBodyStart
See Also:
Constant Field Values

egSoapNameSpace

public static final java.lang.String egSoapNameSpace
See Also:
Constant Field Values

LEAF_INDIC

public static final java.lang.String LEAF_INDIC
See Also:
Constant Field Values

saxParserFactoryHolder

public static java.lang.ThreadLocal saxParserFactoryHolder

saxParserHolder

public static java.lang.ThreadLocal saxParserHolder

soapBody

public static final java.lang.String soapBody
See Also:
Constant Field Values

soapEnv

public static final java.lang.String soapEnv
See Also:
Constant Field Values

soapEnvEnd

public static final java.lang.String soapEnvEnd
See Also:
Constant Field Values

soapEnvStart

public static final java.lang.String soapEnvStart
See Also:
Constant Field Values
Constructor Detail

XmlRep

public XmlRep(java.lang.String xmlStr)
Constuctor for events created as xml string, should be used only for TCPIP protocol in the future

Parameters:
xmlStr - - xml representation of event
Method Detail

addField

public void addField(java.lang.String name,
                     java.lang.String value,
                     java.lang.String nameAfter,
                     boolean first)
Adds a field. If first is true, add it after the first occurrence of the nameAfter; if not, add it after the last one. If no occurrence of nameAfter add it at the end.

Parameters:
name - - String - field name
value - - String - field value
nameAfter - - String - The name of the field after which you want to add the field.
first - - boolean - true if you want to add as first field.

clone

public java.lang.Object clone()

getAllFormatted

public java.lang.String getAllFormatted(int tabSize)
Gets XML as a formatted String.


getAllProperties

public java.util.Properties getAllProperties(boolean forceNamesLC)
Gets all fields from event representation as a linear properties set.
If multiple values of same property are within the specified context,
a single packed string is created which can be easily converted to an ArrayList

Parameters:
forceNamesLC - - forces all property names to lower case if true to make case insensitive compares work for names (needed for events)
Returns:
- linear properties set of all event field names and it's values

getPropertiesList

public java.util.ArrayList getPropertiesList(boolean forceNamesLC)
Gets all fields from event representation as an ArrayList of NameValuePairs;

Parameters:
forceNamesLC - - forces all property names to lower case if true to make case insensitive compares work for names (needed for events)
Returns:
ArrayList of all event fields (NameValuePairs)

getPropertyValue

public java.lang.String getPropertyValue(java.lang.String propName)
Gets a single valued property inside the entire representation (first occurrence).

Parameters:
propName - - property name
Returns:
a single valued property inside the entire Event representation (first occurrence).

main

public static void main(java.lang.String[] args)

removeFields

public void removeFields(java.util.ArrayList rmvFields)
Remove 1st occurrence of each fieldName in entire representation.

Parameters:
rmvFields - ArrayList of fields to be removed

renameField

public void renameField(java.lang.String fromName,
                        java.lang.String toName)
Renames the first field named "fromName" to "toName". Both must be valid names.

Parameters:
fromName - - old name
toName - - new name

setField

public void setField(java.lang.String name,
                     java.lang.String value)
Sets the value to a given field name or creates new field if a field with that name does not exist.

Parameters:
name - - String - field name
value - - String - field value

setProperty

public boolean setProperty(java.lang.String name,
                           java.lang.String value)
Sets the property specified by name(first occurrence) to the value.
If the property doesn't exist it is created.

Parameters:
name - - String
value - - String
Returns:
- boolean - true if operation is successful.

toString

public java.lang.String toString()