summaryrefslogtreecommitdiff
path: root/BKUAppletExt/src/main/java/at/gv/egiz/bku/online
diff options
context:
space:
mode:
Diffstat (limited to 'BKUAppletExt/src/main/java/at/gv/egiz/bku/online')
-rw-r--r--BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java (renamed from BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ext/BKUAppletExt.java)50
-rw-r--r--BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java50
-rw-r--r--BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java112
3 files changed, 192 insertions, 20 deletions
diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ext/BKUAppletExt.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java
index d9df5536..68f0cb72 100644
--- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ext/BKUAppletExt.java
+++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java
@@ -1,53 +1,56 @@
/*
* Copyright 2008 Federal Chancellery Austria and
* Graz University of Technology
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- *
- */
-package at.gv.egiz.bku.online.applet.ext;
-
-import at.gv.egiz.stal.service.translator.STALTranslator;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+package at.gv.egiz.bku.online.applet;
+import at.gv.egiz.bku.gui.AbstractHelpListener;
+import at.gv.egiz.bku.gui.ActivationGUI;
+import at.gv.egiz.bku.gui.BKUGUIFacade;
+import at.gv.egiz.bku.gui.BKUGUIFacade.Style;
import at.gv.egiz.bku.online.applet.BKUApplet;
-import at.gv.egiz.bku.smccstal.AbstractBKUWorker;
+import at.gv.egiz.bku.smccstal.AbstractSMCCSTAL;
import at.gv.egiz.bku.smccstal.ext.CardMgmtRequestHandler;
import at.gv.egiz.stal.ext.APDUScriptRequest;
import at.gv.egiz.stal.service.STALPortType;
+import at.gv.egiz.stal.service.translator.STALTranslator;
import at.gv.egiz.stalx.service.STALService;
import at.gv.egiz.stalx.service.translator.STALXTranslationHandler;
+import java.awt.Container;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.Locale;
import javax.xml.namespace.QName;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
- * @author mcentner
+ *
+ * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at>
*/
-public class BKUAppletExt extends BKUApplet {
+public class ActivationApplet extends BKUApplet {
private static final long serialVersionUID = 1L;
- private static Log log = LogFactory.getLog(BKUAppletExt.class);
+ private static Log log = LogFactory.getLog(ActivationApplet.class);
@Override
public void init() {
super.init();
- if (worker instanceof AbstractBKUWorker) {
+ if (worker instanceof AbstractSMCCSTAL) {
CardMgmtRequestHandler handler = new CardMgmtRequestHandler();
- ((AbstractBKUWorker) worker).addRequestHandler(APDUScriptRequest.class, handler);
+ ((AbstractSMCCSTAL) worker).addRequestHandler(APDUScriptRequest.class, handler);
log.debug("Registered CardMgmtRequestHandler");
} else {
log.warn("Cannot register CardMgmtRequestHandler.");
@@ -60,7 +63,7 @@ public class BKUAppletExt extends BKUApplet {
* @throws java.net.MalformedURLException
*/
@Override
- protected STALPortType getSTALPort() throws MalformedURLException {
+ public STALPortType getSTALPort() throws MalformedURLException {
URL wsdlURL = getURLParameter(WSDL_URL, null);
log.debug("setting STAL WSDL: " + wsdlURL);
QName endpointName = new QName(STAL_WSDL_NS, STAL_SERVICE);
@@ -70,11 +73,18 @@ public class BKUAppletExt extends BKUApplet {
}
@Override
- protected STALTranslator getSTALTranslator() {
+ public STALTranslator getSTALTranslator() {
STALTranslator translator = super.getSTALTranslator();
translator.registerTranslationHandler(new STALXTranslationHandler());
return translator;
}
-
+ @Override
+ protected BKUGUIFacade createGUI(Container contentPane,
+ Locale locale,
+ Style guiStyle,
+ URL backgroundImgURL,
+ AbstractHelpListener helpListener) {
+ return new ActivationGUI(contentPane, locale, guiStyle, backgroundImgURL, helpListener);
+ }
}
diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java
new file mode 100644
index 00000000..72d06618
--- /dev/null
+++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2008 Federal Chancellery Austria and
+ * Graz University of Technology
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package at.gv.egiz.bku.online.applet;
+
+import at.gv.egiz.bku.gui.AbstractHelpListener;
+import at.gv.egiz.bku.gui.BKUGUIFacade;
+import at.gv.egiz.bku.gui.PINManagementGUI;
+import java.awt.Container;
+import java.net.URL;
+import java.util.Locale;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ *
+ * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at>
+ */
+public class PINManagementApplet extends BKUApplet {
+
+ private static final long serialVersionUID = 1L;
+ private static Log log = LogFactory.getLog(PINManagementApplet.class);
+
+ @Override
+ protected BKUGUIFacade createGUI(Container contentPane,
+ Locale locale,
+ BKUGUIFacade.Style guiStyle,
+ URL backgroundImgURL,
+ AbstractHelpListener helpListener) {
+ return new PINManagementGUI(contentPane, locale, guiStyle, backgroundImgURL, helpListener);
+ }
+
+ @Override
+ protected AppletBKUWorker createBKUWorker(BKUApplet applet, BKUGUIFacade gui) {
+ return new PINManagementBKUWorker(applet, gui);
+ }
+}
diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java
new file mode 100644
index 00000000..e65d98ca
--- /dev/null
+++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2008 Federal Chancellery Austria and
+ * Graz University of Technology
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package at.gv.egiz.bku.online.applet;
+
+import at.gv.egiz.bku.gui.BKUGUIFacade;
+import at.gv.egiz.bku.gui.PINManagementGUIFacade;
+import at.gv.egiz.bku.smccstal.ext.PINMgmtRequestHandler;
+import at.gv.egiz.stal.STALResponse;
+import at.gv.egiz.stal.ext.ActivatePINRequest;
+import at.gv.egiz.stal.ext.ChangePINRequest;
+import at.gv.egiz.stal.ext.UnblockPINRequest;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ *
+ * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at>
+ */
+public class PINManagementBKUWorker extends AppletBKUWorker {
+
+ protected PINMgmtRequestHandler handler = new PINMgmtRequestHandler();
+ protected PINManagementActionListener listener = new PINManagementActionListener();
+
+ public PINManagementBKUWorker(BKUApplet applet, BKUGUIFacade gui) {
+ super(applet, gui);
+ handlerMap.clear();
+// PINMgmtRequestHandler handler = new PINMgmtRequestHandler();
+// addRequestHandler(ActivatePINRequest.class, handler);
+// addRequestHandler(ChangePINRequest.class, handler);
+// addRequestHandler(UnblockPINRequest.class, handler);
+ }
+
+ @Override
+ public void run() {
+ gui.showWelcomeDialog();
+
+ try {
+
+ if (waitForCard()) {
+ gui.showErrorDialog("no card, canceled PIN mgmt dialog", null);
+ }
+
+ actionCommandList.clear();
+ actionCommandList.add("cancel");
+
+ ((PINManagementGUIFacade) gui).showPINManagementDialog(handler,
+ listener, "activate",
+ listener, "change",
+ listener, "unblock",
+ this, "cancel");
+
+ waitForAction();
+
+ } catch (Exception ex) {
+ log.error(ex.getMessage(), ex);
+ showErrorDialog(BKUGUIFacade.ERR_UNKNOWN_WITH_PARAM, ex);
+ } finally {
+ if (signatureCard != null) {
+ signatureCard.disconnect(false);
+ }
+ }
+
+ applet.sendRedirect(sessionId);
+ }
+
+ protected class PINManagementActionListener implements ActionListener {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ try {
+ String cmd = e.getActionCommand();
+ if ("activate".equals(cmd)) {
+ //create STAL request, call handle(req)
+ ActivatePINRequest stalReq = new ActivatePINRequest();
+ STALResponse stalResp = handler.handleRequest(stalReq);
+ gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN_WITH_PARAM, new Object[]{"debug"}, this, "back");
+ } else if ("change".equals(cmd)) {
+ } else if ("unblock".equals(cmd)) {
+ } else if ("back".equals(cmd)) {
+
+ ((PINManagementGUIFacade) gui).showPINManagementDialog(handler,
+ this, "activate",
+ this, "change",
+ this, "unblock",
+ PINManagementBKUWorker.this, "cancel");
+
+ }
+ } catch (InterruptedException ex) {
+ log.fatal(ex);
+ }
+ }
+ }
+}