at.gv.egiz.pdfas.impl.vfilter
Class VerificationFilterImpl

java.lang.Object
  extended byat.gv.egiz.pdfas.impl.vfilter.VerificationFilterImpl
All Implemented Interfaces:
VerificationFilter

public class VerificationFilterImpl
extends Object
implements VerificationFilter

Author:
wprinz

Nested Class Summary
protected static class VerificationFilterImpl.SignaturesAndOld
           
 
Field Summary
static String ASSUME_ONLY_SIGNATURE_BLOCKS
           
static String BINARY_ONLY
           
static String CHECK_DOCUMENT
           
 
Constructor Summary
VerificationFilterImpl()
           
 
Method Summary
protected  void checkBinaryOnly(PdfDataSource pdf, boolean considerOldSigs)
           
protected  void debugIUBlocks(List blocks)
           
protected  void debugPartitions(List partitions)
           
protected  String determineRestText(List newSignatures, String extractedText)
           
protected  List extractBinarySignaturesOnly(PdfDataSource pdf, List blocks)
          Extracts the binary singatures from the given PDF.
protected  List extractNewAndOldSignaturesFromText(String text)
           
protected  List extractNewSignaturesFromText(String text)
           
protected  SignatureHolder extractOldSignature(String extractedText, List newSignatures)
          Extracts the old signature from the text, but only if it is older than the oldest signature of the new signatueres.
protected  List extractOldSignaturesFromText(String text)
           
 List extractSignatureHolders(PdfDataSource pdf, List blocks, VerificationFilterParameters parameters)
          Extracts the signatures from the given PDF.
protected  List extractSignatures(PdfDataSource pdf, int endOfDocument)
           
protected  VerificationFilterImpl.SignaturesAndOld extractSignaturesAndOld(String text)
           
protected  List extractSignaturesFromPartition(PdfDataSource pdf, Partition partition)
           
protected  VerificationFilterImpl.SignaturesAndOld extractSignaturesFromPartitionAndOld(PdfDataSource pdf, Partition partition)
           
 List extractSignaturHolders(TextDataSource text, VerificationFilterParameters parameters)
          Extracts the text signatures from the given free-text.
protected  String extractText(PdfDataSource pdf, int endOfDocument)
           
protected  String extractText(PdfDataSource pdf, int endOfDocument, String encoding)
           
protected  List filterOutBinarySignatures(List signatures)
           
protected  List flattenOutTextPartitions(List partitions, List blocks)
           
protected  List intermingleSignatures(List binarySignatures, List extractedSignatures)
           
protected  String normalizeText(String freetext)
           
protected  List performBinaryOnly(PdfDataSource pdf, List blocks)
           
protected  List performFullConservative(PdfDataSource pdf, boolean scanForOldSignatures, List blocks, List partitions)
           
protected  List performSemiConservative(PdfDataSource pdf, boolean scanForOldSignatures, List blocks, List partitions)
           
protected  void sortSignatures(List signatures)
           
protected  void unrollLinearization(List blocks)
          Removes the linearization footer from the list of update blocks.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHECK_DOCUMENT

public static final String CHECK_DOCUMENT
See Also:
Constant Field Values

BINARY_ONLY

public static final String BINARY_ONLY
See Also:
Constant Field Values

ASSUME_ONLY_SIGNATURE_BLOCKS

public static final String ASSUME_ONLY_SIGNATURE_BLOCKS
See Also:
Constant Field Values
Constructor Detail

VerificationFilterImpl

public VerificationFilterImpl()
Method Detail

extractSignatureHolders

public List extractSignatureHolders(PdfDataSource pdf,
                                    List blocks,
                                    VerificationFilterParameters parameters)
                             throws VerificationFilterException
Description copied from interface: VerificationFilter
Extracts the signatures from the given PDF.

Specified by:
extractSignatureHolders in interface VerificationFilter
Parameters:
pdf - The PDF.
blocks - The List of Incremental Update blocks. Usually this comes from a preprocessing step.
parameters - The algorithm parameters.
Returns:
Returns a List of SignatureHolders containing the signatures. May be empty in case no signatures have been found.
Throws:
VerificationFilterException - Thrown if something goes wrong.
See Also:
VerificationFilter.extractSignatureHolders(at.gv.egiz.pdfas.framework.input.PdfDataSource, java.util.List, at.gv.egiz.pdfas.framework.vfilter.VerificationFilterParameters)

extractSignaturHolders

public List extractSignaturHolders(TextDataSource text,
                                   VerificationFilterParameters parameters)
                            throws VerificationFilterException
Description copied from interface: VerificationFilter
Extracts the text signatures from the given free-text.

