diff options
author | Christian Maierhofer <cmaierhofer@iaik.tugraz.at> | 2016-06-23 10:06:40 +0200 |
---|---|---|
committer | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2016-08-17 16:54:05 +0200 |
commit | da64c825de6ad061f5c734630faf0d6e9606dc12 (patch) | |
tree | b4b2a7cc5bca351cf8d06bdf229ed4b9efbf8119 /pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api | |
parent | 73eb447af6122887bf84426b89c62eb592ca16fa (diff) | |
download | pdf-as-4-da64c825de6ad061f5c734630faf0d6e9606dc12.tar.gz pdf-as-4-da64c825de6ad061f5c734630faf0d6e9606dc12.tar.bz2 pdf-as-4-da64c825de6ad061f5c734630faf0d6e9606dc12.zip |
Added Profile configuration validation
Diffstat (limited to 'pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api')
-rw-r--r-- | pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsFactory.java | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsFactory.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsFactory.java index cd0a4699..72d182ed 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsFactory.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsFactory.java @@ -37,9 +37,10 @@ import java.io.OutputStream; import java.lang.management.ManagementFactory; import java.lang.management.OperatingSystemMXBean; import java.lang.management.RuntimeMXBean; -import java.lang.reflect.Field; import java.security.Provider; import java.security.Security; +import java.util.Map; +import java.util.Map.Entry; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; @@ -49,12 +50,16 @@ import javax.crypto.Cipher; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import at.gv.egiz.pdfas.common.exceptions.PdfAsSettingsException; +import at.gv.egiz.pdfas.common.exceptions.PdfAsSettingsValidationException; import at.gv.egiz.pdfas.common.settings.ISettings; import at.gv.egiz.pdfas.lib.api.sign.SignParameter; import at.gv.egiz.pdfas.lib.api.verify.VerifyParameter; +import at.gv.egiz.pdfas.lib.configuration.ConfigurationValidator; import at.gv.egiz.pdfas.lib.impl.PdfAsImpl; import at.gv.egiz.pdfas.lib.impl.SignParameterImpl; import at.gv.egiz.pdfas.lib.impl.VerifyParameterImpl; +import at.gv.egiz.pdfas.lib.impl.configuration.ConfigValidatorLoader; public class PdfAsFactory implements IConfigurationConstants { @@ -359,4 +364,22 @@ public class PdfAsFactory implements IConfigurationConstants { Package pack = PdfAsFactory.class.getPackage(); return pack.getImplementationVersion(); } + + /** + * Execute all loaded Configuration Validators + * + * @throws PdfAsSettingsValidationException + */ + public static void validateConfiguration(ISettings configuration) throws PdfAsSettingsValidationException{ + Map<String, ConfigurationValidator> availableValidators = ConfigValidatorLoader.getAvailableValidators(); + if(availableValidators.isEmpty()){ + logger.info("No configuration validators available"); + } + for(Entry<String, ConfigurationValidator> validatorEntry : availableValidators.entrySet()){ + logger.info("Running configuration validator: "+validatorEntry.getKey()); + validatorEntry.getValue().validate(configuration); + } + logger.info("All configuration validators succeded."); + + } } |