com.novell.security.sso
Class SharedEntry

java.lang.Object
  |
  +--com.novell.security.sso.SharedEntry
All Implemented Interfaces:
Cloneable, Comparable, Serializable

public class SharedEntry
extends Object
implements Cloneable, Comparable, Serializable

Class that represents an entry in a shared secret. Handles all of the the escaping and unescaping automatically. See the SharedSecret class for information about the shared secret format.

Since:
3.1
Version:
3.2
Author:
Steve Kinser
See Also:
SharedSecret, Serialized Form

Field Summary
static char CREDENTIAL_DELIMITER
          The delimiter that seperates the key from the value in an entry where it represents a CredSet reference.
static char NORMAL_DELIMITER
          The delimiter that seperates the key from the value in an entry where it doesn't represent a CredSet reference.
 
Constructor Summary
SharedEntry(String key, String value)
          Constructs an instance of this class.
 
Method Summary
 Object clone()
           
 int compareTo(Object obj)
          Compares this object with the specified object.
 boolean equals(Object obj)
          Determines if this object is equal to the specified object.
static String escapeString(String unescapedString)
          Escapes the specified String.
 String getKey()
          Returns the unescaped key.
 String getValue()
          Returns the unescaped value.
 int hashCode()
           
 boolean isCredSet()
          Returns true if this object represents a CredSet reference and false if otherwise.
static SharedEntry parseEntry(String entryStr)
          Parses a String for a SharedEntry.
 void setValue(String value)
          Sets the value of this object.
 String toString()
          Returns the String representation of this object that has been properly escaped.
static String unescapeString(String escapedString)
          Unescapes the specified String.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CREDENTIAL_DELIMITER

public static final char CREDENTIAL_DELIMITER
The delimiter that seperates the key from the value in an entry where it represents a CredSet reference. The value is ':'.

NORMAL_DELIMITER

public static final char NORMAL_DELIMITER
The delimiter that seperates the key from the value in an entry where it doesn't represent a CredSet reference. The value is '='.
Constructor Detail

SharedEntry

public SharedEntry(String key,
                   String value)
Constructs an instance of this class. The key and value should not be escaped. Neither the key nor the value may be null. The key must not be an empty String, but the value may.
Parameters:
key - The key.
value - The value.
Method Detail

isCredSet

public boolean isCredSet()
Returns true if this object represents a CredSet reference and false if otherwise. A SharedEntry represents a CredSet reference if the key has the value of "SS_CredSet".
Returns:
true if this object represents a CredSet reference and false if otherwise.

clone

public Object clone()

compareTo

public int compareTo(Object obj)
Compares this object with the specified object. The comparison is done based on the keys of both SharedEntry objects unless this object represents a CredSet. In that case the comparison is based on the String representation of both objects.
Specified by:
compareTo in interface Comparable
Parameters:
obj - The object that will be compared with.
Returns:
The comparison value that corresponds with the Comparable interface.

equals

public boolean equals(Object obj)
Determines if this object is equal to the specified object. The comparison is done based on the keys of both SharedEntry objects unless this object represents a CredSet. In that case the comparison is based on the String representation of both objects.
Overrides:
equals in class Object
Parameters:
obj - The object that will be compared with.
Returns:
true if the objects are equal and false if not.

escapeString

public static String escapeString(String unescapedString)
Escapes the specified String. Converts \ to \\, = to \=, and : to \:.
Parameters:
unescapedString - The String that is not escaped.
Returns:
The String that has been escaped.

getKey

public String getKey()
Returns the unescaped key.
Returns:
The key.

getValue

public String getValue()
Returns the unescaped value.
Returns:
The value.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

parseEntry

public static SharedEntry parseEntry(String entryStr)
                              throws SSException
Parses a String for a SharedEntry. The String should be escaped properly. This method can parse a String that was created by calling toString() on any SharedEntry object.
Parameters:
entryStr - The String representation of a SharedEntry object.
Returns:
The new SharedEntry object.
Throws:
SSException - If a SSException occurred.

setValue

public void setValue(String value)
Sets the value of this object.
Parameters:
value - The new value.

toString

public String toString()
Returns the String representation of this object that has been properly escaped.
Overrides:
toString in class Object
Returns:
The String representation of this object.
See Also:
escapeString(java.lang.String)

unescapeString

public static String unescapeString(String escapedString)
Unescapes the specified String. Converts \\ to \, \= to =, and \: to :.
Parameters:
escapedString - The escaped String that will be unescaped.
Returns:
The unescaped String.


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