Class SoDefaultSigner

  • All Implemented Interfaces:
    Signer

    public class SoDefaultSigner
    extends java.lang.Object
    implements Signer
    the defualt signer
    • 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
      • defaultMeta

        protected MetaInfoField[] defaultMeta
        The default meta.
      • signatureList

        protected java.util.ArrayList<Signature> signatureList
        The signature list.
      • 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 the Signer 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.

        Specified by:
        close in interface Signer
      • getSignatures

        public Signature[] getSignatures​(javax.imageio.stream.ImageInputStream documentStream)
        Description copied from interface: Signer
        Returns an array of Signature found in the document given by the parameterized document stream.
        Specified by:
        getSignatures in interface Signer
        Parameters:
        documentStream - The document, provided as input stream, to be analyzed for embedded signatures. The document stream have to be not null and readable.
        Returns:
        an array of found Signatures. If the document contains no Signatures, the returned array is of length 0. Its recommend that the returned array is not null.
      • getSigningDevice

        public SigningDevice getSigningDevice()
        Description copied from interface: Signer
        Returns a SigningDevice information provided by this Signer. The SigningDevice allows to retrieve informations about the device the signer use to retrieve signatures.
        Specified by:
        getSigningDevice in interface Signer
        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 the SignatureContext have to be present, not null 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 the SignatureListener interface.

        NOTE:
        Implementations of this method will be blocking until the signing processes has been finished.

        Specified by:
        startSigning in interface Signer
        Parameters:
        context - the SignatureContext providing necessary informations for the signing process
        listener - a SignatureListener 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 given MetaInfoField 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 interface Signer
        Parameters:
        fieldType - the MetaInfoField class type the support is asked for
        Returns:
        true if this MetaInfoField class type is supported, otherwise false 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 interface Signer
        Parameters:
        documentStream - the document the signing support is asked for
        Returns:
        true if this signer supports signing service for this document type otherwise false will be returned.
      • registerMetaHandlers

        protected void registerMetaHandlers()
        Register meta handlers.
      • 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()