com.tivoli.pd.jutil
Class PDAttrs

java.lang.Object
  extended by com.tivoli.pd.jutil.PDEnvironmentObject
      extended by com.tivoli.pd.jutil.PDAttrs
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class PDAttrs
extends com.tivoli.pd.jutil.PDEnvironmentObject
implements java.lang.Cloneable, java.io.Serializable

This class represents an attribute list. It is the Java equivalent of the attribute list described in the Security Access Manager Authorization C API Developer Reference. The individual attributes have String names. Current supported value types are String, byte array, Long, and PDAdmSvcPobj. PDAttrs allows an attribute to have more than one value, so attempting to add a value to a name that already has been added to a PDAttrs will result in a multi-valued attribute. PDAttrs, if constructed to do so, will allow duplicate entries in the multi-valued attributes. The attribute list can also handle attribute name strings ignoring case.

Modes: Local,Remote

See Also:
Serialized Form

Constructor Summary
PDAttrs(PDAttrs that)
          Constructs a new PDAttrs containing the elements in the specified PDAttrs.
PDAttrs(PDBasicContext context)
          Constructs a new, empty PDAttrs with the specified initial capacity and default load factor, which is 0.75.
PDAttrs(PDBasicContext context, com.tivoli.pd.jasn1.attrlist_t alt)
          Constructs a PDAttrs from the internal attrlist type.
PDAttrs(PDBasicContext context, boolean allowDuplicates)
          Constructs a new, empty PDAttrs that specifies whether the value for each attribute can consist of an unordered list that allows duplicate items.
PDAttrs(PDBasicContext context, byte[] serverData)
          Creates a PDAttrs from the data returned from the Policy Director server.
 
Method Summary
 java.util.Collection add(java.lang.String name, byte[] value)
          Adds the specified byte array value to the collection of values for the specified name in this PDAttrs.
 java.util.Collection add(java.lang.String name, byte[] value, boolean ignoreCase)
          See add(String, byte[])
 java.util.Collection add(java.lang.String name, java.util.Collection vals)
          Associates the specified values with the specified name in this PDAttrs.
 java.util.Collection add(java.lang.String name, java.util.Collection vals, boolean ignoreCase)
          See add(String, Collection)
 java.util.Collection add(java.lang.String name, java.lang.Long value)
          Adds the specified Long value to the collection of values for the specified name in this PDAttrs.
 java.util.Collection add(java.lang.String name, java.lang.Long value, boolean ignoreCase)
          See add(String, Long)
 java.util.Collection add(java.lang.String name, PDAdmSvcPobj value)
          Adds the specified PDAdmSvcPobj value to the collection of values for the specified name in this PDAttrs.
 java.util.Collection add(java.lang.String name, PDAdmSvcPobj value, boolean ignoreCase)
          See add(String, PDAdmSvcPobj)
 java.util.Collection add(java.lang.String name, PDAttrValues vals)
          Deprecated. Use add(String, Collection) instead
 java.util.Collection add(java.lang.String name, PDAttrValues vals, boolean ignoreCase)
          See add(String, PDAttrValues)
 java.util.Collection add(java.lang.String name, java.lang.String value)
          Adds the specified String value to the collection of values for the specified name in this PDAttrs.
 java.util.Collection add(java.lang.String name, java.lang.String val, boolean ignoreCase)
          See add(String, String)
 void addAll(PDAttrs attrs)
          Adds all of the elements in the specified PDAttrs to this PDAttrs.
 boolean allowDups()
          Returns the current value of allowDups.
 void clear()
          Clears the current PDAttrs.
 java.lang.Object clone()
          Clones the current PDAttrs.
 boolean delete(java.lang.String key)
          Removes the named attribute from the PDAttrs.
 boolean delete(java.lang.String key, boolean ignoreCase)
          See delete(String)
 java.util.Set entrySet()
          Return a Set view of the entries in the PDAttrs.
 boolean equals(java.lang.Object obj)
          Indicates whether some other Object is equal to this one.
 PDAttrValues get(java.lang.String key)
          Deprecated. Use getValues(String) instead.
 com.tivoli.pd.jasn1.attrlist_t getAttrlist_t()
          Return this PDAttrs as an attrlist_t
 void getAttrlist_t(com.tivoli.pd.jasn1.attrlist_t alt)
          Add the contents of this PDAttrs to the attrlist_t data structure alt
 java.lang.String[] getNames(boolean upperCase)
          Return the keys in a string array.
 int getQoP()
          Returns the current value of QoP.
 java.util.Collection getValues(java.lang.String key)
          Returns the value(s) to which this PDAttrs maps the specified key.
 java.util.Collection getValues(java.lang.String key, boolean ignoreCase)
          See getValues(String)
 int hashCode()
          Returns a hashcode for the current object.
 java.util.HashSet iKeySet()
          Return the keys HashSet in upper-cased strings.
 java.util.Set keySet()
          Returns a set view of the keys contained in this PDAttrs.
 void setAttrlist_t(com.tivoli.pd.jasn1.attrlist_t alt)
          Set the contents of this PDAttrs to the attrlist_t data structure alt
 void setQoP(int qop)
          Sets the current value of QoP.
 int size()
          Returns the number of key-values mappings in the current PDAttrs.
 java.lang.String toString()
          Returns a String representation of this object.
 
