Class SoDefaultSigner
- java.lang.Object
-
- com.stepover.opensignatureapi.signer.SoDefaultSigner
-
-
Field Summary
Fields Modifier and Type Field Description protected SoDeviceConfiguration
configuration
The configuration.protected SignatureContext
context
The context.protected MetaInfoField[]
defaultMeta
The default meta.protected SignatureListener
listener
The listener.protected java.util.logging.Logger
log
The loggerprotected Color
signatureColor
The signature colorprotected java.util.ArrayList<Signature>
signatureList
The signature list.protected SoSigningDevice
signingDevice
The signing device.protected AbstractSignTask
signTask
The sign task.protected java.lang.Thread
thread
The sign task thread
-
Constructor Summary
Constructors Constructor Description SoDefaultSigner(SoSigningDevice signingDevice)
Instantiates a new so default signer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected MetaInfoField[]
addDefaultMeta(MetaInfoField[] metaFields)
Adds the default meta.void
addSignature(Signature signature)
Adds the signature.void
close()
This method should be called to finish the work with this signer instance.Signature[]
getSignatures(javax.imageio.stream.ImageInputStream documentStream)
Returns an array ofSignature
found in the document given by the parameterized document stream.SigningDevice
getSigningDevice()
Returns aSigningDevice
information provided by thisSigner
.SignatureResult.State
getSignTaskState()
Gets the sign task state.java.lang.Thread
getThread()
boolean
isMetaInfoFieldSupported(java.lang.Class<? extends MetaInfoField> fieldType)
Returns a indicator whether this signer supports givenMetaInfoField
class type.boolean
isSigningSupportedFor(javax.imageio.stream.ImageInputStream documentStream)
Returns a indicator whether this signer supports signing service for the given document stream.protected void
registerMetaHandlers()
Register meta handlers.void
startSigning(SignatureContext context, SignatureListener listener)
This method will be called to initiate a signature retrieval.void
stopSigning()
Stop signing.
-
-
-
Field Detail
-
signingDevice
protected SoSigningDevice signingDevice
The signing device.
-
signatureColor
protected Color signatureColor
The signature color
-
log
protected java.util.logging.Logger log
The logger
-
context
protected SignatureContext context
The context.
-
listener
protected SignatureListener listener
The listener.
-
defaultMeta
protected MetaInfoField[] defaultMeta
The default meta.
-
signTask
protected AbstractSignTask signTask
The sign task.
-
signatureList
protected java.util.ArrayList<Signature> signatureList
The signature list.
-
configuration
protected SoDeviceConfiguration configuration
The configuration.
-
thread
protected java.lang.Thread thread
The sign task thread
-
-
Constructor Detail
-
SoDefaultSigner
public SoDefaultSigner(SoSigningDevice signingDevice)
Instantiates a new so default signer.- Parameters:
signingDevice
- the signing device
-
-
Method Detail
-
close
public void close()
Description copied from interface:Signer
This method should be called to finish the work with this signer instance. Within the close method theSigner
instance frees and releases all its resources.After a call of this method, it is recommended to continue signing processes with a new signer instance retrieved by a call of
SignatureServiceProvider.createSigner()
.The reusability of the
Signer
instance after a call to this method is not a warranted characteristic.
-
getSignatures
public Signature[] getSignatures(javax.imageio.stream.ImageInputStream documentStream)
Description copied from interface:Signer
Returns an array ofSignature
found in the document given by the parameterized document stream.- Specified by:
getSignatures
in interfaceSigner
- Parameters:
documentStream
- The document, provided as input stream, to be analyzed for embedded signatures. The document stream have to be notnull
and readable.- Returns:
- an array of found
Signature
s. If the document contains noSignature
s, the returned array is of length 0. Its recommend that the returned array is notnull
.
-
getSigningDevice
public SigningDevice getSigningDevice()
Description copied from interface:Signer
Returns aSigningDevice
information provided by thisSigner
. TheSigningDevice
allows to retrieve informations about the device the signer use to retrieve signatures.- Specified by:
getSigningDevice
in interfaceSigner
- Returns:
- a
SigningDevice
instance to provide informations about the device used to retrieve the signatures.
-
startSigning
public void startSigning(SignatureContext context, SignatureListener listener)
Description copied from interface:Signer
This method will be called to initiate a signature retrieval.The given
SignatureContext
parameter accompanies the signature request, providing necessary informations for the signing process, like the document to sign on, signature properties and so on. Therefore theSignatureContext
have to be present, notnull
and should provide the necessary informations for a signature retrieval.The
SignatureListener
is a callback mechanism to notify the calling application about signing progress and its result. For detailed informations see the javadoc of theSignatureListener
interface.NOTE:
Implementations of this method will be blocking until the signing processes has been finished.- Specified by:
startSigning
in interfaceSigner
- Parameters:
context
- theSignatureContext
providing necessary informations for the signing processlistener
- aSignatureListener
to be notified about the signing process and to get informations about the signing result.
-
isMetaInfoFieldSupported
public boolean isMetaInfoFieldSupported(java.lang.Class<? extends MetaInfoField> fieldType)
Description copied from interface:Signer
Returns a indicator whether this signer supports givenMetaInfoField
class type.NOTE:
Implementations of this method will assure the following conditions:- the execution of this method will be as fast as possible.
- the returning value does not change if this method will be called twice or more times
- Specified by:
isMetaInfoFieldSupported
in interfaceSigner
- Parameters:
fieldType
- theMetaInfoField
class type the support is asked for- Returns:
true
if thisMetaInfoField
class type is supported, otherwisefalse
will be returned.
-
isSigningSupportedFor
public boolean isSigningSupportedFor(javax.imageio.stream.ImageInputStream documentStream)
Description copied from interface:Signer
Returns a indicator whether this signer supports signing service for the given document stream.NOTE:
Implementations of this method will assure the following conditions:- the execution of this method will be as fast as possible.
- will not close the document stream.
- the returning value does not change if this method will be called twice or more times on the same document stream or content.
- Specified by:
isSigningSupportedFor
in interfaceSigner
- Parameters:
documentStream
- the document the signing support is asked for- Returns:
true
if this signer supports signing service for this document type otherwisefalse
will be returned.
-
registerMetaHandlers
protected void registerMetaHandlers()
Register meta handlers.
-
addDefaultMeta
protected MetaInfoField[] addDefaultMeta(MetaInfoField[] metaFields)
Adds the default meta.
-
addSignature
public void addSignature(Signature signature)
Adds the signature.- Parameters:
signature
- the signature
-
stopSigning
public void stopSigning()
Stop signing.
-
getSignTaskState
public SignatureResult.State getSignTaskState()
Gets the sign task state.- Returns:
- the sign task state
-
getThread
public java.lang.Thread getThread()
-
-