Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| IAIK PKCS#11 Wrapper version 1.2.18
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | 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:
  java.lang.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.

Version:
  1.0
Author:
  Karl Scheibelhofer

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

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.
`java.lang.Object` | `clone()` Create a (deep) clone of this object.
`boolean` | `containsAttribute(Attribute attribute)` Checks, if the given attributte is in this template.
`boolean` | `equals(java.lang.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.
`java.lang.String` | `toString()` This method returns a string representation of the current object.
`java.lang.String` | `toString(boolean newline, boolean withName, java.lang.String indent)` This method returns a string representation of the current object.

Methods inherited from class iaik.pkcs.pkcs11.objects.Object
`allocateAttributes, getAttributeTable, getAttributeValue, getAttributeValues, 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.

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.

### 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.

### 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.

### clone

    public java.lang.Object clone()

  Create a (deep) clone of this object.
  Overrides:
    `clone` in class `Object`
  Returns:
    A clone of this object.

### 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.

### equals

    public boolean equals(java.lang.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.

### 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.

### 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.

### 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.

### 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.

### 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.

### 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.

### toString

    public java.lang.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.

### toString

    public java.lang.String toString(boolean newline,
                                     boolean withName,
                                     java.lang.String indent)

  This method returns a string representation of the current object. Some parameters can be set to manipulate the output. The output is only for debugging purposes and should not be used for other purposes.
  Parameters:
    `newline` - true if the output should start in a new line
    `withName` - true if the type of the attribute should be returned too
    `indent` - the indent to be used
  Returns:
    A string presentation of this object for debugging output.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| IAIK PKCS#11 Wrapper version 1.2.18
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | 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-2004, IAIK, Graz University of Technology, Inffeldgasse 16a, 8010 Graz, Austria. All Rights Reserved. version 1.2.18