aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/knowcenter/wag/egov/egiz/pdf/BinarySignatureHolder.java
diff options
context:
space:
mode:
authornetconomy <netconomy@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2007-08-17 06:10:56 +0000
committernetconomy <netconomy@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2007-08-17 06:10:56 +0000
commit3d982813b34f6f230baf4a467cdc37ec92a77595 (patch)
tree85319d39cee2ded1bb7a2b2dd9e8ea37e3778248 /src/main/java/at/knowcenter/wag/egov/egiz/pdf/BinarySignatureHolder.java
parent07f6c8f33b2d700276fe6ec6339ff836c8710131 (diff)
downloadpdf-as-3-3d982813b34f6f230baf4a467cdc37ec92a77595.tar.gz
pdf-as-3-3d982813b34f6f230baf4a467cdc37ec92a77595.tar.bz2
pdf-as-3-3d982813b34f6f230baf4a467cdc37ec92a77595.zip
Performance
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@167 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/knowcenter/wag/egov/egiz/pdf/BinarySignatureHolder.java')
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/pdf/BinarySignatureHolder.java165
1 files changed, 98 insertions, 67 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/BinarySignatureHolder.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/BinarySignatureHolder.java
index 1f522ff..8d42370 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/BinarySignatureHolder.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/BinarySignatureHolder.java
@@ -19,6 +19,10 @@ package at.knowcenter.wag.egov.egiz.pdf;
import java.io.Serializable;
+import at.gv.egiz.pdfas.impl.input.ByteArrayPdfDataSourceImpl;
+import at.gv.egiz.pdfas.framework.input.DataSource;
+import at.gv.egiz.pdfas.framework.input.PdfDataSource;
+
import at.knowcenter.wag.egov.egiz.sig.SignatureObject;
/**
@@ -44,48 +48,58 @@ public class BinarySignatureHolder implements Serializable, SignatureHolder
*/
private static final long serialVersionUID = -7208103904479272760L;
- /**
- * The whole pdf this holder was extracted from.
- */
- private byte[] signed_pdf = null;
-
- /**
- * The number of bytes that give the signed document.
- */
- private int signed_pdf_length = -1;
-
- /**
- * The signed text of this object.
- *
- * <p>
- * This is the value that will be signed by the Connector.
- * </p>
- */
- private String signed_text = null;
+// /**
+// * The whole pdf this holder was extracted from.
+// */
+// private byte[] signed_pdf = null;
+
+ private PdfDataSource pdfDataSource = null;
+
+// /**
+// * The number of bytes that give the signed document.
+// */
+// private int signed_pdf_length = -1;
+
+// /**
+// * The signed text of this object.
+// *
+// * <p>
+// * This is the value that will be signed by the Connector.
+// * </p>
+// */
+// private String signed_text = null;
/**
* The signature object.
*/
private SignatureObject signature_object = null;
- /**
- * Constructor that takes the pdf and the SignatureObject as parameters.
- *
- * @param pdf
- * The pdf data.
- * @param length
- * The length (number of bytes) of the pdf data to be used for being
- * converted into "signed text".
- * @param so
- * The signed signature object.
- */
- public BinarySignatureHolder(final byte[] pdf, final int length, SignatureObject so)
+// /**
+// * Constructor that takes the pdf and the SignatureObject as parameters.
+// *
+// * @param pdf
+// * The pdf data.
+// * @param length
+// * The length (number of bytes) of the pdf data to be used for being
+// * converted into "signed text".
+// * @param so
+// * The signed signature object.
+// */
+// public BinarySignatureHolder(final byte[] pdf, final int length, SignatureObject so)
+// {
+//// this.signed_pdf = pdf;
+// this.pdfDataSource = new ByteArrayPdfDataSourceImpl(pdf);
+// // streaming byte array
+// this.signed_pdf_length = length;
+// this.signature_object = so;
+//
+//// this.signed_text = null;
+// }
+
+ public BinarySignatureHolder(PdfDataSource pdf, SignatureObject so)
{
- this.signed_pdf = pdf;
- this.signed_pdf_length = length;
+ this.pdfDataSource = pdf;
this.signature_object = so;
-
- this.signed_text = null;
}
/**
@@ -93,11 +107,12 @@ public class BinarySignatureHolder implements Serializable, SignatureHolder
*/
public String getSignedText()
{
- if (this.signed_text == null)
- {
- computeSignedText();
- }
- return this.signed_text;
+ throw new RuntimeException("BinarySignatureHolder must not return text.");
+// if (this.signed_text == null)
+// {
+// computeSignedText();
+// }
+// return this.signed_text;
}
/**
@@ -107,40 +122,56 @@ public class BinarySignatureHolder implements Serializable, SignatureHolder
{
return this.signature_object;
}
-
+
/**
- * Computes or recomputes the signed text from the underlying binary data.
- *
- * <p>
- * This usually encodes the binary data of given length in Base64.
- * </p>
- *
- * <p>
- * This is usually called automatically when the signed text is first
- * requested.
- * </p>
+ * @see at.knowcenter.wag.egov.egiz.pdf.SignatureHolder#getDataSource()
*/
- protected void computeSignedText()
+ public DataSource getDataSource()
{
- this.signed_text = BinarySignature.retrieveSignableTextFromData(this.signed_pdf, this.signed_pdf_length);
+ return getSignedPdf();
}
-
- /**
- * Returns the signed_pdf.
- * @return Returns the signed_pdf.
- */
- public byte[] getSignedPdf()
+
+
+
+ // TODO obsolete funtction - remove;
+// /**
+// * Computes or recomputes the signed text from the underlying binary data.
+// *
+// * <p>
+// * This usually encodes the binary data of given length in Base64.
+// * </p>
+// *
+// * <p>
+// * This is usually called automatically when the signed text is first
+// * requested.
+// * </p>
+// */
+// protected void computeSignedText()
+// {
+// this.signed_text = BinarySignature.retrieveSignableTextFromData(this.signed_pdf, this.signed_pdf_length);
+// }
+
+// /**
+// * Returns the signed_pdf.
+// * @return Returns the signed_pdf.
+// */
+// public byte[] getSignedPdf()
+// {
+// return this.signed_pdf;
+// }
+
+ public PdfDataSource getSignedPdf ()
{
- return this.signed_pdf;
+ return this.pdfDataSource;
}
- /**
- * Returns the signed_pdf_length.
- * @return Returns the signed_pdf_length.
- */
- public int getSignedPdfLength()
- {
- return this.signed_pdf_length;
- }
+// /**
+// * Returns the signed_pdf_length.
+// * @return Returns the signed_pdf_length.
+// */
+// public int getSignedPdfLength()
+// {
+// return this.signed_pdf_length;
+// }
}