aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java')
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java35
1 files changed, 17 insertions, 18 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java b/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java
index b744d2a..303d48f 100644
--- a/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java
+++ b/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java
@@ -29,6 +29,7 @@ import at.gv.egiz.pdfas.api.verify.VerifyResult;
import at.gv.egiz.pdfas.api.verify.VerifyResults;
import at.gv.egiz.pdfas.commandline.CommandlineConnectorChooser;
import at.gv.egiz.pdfas.exceptions.ErrorCode;
+import at.gv.egiz.pdfas.framework.ConnectorFactory;
import at.gv.egiz.pdfas.framework.config.SettingsHelper;
import at.gv.egiz.pdfas.framework.input.ExtractionStage;
import at.gv.egiz.pdfas.framework.signator.SignatorInformation;
@@ -65,10 +66,6 @@ import at.knowcenter.wag.egov.egiz.sig.SignatureTypes;
*/
public class PdfAsObject implements PdfAs
{
- /**
- * The work directory.
- */
- protected File workDirectory = null;
/**
* The log.
@@ -86,21 +83,23 @@ public class PdfAsObject implements PdfAs
*/
public PdfAsObject(File workDirectory) throws PdfAsException
{
- if (workDirectory == null)
- {
- throw new IllegalArgumentException("The work directory must not be null.");
- }
- if (!workDirectory.isDirectory())
- {
- throw new IllegalArgumentException("The work directory does not exist or is not a directory. " + workDirectory.getPath());
- }
-
- this.workDirectory = workDirectory;
-
- SettingsReader.initialize(workDirectory.getPath());
+ String path = workDirectory != null ? workDirectory.getPath() : null;
+ SettingsReader.initialize(path, path);
reloadConfig();
}
-
+
+ /**
+ * This constructor is for internal use only - use
+ * {@link at.gv.egiz.pdfas.PdfAsFactory} instead.
+ *
+ * @throws PdfAsException
+ * Thrown, if the configuration cannot be processed.
+ */
+ public PdfAsObject() throws PdfAsException
+ {
+ this(null);
+ }
+
/**
* @see at.gv.egiz.pdfas.api.PdfAs#reloadConfig()
*/
@@ -235,7 +234,7 @@ public class PdfAsObject implements PdfAs
TablePos pos = PosHelper.formTablePos(signParameters.getSignaturePositioning());
String connectorId = CommandlineConnectorChooser.chooseCommandlineConnectorForSign(signParameters.getSignatureDevice());
-
+
SignatorInformation si = PdfAS
.signCommandline(new PdfDataSourceAdapter(signParameters.getDocument()), new DataSinkAdapter(signParameters.getOutput()), signatorId, connectorId, signParameters.getSignatureProfileId(), pos);