anon.infoservice
Class PerformanceInfo

java.lang.Object
  extended by anon.infoservice.AbstractDatabaseEntry
      extended by anon.infoservice.AbstractCertifiedDatabaseEntry
          extended by anon.infoservice.PerformanceInfo
All Implemented Interfaces:
ICertifiedDatabaseEntry, IXMLEncodable

public class PerformanceInfo
extends AbstractCertifiedDatabaseEntry
implements IXMLEncodable

A PerformanceInfo object holds all PerformanceEntry objects retrieved by a certain Info Service through the /performanceinfo command. It is stored in the JAP client database using the id of the Info Service. To access the data the static method getAverageEntry should be used rather accessing the database directly! This way it is ensured that the entry is derived from all available Info Services.

Author:
Christian Banse
See Also:
getLowestCommonBoundEntry(String)

Field Summary
private  MultiCertPath m_certPath
           
private  java.util.Hashtable m_entries
          All PerformanceEntry objects measured by the info service
private  java.lang.String m_id
          The id of the entry - should be a Info Service Id
private  long m_lastUpdate
          Last Update time of the database entry
private  long m_serial
          Serial number of the database entry
private  XMLSignature m_signature
           
private  org.w3c.dom.Element m_xmlData
          Stored XML data for toXmlElement()
private static double PERFORMANCE_INFO_MIN_PERCENTAGE_OF_VALID_ENTRIES
           
static int PERFORMANCE_INFO_TTL
           
static java.lang.String XML_ATTR_ID
           
static java.lang.String XML_ELEMENT_CONTAINER_NAME
           
static java.lang.String XML_ELEMENT_NAME
           
 
Fields inherited from class anon.infoservice.AbstractDatabaseEntry
XML_ATTR_LAST_UPDATE, XML_LAST_UPDATE
 
Fields inherited from interface anon.util.IXMLEncodable
FIELD_XML_ELEMENT_CONTAINER_NAME, FIELD_XML_ELEMENT_NAME, XML_ATTR_LANGUAGE, XML_ATTR_VERSION
 
Constructor Summary
PerformanceInfo(org.w3c.dom.Element a_info)
          Creates a new PerformanceInfo object from an XML element which is usually either retrieved from the Info Service or stored in the configuration file and loaded at startup.
 
Method Summary
 MultiCertPath getCertPath()
           
private  PerformanceEntry getEntry(java.lang.String a_id)
          Returns a performance entry for the giving Cascade.
 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.
static PerformanceEntry getLowestCommonBoundEntry(java.lang.String a_cascadeId)
          Loops through all PerformanceInfo objects from the different Info Services and returns a new PerformanceEntry for the given cascade with the lowest common boundary
private static int getMajorityBoundFromSortedBounds(java.util.Vector a_vecSortedIntegers, int a_default)
           
 XMLSignature getSignature()
           
 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).
 boolean isValid()
           
 boolean isVerified()
          Returns if this entry has been verified with a certificate chain.
 org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc)
          Returns an XML Node of the current PerformanceInfo using the stored XML data
 
Methods inherited from class anon.infoservice.AbstractCertifiedDatabaseEntry
checkId
 
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

PERFORMANCE_INFO_MIN_PERCENTAGE_OF_VALID_ENTRIES

private static final double PERFORMANCE_INFO_MIN_PERCENTAGE_OF_VALID_ENTRIES
See Also:
Constant Field Values

m_lastUpdate

private long m_lastUpdate
Last Update time of the database entry


m_serial

private long m_serial
Serial number of the database entry


m_id

private java.lang.String m_id
The id of the entry - should be a Info Service Id


m_xmlData

private org.w3c.dom.Element m_xmlData
Stored XML data for toXmlElement()


m_signature

private XMLSignature m_signature

m_certPath

private MultiCertPath m_certPath

m_entries

private java.util.Hashtable m_entries
All PerformanceEntry objects measured by the info service


XML_ATTR_ID

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

XML_ELEMENT_NAME

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

XML_ELEMENT_CONTAINER_NAME

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

PERFORMANCE_INFO_TTL

public static final int PERFORMANCE_INFO_TTL
See Also:
Constant Field Values
Constructor Detail

PerformanceInfo

public PerformanceInfo(org.w3c.dom.Element a_info)
                throws XMLParseException
Creates a new PerformanceInfo object from an XML element which is usually either retrieved from the Info Service or stored in the configuration file and loaded at startup.

Parameters:
a_info - The XML data
Throws:
XMLParseException
Method Detail

getSignature

public XMLSignature getSignature()
Specified by:
getSignature in interface ICertifiedDatabaseEntry
Specified by:
getSignature in class AbstractCertifiedDatabaseEntry

getCertPath

public MultiCertPath getCertPath()
Specified by:
getCertPath in interface ICertifiedDatabaseEntry
Specified by:
getCertPath in class AbstractCertifiedDatabaseEntry

isVerified

public boolean isVerified()
Description copied from class: AbstractCertifiedDatabaseEntry
Returns if this entry has been verified with a certificate chain.

Specified by:
isVerified in interface ICertifiedDatabaseEntry
Specified by:
isVerified in class AbstractCertifiedDatabaseEntry
Returns:
if this entry has been verified with a certificate chain

isValid

public boolean isValid()
Specified by:
isValid in interface ICertifiedDatabaseEntry

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.

getEntry

private PerformanceEntry getEntry(java.lang.String a_id)
Returns a performance entry for the giving Cascade. This method should ONLY be used inside getLowestCommonBoundEntry!

Parameters:
a_id - The cascade id
Returns:
The performance entry of the given cascade
See Also:
getLowestCommonBoundEntry(String)

getLowestCommonBoundEntry

public static PerformanceEntry getLowestCommonBoundEntry(java.lang.String a_cascadeId)
Loops through all PerformanceInfo objects from the different Info Services and returns a new PerformanceEntry for the given cascade with the lowest common boundary

Parameters:
a_cascadeId - Id of the cascade
Returns:
PerformanceEntry with lowest common boundary values for the given cascade

getMajorityBoundFromSortedBounds

private static int getMajorityBoundFromSortedBounds(java.util.Vector a_vecSortedIntegers,
                                                    int a_default)

toXmlElement

public org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc)
Returns an XML Node of the current PerformanceInfo using the stored XML data

Specified by:
toXmlElement in interface IXMLEncodable
Parameters:
a_doc - a document
Returns:
the XML node