wt.org
Class WTPrincipalCacheElement

java.lang.Object
  extended bywt.org.WTPrincipalCacheElement
All Implemented Interfaces:
Externalizable, Serializable

class WTPrincipalCacheElement
extends Object
implements Externalizable

This class is used to cache Principal objects in the WTPrincipalCache. Objects of the class contain the Principal object being cached and the time the object was added to the cache. The object can also contain the parent groups for the Principal, the members associated with the principal (if the principal is a group), and the subordinates associated with the principal (if the principal is an organization). The time the object is added to cache is used to implement a Time To Live feature for cache entries. Each time a cache entry is read the time the entry was cached is checked against the current time to see if the amount of time the entry has resided in the cache exceeds an amount of time specified by a property. If so, the entry has exceeded its "time to live" and is removed from the cache.

Supported API: false

Extendable: false


Field Summary
private  long cachedTime
           
private static String CLASSNAME
           
static long EXTERNALIZATION_VERSION_UID
           
private  HashMap memberReferences
           
private  ObjectIdentifier[] members
           
protected static long OLD_FORMAT_VERSION_UID
           
private  ObjectIdentifier organization
           
private  ObjectIdentifier[] parentGroups
           
private  HashMap parentReferences
           
private  WTPrincipal principal
           
private static String RESOURCE
           
(package private) static long serialVersionUID
           
private  ObjectIdentifier[] subordinates
           
 
Constructor Summary
WTPrincipalCacheElement()
          The no arg constructor.
WTPrincipalCacheElement(WTPrincipal principal)
          Constructor.
 
Method Summary
 boolean equals(Object rs)
          

Supported API: false
 long getCachedTime()
          

Supported API: false
 Map getMemberReferences()
          

Supported API: false
 ObjectIdentifier[] getMembers()
          

Supported API: false
 ObjectIdentifier getOrganization()
          

Supported API: false
 ObjectIdentifier[] getParentGroups()
          

Supported API: false
 Map getParentReferences()
          

Supported API: false
 WTPrincipal getPrincipal()
          

Supported API: false
 ObjectIdentifier[] getSubordinates()
          

Supported API: false
 int hashCode()
          

Supported API: false
 void readExternal(ObjectInput input)
          Reads the non-transient fields of this class from an external source.
