From d7fde6fc92f36a7cc8b8d412724951b12193bb9b Mon Sep 17 00:00:00 2001 From: clemenso Date: Wed, 11 Feb 2009 20:01:17 +0000 Subject: activation applet (NO PINMgmt yet) git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@295 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../egiz/bku/online/applet/ActivationApplet.java | 90 +++++++++++++++++ .../bku/online/applet/PINManagementApplet.java | 50 +++++++++ .../bku/online/applet/PINManagementBKUWorker.java | 112 +++++++++++++++++++++ .../egiz/bku/online/applet/ext/BKUAppletExt.java | 80 --------------- 4 files changed, 252 insertions(+), 80 deletions(-) create mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java create mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java create mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ext/BKUAppletExt.java (limited to 'BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet') diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java new file mode 100644 index 00000000..68f0cb72 --- /dev/null +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java @@ -0,0 +1,90 @@ +/* + * 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.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.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 Clemens Orthacker + */ +public class ActivationApplet extends BKUApplet { + + private static final long serialVersionUID = 1L; + private static Log log = LogFactory.getLog(ActivationApplet.class); + + @Override + public void init() { + super.init(); + if (worker instanceof AbstractSMCCSTAL) { + CardMgmtRequestHandler handler = new CardMgmtRequestHandler(); + ((AbstractSMCCSTAL) worker).addRequestHandler(APDUScriptRequest.class, handler); + log.debug("Registered CardMgmtRequestHandler"); + } else { + log.warn("Cannot register CardMgmtRequestHandler."); + } + } + + /** + * creates a STAL-X enabled webservice port + * @return + * @throws java.net.MalformedURLException + */ + @Override + 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); + log.info("creating STAL-X enabled webservice port"); + STALService stal = new STALService(wsdlURL, endpointName); + return stal.getSTALPort(); + } + + @Override + 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 + */ +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 + */ +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); + } + } + } +} 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/ext/BKUAppletExt.java deleted file mode 100644 index d9df5536..00000000 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ext/BKUAppletExt.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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; - -import at.gv.egiz.bku.online.applet.BKUApplet; -import at.gv.egiz.bku.smccstal.AbstractBKUWorker; -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.stalx.service.STALService; -import at.gv.egiz.stalx.service.translator.STALXTranslationHandler; -import java.net.MalformedURLException; -import java.net.URL; -import javax.xml.namespace.QName; - -/** - * @author mcentner - */ -public class BKUAppletExt extends BKUApplet { - - private static final long serialVersionUID = 1L; - private static Log log = LogFactory.getLog(BKUAppletExt.class); - - @Override - public void init() { - super.init(); - if (worker instanceof AbstractBKUWorker) { - CardMgmtRequestHandler handler = new CardMgmtRequestHandler(); - ((AbstractBKUWorker) worker).addRequestHandler(APDUScriptRequest.class, handler); - log.debug("Registered CardMgmtRequestHandler"); - } else { - log.warn("Cannot register CardMgmtRequestHandler."); - } - } - - /** - * creates a STAL-X enabled webservice port - * @return - * @throws java.net.MalformedURLException - */ - @Override - protected 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); - log.info("creating STAL-X enabled webservice port"); - STALService stal = new STALService(wsdlURL, endpointName); - return stal.getSTALPort(); - } - - @Override - protected STALTranslator getSTALTranslator() { - STALTranslator translator = super.getSTALTranslator(); - translator.registerTranslationHandler(new STALXTranslationHandler()); - return translator; - } - - -} -- cgit v1.2.3