Methods inherited from class com.tivoli.pd.jutil.PDEnvironmentObject
getContext, setContext
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PDAttrs

public PDAttrs(PDBasicContext context)
        throws PDException
Constructs a new, empty PDAttrs with the specified initial capacity and default load factor, which is 0.75.

Parameters:
context - the context that defines values for logging and tracing. Cannot be null.
Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.

PDAttrs

public PDAttrs(PDBasicContext context,
               boolean allowDuplicates)
        throws PDException
Constructs a new, empty PDAttrs that specifies whether the value for each attribute can consist of an unordered list that allows duplicate items. The PDAttrs will have the default load factor (.75).

Parameters:
context - the context that defines values for logging and tracing. Cannot be null.
allowDuplicates - A boolean indicating whether each attribute value can be an unordered list that allows duplicate items.
Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.

PDAttrs

public PDAttrs(PDAttrs that)
        throws PDException
Constructs a new PDAttrs containing the elements in the specified PDAttrs.

Parameters:
that - the PDAttrs whose elements are to be placed into this PDAttrs.
Throws:
PDException - if one or more of the elements in the PDAttrs to be added are not PDAttr objects, or if no PDAttrs is passed in. This exception may contain error and message codes defined in the product Error Message Reference document.

PDAttrs

public PDAttrs(PDBasicContext context,
               byte[] serverData)
        throws PDException
Creates a PDAttrs from the data returned from the Policy Director server. This is not intended for public use.

Parameters:
context - the context that defines values for logging and tracing. Cannot be null.
serverData - ASN.1 rendition of an Attrlist.
Throws:
PDException

PDAttrs

public PDAttrs(PDBasicContext context,
               com.tivoli.pd.jasn1.attrlist_t alt)
        throws PDException
Constructs a PDAttrs from the internal attrlist type. This is not intended for public use.

Parameters:
context - the context that defines values for logging and tracing. Cannot be null.
alt - attrlist_t.
Throws:
PDException
Method Detail

iKeySet

public java.util.HashSet iKeySet()
Return the keys HashSet in upper-cased strings.


getNames

public java.lang.String[] getNames(boolean upperCase)
Return the keys in a string array. If upperCase, return the keys in upper-cased strings. Otherwise, return the keys unchanged.

Parameters:
upperCase - Specify if the keys should be returned upper-cased.

add

public java.util.Collection add(java.lang.String name,
                                PDAttrValues vals,
                                boolean ignoreCase)
                         throws PDException
See add(String, PDAttrValues)

Parameters:
ignoreCase - Specify if the name should be addeded ignoring case.
Throws:
PDException

add

public java.util.Collection add(java.lang.String name,
                                java.util.Collection vals,
                                boolean ignoreCase)
                         throws PDException
See add(String, Collection)

Parameters:
ignoreCase - Specify if the name should be addeded ignoring case.
Throws:
PDException

add

public java.util.Collection add(java.lang.String name,
                                java.lang.String val,
                                boolean ignoreCase)
                         throws PDException
See add(String, String)

Parameters:
ignoreCase - Specify if the name should be added ignoring case.
Throws:
PDException

add

public java.util.Collection add(java.lang.String name,
                                java.lang.Long value,
                                boolean ignoreCase)
                         throws PDException
See add(String, Long)

