anon.infoservice
Class MixCascadeExitAddresses

java.lang.Object
  extended by anon.infoservice.AbstractDatabaseEntry
      extended by anon.infoservice.MixCascadeExitAddresses
All Implemented Interfaces:
IXMLEncodable

public class MixCascadeExitAddresses
extends AbstractDatabaseEntry
implements IXMLEncodable

Stores all exit addresses of one MixCasacde.

Author:
Christian Banse

Field Summary
static int EXIT_ADDRESS_TTL
          The time-to-live of the exit address.
private  long m_lastUpdate
          The time of the last update.
private  java.lang.String m_strCascadeId
          The cascade id.
private  java.util.Hashtable m_tblAddresses
          The list of addresses.
static java.lang.String XML_ATTR_LAST_UPDATE
          The last update XML attribute name.
static java.lang.String XML_ATTR_PAYMENT
          The payment XML attribute name.
static java.lang.String XML_ELEMENT_ADDRESS_NAME
          The exit address XML element name.
static java.lang.String XML_ELEMENT_CONTAINER_NAME
          The entry's container XML element name.
static java.lang.String XML_ELEMENT_NAME
          The XML element name.
 
Fields inherited from class anon.infoservice.AbstractDatabaseEntry
XML_LAST_UPDATE
 
Fields inherited from interface anon.util.IXMLEncodable
FIELD_XML_ELEMENT_CONTAINER_NAME, FIELD_XML_ELEMENT_NAME, XML_ATTR_ID, XML_ATTR_LANGUAGE, XML_ATTR_VERSION
 
Constructor Summary
  MixCascadeExitAddresses(org.w3c.dom.Element a_xmlElement)
           
private MixCascadeExitAddresses(java.lang.String a_cascadeID)
          Constructs a new MixCascadeExitAddress object from a given mix cascade id.
 
Method Summary
private  boolean addInetAddress(java.net.InetAddress a_addr)
           
private  boolean addInetAddress(java.net.InetAddress a_addr, long a_timestamp)
          Adds an address to the list.
static void addInetAddress(java.lang.String a_cascadeID, java.net.InetAddress a_IPAddress)
           
 java.lang.String getId()
          Returns a unique ID for a database entry.
 long getLastUpdate()
          Returns the time in milliseconds when this db entry was created from the origin instance.
 long getVersionNumber()
          Returns version number which is used to determine the more recent infoservice entry, if two entries are compared (higher version number -> more recent entry).
static boolean isValidAddress(java.net.InetAddress a_address)
           
private static boolean isValidAddress(java.net.InetAddress a_address, java.lang.String a_methodName)
           
 org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc)
          Return an element that can be appended to the document.
 
Methods inherited from class anon.infoservice.AbstractDatabaseEntry
deletePersistence, getCreationTime, getExpireTime, isNewerThan, isPersistanceDeletionAllowed, isUserDefined, resetCreationTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXIT_ADDRESS_TTL

public static final int EXIT_ADDRESS_TTL
The time-to-live of the exit address.

See Also:
Constant Field Values

XML_ELEMENT_CONTAINER_NAME

public static final java.lang.String XML_ELEMENT_CONTAINER_NAME
The entry's container XML element name.

See Also:
Constant Field Values

XML_ELEMENT_NAME

public static final java.lang.String XML_ELEMENT_NAME
The XML element name.

See Also:
Constant Field Values

XML_ELEMENT_ADDRESS_NAME

public static final java.lang.String XML_ELEMENT_ADDRESS_NAME
The exit address XML element name.

See Also:
Constant Field Values

XML_ATTR_LAST_UPDATE

public static final java.lang.String XML_ATTR_LAST_UPDATE
The last update XML attribute name.

See Also:
Constant Field Values

XML_ATTR_PAYMENT

public static final java.lang.String XML_ATTR_PAYMENT
The payment XML attribute name.

See Also:
Constant Field Values

m_lastUpdate

private long m_lastUpdate
The time of the last update.


m_strCascadeId

private java.lang.String m_strCascadeId
The cascade id.


m_tblAddresses

private java.util.Hashtable m_tblAddresses
The list of addresses.

Constructor Detail

MixCascadeExitAddresses

private MixCascadeExitAddresses(java.lang.String a_cascadeID)
Constructs a new MixCascadeExitAddress object from a given mix cascade id.

Parameters:
a_strCascadeId - The mix cascade id.

MixCascadeExitAddresses

public MixCascadeExitAddresses(org.w3c.dom.Element a_xmlElement)
                        throws XMLParseException
Throws:
XMLParseException
Method Detail

getId

public java.lang.String getId()
Description copied from class: AbstractDatabaseEntry
Returns a unique ID for a database entry.

Specified by:
getId in class AbstractDatabaseEntry
Returns:
The ID of this database entry.

getLastUpdate

public long getLastUpdate()
Description copied from class: AbstractDatabaseEntry
Returns the time in milliseconds when this db entry was created from the origin instance. Never (!) insert the local creation time here, as this will DoS the InfoServices in an endless loop.

Specified by:
getLastUpdate in class AbstractDatabaseEntry
Returns:
the time in milliseconds when this db entry was created from the origin instance

getVersionNumber

public long getVersionNumber()
Description copied from class: AbstractDatabaseEntry
Returns version number which is used to determine the more recent infoservice entry, if two entries are compared (higher version number -> more recent entry). Never (!) insert the local creation time here, as this will DoS the InfoServices in an endless loop.

Specified by:
getVersionNumber in class AbstractDatabaseEntry
Returns:
The version number for this entry.

addInetAddress

public static void addInetAddress(java.lang.String a_cascadeID,
                                  java.net.InetAddress a_IPAddress)

isValidAddress

public static boolean isValidAddress(java.net.InetAddress a_address)

isValidAddress

private static boolean isValidAddress(java.net.InetAddress a_address,
                                      java.lang.String a_methodName)

addInetAddress

private boolean addInetAddress(java.net.InetAddress a_addr)

addInetAddress

private boolean addInetAddress(java.net.InetAddress a_addr,
                               long a_timestamp)
Adds an address to the list.

Parameters:
a_addr - The address to add.
Returns:
True, if the list has changed, false otherwise.

toXmlElement

public org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc)
Description copied from interface: IXMLEncodable
Return an element that can be appended to the document. This Method must not change the document in any way!

Specified by:
toXmlElement in interface IXMLEncodable
Parameters:
a_doc - a document
Returns:
the interface as xml element