Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| IAIK PKCS#11 Wrapper version 1.2.16
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## iaik.pkcs.pkcs11.objects
Class GenericTemplate

    java.lang.Object
      iaik.pkcs.pkcs11.objects.Object
          iaik.pkcs.pkcs11.objects.GenericTemplate

All Implemented Interfaces:
  Cloneable

public class GenericTemplate
extends Object

An object of this class is a generic template. Its purpose is to serve as a container for a set of attributes that the application can use to search for objects. This can be especially useful, if an application wants to search for objects in a very restricted manner. For instance, if an application wants to find all objects which contain an ID attribute with an given value, it can use this class. If it would use the Key class, it would only find Key objects. Moreover, objects of this class may serve as templates for object creation and key and key-pair generation.

Invariants
  (attributes_ <> null)

Nested Class Summary

Nested classes inherited from class iaik.pkcs.pkcs11.objects.Object
`Object.ObjectClass, Object.VendorDefinedObjectBuilder`

Field Summary

Fields inherited from class iaik.pkcs.pkcs11.objects.Object
`attributeTable_, objectClass_, objectClassNames_, objectHandle_, vendorObjectBuilder_`

Constructor Summary
`GenericTemplate()` The default constructor.

Method Summary
`void` | `addAllAttributes(Object object)` Adds all attributes of the given object to this generic template.
`void` | `addAllPresentAttributes(Object object)` Adds all attributes of the given object which have their present flag set to this generic template.
`void` | `addAttribute(Attribute attribute)` Adds an attribute to this generic search template.
`Object` | `clone()` Create a (deep) clone of this object.
`boolean` | `containsAttribute(Attribute attribute)` Checks, if the given attributte is in this template.
`boolean` | `equals(Object otherObject)` Compares all member variables of this object with the other object.
`int` | `hashCode()` The overriding of this method should ensure that the objects of this class work correctly in a hashtable.
`void` | `readAttributes(Session session)` Read the values of the attributes of this object from the token.
`void` | `removeAllAttributes(Object object)` Removes all attributes of the given object from this generic template.
`void` | `removeAllPresentAttributes(Object object)` Removes all attributes of the given object which have their present flag set from this generic template.
`Attribute` | `removeAttribute(Attribute attribute)` Removes the given attribute from the template.
`protected void` | `setAllPresentFlags(boolean present)` Set the present flags of all attributes of this object to the given value.
`String` | `toString()` This method returns a string representation of the current object.

Methods inherited from class iaik.pkcs.pkcs11.objects.Object
`allocateAttributes, getAttributeTable, getAttributeValue, getInstance, getObjectClass, getObjectClassName, getObjectHandle, getSetAttributes, getSetAttributes, getUnknownObject, getVendorDefinedObjectBuilder, putAttributesInTable, setObjectHandle, setVendorDefinedObjectBuilder`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### GenericTemplate

    public GenericTemplate()

  The default constructor. Creates an object with no attributes.

Preconditions
Postconditions

Method Detail

### addAttribute

    public void addAttribute(Attribute attribute)

  Adds an attribute to this generic search template.

  Parameters:
    `attribute` - The attribute to add to the template.
  Preconditions
    (attribute <> null)
  Postconditions

### addAllAttributes

    public void addAllAttributes(Object object)

  Adds all attributes of the given object to this generic template. Notice that this method does not automatically clone the attributes. If the application needs this, it must clone the argument object before.

  Parameters:
    `object` - The object that holds the attributes to add to the template.
  Preconditions
    (object <> null)
  Postconditions

### addAllPresentAttributes

    public void addAllPresentAttributes(Object object)

  Adds all attributes of the given object which have their present flag set to this generic template. Notice that this method does not automatically clone the attributes. If the application needs this, it must clone the argument object before.

  Parameters:
    `object` - The object that holds the attributes to add to the template.
  Preconditions
    (object <> null)
  Postconditions

