summaryrefslogtreecommitdiff
path: root/smcc/src/main/java/at/gv
diff options
context:
space:
mode:
authorclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2009-08-13 09:09:06 +0000
committerclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2009-08-13 09:09:06 +0000
commit497f6336cc96cd3b2b4cd760774ec4c2ed892df2 (patch)
tree8dfdd6467af2a2f22d11c12ff08801371b7ada39 /smcc/src/main/java/at/gv
parent2dc37cef3cb0f5aa4dcc7a3bb28259181e6f5b3e (diff)
downloadmocca-497f6336cc96cd3b2b4cd760774ec4c2ed892df2.tar.gz
mocca-497f6336cc96cd3b2b4cd760774ec4c2ed892df2.tar.bz2
mocca-497f6336cc96cd3b2b4cd760774ec4c2ed892df2.zip
[#436] resolve "#PIN digits" message via message resource bundle
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@418 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'smcc/src/main/java/at/gv')
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java6
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/PINSpec.java36
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java4
3 files changed, 33 insertions, 13 deletions
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java b/smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java
index 99aadebd..414d4678 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java
@@ -104,13 +104,13 @@ public class ACOSCard extends AbstractSignatureCard implements PINMgmtSignatureC
};
private static final PINSpec DEC_PIN_SPEC = new PINSpec(0, 8, "[0-9]",
- "at/gv/egiz/smcc/ACOSCard", "dec.pin.name", KID_PIN_DEC, AID_DEC);
+ "at/gv/egiz/smcc/ACOSCard", "dec.pin", KID_PIN_DEC, AID_DEC);
private static final PINSpec SIG_PIN_SPEC = new PINSpec(0, 8, "[0-9]",
- "at/gv/egiz/smcc/ACOSCard", "sig.pin.name", KID_PIN_SIG, AID_SIG);
+ "at/gv/egiz/smcc/ACOSCard", "sig.pin", KID_PIN_SIG, AID_SIG);
private static final PINSpec INF_PIN_SPEC = new PINSpec(0, 8, "[0-9]",
- "at/gv/egiz/smcc/ACOSCard", "inf.pin.name", KID_PIN_INF, AID_DEC);
+ "at/gv/egiz/smcc/ACOSCard", "inf.pin", KID_PIN_INF, AID_DEC);
/**
* The version of the card's digital signature application.
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/PINSpec.java b/smcc/src/main/java/at/gv/egiz/smcc/PINSpec.java
index b8ffafab..1812049c 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/PINSpec.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/PINSpec.java
@@ -33,7 +33,10 @@ public class PINSpec {
String resourceBundleName_;
- String name_;
+ String nameKey_;
+
+ /** the localized, i.e. configurable length */
+ String lengthKey_;
byte kid_;
@@ -49,13 +52,14 @@ public class PINSpec {
* @param kid the keyId for this pin
*/
public PINSpec(int minLenght, int maxLength, String rexepPattern,
- String resourceBundleName, String name, byte kid, byte[] contextAID) {
+ String resourceBundleName, String resourceKey, byte kid, byte[] contextAID) {
minLength_ = minLenght;
maxLength_ = maxLength;
rexepPattern_ = rexepPattern;
resourceBundleName_ = resourceBundleName;
- name_ = name;
+ nameKey_ = resourceKey + ".name";
+ lengthKey_ = resourceKey + ".length";
kid_ = kid;
context_aid_ = contextAID;
}
@@ -66,7 +70,8 @@ public class PINSpec {
minLength_ = minLenght;
maxLength_ = maxLength;
rexepPattern_ = rexepPattern;
- name_ = name;
+ nameKey_ = name + ".name";
+ lengthKey_ = name + ".length";
kid_ = kid;
context_aid_ = contextAID;
}
@@ -75,9 +80,9 @@ public class PINSpec {
if (resourceBundleName_ != null) {
ResourceBundle resourceBundle = ResourceBundle.getBundle(resourceBundleName_);
- return resourceBundle.getString(name_);
+ return resourceBundle.getString(nameKey_);
} else {
- return name_;
+ return nameKey_;
}
}
@@ -86,13 +91,28 @@ public class PINSpec {
if (resourceBundleName_ != null) {
ResourceBundle resourceBundle = ResourceBundle.getBundle(resourceBundleName_, locale);
- return resourceBundle.getString(name_);
+ return resourceBundle.getString(nameKey_);
} else {
- return name_;
+ return nameKey_;
}
}
+ public String getLocalizedLength() {
+
+ if (resourceBundleName_ != null) {
+ ResourceBundle resourceBundle = ResourceBundle.getBundle(resourceBundleName_);
+ return resourceBundle.getString(lengthKey_);
+ } else {
+ if (maxLength_ > minLength_) {
+ return minLength_ + "-" + maxLength_;
+ } else {
+ return String.valueOf(minLength_);
+ }
+ }
+
+ }
+
public int getMaxLength() {
return maxLength_;
}
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java b/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java
index 921819ee..2e6dd5d6 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java
@@ -150,11 +150,11 @@ public class STARCOSCard extends AbstractSignatureCard implements PINMgmtSignatu
private static final PINSpec CARD_PIN_SPEC =
new PINSpec(4, 12, "[0-9]",
- "at/gv/egiz/smcc/STARCOSCard", "card.pin.name", KID_PIN_CARD, null);
+ "at/gv/egiz/smcc/STARCOSCard", "card.pin", KID_PIN_CARD, null);
private static final PINSpec SS_PIN_SPEC =
new PINSpec(6, 12, "[0-9]",
- "at/gv/egiz/smcc/STARCOSCard", "sig.pin.name", KID_PIN_SS, AID_DF_SS);
+ "at/gv/egiz/smcc/STARCOSCard", "sig.pin", KID_PIN_SS, AID_DF_SS);
/**
* Creates an new instance.