private  boolean readOldVersion(ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source, which is not the current version.
protected  boolean readVersion(WTPrincipalCacheElement thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
 void setCachedTime(long cachedTime)
          Sets the cachedTime attribute.
 void setCachedTime(long cachedTime, long randomMaxValue)
          Sets the cachedTime attribute.
 void setMembers(ObjectIdentifier[] members)
          

Supported API: false
 void setOrganization(ObjectIdentifier organization)
          

Supported API: false
 void setParentGroups(ObjectIdentifier[] parentGroups)
          

Supported API: false
 void setPrincipal(WTPrincipal principal)
          

Supported API: false
 void setSubordinates(ObjectIdentifier[] subordinates)
          

Supported API: false
 boolean timeToLiveExpired(long timeToLive)
          Checks to see if the WTPrincipalCacheElement has resided in the cache for the specified period of time.
 String toString()
          

Supported API: false
 void writeExternal(ObjectOutput output)
          Writes the non-transient fields of this class to an external source.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

cachedTime

private long cachedTime

members

private ObjectIdentifier[] members

organization

private ObjectIdentifier organization

parentGroups

private ObjectIdentifier[] parentGroups

subordinates

private ObjectIdentifier[] subordinates

principal

private WTPrincipal principal

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

EXTERNALIZATION_VERSION_UID

public static final long EXTERNALIZATION_VERSION_UID
See Also:
Constant Field Values

OLD_FORMAT_VERSION_UID

protected static final long OLD_FORMAT_VERSION_UID
See Also:
Constant Field Values

memberReferences

private volatile HashMap memberReferences

parentReferences

private volatile HashMap parentReferences
Constructor Detail

WTPrincipalCacheElement

public WTPrincipalCacheElement()
The no arg constructor.

Supported API: false


WTPrincipalCacheElement

public WTPrincipalCacheElement(WTPrincipal principal)
Constructor. It sets the principal attribute to the input value.

Supported API: false

Parameters:
principal - The Principal object being cached.
Method Detail

writeExternal

public void writeExternal(ObjectOutput output)
                   throws IOException
Writes the non-transient fields of this class to an external source.

Supported API: false

Specified by:
writeExternal in interface Externalizable
Parameters:
output -
Throws:
IOException

readExternal

public void readExternal(ObjectInput input)
                  throws IOException,
                         ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Specified by:
readExternal in interface Externalizable
Parameters:
input -
Throws:
IOException
ClassNotFoundException

readVersion

protected boolean readVersion(WTPrincipalCacheElement thisObject,
                              ObjectInput input,
                              long readSerialVersionUID,
                              boolean passThrough,
                              boolean superDone)
                       throws IOException,
                              ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Parameters:
thisObject -
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

readOldVersion

private boolean readOldVersion(ObjectInput input,
                               long readSerialVersionUID,
                               boolean passThrough,
                               boolean superDone)
                        throws IOException,
                               ClassNotFoundException
Reads the non-transient fields of this class from an external source, which is not the current version.

Parameters:
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

getCachedTime

public long getCachedTime()


Supported API: false

Returns:
long

getMembers

public ObjectIdentifier[] getMembers()


Supported API: false

Returns:
ObjectIdentifier[]

getMemberReferences

public Map getMemberReferences()
                        throws WTException


Supported API: false

Returns:
Map
Throws:
WTException

getOrganization

public ObjectIdentifier getOrganization()


Supported API: false

Returns:
ObjectIdentifier

getParentGroups

public ObjectIdentifier[] getParentGroups()


Supported API: false

Returns:
ObjectIdentifier[]

getPrincipal

public WTPrincipal getPrincipal()


Supported API: false

Returns:
WTPrincipal

getSubordinates

public ObjectIdentifier[] getSubordinates()


Supported API: false

Returns:
ObjectIdentifier[]

setCachedTime

public void setCachedTime(long cachedTime)
Sets the cachedTime attribute.

Supported API: false

Parameters:
cachedTime - The cachedTime value in milliseconds. If the value is less than or equal to 0, the cachedTime attribute is set to zero.

setCachedTime

public void setCachedTime(long cachedTime,
                          long randomMaxValue)
Sets the cachedTime attribute. The value is set to the input cachedTime plus a random value between zero and the input randomMaxValue.

Supported API: false

Parameters:
cachedTime - The cachedTime value in milliseconds. If the value is less than or equal to 0, the cachedTime attribute is set to zero.
randomMaxValue - Used to add a random amount of time to the input cachedTime value. Specify randomMaxValue in milliseconds. The random value added to cachedTime will be between 0 and randomMaxValue. If randomMaxValue is less than or equal to 0, the value added to cachedTime is 0.

setMembers

public void setMembers(ObjectIdentifier[] members)


Supported API: false

Parameters:
members -

setOrganization

public void setOrganization(ObjectIdentifier organization)


Supported API: false

Parameters:
organization -

setParentGroups

public void setParentGroups(ObjectIdentifier[] parentGroups)


Supported API: false

Parameters:
parentGroups -

getParentReferences

public Map getParentReferences()
                        throws WTException


Supported API: false

Returns:
Map
Throws:
WTException

setPrincipal

public void setPrincipal(WTPrincipal principal)


Supported API: false

Parameters:
principal -

setSubordinates

public void setSubordinates(ObjectIdentifier[] subordinates)


Supported API: false

Parameters:
subordinates -

timeToLiveExpired

public boolean timeToLiveExpired(long timeToLive)
Checks to see if the WTPrincipalCacheElement has resided in the cache for the specified period of time. If the element has esided in cache for more than the specified amount of time, true is returned; otherwise, false is returned. Note that if this Element's cachedTime attribute is 0, false is always returned.

Supported API: false

Parameters:
timeToLive - The amount of time, specified in seconds. If the element has been in cache for more than this amount, true is returned; otherwise, false is returned.
Returns:
boolean

equals

public boolean equals(Object rs)


Supported API: false

Parameters:
rs -
Returns:
boolean

hashCode

public int hashCode()


Supported API: false

Returns:
int

toString

public String toString()


Supported API: false

Returns:
String