aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
authorpdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-11-29 14:31:09 +0000
committerpdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-11-29 14:31:09 +0000
commit690218d811d7915d636703c27428515aaa6a5c56 (patch)
tree23701effd071c3003abb99584844f6fbc1883d84 /src/main/java/at
parentad6dff8c82aa8f85df0199006e454ae14fc72492 (diff)
downloadpdf-as-3-690218d811d7915d636703c27428515aaa6a5c56.tar.gz
pdf-as-3-690218d811d7915d636703c27428515aaa6a5c56.tar.bz2
pdf-as-3-690218d811d7915d636703c27428515aaa6a5c56.zip
added DynamicSignatureProfile support
improved collections git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@639 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypes.java80
1 files changed, 50 insertions, 30 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypes.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypes.java
index 860120e..b5aaea7 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypes.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypes.java
@@ -19,10 +19,12 @@ package at.knowcenter.wag.egov.egiz.sig;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Vector;
+import java.util.Set;
+import org.apache.commons.lang.ArrayUtils;
import org.apache.log4j.Logger;
import at.knowcenter.wag.egov.egiz.cfg.ConfigLogger;
@@ -35,7 +37,7 @@ import at.knowcenter.wag.exactparser.ByteArrayUtils;
public class SignatureTypes
{
-// 03.11.2010 changed by exthex - commented unneded setDefaultStyles method to reduce confusion
+// 03.11.2010 changed by exthex - commented unneeded setDefaultStyles method to reduce confusion
/**
* The settings key prefix for signature definitions. <code>"sig_obj."</code>
@@ -193,6 +195,7 @@ public class SignatureTypes
* The settings reader reference
*/
private SettingsReader settings_ = null;
+
// /**
// * The reference to the settings property tree
@@ -260,10 +263,10 @@ public class SignatureTypes
// */
// private Hashtable sigEntries_ = new Hashtable(8);
- /**
- * A list of all configured signature type definitions
- */
- private List signatureTypeDefinitions_ = new Vector();
+// /**
+// * A list of all configured signature type definitions
+// */
+// private List signatureTypeDefinitions_ = new Vector();
/**
* A type-name to type-definition map
@@ -278,7 +281,7 @@ public class SignatureTypes
/**
* A plain list of signature type names
*/
- ArrayList typeList_ = new ArrayList(4);
+// ArrayList typeList_ = new ArrayList(4);
/**
* Used as singleton to read the singnature type definitions only one times of
@@ -380,32 +383,45 @@ public class SignatureTypes
ArrayList types = settings_.getKeys(TYPES);
for (int type_idx = 0; type_idx < types.size(); type_idx++)
{
- String type = (String) types.get(type_idx);
- if (STATE_ON.equals(settings_.getSetting(TYPES + "." + type, null)))
- {
- SignatureTypeDefinition sig_type_def;
- try
- {
- sig_type_def = new SignatureTypeDefinition(settings_, type);
- signatureTypeDefinitions_.add(sig_type_def);
- typeDefMap_.put(type, sig_type_def);
- typeList_.add(type);
- }
- catch (SignatureException e)
- {
- logger_.error(e.getMessage(), e);
- }
- }
+ String type = (String) types.get(type_idx);
+ addSignatureType(type);
}
}
}
+
+ public void removeSignatureType(String typeName) {
+ this.typeDefMap_.remove(typeName);
+ }
+
+ /**
+ * Create and add {@link SignatureTypeDefinition} from its name
+ * @param typeName
+ */
+ public void addSignatureType(String typeName) {
+
+ if (STATE_ON.equals(settings_.getSetting(TYPES + "." + typeName, null)))
+ {
+ SignatureTypeDefinition sig_type_def;
+ try
+ {
+ sig_type_def = new SignatureTypeDefinition(settings_, typeName);
+ //signatureTypeDefinitions_.add(sig_type_def);
+ typeDefMap_.put(typeName, sig_type_def);
+ //typeList_.add(type);
+ }
+ catch (SignatureException e)
+ {
+ logger_.error(e.getMessage(), e);
+ }
+ }
+ }
/**
- * @return a arrayList (String) of signature types
+ * @return a arrayList (String) of signature types names
*/
- public ArrayList getSignatureTypes()
+ public Set getSignatureTypes()
{
- return typeList_;
+ return this.typeDefMap_.keySet();
}
/**
@@ -413,7 +429,7 @@ public class SignatureTypes
*/
public List getSignatureTypeDefinitions()
{
- return signatureTypeDefinitions_;
+ return new ArrayList(this.typeDefMap_.values());
}
/**
@@ -452,6 +468,10 @@ public class SignatureTypes
}
return null;
}
+
+ public static boolean isRequredSigTypeKey(String name) {
+ return ArrayUtils.contains(REQUIRED_SIG_KEYS, name);
+ }
/**
* The standard toString method. Used for testing only.
@@ -461,9 +481,9 @@ public class SignatureTypes
public String toString()
{
String strg = "";
- for (int i = 0; i < signatureTypeDefinitions_.size(); i++)
- {
- SignatureTypeDefinition std = (SignatureTypeDefinition) signatureTypeDefinitions_.get(i);
+ for (Iterator it = this.typeDefMap_.values().iterator(); it.hasNext();) {
+ SignatureTypeDefinition std = (SignatureTypeDefinition) it.next();
+
strg += "----------TYPE:" + std.getType() + "----------\n";
strg += std.toString();
}