diff options
Diffstat (limited to 'pdf-over-signator/src/main/java/at/asit/pdfover/signator/Signator.java')
-rw-r--r-- | pdf-over-signator/src/main/java/at/asit/pdfover/signator/Signator.java | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/Signator.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/Signator.java deleted file mode 100644 index 798788d2..00000000 --- a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/Signator.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2012 by A-SIT, Secure Information Technology Center Austria - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://joinup.ec.europa.eu/software/page/eupl - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - */ -package at.asit.pdfover.signator; - -//Imports -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.lang.reflect.InvocationTargetException; -import java.util.EnumMap; -import java.util.Map; - -/** - * PDF Signator Interface - */ -public class Signator { - - /** - * SLF4J Logger instance - **/ - private static Logger log = LoggerFactory.getLogger(Signator.class); - - /** - * List of available PDF signing libraries - */ - public enum Signers { - /** - * PDF-AS 3 - */ - PDFAS, - /** - * PDF-AS 4 - */ - PDFAS4 - }; - - private static Map<Signers, SignerFactory> factoryMap; - - static { - factoryMap = new EnumMap<Signers, SignerFactory>(Signers.class); - - try { -// Class<?> pdfAsClass = Class.forName("at.asit.pdfover.signer.pdfas.PDFASSignerFactory"); -// SignerFactory factory = (SignerFactory)pdfAsClass.newInstance(); -// registerSigner(Signers.PDFAS, factory); - Class<?> pdfAs4Class = Class.forName("at.asit.pdfover.signer.pdfas.PdfAs4SignerFactory"); - SignerFactory factory = (SignerFactory)pdfAs4Class.getDeclaredConstructor().newInstance(); - registerSigner(Signers.PDFAS4, factory); - } catch (ClassNotFoundException e) { - log.error("PDF Signer Factory not found", e); - throw new RuntimeException("PDF Signer Factory not found", e); - } catch (InstantiationException | InvocationTargetException | NoSuchMethodException e) { - log.error("PDF Signer Factory could not be instantiated", e); - throw new RuntimeException("PDF Signer Factory could not be instantiated", e); - } catch (IllegalAccessException e) { - log.error("PDF Signer Factory could not accessed", e); - throw new RuntimeException("PDF Signer Factory could not accessed", e); - } - } - - private static void registerSigner(Signers signer, SignerFactory factory) { - factoryMap.put(signer, factory); - } - - /** - * Gets a PDF Signer according to the chosen signer library - * @param signer the chosen Signer type - * @return the PDF Signer - */ - public static Signer getSigner(Signers signer) { - return factoryMap.get(signer).createSigner(); - } -} |