Parameters:
ignoreCase - Specify if the name should be addeded ignoring case.
Throws:
PDException

add

public java.util.Collection add(java.lang.String name,
                                PDAdmSvcPobj value,
                                boolean ignoreCase)
                         throws PDException
See add(String, PDAdmSvcPobj)

Parameters:
ignoreCase - Specify if the name should be added ignoring case.
Throws:
PDException

add

public java.util.Collection add(java.lang.String name,
                                byte[] value,
                                boolean ignoreCase)
                         throws PDException
See add(String, byte[])

Parameters:
ignoreCase - Specify if the name should be added ignoring case.
Throws:
PDException

delete

public boolean delete(java.lang.String key,
                      boolean ignoreCase)
See delete(String)

Parameters:
ignoreCase - Specify if the name should be added ignoring case.

getValues

public java.util.Collection getValues(java.lang.String key,
                                      boolean ignoreCase)
See getValues(String)

Parameters:
ignoreCase - Specify if the name should be added ignoring case.

add

public java.util.Collection add(java.lang.String name,
                                PDAttrValues vals)
                         throws PDException
Deprecated. Use add(String, Collection) instead

Associates the specified values with the specified name in this PDAttrs. If this PDAttrs previously contained values for the name, then the input values are added to the values already known for the name.

Parameters:
name - the name of the attribute.
vals - the new values to be associated with the name.
Returns:
the previous values associated with the name, or null if no values were previously known for the name.
Throws:
PDException - on parameter errors. This exception may contain error and message codes defined in the product Error Message Reference document.

add

public java.util.Collection add(java.lang.String name,
                                java.util.Collection vals)
                         throws PDException
Associates the specified values with the specified name in this PDAttrs. If this PDAttrs previously contained values for the name, then the input values are added to the values already known for the name.

Parameters:
name - the name of the attribute.
vals - the new values to be associated with the name. Must be either a PDAttrValues or a PDAttrValueList.
Returns:
the previous values associated with the name, or null if no values were previously known for the name.
Throws:
PDException - on parameter errors. This exception may contain error and message codes defined in the product Error Message Reference document.

add

public java.util.Collection add(java.lang.String name,
                                java.lang.String value)
                         throws PDException
Adds the specified String value to the collection of values for the specified name in this PDAttrs. If this PDAttrs previously contained values for this name, then the input value is added to the values already known for the name.

Parameters:
name - the name of the attribute.
value - the new String value to be added for the name.
Returns:
the previous values associated with the name, or null if no values were previously known for the name.
Throws:
PDException - if the input value contains an object other than a PDAttrValue, or on parameter errors. This exception may contain error and message codes defined in the product Error Message Reference document.

add

public java.util.Collection add(java.lang.String name,
                                java.lang.Long value)
                         throws PDException
Adds the specified Long value to the collection of values for the specified name in this PDAttrs. If this PDAttrs previously contained values for the name, then the input value is added to the values already known for the name.

Parameters:
name - the name of the attribute.
value - the new Long value to be added for the name.
Returns:
the previous values associated with the name, or null if no values were previously known for the name.
Throws:
PDException - if the input value contains an object other than a PDAttrValue, or on parameter errors. This exception may contain error and message codes defined in the product Error Message Reference document.

add

public java.util.Collection add(java.lang.String name,
                                PDAdmSvcPobj value)
                         throws PDException
Adds the specified PDAdmSvcPobj value to the collection of values for the specified name in this PDAttrs. If this PDAttrs previously contained values for this name, then the input value is added to the values already known for the name.

Parameters:
name - the name of the attribute.
value - the new PDAdmSvcPobj value to be added for the name.
Returns:
the previous values associated with the name, or null if no values were previously known for the name.
Throws:
PDException - if the input contains an object other than a PDAttrValue, or on parameter errors. This exception may contain error and message codes defined in the product Error Message Reference document.

add

public java.util.Collection add(java.lang.String name,
                                byte[] value)
                         throws PDException
Adds the specified byte array value to the collection of values for the specified name in this PDAttrs. If this PDAttrs previously contained values for the name, then the input value is added to the values already known for the name.

Parameters:
name - the name of the attribute.
value - the new byte array value to be added for the name.
Returns:
the previous values associated with the name, or null if no values were previously known for the name.
Throws:
PDException - if the input value contains an object other than a PDAttrValue, or on parameter errors. This exception may contain error and message codes defined in the product Error Message Reference document.

