diff options
Diffstat (limited to 'Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/PDFSignator.java')
-rw-r--r-- | Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/PDFSignator.java | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/PDFSignator.java b/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/PDFSignator.java new file mode 100644 index 00000000..1801e608 --- /dev/null +++ b/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/PDFSignator.java @@ -0,0 +1,77 @@ +package at.asit.pdfover.pdfsignator; + +import java.util.HashMap; + +/** + * PDF Signator base Class + * This class should be extended to support PDF-AS and PADES. + */ +public abstract class PDFSignator { + + /** + * Map to store profiles + */ + protected HashMap<String, SignatureProfile> profiles = new HashMap<String, SignatureProfile>(); + + /** + * Perfom signature creation + * @param parameter The signature parameters + * @return The signing result + */ + public abstract SignResult Sign(SignParameter parameter); + + /** + * Creates new signing profile + * @param base The profile id of the base profile + * @param profileID The id of the new profile + * @return The new Profile + */ + public abstract SignatureProfile CreateNewProfile(String base, String profileID); + + /** + * Creates new signing profile + * @param base The base profile + * @param profileID The id of the new profile + * @return The new Profile + */ + public abstract SignatureProfile CreateNewProfile(SignatureProfile base, String profileID); + + /** + * Creates new signing profile + * @param profileID The id of the new profile + * @return The new Profile + */ + public abstract SignatureProfile CreateNewProfile(String profileID); + + /** + * Returns Profile object for given profile id + * @param profileID The profile id + * @return The requested Profile + */ + public SignatureProfile GetProfile(String profileID) { + if(this.profiles.containsKey(profileID)) { + // TODO: Think about handing out a copy of the profile to keep default values ... + return this.profiles.get(profileID); + } + + // TODO: throw Exception + return null; + } + + /** + * Get all available profiles + * @return Array containing all knwon profiles + */ + public SignatureProfile[] GetAvailableProfiles() { + // TODO: Think about handing out a copy of the profile to keep default values ... + return this.profiles.values().toArray(new SignatureProfile[0]); + } + + /** + * Gets all available profile ids + * @return Array containing all known profile ids + */ + public String[] GetAvailableProfileIDs() { + return this.profiles.keySet().toArray(new String[0]); + } +} |