Specified by:
extractSignaturHolders in interface VerificationFilter
Parameters:
text - The free-text.
parameters - The algorithm parameters.
Returns:
Returns a List of SignatureHolders containing the signatures. May be empty in case no signatures have been found.
Throws:
VerificationFilterException - Thrown if something goes wrong.
See Also:
VerificationFilter.extractSignaturHolders(at.gv.egiz.pdfas.framework.input.TextDataSource, at.gv.egiz.pdfas.framework.vfilter.VerificationFilterParameters)

normalizeText

protected String normalizeText(String freetext)
                        throws VerificationFilterException
Throws:
VerificationFilterException

unrollLinearization

protected void unrollLinearization(List blocks)
Removes the linearization footer from the list of update blocks.

Parameters:
blocks - The list of FooterParseResult objects in \prev order.

performBinaryOnly

protected List performBinaryOnly(PdfDataSource pdf,
                                 List blocks)
                          throws VerificationFilterException
Throws:
VerificationFilterException

performSemiConservative

protected List performSemiConservative(PdfDataSource pdf,
                                       boolean scanForOldSignatures,
                                       List blocks,
                                       List partitions)
                                throws VerificationFilterException
Throws:
VerificationFilterException

performFullConservative

protected List performFullConservative(PdfDataSource pdf,
                                       boolean scanForOldSignatures,
                                       List blocks,
                                       List partitions)
                                throws VerificationFilterException
Throws:
VerificationFilterException

flattenOutTextPartitions

protected List flattenOutTextPartitions(List partitions,
                                        List blocks)

extractText

protected String extractText(PdfDataSource pdf,
                             int endOfDocument)
                      throws PresentableException
Throws:
PresentableException

extractText

protected String extractText(PdfDataSource pdf,
                             int endOfDocument,
                             String encoding)
                      throws PresentableException
Throws:
PresentableException

extractNewSignaturesFromText

protected List extractNewSignaturesFromText(String text)
                                     throws VerificationFilterException
Throws:
VerificationFilterException

extractNewAndOldSignaturesFromText

protected List extractNewAndOldSignaturesFromText(String text)
                                           throws VerificationFilterException
Throws:
VerificationFilterException

extractOldSignaturesFromText

protected List extractOldSignaturesFromText(String text)
                                     throws PresentableException
Throws:
PresentableException

intermingleSignatures

protected List intermingleSignatures(List binarySignatures,
                                     List extractedSignatures)

filterOutBinarySignatures

protected List filterOutBinarySignatures(List signatures)

sortSignatures

protected void sortSignatures(List signatures)

debugIUBlocks

protected void debugIUBlocks(List blocks)

debugPartitions

protected void debugPartitions(List partitions)

extractBinarySignaturesOnly

protected List extractBinarySignaturesOnly(PdfDataSource pdf,
                                           List blocks)
                                    throws VerificationFilterException
Extracts the binary singatures from the given PDF.

IU blocks without an egiz dict are not considered.

Parameters:
pdf -
blocks -
Returns:
Returns the List of signature holders.
Throws:
PresentableException
VerificationFilterException

extractSignatures

protected List extractSignatures(PdfDataSource pdf,
                                 int endOfDocument)
                          throws VerificationFilterException
Throws:
VerificationFilterException

determineRestText

protected String determineRestText(List newSignatures,
                                   String extractedText)

extractSignaturesFromPartition

protected List extractSignaturesFromPartition(PdfDataSource pdf,
                                              Partition partition)
                                       throws VerificationFilterException
Throws:
VerificationFilterException

extractSignaturesFromPartitionAndOld

protected VerificationFilterImpl.SignaturesAndOld extractSignaturesFromPartitionAndOld(PdfDataSource pdf,
                                                                                       Partition partition)
                                                                                throws VerificationFilterException
Throws:
VerificationFilterException

checkBinaryOnly

protected void checkBinaryOnly(PdfDataSource pdf,
                               boolean considerOldSigs)
                        throws VerificationFilterException
Throws:
VerificationFilterException

extractSignaturesAndOld

protected VerificationFilterImpl.SignaturesAndOld extractSignaturesAndOld(String text)
                                                                   throws VerificationFilterException
Throws:
VerificationFilterException

extractOldSignature

protected SignatureHolder extractOldSignature(String extractedText,
                                              List newSignatures)
                                       throws PDFDocumentException,
                                              SignatureException,
                                              NormalizeException,
                                              SignatureTypesException
Extracts the old signature from the text, but only if it is older than the oldest signature of the new signatueres.

Parameters:
extractedText -
newSignatures -
Returns:
Throws:
PDFDocumentException
SignatureException
NormalizeException
SignatureTypesException


Copyright © 2006-2010. All Rights Reserved.