com.ibm.security.certclient.base

Class PkAttr

  1. java.lang.Object
  2. extended bycom.ibm.security.certclient.base.PkAttr
All implemented interfaces:
PkAttrKind, Serializable, Cloneable, Comparable

  1. public final class PkAttr
  2. extends Object
  3. implements PkAttrKind, Serializable, Cloneable, Comparable
A PkAttr represents a single (name, kind, value): triple.

The name is a String. Possibly the string representation of an OID, or one of the constants defined by the interfaces extended by PkConstants, but that is not enforced by PkAttr.

The kind is a scalar whose bits are used to represent characteristics of the attribute. Constants are defined in PkAttrKind.

The value is an Object. This class does not impose any specific requirements on the value. However, For a given name, the value should be an instance of a specific class. The interfaces that define names that apply to PkAttrs document the valid class for each name.

Author:
Rod Mancisidor
See Also:
Serialized Form

Field Summary

Modifier and Type Field and Description
  1. static
  2. PkAttr
NULL
Used as a marker for attributes that don't exist.
Fields inherited from interface com.ibm.security.certclient.base.PkAttrKind
ATTR_APPLIED, ATTR_APPROVED, ATTR_NAMES

Constructor Summary

Constructor and Description
PkAttr(String name)
Create a new mutable PkAttr.
PkAttr(String name,int kind,Object value)
Create a new mutable PkAttr.
PkAttr(String name,int kind,Object value,boolean readOnly)
Create a new PkAttr.

Method Summary

Modifier and Type Method and Description
  1. int
compareTo(Object other)
Compares against another attribute.
  1. int
compareTo(PkAttr other)
Compares against another attribute.
  1. boolean
equals(Object obj)
Returns true if and only if this attribute is equal to obj.
  1. int
getKind()
Returns the kind.
  1. String
getName()
Returns the name of this attribute.
  1. String
getString()
Returns the value of this attribute as a String.
  1. Object
getValue()
Returns the value of this attribute as an Object.
  1. int
hashCode()
Returns a hashCode for the attribute that is consistent with the definition of equality as implemented in the equals method.
  1. boolean
isApplied()
Is this attribute meant for the cert or CRL?
  1. boolean
isApproved()
Has this attribute been approved by the current process (EE, RA or CA)?
  1. boolean
isNameOid()
Returns true if and only if the name of this attribute is an OID.
  1. void
setApplied(boolean b)
Turns on the PkAttrKind.ATTR_APPLIED bit for this attribute.
  1. void
setApproved(boolean b)
Turns on the PkAttrKind.ATTR_APPROVED bit for this attribute.
  1. void
setKind(int kind)
Sets the kind of this attribute.
  1. void
setReadOnly()
Makes this attribute immutable.
  1. void
setValue(Object value)
Sets the value of this attribute.
  1. String
toString()
Returns a string representation of this event.
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait

Field Detail

NULL

  1. public static final PkAttr NULL
Used as a marker for attributes that don't exist. Can be used with PkAttrs.get.

Constructor Detail

PkAttr

  1. public PkAttr(String name)
Create a new mutable PkAttr. Tha kind is 0 and the value is null.
Parameters:
name - The attribute name.

PkAttr

  1. public PkAttr(String name,
  2. int kind,
  3. Object value)
Create a new mutable PkAttr.
Parameters:
name - The attribute name.
kind - The attribute kind.
value - The attribute value.

PkAttr

  1. public PkAttr(String name,
  2. int kind,
  3. Object value,
  4. boolean readOnly)
Create a new PkAttr.
Parameters:
name - The attribute name.
kind - The attribute kind.
value - The attribute value.
readOnly - If true, the new attribute is immutable, else it is mutable.

Method Detail

getKind

  1. public int getKind()
Returns the kind.

isApplied

  1. public boolean isApplied()
Is this attribute meant for the cert or CRL?

Only attributes meant for the cert or CRL are placed in certs or CRLs. That is, when the PkCertGen bean generates a certificate, it only places in the certificate those attributes that are marked as applied and approved.


isApproved

  1. public boolean isApproved()
Has this attribute been approved by the current process (EE, RA or CA)?

Only attributes that have been approved are placed in certs or CRLs, in addition, only attributes that have been approved are written by the formatting beans. This implies that only approved attributes are sent by client beans--For example by the TcpClient bean.


getName

  1. public String getName()
Returns the name of this attribute.

isNameOid

  1. public boolean isNameOid()
Returns true if and only if the name of this attribute is an OID.

getValue

  1. public Object getValue()
Returns the value of this attribute as an Object.

getString

  1. public String getString()
Returns the value of this attribute as a String.

setReadOnly

  1. public void setReadOnly()
Makes this attribute immutable.

setKind

  1. public void setKind(int kind)
Sets the kind of this attribute.
Parameters:
kind - Should be 0 or a binary OR of any subset of the constants defined in PkAttrKind.

setApplied

  1. public void setApplied(boolean b)
Turns on the PkAttrKind.ATTR_APPLIED bit for this attribute. Leaves all other bits unchanged.

setApproved

  1. public void setApproved(boolean b)
Turns on the PkAttrKind.ATTR_APPROVED bit for this attribute. Leaves all other bits unchanged.

setValue

  1. public void setValue(Object value)
Sets the value of this attribute.
Parameters:
value - The new attribute value.

toString

  1. public String toString()
Returns a string representation of this event.
Overrides:
toString in class Object

hashCode

  1. public int hashCode()
Returns a hashCode for the attribute that is consistent with the definition of equality as implemented in the equals method.
Overrides:
hashCode in class Object

equals

  1. public boolean equals(Object obj)
Returns true if and only if this attribute is equal to obj.

Two attributes are equal if their names are the same (case-sensitive) and their kinds have the same numeric value and their values are the same as determined by the equals method.

Overrides:
equals in class Object

compareTo

  1. public int compareTo(PkAttr other)
Compares against another attribute.

This method implements the Comparable interface.

Note: this class has a natural ordering that is inconsistent with equals.

Parameters:
other - the Object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
See Also:

compareTo

  1. public int compareTo(Object other)
Compares against another attribute.

This method implements the Comparable interface.

Note: this class has a natural ordering that is inconsistent with equals.

Specified by:
compareTo in interface Comparable
Parameters:
other - the Object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws:
ClassCastException - if the specified object's kind prevents it from being compared to this Object.