diff options
Diffstat (limited to 'src/main/java/at/gv/egiz/pdfas/impl/api/commons')
-rw-r--r-- | src/main/java/at/gv/egiz/pdfas/impl/api/commons/SignatureProfileImpl.java | 16 | ||||
-rw-r--r-- | src/main/java/at/gv/egiz/pdfas/impl/api/commons/TextBasedDataSourceApiAdapter.java | 72 |
2 files changed, 87 insertions, 1 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/api/commons/SignatureProfileImpl.java b/src/main/java/at/gv/egiz/pdfas/impl/api/commons/SignatureProfileImpl.java index 90e2ca0..b825c82 100644 --- a/src/main/java/at/gv/egiz/pdfas/impl/api/commons/SignatureProfileImpl.java +++ b/src/main/java/at/gv/egiz/pdfas/impl/api/commons/SignatureProfileImpl.java @@ -36,6 +36,11 @@ public class SignatureProfileImpl implements SignatureProfile { * Short description of the profile.
*/
protected String profileDescription;
+
+ /**
+ * true if this is the default profile, false otherwise.
+ */
+ protected boolean defaultProfile = false;
/**
* Constructor.
@@ -60,12 +65,14 @@ public class SignatureProfileImpl implements SignatureProfile { * The profile description.
* @param moaKeyIdentifier
* The MOA key identifier of this profile.
+ * @param isDefault
*/
- public SignatureProfileImpl(String profileId, String profileDescription, String moaKeyIdentifier) {
+ public SignatureProfileImpl(String profileId, String profileDescription, String moaKeyIdentifier, boolean isDefault) {
this.profileId = profileId;
this.moaKeyIdentifier = moaKeyIdentifier;
this.profileDescription = profileDescription;
this.signatureBlockEntries = new Properties();
+ this.defaultProfile = isDefault;
}
/**
@@ -121,4 +128,11 @@ public class SignatureProfileImpl implements SignatureProfile { .toString();
}
+ /**
+ *
+ */
+ public boolean isDefault() {
+ return this.defaultProfile;
+ }
+
}
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/api/commons/TextBasedDataSourceApiAdapter.java b/src/main/java/at/gv/egiz/pdfas/impl/api/commons/TextBasedDataSourceApiAdapter.java new file mode 100644 index 0000000..5363c42 --- /dev/null +++ b/src/main/java/at/gv/egiz/pdfas/impl/api/commons/TextBasedDataSourceApiAdapter.java @@ -0,0 +1,72 @@ +/**
+ *
+ */
+package at.gv.egiz.pdfas.impl.api.commons;
+
+import java.io.InputStream;
+
+import at.gv.egiz.pdfas.api.io.TextBased;
+import at.gv.egiz.pdfas.framework.input.TextDataSource;
+
+/**
+ * Adapter that converts a framework DataSource to an API PdfDataSource.
+ *
+ * @author wprinz
+ */
+public class TextBasedDataSourceApiAdapter implements at.gv.egiz.pdfas.api.io.DataSource, TextBased
+{
+ /**
+ * The framework DataSource to be adapted to an API DataSource.
+ */
+ protected TextDataSource frameworkDataSource = null;
+
+ /**
+ * Constructor.
+ *
+ * @param frameworkDataSource
+ * The framework DataSource to be adapted to an API DataSource.
+ */
+ public TextBasedDataSourceApiAdapter(TextDataSource frameworkDataSource)
+ {
+ this.frameworkDataSource = frameworkDataSource;
+ }
+
+ /**
+ * @see at.gv.egiz.pdfas.api.io.DataSource#createInputStream()
+ */
+ public InputStream createInputStream()
+ {
+ return this.frameworkDataSource.createInputStream();
+ }
+
+ /**
+ * @see at.gv.egiz.pdfas.api.io.DataSource#getAsByteArray()
+ */
+ public byte[] getAsByteArray()
+ {
+ return this.frameworkDataSource.getAsByteArray();
+ }
+
+ /**
+ * @see at.gv.egiz.pdfas.api.io.DataSource#getLength()
+ */
+ public int getLength()
+ {
+ return this.frameworkDataSource.getLength();
+ }
+
+ public String getCharacterEncoding()
+ {
+ return "UTF-8";
+ }
+
+ public String getMimeType()
+ {
+ return "text/plain";
+ }
+
+ public String getText() {
+ return this.frameworkDataSource.getText();
+ }
+
+}
|