### clone

    public Object clone()

  Create a (deep) clone of this object.

  Overrides:
    `clone` in class `Object`
  Returns:
    A clone of this object.
  Preconditions
  Postconditions
    (result <> null) and (result instanceof GenericTemplate) and (result.equals(this))

### containsAttribute

    public boolean containsAttribute(Attribute attribute)

  Checks, if the given attributte is in this template. More precisely, it returns true, if there is any attribute in this template for which attribute.equals(otherAttribute) returns true.

  Parameters:
    `attribute` - The attribute to look for.
  Returns:
    True, if the attribute is in the template. False, otherwise.
  Preconditions
    (attribute <> null)
  Postconditions

### equals

    public boolean equals(Object otherObject)

  Compares all member variables of this object with the other object. Returns only true, if all are equal in both objects.

  Overrides:
    `equals` in class `Object`
  Parameters:
    `otherObject` - The other object to compare to.
  Returns:
    True, if other is an instance of this class and all member variables of both objects are equal. False, otherwise.
  Preconditions
  Postconditions

### hashCode

    public int hashCode()

  The overriding of this method should ensure that the objects of this class work correctly in a hashtable.

  Overrides:
    `hashCode` in class `Object`
  Returns:
    The hash code of this object.
  Preconditions
  Postconditions

### readAttributes

    public void readAttributes(Session session)
                        throws TokenException

  Read the values of the attributes of this object from the token.

  Overrides:
    `readAttributes` in class `Object`
  Parameters:
    `session` - The session handle to use for reading attributes. This session must have the appropriate rights; i.e. it must be a user-session, if it is a private object.
  Throws:
    `TokenException` - If getting the attributes failed.
  Preconditions
    (session <> null)
  Postconditions

### removeAttribute

    public Attribute removeAttribute(Attribute attribute)

  Removes the given attribute from the template. More precisely, it removes the attribute from the template which has the same type as the given attribute. Notice that type in this context does not refer the the type of data in the attribute's value. For instance, Attribute.SIGN is a type of an attribute.

  Parameters:
    `attribute` - The attribute to remove.
  Returns:
    The removed attribute, if the attribute was in the template. Null, otherwise.
  Preconditions
    (attribute <> null)
  Postconditions

### removeAllAttributes

    public void removeAllAttributes(Object object)

  Removes all attributes of the given object from this generic template. More precisely, it removes the attributes from the template which have the same type as an attribute of the given object. Notice that type in this context does not refer the the type of data in the attribute's value. For instance, Attribute.SIGN is a type of an attribute.

  Parameters:
    `object` - The object that holds the attributes to add to the template.
  Preconditions
    (object <> null)
  Postconditions

### removeAllPresentAttributes

    public void removeAllPresentAttributes(Object object)

  Removes all attributes of the given object which have their present flag set from this generic template. More precisely, it removes the attributes from the template which have the same type as an attribute of the given object. Notice that type in this context does not refer the the type of data in the attribute's value. For instance, Attribute.SIGN is a type of an attribute.

  Parameters:
    `object` - The object that holds the attributes to add to the template.
  Preconditions
    (object <> null)
  Postconditions

### setAllPresentFlags

    protected void setAllPresentFlags(boolean present)

  Set the present flags of all attributes of this object to the given value.

  Parameters:
    `present` - The new value for the present flags of all attributes.
  Preconditions
  Postconditions

### toString

    public String toString()

  This method returns a string representation of the current object. The output is only for debugging purposes and should not be used for other purposes.

  Overrides:
    `toString` in class `Object`
  Returns:
    A string presentation of this object for debugging output.
  Preconditions
  Postconditions
    (result <> null)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| IAIK PKCS#11 Wrapper version 1.2.16
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

IAIK JavaSecurity Website http://jce.iaik.tugraz.at/
IAIK at Graz University of Technology, Austria, Europe
Copyright 2001-2002, IAIK, Graz University of Technology, Inffeldgasse 16a, 8010 Graz, Austria. All Rights Reserved.