com.novell.ecb.secretstore
Class SecretInstance

java.lang.Object
  |
  +--com.novell.ecb.secretstore.SecretInstance
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
SharedSecretInstance

public class SecretInstance
extends java.lang.Object
implements java.io.Serializable

Represents a Secret in the SecretStore.

This is a common object used by all the command beans which operate on a Secret.

Bean user is not expected to instantiate this object directly. GetSecretInstance bean is provided for that purpose.

Version:
1.0
See Also:
GetSecretInstance, Serialized Form

Constructor Summary
SecretInstance()
          Constructs a SecretInstance object.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Returns true if this Secret and the Object passed as argument both have the same secretID and belong to the same user.
 boolean exists()
          Returns true if this Secret exists in the SecretStore.
 java.util.Date getAccessTime()
          Returns the time when Secret was last accessed from the SecretStore.
 java.util.Date getCreateTime()
          Returns the creation time of the Secret in the SecretStore.
 java.util.Date getModifyTime()
          Returns the time when Secret was last modified in the SecretStore.
 SSFlags getStatus()
          Returns the current status of the SecretStore.
 int hashCode()
          Returns a hash code value for this object.
 java.lang.String toString()
          Returns a String representation for this object.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SecretInstance

public SecretInstance()
Constructs a SecretInstance object.

Example: Shows how to use SecretInstance object.


     // Get the SecretInstance from GetSecretInstance or EnumerateSecrets bean.
     // Mostly, this object is passed from one bean to another for performing
     // operations on a Secret. This object implements some methods which are
     // useful in getting the information related with a Secret.
   SecretInstance si = getSI.getSecretInstance();
   try
     {
        Date createTime = null;
        Date accessTime = null;
        Date modifyTime = null;
        SSFlags status = null;
         // Test whether this Secret exists in SecretStore
        if (si.exists()) {
           createTime = si.getCreateTime();
           accessTime = si.getAccessTime();
           modifyTime = si.getModifyTime();
           status = si.getStatus();
           System.out.println("Secret creation time: " + createTime.toString());
           System.out.println("Secret last modification time: " + modifyTime.toString());
           System.out.println("Secret last acess time: " + accessTime.toString());
           if (status.isSet(SSFlags.OUT_ENHANCED_PROTECTED))
              System.out.println("Secret is enhanced protected.");
           if (status.isSet(SSFlags.OUT_EP_PWORD_PRESENT))
              System.out.println("Secret has an enhanced protection password set.");
           // Do any further operations
          ...
          ...
         } else {
           // Secret does not exist in SecretStore
           // Do any further operations
          ...
          ...
         }
     }
     catch(CommandException e)
      {
         // TODO: Handle exception
      }
 

See Also:
GetSecretInstance, EnumerateSecrets
Method Detail

getAccessTime

public java.util.Date getAccessTime()
                             throws SecretStoreException
Returns the time when Secret was last accessed from the SecretStore.

Returns:
Date Time when the Secret was last accessed. If no time is set on server side, "the epoch" value is returned. If this object is not instantiated properly, null is returned.
Throws:
SecretStoreException - Thrown if a problems occur in the SecretStore.

getCreateTime

public java.util.Date getCreateTime()
                             throws SecretStoreException
Returns the creation time of the Secret in the SecretStore.

Returns:
Date Time when the Secret was created. If no time is set on server side, "the epoch" value is returned. If this object is not instantiated properly, null is returned.
Throws:
SecretStoreException - Thrown if a problems occur in the SecretStore.

getModifyTime

public java.util.Date getModifyTime()
                             throws SecretStoreException
Returns the time when Secret was last modified in the SecretStore.

Returns:
Date Time when the Secret was last modified. If no time is set on server side, "the epoch" value is returned. If this object is not instantiated properly, null is returned.
Throws:
SecretStoreException - Thrown if a problems occur in the SecretStore.

getStatus

public SSFlags getStatus()
                  throws SecretStoreException
Returns the current status of the SecretStore.

Returns:
SSFlags The current status of the SecretStore. If this object is not instantiated properly, null is returned.
Throws:
SecretStoreException - Thrown if a problems occur in the SecretStore.

exists

public boolean exists()
               throws SecretStoreException
Returns true if this Secret exists in the SecretStore.

Returns:
boolean True if this Secret exists in the SecretStore; else, returns False. If this object is not instantiated properly, false is returned.
Throws:
SecretStoreException - Thrown if a problems occur in the SecretStore.

equals

public boolean equals(java.lang.Object obj)
Returns true if this Secret and the Object passed as argument both have the same secretID and belong to the same user.

Overrides:
equals in class java.lang.Object
Returns:
boolean True if this Secret and the Object passed as argument both have the same secretID and belong to the same user. If this object is not instantiated properly, false is returned.

hashCode

public int hashCode()
Returns a hash code value for this object.

Constructed using the hash code of the combination of the context's name and the secret identifier.

Overrides:
hashCode in class java.lang.Object
Returns:
int Hash code value for this object. If this object is not instantiated properly, 0 is returned.

toString

public java.lang.String toString()
Returns a String representation for this object.

Constructed using the secret identifier.

Overrides:
toString in class java.lang.Object
Returns:
String String representation for this object. If this object is not instantiated properly, null is returned.


Copyright © 2001-2003 Novell, Inc. All Rights Reserved.