From 678f2d84046c8e3ab7abe459d984868d4c9d2a3c Mon Sep 17 00:00:00 2001 From: clemenso Date: Mon, 18 Jan 2010 15:55:46 +0000 Subject: 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 --- BKUOnline/pom.xml | 1 - BKUOnline/src/main/webapp/WEB-INF/mocca-conf.xml | 2 +- BKUOnline/src/main/webapp/applet.jsp | 2 +- BKUWebStart/pom.xml | 4 +-- .../java/at/gv/egiz/bku/webstart/Configurator.java | 2 +- BKUWebStart/src/main/jnlp/template-unstable.xml | 6 ++-- .../at/gv/egiz/bku/webstart/conf/conf.zip | Bin 3005 -> 3045 bytes .../at/gv/egiz/smcc/conf/SMCCConfiguration.java | 22 ++++++++---- .../java/at/gv/egiz/smcc/reader/ReaderFactory.java | 37 ++++++++++----------- 9 files changed, 41 insertions(+), 35 deletions(-) diff --git a/BKUOnline/pom.xml b/BKUOnline/pom.xml index c7dc5c58..3904fabd 100644 --- a/BKUOnline/pom.xml +++ b/BKUOnline/pom.xml @@ -312,7 +312,6 @@ at.gv.egiz BKUWebStart - ${project.version} provided zip diff --git a/BKUOnline/src/main/webapp/WEB-INF/mocca-conf.xml b/BKUOnline/src/main/webapp/WEB-INF/mocca-conf.xml index b7778ed2..5c96dc58 100644 --- a/BKUOnline/src/main/webapp/WEB-INF/mocca-conf.xml +++ b/BKUOnline/src/main/webapp/WEB-INF/mocca-conf.xml @@ -43,7 +43,7 @@ - + |--> diff --git a/BKUOnline/src/main/webapp/applet.jsp b/BKUOnline/src/main/webapp/applet.jsp index 423b349e..cd0a4d1b 100644 --- a/BKUOnline/src/main/webapp/applet.jsp +++ b/BKUOnline/src/main/webapp/applet.jsp @@ -107,6 +107,6 @@ deployJava.runApplet(attributes, parameters, '1.6.0_04'); } - + diff --git a/BKUWebStart/pom.xml b/BKUWebStart/pom.xml index bcc40ac5..af7edda8 100644 --- a/BKUWebStart/pom.xml +++ b/BKUWebStart/pom.xml @@ -89,7 +89,7 @@ false ${project.basedir}/src/main/jnlp - template.xml + template-unstable.xml mocca.jnlp at.gv.egiz.bku.webstart.Launcher @@ -156,7 +156,7 @@ false ${project.basedir}/src/main/jnlp - template-unstable.xml + template.xml mocca.jnlp at.gv.egiz.bku.webstart.Launcher diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Configurator.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Configurator.java index d8fe3e70..37638510 100644 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Configurator.java +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Configurator.java @@ -59,7 +59,7 @@ public class Configurator { * configurations with less than this (major) version will be backuped and updated * allowed: MAJOR[.MINOR[.X[-SNAPSHOT]]] */ - public static final String MIN_CONFIG_VERSION = "1.2.4-SNAPSHOT"; + public static final String MIN_CONFIG_VERSION = "1.2.11-SNAPSHOT"; public static final String CONFIG_DIR = ".mocca/conf/"; public static final String CERTS_DIR = ".mocca/certs/"; public static final String VERSION_FILE = ".version"; diff --git a/BKUWebStart/src/main/jnlp/template-unstable.xml b/BKUWebStart/src/main/jnlp/template-unstable.xml index b473f492..b6574715 100644 --- a/BKUWebStart/src/main/jnlp/template-unstable.xml +++ b/BKUWebStart/src/main/jnlp/template-unstable.xml @@ -3,14 +3,14 @@ | To strip versions from jar filenames do | for JAR in *jar; do mv JAR {JAR/-[0-9]*/.jar}; done |--> - + MOCCA Unstable E-Government Innovationszentrum (EGIZ) - ${project.Description} (BKU) MOCCA Web Start - Unstable Build - ${project.Description} + MOCCA Web Start - Unstable Build + MOCCA Web Start - Unstable Build diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/conf/conf.zip b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/conf/conf.zip index 7ed90b7b..3a3eb26d 100644 Binary files a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/conf/conf.zip and b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/conf/conf.zip differ 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 */ -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 features = queryFeatures(icc); - boolean disablePinpad = false; + Map 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); -- cgit v1.2.3