diff options
author | clemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2010-01-18 15:55:46 +0000 |
---|---|---|
committer | clemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2010-01-18 15:55:46 +0000 |
commit | 678f2d84046c8e3ab7abe459d984868d4c9d2a3c (patch) | |
tree | 2887fcebd49fce4ca732920d6185369ca7ba18ea /smcc/src/main | |
parent | 3eaf40f3d8d9393857c13d95a678f2b161b75613 (diff) | |
download | mocca-678f2d84046c8e3ab7abe459d984868d4c9d2a3c.tar.gz mocca-678f2d84046c8e3ab7abe459d984868d4c9d2a3c.tar.bz2 mocca-678f2d84046c8e3ab7abe459d984868d4c9d2a3c.zip |
support reader configuration (disablePinpad) in BKUWebStart
webstart-local -> template-local.xml
pkcs11sign -> template.xml
default -> template-unstable.xml
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@576 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'smcc/src/main')
-rw-r--r-- | smcc/src/main/java/at/gv/egiz/smcc/conf/SMCCConfiguration.java | 22 | ||||
-rw-r--r-- | smcc/src/main/java/at/gv/egiz/smcc/reader/ReaderFactory.java | 37 |
2 files changed, 33 insertions, 26 deletions
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/conf/SMCCConfiguration.java b/smcc/src/main/java/at/gv/egiz/smcc/conf/SMCCConfiguration.java index 696709bd..136ca283 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/conf/SMCCConfiguration.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/conf/SMCCConfiguration.java @@ -17,19 +17,29 @@ package at.gv.egiz.smcc.conf; -import java.util.Properties; - /** * * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at> */ -public class SMCCConfiguration extends Properties { +public class SMCCConfiguration { private static final long serialVersionUID = 1L; - public static final String DISABLE_PINPAD_P = "disable.pinpad"; + boolean disablePinpad; + + /** + * @return the disablePinpad + */ + public boolean isDisablePinpad() { + return disablePinpad; + } - public void setDisablePinpad(String value) { - this.setProperty(DISABLE_PINPAD_P, value); + /** + * @param disablePinpad the disablePinpad to set + */ + public void setDisablePinpad(boolean disablePinpad) { + this.disablePinpad = disablePinpad; } + + } diff --git a/smcc/src/main/java/at/gv/egiz/smcc/reader/ReaderFactory.java b/smcc/src/main/java/at/gv/egiz/smcc/reader/ReaderFactory.java index eb197d9f..bf1730e9 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/reader/ReaderFactory.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/reader/ReaderFactory.java @@ -19,6 +19,7 @@ package at.gv.egiz.smcc.reader; import at.gv.egiz.smcc.conf.SMCCConfiguration; import at.gv.egiz.smcc.util.SMCCHelper; +import java.util.Collections; import java.util.HashMap; import java.util.Map; import javax.smartcardio.Card; @@ -35,16 +36,16 @@ public class ReaderFactory { protected final static Log log = LogFactory.getLog(ReaderFactory.class); - protected SMCCConfiguration configuration; + protected static SMCCConfiguration configuration; - private ReaderFactory() { - } - - /** - * @param configuration the configuration to set - */ public void setConfiguration(SMCCConfiguration configuration) { - this.configuration = configuration; + if (configuration != null) { + log.debug("reader configuration: disablePinpad=" + configuration.isDisablePinpad()); + } + //spring injects configuration into singleton ReaderFactory instance, + //but we access the ReaderFactory statically (getReader) + //(we rather should query the application context to obtain a reader factory) + ReaderFactory.configuration = configuration; } public static CardReader getReader(Card icc, CardTerminal ct) { @@ -52,19 +53,15 @@ public class ReaderFactory { String name = ct.getName(); log.info("creating reader " + name); - Map<Byte, Integer> features = queryFeatures(icc); - boolean disablePinpad = false; + Map<Byte, Integer> features; + if (configuration != null && configuration.isDisablePinpad()) { + features = Collections.emptyMap(); + } else { + features = queryFeatures(icc); + } + CardReader reader; - - //TODO query application context for reader config -// if (configuration != null) { -// String disablePinpad = configuration.getProperty(SMCCConfiguration.DISABLE_PINPAD_P); -// log.debug("setting disablePinpad to " + Boolean.parseBoolean(disablePinpad)); -// reader.setDisablePinpad(Boolean.parseBoolean(disablePinpad)); -// } - log.warn("card reader configuration is not considered"); - - if (features.isEmpty() || disablePinpad) { + if (features.isEmpty()) { reader = new DefaultCardReader(ct); } else { reader = new PinpadCardReader(ct, features); |