aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz/pdfas/impl/api
diff options
context:
space:
mode:
authortknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-08-20 10:59:37 +0000
committertknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-08-20 10:59:37 +0000
commita95ebceaf0f77a25c26f866dff60faa6b388526c (patch)
tree306312ff46ede4feca7cc87721af1542bd4180ae /src/main/java/at/gv/egiz/pdfas/impl/api
parentc8481184208979098d9da7278ffd9f760a32ec9b (diff)
downloadpdf-as-3-a95ebceaf0f77a25c26f866dff60faa6b388526c.tar.gz
pdf-as-3-a95ebceaf0f77a25c26f866dff60faa6b388526c.tar.bz2
pdf-as-3-a95ebceaf0f77a25c26f866dff60faa6b388526c.zip
Internal error passed as RuntimeException instead of being ignored.
PdfAsFactory: Switch implemented that allows to skip provider registration. git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@589 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/gv/egiz/pdfas/impl/api')
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java38
1 files changed, 35 insertions, 3 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 2ccc1b7..e94acfd 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
@@ -81,6 +81,7 @@ public class PdfAsObject implements PdfAs
/**
* This constructor is for internal use only - use
* {@link at.gv.egiz.pdfas.PdfAsFactory} instead.
+ * Note: IAIK JCE and IAIK ECC security providers are automatically registered.
*
* @param workDirectory
* The work directory.
@@ -89,14 +90,32 @@ public class PdfAsObject implements PdfAs
*/
public PdfAsObject(File workDirectory) throws PdfAsException
{
- String path = workDirectory != null ? workDirectory.getPath() : null;
+ this(workDirectory, SettingsReader.REGISTER_IAIK_PROVIDERS_ON_DEFAULT);
+ }
+
+ /**
+ * This constructor is for internal use only - use
+ * {@link at.gv.egiz.pdfas.PdfAsFactory} instead.
+ *
+ * @param workDirectory
+ * The work directory.
+ * @param registerProvider <code>true</code>: automatically registers IAIK JCE and ECC Provider;
+ * <code>false</code>: providers will NOT be automatically registered, providers
+ * needed have to be registered by the API user
+ * @throws PdfAsException
+ * Thrown, if the configuration cannot be processed.
+ */
+ public PdfAsObject(File workDirectory, boolean registerProvider) throws PdfAsException
+ {
+ String path = workDirectory != null ? workDirectory.getPath() : null;
SettingsReader.initialize(path, path);
- reloadConfig();
+ reloadConfig(registerProvider);
}
/**
* This constructor is for internal use only - use
* {@link at.gv.egiz.pdfas.PdfAsFactory} instead.
+ * Note: IAIK JCE and IAIK ECC security providers are automatically registered.
*
* @throws PdfAsException
* Thrown, if the configuration cannot be processed.
@@ -112,7 +131,20 @@ public class PdfAsObject implements PdfAs
public void reloadConfig() throws PdfAsException
{
ConfigUtils.initializeLogger();
- SettingsReader.createInstance();
+ SettingsReader.createInstance();
+ SignatureTypes.createInstance();
+ }
+
+ /**
+ * @param registerProvider <code>true</code>: automatically registers IAIK JCE and ECC Provider;
+ * <code>false</code>: providers will NOT be automatically registered, providers
+ * needed have to be registered by the API user
+ * @see at.gv.egiz.pdfas.api.PdfAs#reloadConfig()
+ */
+ private void reloadConfig(boolean registerProvider) throws PdfAsException
+ {
+ ConfigUtils.initializeLogger();
+ SettingsReader.createInstance(registerProvider);
SignatureTypes.createInstance();
}