Package xades4j.production
Class SignedDataObjects
java.lang.Object
xades4j.production.SignedDataObjects
Represents a set of data objects to be signed. Besides the data objects themselves,
this class can be used to specify:
- Properties that apply to ALL the signed data objects
- A base URI for the data object references
ResourceResolver
s to be used when processing the current set of data objects, in addition to the globally registered resolvers
- Author:
- Luís
- See Also:
-
Constructor Summary
ConstructorDescriptionCreates an empty container.SignedDataObjects
(Iterable<DataObjectDesc> dataObjs) Creates a container with the given data objects.SignedDataObjects
(DataObjectDesc... dataObjs) Creates a container with the given data objects. -
Method Summary
Modifier and TypeMethodDescriptionwithBaseUri
(String baseUri) Sets the base URI for all the relative references.withCommitmentType
(AllDataObjsCommitmentTypeProperty commitment) Adds a CommitmentType signed property shared among all data objects.Adds a AllDataObjectsTimeStamp signed property applied to all data objects.withOtherDataObjectProperty
(OtherSignedDataObjectProperty otherSignedDataObjProp) Adds a custom global signed data object property.withOtherDataObjectProperty
(OtherUnsignedDataObjectProperty otherUnsignedDataObjProp) Adds a custom global unsigned data object property.withResourceResolver
(org.apache.xml.security.utils.resolver.ResourceResolverSpi resolver) Registers aResourceResolverSpi
to be used when signing the current set of data objects.withSignedDataObject
(DataObjectDesc object) Adds a data object to be signed.withSignedDataObjects
(Iterable<DataObjectDesc> objsInfo) Adds a set of data objects to be signed.
-
Constructor Details
-
SignedDataObjects
public SignedDataObjects()Creates an empty container. -
SignedDataObjects
Creates a container with the given data objects.- Parameters:
dataObjs
- the signed data objects- Throws:
NullPointerException
- ifdataObjs
or any of the objects is null
-
SignedDataObjects
Creates a container with the given data objects.- Parameters:
dataObjs
- the signed data objects- Throws:
NullPointerException
- ifdataObjs
or any of the objects is null
-
-
Method Details
-
withBaseUri
Sets the base URI for all the relative references. Fragment references (starting with '#') are not affected.- Parameters:
baseUri
- the references' base URI- Returns:
- the current instance
-
withCommitmentType
Adds a CommitmentType signed property shared among all data objects. The resulting property in the XAdES signature will contain theAllSignedDataObjects
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 presentNullPointerException
- if the given property isnull
-
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 throughXadesSigningProfile
.- Parameters:
otherSignedDataObjProp
- the custom property- Returns:
- the current instance
- Throws:
NullPointerException
- ifotherSignedDataObjProp
isnull
PropertyTargetException
- if the property is already presentIllegalArgumentException
- 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 throughXadesSigningProfile
.- Parameters:
otherUnsignedDataObjProp
- the custom property- Returns:
- the current instance
- Throws:
NullPointerException
- ifotherUnsignedDataObjProp
isnull
PropertyTargetException
- if the property is already presentIllegalArgumentException
- if the property if not properly annotated
-
withSignedDataObjects
Adds a set of data objects to be signed. Each data object description will result in ads:Reference
element in the final XAdES signature.- Parameters:
objsInfo
- the data objects- Returns:
- the current instance
- Throws:
NullPointerException
- ifobjsInfo
or any of the objects isnull
IllegalStateException
- if any of the data object descriptions is already present
-
withSignedDataObject
Adds a data object to be signed. Each data object description will result in ads:Reference
element in the final XAdES signature.- Parameters:
object
- the data object- Returns:
- the current instance
- Throws:
NullPointerException
- ifobject
isnull
IllegalStateException
- if the data object description is already present
-
withResourceResolver
public SignedDataObjects withResourceResolver(org.apache.xml.security.utils.resolver.ResourceResolverSpi resolver) Registers aResourceResolverSpi
to be used when signing the current set of data objects. The resolvers are considered in the same order they are added and have priority over the globally registered resolvers.- Parameters:
resolver
- the resolver- Returns:
- the current instance
- Throws:
NullPointerException
- ifresolver
isnull
-