xades4j.production
Class SignedDataObjects

java.lang.Object
  extended by xades4j.production.SignedDataObjects

public final class SignedDataObjects
extends Object

A set of objects to be signed. Properties that apply to ALL the signed data objects can be specified via this class. This class checks for duplicate data object descriptions (not allowed).

Author:
Luís
See Also:
DataObjectDesc, DataObjectReference, EnvelopedXmlObject

Constructor Summary
SignedDataObjects()
          Creates an empty container.
SignedDataObjects(DataObjectDesc... dataObjs)
          Creates a container with the given data objects.
SignedDataObjects(Iterable<DataObjectDesc> dataObjs)
          Creates a container with the given data objects.
 
Method Summary
 SignedDataObjects withBaseUri(String baseUri)
          Sets the base URI for all/b> the relative references.
 SignedDataObjects withCommitmentType(AllDataObjsCommitmentTypeProperty commitment)
          Adds a CommitmentType signed property shared among all data objects.
 SignedDataObjects withDataObjectsTimeStamp()
          Adds a AllDataObjectsTimeStamp signed property applied to all data objects.
 SignedDataObjects withOtherDataObjectProperty(OtherSignedDataObjectProperty otherSignedDataObjProp)
          Adds a custom global signed data object property.
 SignedDataObjects withOtherDataObjectProperty(OtherUnsignedDataObjectProperty otherUnsignedDataObjProp)
          Adds a custom global unsigned data object property.
 SignedDataObjects withSignedDataObject(DataObjectDesc object)
          Adds a data object to be signed.
 SignedDataObjects withSignedDataObjects(Iterable<DataObjectDesc> objsInfo)
          Adds a set of data objects to be signed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SignedDataObjects

public SignedDataObjects()
Creates an empty container.


SignedDataObjects

public SignedDataObjects(Iterable<DataObjectDesc> dataObjs)
Creates a container with the given data objects.

Parameters:
dataObjs - the signed data objects
Throws:
NullPointerException - if dataObjs or any of the objects is null

SignedDataObjects

public SignedDataObjects(DataObjectDesc... dataObjs)
Creates a container with the given data objects.

Parameters:
dataObjs - the signed data objects
Throws:
NullPointerException - if dataObjs or any of the objects is null
Method Detail

withBaseUri

public SignedDataObjects withBaseUri(String baseUri)
Sets the base URI for all/b> the relative references. Fragment references (starting with '#') are not afected.

Parameters:
baseUri - the references' base uri
Returns:
the current instance

withCommitmentType

public SignedDataObjects withCommitmentType(AllDataObjsCommitmentTypeProperty commitment)
Adds a CommitmentType signed property shared among all data objects. The resulting property in the XAdES signature will contain the AllSignedDataObjects element. This method can be invoked multiple times with different properties since the signer may express multiple commitments towards the data objects.

Parameters:
commitment - the CommitmentType property
Returns:
the current instance
Throws:
PropertyTargetException - if the given property (instance) is already present
NullPointerException - if the given property is null

withDataObjectsTimeStamp

public SignedDataObjects withDataObjectsTimeStamp()
Adds a AllDataObjectsTimeStamp signed property applied to all data objects. This method can be invoked multiple times since multiple times-stamps can be present.

Returns:
the current instance

withOtherDataObjectProperty

public SignedDataObjects withOtherDataObjectProperty(OtherSignedDataObjectProperty otherSignedDataObjProp)
Adds a custom global signed data object property. The purpose of this method is extensibility.

Each custom property needs a corresponding PropertyDataObjectGenerator which can be supplied through XadesSigningProfile.

Parameters:
otherSignedDataObjProp - the custom property
Returns:
the current instance
Throws:
NullPointerException - if otherSignedDataObjProp is null
PropertyTargetException - if the property is already present
IllegalArgumentException - if the property if not properly annotated

withOtherDataObjectProperty

public SignedDataObjects withOtherDataObjectProperty(OtherUnsignedDataObjectProperty otherUnsignedDataObjProp)
Adds a custom global unsigned data object property. The purpose of this method is extensibility.

Each custom property needs a corresponding PropertyDataObjectGenerator which can be supplied through XadesSigningProfile.

Parameters:
otherUnsignedDataObjProp - the custom property
Returns:
the current instance
Throws:
NullPointerException - if otherUnsignedDataObjProp is null
PropertyTargetException - if the property is already present
IllegalArgumentException - if the property if not properly annotated

withSignedDataObjects

public SignedDataObjects withSignedDataObjects(Iterable<DataObjectDesc> objsInfo)
Adds a set of data objects to be signed. Each data object description will result in a ds:Reference element in the final XAdES signature.

Parameters:
objsInfo - the data objects
Returns:
the current instance
Throws:
NullPointerException - if objsInfo or any of the objects is null
IllegalStateException - if any of the data object descriptions is already present

withSignedDataObject

public SignedDataObjects withSignedDataObject(DataObjectDesc object)
Adds a data object to be signed. Each data object description will result in a ds:Reference element in the final XAdES signature.

Parameters:
object - the data object
Returns:
the current instance
Throws:
NullPointerException - if object is null
IllegalStateException - if the data object description is already present


Copyright © 2012. All Rights Reserved.