summaryrefslogtreecommitdiff
path: root/BKUApplet/src/main/java
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 /BKUApplet/src/main/java
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 'BKUApplet/src/main/java')
-rw-r--r--BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java8
-rw-r--r--BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java17
-rw-r--r--BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java12
-rw-r--r--BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/MultiInstanceHandler.java49
-rw-r--r--BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/QuitHandler.java37
-rw-r--r--BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WebServiceSignRequestHandler.java24
6 files changed, 20 insertions, 127 deletions
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java
index 96c0e7eb..97b5869f 100644
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java
@@ -17,11 +17,10 @@
package at.gv.egiz.bku.online.applet;
import java.net.MalformedURLException;
+import java.net.URL;
import java.util.Locale;
import java.util.ResourceBundle;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import javax.net.ssl.HttpsURLConnection;
import javax.swing.JApplet;
@@ -30,10 +29,6 @@ import org.apache.commons.logging.LogFactory;
import at.gv.egiz.bku.gui.BKUGUIFacade;
import at.gv.egiz.bku.gui.BKUGUIFactory;
-import at.gv.egiz.bku.smccstal.AbstractSMCCSTAL;
-import at.gv.egiz.stal.QuitRequest;
-
-import java.net.URL;
/**
* Note: all swing code is executed by the event dispatch thread (see
@@ -66,7 +61,6 @@ public class BKUApplet extends JApplet {
public void init() {
log.info("Welcome to MOCCA\n");
log.debug("Called init()");
- AbstractSMCCSTAL.addRequestHandler(QuitRequest.class, QuitHandler.getInstance());
HttpsURLConnection.setDefaultSSLSocketFactory(InternalSSLSocketFactory.getInstance());
String localeString = getMyAppletParameter(LOCALE_PARAM_KEY);
if (localeString != null) {
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java
index 3f64de3d..f708826d 100644
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java
@@ -37,16 +37,15 @@ import at.gv.egiz.smcc.util.SMCCHelper;
import at.gv.egiz.stal.QuitRequest;
import at.gv.egiz.stal.STALRequest;
import at.gv.egiz.stal.STALResponse;
-import at.gv.egiz.stal.service.types.GetNextRequestResponseType;
-import at.gv.egiz.stal.service.types.GetNextRequestType;
-import at.gv.egiz.stal.service.types.ObjectFactory;
import at.gv.egiz.stal.service.STALPortType;
import at.gv.egiz.stal.service.STALService;
import at.gv.egiz.stal.service.types.ErrorResponseType;
+import at.gv.egiz.stal.service.types.GetNextRequestResponseType;
+import at.gv.egiz.stal.service.types.GetNextRequestType;
+import at.gv.egiz.stal.service.types.ObjectFactory;
import at.gv.egiz.stal.service.types.RequestType;
import at.gv.egiz.stal.service.types.ResponseType;
import at.gv.egiz.stal.util.STALTranslator;
-import java.applet.AppletContext;
public class BKUWorker extends AbstractSMCCSTAL implements Runnable,
ActionListener, SMCCSTALRequestHandler {
@@ -74,7 +73,7 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable,
this.gui = gui;
this.parent = parent;
this.errorMessages = errorMessageBundle;
- QuitHandler.getInstance().registerHandlerInstance(this);
+ addRequestHandler(QuitRequest.class, this);
// register SignRequestHandler once we have a webservice port
}
@@ -87,7 +86,7 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable,
protected BKUWorker(BKUGUIFacade gui, ResourceBundle errorMessageBundle) {
this.gui = gui;
this.errorMessages = errorMessageBundle;
- QuitHandler.getInstance().registerHandlerInstance(this);
+ addRequestHandler(QuitRequest.class, this);
}
private STALPortType getSTALPort() throws MalformedURLException {
@@ -252,7 +251,6 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable,
if (signatureCard != null) {
signatureCard.disconnect(false);
}
- QuitHandler.getInstance().unregisterHandlerInstance(this);
sendRedirect();
}
@@ -383,11 +381,6 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable,
}
@Override
- public SMCCSTALRequestHandler newInstance() {
- return this;
- }
-
- @Override
public boolean requireCard() {
return false;
}
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java
index a9bbc559..2ac1bc62 100644
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java
@@ -5,15 +5,16 @@
package at.gv.egiz.bku.online.applet;
-import at.gv.egiz.bku.smccstal.SMCCSTALRequestHandler;
-import at.gv.egiz.bku.smccstal.SignRequestHandler;
-import at.gv.egiz.stal.signedinfo.ReferenceType;
import java.applet.AppletContext;
import java.net.URL;
import java.util.List;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import at.gv.egiz.bku.smccstal.SignRequestHandler;
+import at.gv.egiz.stal.signedinfo.ReferenceType;
+
/**
*
* @author clemens
@@ -31,11 +32,6 @@ public class ExternalDisplaySignRequestHandler extends SignRequestHandler {
}
@Override
- public SMCCSTALRequestHandler newInstance() {
- return new ExternalDisplaySignRequestHandler(ctx, hashDataURL);
- }
-
- @Override
public void displayHashDataInputs(List<ReferenceType> signedReferences) throws Exception {
//TODO pass reference Id's to servlet (TODO servlet)
log.debug("displaying hashdata inputs at " + hashDataURL);
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/MultiInstanceHandler.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/MultiInstanceHandler.java
deleted file mode 100644
index a07df559..00000000
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/MultiInstanceHandler.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package at.gv.egiz.bku.online.applet;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import at.gv.egiz.bku.gui.BKUGUIFacade;
-import at.gv.egiz.bku.smccstal.SMCCSTALRequestHandler;
-import at.gv.egiz.smcc.SignatureCard;
-import at.gv.egiz.stal.QuitRequest;
-import at.gv.egiz.stal.STALRequest;
-import at.gv.egiz.stal.STALResponse;
-
-public abstract class MultiInstanceHandler implements SMCCSTALRequestHandler {
-
- private static Log log = LogFactory.getLog(MultiInstanceHandler.class);
-
- protected List<SMCCSTALRequestHandler> handlerList = new ArrayList<SMCCSTALRequestHandler>();
-
-
-
- protected MultiInstanceHandler() {
- }
-
- public void registerHandlerInstance(SMCCSTALRequestHandler handler) {
- handlerList.add(handler);
- }
-
- public void unregisterHandlerInstance(SMCCSTALRequestHandler handler) {
- handlerList.remove(handler);
- }
-
-
- @Override
- public void init(SignatureCard sc, BKUGUIFacade gui) {
- }
-
- @Override
- public SMCCSTALRequestHandler newInstance() {
- return this;
- }
-
- @Override
- public boolean requireCard() {
- return false;
- }
-}
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/QuitHandler.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/QuitHandler.java
deleted file mode 100644
index ab07e1a8..00000000
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/QuitHandler.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package at.gv.egiz.bku.online.applet;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import at.gv.egiz.bku.smccstal.SMCCSTALRequestHandler;
-import at.gv.egiz.stal.QuitRequest;
-import at.gv.egiz.stal.STALRequest;
-import at.gv.egiz.stal.STALResponse;
-
-public class QuitHandler extends MultiInstanceHandler {
-
- private static Log log = LogFactory.getLog(QuitHandler.class);
-
- private static QuitHandler instance = new QuitHandler();
-
- private QuitHandler() {
- }
-
- public static QuitHandler getInstance() {
- return instance;
- }
-
- @Override
- public STALResponse handleRequest(STALRequest request) {
- if (request instanceof QuitRequest) {
- log.info("Received QuitCommand");
- for (SMCCSTALRequestHandler handler : handlerList) {
- handler.handleRequest(request);
- }
- } else {
- log.error("Unexpected request to handle: " + request);
- }
- return null;
- }
-
-}
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WebServiceSignRequestHandler.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WebServiceSignRequestHandler.java
index 4a87b8b5..b417fd33 100644
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WebServiceSignRequestHandler.java
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WebServiceSignRequestHandler.java
@@ -16,24 +16,25 @@
*/
package at.gv.egiz.bku.online.applet;
-import at.gv.egiz.bku.smccstal.SMCCSTALRequestHandler;
-import at.gv.egiz.bku.smccstal.SignRequestHandler;
-import at.gv.egiz.stal.HashDataInput;
-import at.gv.egiz.stal.impl.ByteArrayHashDataInput;
-import at.gv.egiz.stal.service.STALPortType;
-import at.gv.egiz.stal.service.types.GetHashDataInputResponseType;
-import at.gv.egiz.stal.service.types.GetHashDataInputType;
-import at.gv.egiz.stal.signedinfo.DigestMethodType;
-import at.gv.egiz.stal.signedinfo.ReferenceType;
import java.security.DigestException;
import java.security.MessageDigest;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import at.gv.egiz.bku.smccstal.SignRequestHandler;
+import at.gv.egiz.stal.HashDataInput;
+import at.gv.egiz.stal.impl.ByteArrayHashDataInput;
+import at.gv.egiz.stal.service.STALPortType;
+import at.gv.egiz.stal.service.types.GetHashDataInputResponseType;
+import at.gv.egiz.stal.service.types.GetHashDataInputType;
+import at.gv.egiz.stal.signedinfo.DigestMethodType;
+import at.gv.egiz.stal.signedinfo.ReferenceType;
+
/**
* @author clemens
*/
@@ -159,9 +160,4 @@ public class WebServiceSignRequestHandler extends SignRequestHandler {
gui.showHashDataInputDialog(hashDataInputs, this, "ok");
}
-
- @Override
- public SMCCSTALRequestHandler newInstance() {
- return new WebServiceSignRequestHandler(this.sessId, this.stalPort);
- }
}