From e2f20196c80c6563e6f49e3d3a71c9be963104a8 Mon Sep 17 00:00:00 2001 From: ferbas Date: Tue, 27 Oct 2009 11:14:55 +0000 Subject: added support for dynamic algorithm suites / acos04 git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@364 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../wag/egov/egiz/sig/sigid/DetachedIdFormatter.java | 13 ++++++++++--- .../egov/egiz/sig/sigid/DetachedLocRefMOAIdFormatter.java | 11 +++++++---- .../wag/egov/egiz/sig/sigid/DetachedMOCIdFormatter.java | 12 +++++++++--- .../wag/egov/egiz/sig/sigid/HotfixIdFormatter.java | 2 +- .../at/knowcenter/wag/egov/egiz/sig/sigid/IdFormatter.java | 2 +- .../wag/egov/egiz/sig/sigid/OldMOAIdFormatter.java | 2 +- 6 files changed, 29 insertions(+), 13 deletions(-) (limited to 'src/main/java/at/knowcenter/wag/egov') diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/DetachedIdFormatter.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/DetachedIdFormatter.java index 1b24a98..6d83a9f 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/DetachedIdFormatter.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/DetachedIdFormatter.java @@ -34,7 +34,7 @@ public class DetachedIdFormatter implements IdFormatter /** * @see at.knowcenter.wag.egov.egiz.sig.sigid.IdFormatter#formatIds(java.lang.String[]) */ - public String formatIds(String[] ids) + public String formatIds(String[] ids, String algorithmParams) { // read id from property file and use it try { @@ -67,8 +67,15 @@ public class DetachedIdFormatter implements IdFormatter join += "-" + cur_id; //$NON-NLS-1$ } String idstr = base + "@" + join.substring(1); //$NON-NLS-1$ - String final_ids = SIG_ID_PREFIX + "@" + idstr; - return final_ids; + + // dferbas + StringBuilder final_ids = new StringBuilder(SIG_ID_PREFIX); + //String final_ids = SIG_ID_PREFIX + "@" + idstr; + if (algorithmParams != null && algorithmParams.length() > 0) { + final_ids.append(":").append(algorithmParams); + } + final_ids.append("@").append(idstr); + return final_ids.toString(); } } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/DetachedLocRefMOAIdFormatter.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/DetachedLocRefMOAIdFormatter.java index 14fb41e..7d66a4e 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/DetachedLocRefMOAIdFormatter.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/DetachedLocRefMOAIdFormatter.java @@ -31,7 +31,7 @@ public class DetachedLocRefMOAIdFormatter implements IdFormatter /** * @see at.knowcenter.wag.egov.egiz.sig.sigid.IdFormatter#formatIds(java.lang.String[]) */ - public String formatIds(String[] ids) + public String formatIds(String[] ids, String algorithmParams) { // read id from property file and use it @@ -47,8 +47,11 @@ public class DetachedLocRefMOAIdFormatter implements IdFormatter logger_.error(e.getMessage(), e); } - - - return SIG_ID_PREFIX; + // dferbas + if (algorithmParams != null && algorithmParams.length() > 0) { + return SIG_ID_PREFIX + ":" + algorithmParams; + } else { + return SIG_ID_PREFIX; + } } } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/DetachedMOCIdFormatter.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/DetachedMOCIdFormatter.java index 8b9b606..c15367f 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/DetachedMOCIdFormatter.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/DetachedMOCIdFormatter.java @@ -35,7 +35,7 @@ public class DetachedMOCIdFormatter implements IdFormatter { /** * @see at.knowcenter.wag.egov.egiz.sig.sigid.IdFormatter#formatIds(java.lang.String[]) */ - public String formatIds(String[] ids) { + public String formatIds(String[] ids, String algorithmParams) { // read id from property file and use it String prefix = null; try { @@ -45,8 +45,14 @@ public class DetachedMOCIdFormatter implements IdFormatter { } prefix = StringUtils.defaultIfEmpty(this.algorithmId, prefix); - StringBuffer formattedIds = new StringBuffer(prefix).append("@").append(ids[0]); - return formattedIds.toString(); + // dferbas + StringBuilder formattedIds = new StringBuilder(prefix); + if (algorithmParams != null && algorithmParams.length() > 0) { + formattedIds.append(":").append(algorithmParams); + } + formattedIds.append("@").append(ids[0]); + return formattedIds.toString(); + } } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/HotfixIdFormatter.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/HotfixIdFormatter.java index ac86b4f..36c52af 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/HotfixIdFormatter.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/HotfixIdFormatter.java @@ -25,7 +25,7 @@ public class HotfixIdFormatter implements IdFormatter /** * @see at.knowcenter.wag.egov.egiz.sig.sigid.IdFormatter#formatIds(java.lang.String[]) */ - public String formatIds(String[] ids) + public String formatIds(String[] ids, String algorithmParams) { // ids algorithm: String join = ""; //$NON-NLS-1$ diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/IdFormatter.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/IdFormatter.java index e86e352..6f6a50a 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/IdFormatter.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/IdFormatter.java @@ -9,6 +9,6 @@ package at.knowcenter.wag.egov.egiz.sig.sigid; */ public interface IdFormatter { - public String formatIds (String [] ids); + public String formatIds (String [] ids, String algorithmParams); } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/OldMOAIdFormatter.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/OldMOAIdFormatter.java index bf1bd48..25dea0f 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/OldMOAIdFormatter.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/OldMOAIdFormatter.java @@ -13,7 +13,7 @@ public class OldMOAIdFormatter implements IdFormatter /** * @see at.knowcenter.wag.egov.egiz.sig.sigid.IdFormatter#formatIds(java.lang.String[]) */ - public String formatIds(String[] ids) + public String formatIds(String[] ids, String algorithmParams) { return null;//"etsi-bka-moa-1.0"; } -- cgit v1.2.3