summaryrefslogtreecommitdiff
path: root/smccSTAL/src/main/java/at/gv/egiz
diff options
context:
space:
mode:
authorwbauer <wbauer@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2008-10-16 07:51:13 +0000
committerwbauer <wbauer@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2008-10-16 07:51:13 +0000
commitef8dc449ddc60008bce9264c73b4162cc487c174 (patch)
tree50df619b2a14f2747178a689a3cfc506977709b3 /smccSTAL/src/main/java/at/gv/egiz
parent9c6e13994a51c4dd2a2dacb86d460ff66f4ed882 (diff)
downloadmocca-ef8dc449ddc60008bce9264c73b4162cc487c174.tar.gz
mocca-ef8dc449ddc60008bce9264c73b4162cc487c174.tar.bz2
mocca-ef8dc449ddc60008bce9264c73b4162cc487c174.zip
Changed STAL Handler from static registration to one Object per STAL instance
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@121 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'smccSTAL/src/main/java/at/gv/egiz')
-rw-r--r--smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java21
-rw-r--r--smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/InfoBoxReadRequestHandler.java5
-rw-r--r--smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SMCCSTALRequestHandler.java2
3 files changed, 9 insertions, 19 deletions
diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java
index b48388db..cf524737 100644
--- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java
+++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java
@@ -37,19 +37,17 @@ import at.gv.egiz.stal.SignRequest;
public abstract class AbstractSMCCSTAL implements STAL {
private static Log log = LogFactory.getLog(AbstractSMCCSTAL.class);
-
+
public final static int DEFAULT_MAX_RETRIES = 3;
protected Locale locale = Locale.getDefault();
- // protected SMCCHelper smccHelper = new SMCCHelper();
protected SignatureCard signatureCard = null;
- protected static Map<String, SMCCSTALRequestHandler> handlerMap = new HashMap<String, SMCCSTALRequestHandler>();
-
+ protected Map<String, SMCCSTALRequestHandler> handlerMap = new HashMap<String, SMCCSTALRequestHandler>();
+
protected int maxRetries = DEFAULT_MAX_RETRIES;
- static {
+ protected AbstractSMCCSTAL() {
addRequestHandler(InfoboxReadRequest.class, new InfoBoxReadRequestHandler());
- // addRequestHandler(SignRequest.class, new SignRequestHandler());
}
/**
@@ -72,7 +70,7 @@ public abstract class AbstractSMCCSTAL implements STAL {
log.info("Processing: " + request.getClass());
int retryCounter = 0;
while (retryCounter < maxRetries) {
- log.info("Number of retries: "+retryCounter);
+ log.info("Number of retries: " + retryCounter);
SMCCSTALRequestHandler handler = null;
handler = handlerMap.get(request.getClass().getSimpleName());
if (handler != null) {
@@ -83,7 +81,6 @@ public abstract class AbstractSMCCSTAL implements STAL {
}
}
try {
- handler = handler.newInstance();
handler.init(signatureCard, getGUI());
STALResponse response = handler.handleRequest(request);
if (response != null) {
@@ -91,7 +88,7 @@ public abstract class AbstractSMCCSTAL implements STAL {
log.info("Got an error response");
ErrorResponse err = (ErrorResponse) response;
if (err.getErrorCode() == 6001) {
- retryCounter = Integer.MAX_VALUE-1;
+ retryCounter = Integer.MAX_VALUE - 1;
}
if (++retryCounter < maxRetries) {
log.info("Retrying");
@@ -128,13 +125,13 @@ public abstract class AbstractSMCCSTAL implements STAL {
return responseList;
}
- public static void addRequestHandler(Class<? extends STALRequest> id,
+ public void addRequestHandler(Class<? extends STALRequest> id,
SMCCSTALRequestHandler handler) {
log.debug("Registering STAL request handler: " + id.getSimpleName());
handlerMap.put(id.getSimpleName(), handler);
}
- public static SMCCSTALRequestHandler getRequestHandler(
+ public SMCCSTALRequestHandler getRequestHandler(
Class<? extends STALRequest> request) {
return handlerMap.get(request.getSimpleName());
}
@@ -150,5 +147,5 @@ public abstract class AbstractSMCCSTAL implements STAL {
public void setMaxRetries(int maxRetries) {
this.maxRetries = maxRetries;
}
-
+
}
diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/InfoBoxReadRequestHandler.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/InfoBoxReadRequestHandler.java
index 25085b16..b48d6d50 100644
--- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/InfoBoxReadRequestHandler.java
+++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/InfoBoxReadRequestHandler.java
@@ -133,9 +133,4 @@ public class InfoBoxReadRequestHandler extends AbstractRequestHandler implements
}
return new String(gui.getPin());
}
-
- @Override
- public SMCCSTALRequestHandler newInstance() {
- return new InfoBoxReadRequestHandler();
- }
}
diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SMCCSTALRequestHandler.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SMCCSTALRequestHandler.java
index 6f303f76..94ab7a5b 100644
--- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SMCCSTALRequestHandler.java
+++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SMCCSTALRequestHandler.java
@@ -30,6 +30,4 @@ public interface SMCCSTALRequestHandler {
public boolean requireCard();
- public SMCCSTALRequestHandler newInstance();
-
}