Class SoDefaultSigner
- java.lang.Object
-
- com.stepover.opensignatureapi.signer.SoDefaultSigner
-
-
Field Summary
Fields Modifier and Type Field Description protected SoDeviceConfigurationconfigurationThe configuration.protected SignatureContextcontextThe context.protected MetaInfoField[]defaultMetaThe default meta.protected SignatureListenerlistenerThe listener.protected java.util.logging.LoggerlogThe loggerprotected ColorsignatureColorThe signature colorprotected java.util.ArrayList<Signature>signatureListThe signature list.protected SoSigningDevicesigningDeviceThe signing device.protected AbstractSignTasksignTaskThe sign task.protected java.lang.ThreadthreadThe 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.voidaddSignature(Signature signature)Adds the signature.voidclose()This method should be called to finish the work with this signer instance.Signature[]getSignatures(javax.imageio.stream.ImageInputStream documentStream)Returns an array ofSignaturefound in the document given by the parameterized document stream.SigningDevicegetSigningDevice()Returns aSigningDeviceinformation provided by thisSigner.SignatureResult.StategetSignTaskState()Gets the sign task state.java.lang.ThreadgetThread()booleanisMetaInfoFieldSupported(java.lang.Class<? extends MetaInfoField> fieldType)Returns a indicator whether this signer supports givenMetaInfoFieldclass type.booleanisSigningSupportedFor(javax.imageio.stream.ImageInputStream documentStream)Returns a indicator whether this signer supports signing service for the given document stream.protected voidregisterMetaHandlers()Register meta handlers.voidstartSigning(SignatureContext context, SignatureListener listener)This method will be called to initiate a signature retrieval.voidstopSigning()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:SignerThis method should be called to finish the work with this signer instance. Within the close method theSignerinstance 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
Signerinstance after a call to this method is not a warranted characteristic.
-
getSignatures
public Signature[] getSignatures(javax.imageio.stream.ImageInputStream documentStream)
Description copied from interface:SignerReturns an array ofSignaturefound in the document given by the parameterized document stream.- Specified by:
getSignaturesin interfaceSigner- Parameters:
documentStream- The document, provided as input stream, to be analyzed for embedded signatures. The document stream have to be notnulland readable.- Returns:
- an array of found
Signatures. If the document contains noSignatures, the returned array is of length 0. Its recommend that the returned array is notnull.
-
getSigningDevice
public SigningDevice getSigningDevice()
Description copied from interface:SignerReturns aSigningDeviceinformation provided by thisSigner. TheSigningDeviceallows to retrieve informations about the device the signer use to retrieve signatures.- Specified by:
getSigningDevicein interfaceSigner- Returns:
- a
SigningDeviceinstance to provide informations about the device used to retrieve the signatures.
-
startSigning
public void startSigning(SignatureContext context, SignatureListener listener)
Description copied from interface:SignerThis method will be called to initiate a signature retrieval.The given
SignatureContextparameter accompanies the signature request, providing necessary informations for the signing process, like the document to sign on, signature properties and so on. Therefore theSignatureContexthave to be present, notnulland should provide the necessary informations for a signature retrieval.The
SignatureListeneris a callback mechanism to notify the calling application about signing progress and its result. For detailed informations see the javadoc of theSignatureListenerinterface.NOTE:
Implementations of this method will be blocking until the signing processes has been finished.- Specified by:
startSigningin interfaceSigner- Parameters:
context- theSignatureContextproviding necessary informations for the signing processlistener- aSignatureListenerto 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:SignerReturns a indicator whether this signer supports givenMetaInfoFieldclass 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:
isMetaInfoFieldSupportedin interfaceSigner- Parameters:
fieldType- theMetaInfoFieldclass type the support is asked for- Returns:
trueif thisMetaInfoFieldclass type is supported, otherwisefalsewill be returned.
-
isSigningSupportedFor
public boolean isSigningSupportedFor(javax.imageio.stream.ImageInputStream documentStream)
Description copied from interface:SignerReturns 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:
isSigningSupportedForin interfaceSigner- Parameters:
documentStream- the document the signing support is asked for- Returns:
trueif this signer supports signing service for this document type otherwisefalsewill 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()
-
-