anon.infoservice
Class AbstractDatabaseEntry

java.lang.Object
  extended by anon.infoservice.AbstractDatabaseEntry
Direct Known Subclasses:
AbstractCascadeIDEntry, AbstractCertifiedDatabaseEntry, AbstractDistributableDatabaseEntry, AbstractDistributableDatabaseEntry.SerialDBEntry, AbstractIDEntry, AbstractMarkedMessageIDDBEntry, DNSCacheEntry, MixCascadeExitAddresses, PerformanceEntry, ServiceOperator, StatusInfo

public abstract class AbstractDatabaseEntry
extends java.lang.Object

This is a generic definition for a database entry. Every database entry must implement this methods.


Field Summary
private  long m_creationTime
           
private  long m_expireTime
          Stores the time when this entry will be deleted from the database.
static java.lang.String XML_ATTR_LAST_UPDATE
           
static java.lang.String XML_LAST_UPDATE
           
 
Constructor Summary
AbstractDatabaseEntry(long a_expireTime)
          Creates a new AbstractDatabaseEntry with the specified expire time.
 
Method Summary
 void deletePersistence()
           
 long getCreationTime()
          Returns the time in milliseconds when this db entry was create, that means read from the network or created from internal values.
 long getExpireTime()
          Returns the time (see System.currentTimeMillis()) when this DatabaseEntry will be removed from the Database, if it is not updated meanwhile.
abstract  java.lang.String getId()
          Returns a unique ID for a database entry.
abstract  long getLastUpdate()
          Returns the time in milliseconds when this db entry was created from the origin instance.
abstract  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 isNewerThan(AbstractDatabaseEntry a_oldEntry)
          Returns if this entry is newer than the given entry.
 boolean isPersistanceDeletionAllowed()
           
 boolean isUserDefined()
          Returns whether this entry was generated by a user within the JAP client (true) or was generated by an InfoService itself (false).
 void resetCreationTime()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XML_LAST_UPDATE

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

XML_ATTR_LAST_UPDATE

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

m_expireTime

private long m_expireTime
Stores the time when this entry will be deleted from the database.


m_creationTime

private long m_creationTime
Constructor Detail

AbstractDatabaseEntry

public AbstractDatabaseEntry(long a_expireTime)
Creates a new AbstractDatabaseEntry with the specified expire time.

Parameters:
a_expireTime - The time when this entry will be deleted from the database.
Method Detail

isNewerThan

public final boolean isNewerThan(AbstractDatabaseEntry a_oldEntry)
Returns if this entry is newer than the given entry. If the entry that already is in the database is newer than an entry that is added to the db, nothing is changed and the old entry remains in the db.

Parameters:
a_oldEntry - AbstractDatabaseEntry
Returns:
if this entry is newer than the given entry, or if the given entry is null

isUserDefined

public boolean isUserDefined()
Returns whether this entry was generated by a user within the JAP client (true) or was generated by an InfoService itself (false).

Returns:
Whether this entry is user-defined.

isPersistanceDeletionAllowed

public boolean isPersistanceDeletionAllowed()

deletePersistence

public void deletePersistence()

getId

public abstract java.lang.String getId()
Returns a unique ID for a database entry.

Returns:
The ID of this database entry.

getExpireTime

public final long getExpireTime()
Returns the time (see System.currentTimeMillis()) when this DatabaseEntry will be removed from the Database, if it is not updated meanwhile.

Returns:
The expire time for this DatabaseEntry.

getLastUpdate

public abstract long getLastUpdate()
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.

Returns:
the time in milliseconds when this db entry was created from the origin instance

getCreationTime

public final long getCreationTime()
Returns the time in milliseconds when this db entry was create, that means read from the network or created from internal values.

Returns:
the time in milliseconds when this db entry was created

resetCreationTime

public final void resetCreationTime()

getVersionNumber

public abstract 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). Never (!) insert the local creation time here, as this will DoS the InfoServices in an endless loop.

Returns:
The version number for this entry.