com.sas.edir.content
Class FileManager.Key

java.lang.Object
  |
  +--com.sas.edir.content.FileManager.Key
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
DateExpirationKey, FileManager.DefaultKey
Enclosing class:
FileManager

public abstract static class FileManager.Key
extends java.lang.Object
implements java.io.Serializable

This is the abstract class that all keys must extend in order to store content in the FileManager.

Version:
1.0
Author:
SAS
See Also:
Serialized Form

Constructor Summary
protected FileManager.Key()
          Null constuctor
  FileManager.Key(java.lang.Object uid)
          Constuctor to create a new Key based on a unique id.
  FileManager.Key(java.lang.String user, java.lang.Object uid)
          Constuctor to create a new Key based on a user and a unique id A null or FileManager.ROOT user will store the data associated with this key in the root directory of the FileManager.
 
Method Summary
abstract  void delete()
          Notifies the key that the data associated with this key has been deleted Keys will throw an exception if it cannot reconcile the delete and the data will not be removed from the FileManager.
 boolean equals(java.lang.Object object)
          Compares two Objects for equality.
abstract  java.lang.Object fetch()
          Notifies the key that the data associated with this key no longer exists in the FileManager, but gives the key a chance to re-fetch the data if desired.
 java.lang.Object getUID()
          Returns the Unique ID associated with this key
 java.lang.String getUser()
          Returns the User associated with this key
 int hashCode()
          Returns a hash code value for the object.
abstract  boolean isExpired()
          Returns true if this key has expired
abstract  void save()
          Notifies the key that the data associated with this key has been saved Keys will throw an exception if it cannot reconcile the save and the data will be removed from the FileManager.
 java.lang.String toString()
          Return key as a String
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileManager.Key

protected FileManager.Key()
Null constuctor

FileManager.Key

public FileManager.Key(java.lang.Object uid)
Constuctor to create a new Key based on a unique id. The default storage of the data associated with this key is the root directory of the FileManager.

FileManager.Key

public FileManager.Key(java.lang.String user,
                       java.lang.Object uid)
Constuctor to create a new Key based on a user and a unique id A null or FileManager.ROOT user will store the data associated with this key in the root directory of the FileManager.
Method Detail

getUser

public final java.lang.String getUser()
Returns the User associated with this key

getUID

public final java.lang.Object getUID()
Returns the Unique ID associated with this key

hashCode

public int hashCode()
Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable. The general contract of hashCode is: · Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer. This integer need not remain consistent from one execution of an application to another execution of the same application. · If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result. By default, this returns the hashCode of the uid object
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object object)
Compares two Objects for equality. Two FileManager.Key objects are equal (by default) if their user (getUser()) and their uid (getUID()) fields are equal. This can be redefined on a per FileManager.Key extension.
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Return key as a String
Overrides:
toString in class java.lang.Object

isExpired

public abstract boolean isExpired()
Returns true if this key has expired

save

public abstract void save()
                   throws java.lang.Exception
Notifies the key that the data associated with this key has been saved Keys will throw an exception if it cannot reconcile the save and the data will be removed from the FileManager.

delete

public abstract void delete()
                     throws java.lang.Exception
Notifies the key that the data associated with this key has been deleted Keys will throw an exception if it cannot reconcile the delete and the data will not be removed from the FileManager.

fetch

public abstract java.lang.Object fetch()
Notifies the key that the data associated with this key no longer exists in the FileManager, but gives the key a chance to re-fetch the data if desired.