addAll

public void addAll(PDAttrs attrs)
            throws PDException
Adds all of the elements in the specified PDAttrs to this PDAttrs. The behavior of this operation is undefined if the specified PDAttrs is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified PDAttrs is this PDAttrs, and this PDAttrs is nonempty.) This implementation iterates over the specified PDAttrs, and adds each PDAttr returned by the iterator to this map, in turn.

Parameters:
attrs - the PDAttrs to be added.
Throws:
PDException - if no PDAttrs is passed. This exception may contain error and message codes defined in the product Error Message Reference document.

clear

public void clear()
Clears the current PDAttrs. Remove all mappings in the current PDAttrs, reset QoP to zero, and reset the version number to the current supported level. Leave allowDups as it was when the PDAttrs was originally created.


delete

public boolean delete(java.lang.String key)
Removes the named attribute from the PDAttrs.

Parameters:
key - the name of the attribute to be removed.
Returns:
true if the attribute was in the PDAttrs

clone

public java.lang.Object clone()
Clones the current PDAttrs. This is implemented as a deep copy.

Overrides:
clone in class java.lang.Object

entrySet

public java.util.Set entrySet()
Return a Set view of the entries in the PDAttrs. Modifications to the Set will result in modifications to the underlying PDAttrs.


equals

public boolean equals(java.lang.Object obj)
Indicates whether some other Object is equal to this one. In particular, this implementation checks that the QoP, version, and allowDups are the same, and then defers to the equals check, which will devolve into a containsAll check on the current PDAttrs set.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to be compared to this one.
Returns:
true if the PDAttrs are identical, false otherwise.

get

public PDAttrValues get(java.lang.String key)
                 throws PDException
Deprecated. Use getValues(String) instead.

Returns the value(s) to which this PDAttrs maps the specified key. Returns null if the PDAttrs contains no mapping for the specified key.

Parameters:
key - key whose associated value(s) is/are to be returned.
Throws:
Throws - PDException. This exception may contain error and message codes defined in the product Error Message Reference document.
PDException

getValues

public java.util.Collection getValues(java.lang.String key)
Returns the value(s) to which this PDAttrs maps the specified key. Returns null if the PDAttrs contains no mapping for the specified key.

Parameters:
key - key whose associated value(s) is/are to be returned.

getQoP

public int getQoP()
Returns the current value of QoP.


allowDups

public boolean allowDups()
Returns the current value of allowDups.


hashCode

public int hashCode()
Returns a hashcode for the current object.

Overrides:
hashCode in class java.lang.Object

keySet

public java.util.Set keySet()
Returns a set view of the keys contained in this PDAttrs. The set is backed by the map, so changes to the PDAttrs are reflected in the set, and vice-versa. The set supports element removal, which removes the corresponding mapping from this PDAttrs, via the Iterator.remove, Set.remove, removeAll, retainAll, and clear operations. It does not support the add or addAll operations.


setQoP

public void setQoP(int qop)
            throws PDException
Sets the current value of QoP.

Parameters:
qop - the new value for QoP.
Throws:
PDException - if the QoP value is unknown. This exception may contain error and message codes defined in the product Error Message Reference document.

size

public int size()
Returns the number of key-values mappings in the current PDAttrs. Note that is equivalent to the number of keys in the PDAttrs, not the number of values, as a multi-value key counts as only one key.


toString

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

Overrides:
toString in class java.lang.Object

getAttrlist_t

public com.tivoli.pd.jasn1.attrlist_t getAttrlist_t()
                                             throws PDException
Return this PDAttrs as an attrlist_t

Returns:
attrlist_t contents of this PDAttrs in an attrlist_t data structure
Throws:
PDException

getAttrlist_t

public void getAttrlist_t(com.tivoli.pd.jasn1.attrlist_t alt)
                   throws PDException
Add the contents of this PDAttrs to the attrlist_t data structure alt

Parameters:
alt - attrlist_t type
Throws:
PDException

setAttrlist_t

public void setAttrlist_t(com.tivoli.pd.jasn1.attrlist_t alt)
                   throws PDException
Set the contents of this PDAttrs to the attrlist_t data structure alt

Parameters:
alt - attrlist_t type
Throws:
PDException