com.endeca.logging
Class LogEntry

java.lang.Object
  extended by java.util.AbstractMap
      extended by com.endeca.logging.LogEntry
All Implemented Interfaces:
Externalizable, Serializable, Map

public class LogEntry
extends AbstractMap
implements Externalizable

This class contains the logging information sent from the application to the Log Server. Each LogEntry stores data about the current query in key/value pairs. Examples of the kind of data that can be recorded in a LogEntry include the session ID, the number of records in the current navigation state, and the active sort key.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
LogEntry()
          Construct an empty LogEntry.
LogEntry(int sz)
          Construct an empty LogEntry with an initial capacity of 'sz'.
LogEntry(LogEntry cp)
          Create a copy of a LogEntry.
LogEntry(Map keyValuePairs)
          Construct a LogEntry with the given key-value pairs.
 
Method Summary
 Set entrySet()
          Implemented for the Map interface.
 boolean equals(Object other)
           
static LogEntry fromString(String str)
          Parse a LogEntry from a String.
 double getDouble(String key)
          Get the integer value associated with the given key.
 int getInt(String key)
          Get the integer value associated with the given key.
 List getList(String key)
          Get the given list value associated with a given key.
 String getString(String key)
          Get the value associated with the given key.
 int hashCode()
           
 Object put(Object key, Object value)
          Implemented for the Map interface.
 void putDouble(String key, double value)
          Set the given key to the given double value.
 void putInt(String key, int value)
          Set the given key to the given integer value.
 void putList(String key, List value)
          Set the given key to the list value.
 void putString(String key, String value)
          Set the given key to the given value.
 void readExternal(ObjectInput in)
           
 String toString()
           
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class java.util.AbstractMap
clear, clone, containsKey, containsValue, get, isEmpty, keySet, putAll, remove, size, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LogEntry

public LogEntry()
Construct an empty LogEntry.


LogEntry

public LogEntry(int sz)
Construct an empty LogEntry with an initial capacity of 'sz'.


LogEntry

public LogEntry(Map keyValuePairs)
Construct a LogEntry with the given key-value pairs.


LogEntry

public LogEntry(LogEntry cp)
Create a copy of a LogEntry.

Method Detail

putString

public void putString(String key,
                      String value)
Set the given key to the given value.


getString

public String getString(String key)
Get the value associated with the given key.

Returns:
null if no value is associated with the given key.

putInt

public void putInt(String key,
                   int value)
Set the given key to the given integer value. The number will be stored as a String in decimal representation. Therefore, you can retrieve the value later by calling either by getInt(), getDouble(), or getString().


getInt

public int getInt(String key)
           throws NumberFormatException,
                  NullPointerException
Get the integer value associated with the given key. If the value was originally set via setString(), then this method will still succeed as long as the value is a valid decimal integer.

Throws:
NumberFormatException - if the value is not numeric.
NullPointerException - if no value is associated with the given key.

putDouble

public void putDouble(String key,
                      double value)
Set the given key to the given double value. The number will be stored as a String in decimal representation. Therefore, you can retrieve the value later by calling either by getDouble() or getString().


getDouble

public double getDouble(String key)
                 throws NumberFormatException,
                        NullPointerException
Get the integer value associated with the given key. If the value was originally set via setInt() or setString(), then this method will still succeed as long as the value is a valid decimal number.

Throws:
NumberFormatException - if the value is not numeric.
NullPointerException - if no value is associated with the given key.

putList

public void putList(String key,
                    List value)
Set the given key to the list value. Note that the values in the list will all be converted to strings, so getList will return a list of Strings.


getList

public List getList(String key)
Get the given list value associated with a given key. If the value was not originally set using setList, this method will return a list with a single item containing the string representation of the original value. Any changes made to the java.util.List object after calling getList will not be reflected in the LogEntry's value. In order to change the value of the list contents, setList() must be used.


entrySet

public Set entrySet()
Implemented for the Map interface.

Specified by:
entrySet in interface Map
Specified by:
entrySet in class AbstractMap

put

public Object put(Object key,
                  Object value)
Implemented for the Map interface.

Specified by:
put in interface Map
Overrides:
put in class AbstractMap

toString

public String toString()
Overrides:
toString in class AbstractMap

fromString

public static LogEntry fromString(String str)
                           throws LogException,
                                  IOException
Parse a LogEntry from a String. The String should be of the same format as that returned by toString(). Note that the format is subject to change in the future.

Throws:
LogException
IOException

equals

public boolean equals(Object other)
Specified by:
equals in interface Map
Overrides:
equals in class AbstractMap

hashCode

public int hashCode()
Specified by:
hashCode in interface Map
Overrides:
hashCode in class AbstractMap

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException


© 2008 Endeca Technologies, Inc.
Endeca Confidential