From 62a3115ce4d55a7a3b3fbf202bac0fff85dc412b Mon Sep 17 00:00:00 2001 From: Jakob Heher Date: Tue, 2 Aug 2022 14:18:37 +0200 Subject: YAGNI: PDF signer factory pattern --- .../at/asit/pdfover/signer/pdfas/PdfAs4Signer.java | 15 +++-------- .../pdfover/signer/pdfas/PdfAs4SignerFactory.java | 31 ---------------------- 2 files changed, 4 insertions(+), 42 deletions(-) delete mode 100644 pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignerFactory.java (limited to 'pdf-over-signer') diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java index 9943ec0e..bc5d4263 100644 --- a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java +++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java @@ -12,7 +12,6 @@ import at.asit.pdfover.signator.SignResultImpl; import at.asit.pdfover.signator.SignatureException; import at.asit.pdfover.signator.SignatureParameter; import at.asit.pdfover.signator.SignaturePosition; -import at.asit.pdfover.signator.Signer; import at.asit.pdfover.signator.SigningState; import at.gv.egiz.pdfas.common.exceptions.PDFASError; import at.gv.egiz.pdfas.common.exceptions.PdfAsException; @@ -30,10 +29,7 @@ import at.knowcenter.wag.egov.egiz.pdf.TablePos; /** * PDF AS Signer Implementation */ -public class PdfAs4Signer implements Signer { - - - +public class PdfAs4Signer { /** * The template URL @@ -46,8 +42,7 @@ public class PdfAs4Signer implements Signer { protected static final String LOC_REF = "" + URL_TEMPLATE + ""; - @Override - public SigningState prepare(SignatureParameter parameter) + public static SigningState prepare(SignatureParameter parameter) throws SignatureException { PdfAs4SignatureParameter sign_para = null; @@ -97,8 +92,7 @@ public class PdfAs4Signer implements Signer { return state; } - @Override - public SignResult sign(SigningState state) throws SignatureException { + public static SignResult sign(SigningState state) throws SignatureException { try { PdfAs4SigningState sstate = null; @@ -157,8 +151,7 @@ public class PdfAs4Signer implements Signer { } } - @Override - public SignatureParameter newParameter() { + public static SignatureParameter newParameter() { return new PdfAs4SignatureParameter(); } } diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignerFactory.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignerFactory.java deleted file mode 100644 index 3fa7ce16..00000000 --- a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignerFactory.java +++ /dev/null @@ -1,31 +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.signer.pdfas; - -//Imports -import at.asit.pdfover.signator.Signer; -import at.asit.pdfover.signator.SignerFactory; - -/** - * Factory class for PDF-AS Signer - */ -public class PdfAs4SignerFactory extends SignerFactory { - - @Override - public Signer createSigner() { - return new PdfAs4Signer(); - } -} -- cgit v1.2.3