From 4032e46810c24dc3f013de296a2133f4651696b9 Mon Sep 17 00:00:00 2001
From: clemenso
Date: Fri, 31 Oct 2008 15:30:34 +0000
Subject: local HelpListener card locked/not activated
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@137 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
.../egiz/bku/online/applet/AppletHelpListener.java | 46 ++++++++
.../at/gv/egiz/bku/online/applet/BKUApplet.java | 4 +-
.../bku/online/applet/ExternalHelpListener.java | 83 --------------
.../at/gv/egiz/bku/gui/AbstractHelpListener.java | 84 +++++++++++++++
.../main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java | 2 +
.../at/gv/egiz/bku/gui/Messages.properties | 4 +-
BKULocal/pom.xml | 119 ++++++++++-----------
.../gv/egiz/bku/local/gui/LocalHelpListener.java | 41 +++++++
.../at/gv/egiz/bku/local/stal/SMCCSTALFactory.java | 11 +-
BKUOnline/src/main/webapp/HTTP-ohne.html | 2 +-
.../bku/smccstal/InfoBoxReadRequestHandler.java | 7 ++
.../gv/egiz/bku/smccstal/SignRequestHandler.java | 6 ++
12 files changed, 260 insertions(+), 149 deletions(-)
create mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java
delete mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalHelpListener.java
create mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java
create mode 100644 BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java
new file mode 100644
index 00000000..a0305eb4
--- /dev/null
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java
@@ -0,0 +1,46 @@
+/*
+ * 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 java.applet.AppletContext;
+import java.net.URL;
+
+/**
+ *
+ * @author clemens
+ */
+public class AppletHelpListener extends AbstractHelpListener {
+
+ protected AppletContext ctx;
+
+ public AppletHelpListener(AppletContext ctx, URL helpURL, String locale) {
+ super(helpURL, locale);
+ if (ctx == null) {
+ throw new RuntimeException("no applet context provided");
+ }
+ this.ctx = ctx;
+ }
+
+ @Override
+ public void showDocument(URL helpDocument) throws Exception {
+ ctx.showDocument(helpDocument, "_blank");
+ }
+
+
+}
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 470534da..2b0188bb 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
@@ -82,10 +82,10 @@ public class BKUApplet extends JApplet {
}
String guiStyle = getMyAppletParameter(GUI_STYLE);
BKUGUIFacade gui = BKUGUIFactory.createGUI(guiStyle);
- ExternalHelpListener helpListener = null;
+ AppletHelpListener helpListener = null;
try {
URL helpURL = getMyAppletParameterURL(HELP_URL);
- helpListener = new ExternalHelpListener(getAppletContext(), helpURL, localeString);
+ helpListener = new AppletHelpListener(getAppletContext(), helpURL, localeString);
} catch (MalformedURLException ex) {
log.error("invalid help URL: " + ex.getMessage());
}
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalHelpListener.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalHelpListener.java
deleted file mode 100644
index f92a6963..00000000
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalHelpListener.java
+++ /dev/null
@@ -1,83 +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;
-
-import java.applet.AppletContext;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.net.MalformedURLException;
-import java.net.URL;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- *
- * @author clemens
- */
-public class ExternalHelpListener implements ActionListener {
-
- protected final static Log log = LogFactory.getLog(ExternalHelpListener.class);
- protected AppletContext ctx;
- protected String helpURLBase;
- protected String locale;
-
- public ExternalHelpListener(AppletContext ctx, URL helpURL, String locale) {
- if (ctx == null) {
- throw new RuntimeException("no applet context provided");
- }
- if (helpURL == null || "".equals(helpURL)) {
- throw new RuntimeException("no help URL provided");
- }
- this.ctx = ctx;
- this.helpURLBase = helpURL.toString();
- this.locale = locale;
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- log.debug("received help action: " + e.getActionCommand());
- URL helpURL;
- try {
- String urlString = helpURLBase;
- if (locale != null) {
- urlString = appendParameter(urlString, "locale", locale);
- }
- if (e.getActionCommand() != null && !"".equals(e.getActionCommand())) {
- urlString = appendParameter(urlString, "topic", e.getActionCommand());
- }
- helpURL = new URL(urlString);
- } catch (MalformedURLException ex) {
- try {
- log.error("failed to create help URL: " + ex.getMessage());
- helpURL = new URL(helpURLBase);
- } catch (MalformedURLException ex1) {
- log.error("failed to create default help URL, requested help will not be displayed");
- return;
- }
- }
- ctx.showDocument(helpURL, "_blank");
- }
-
- private String appendParameter(String url, String paramName, String paramValue) {
- if (url.indexOf('?') < 0) {
- return url + "?" + paramName + "=" + paramValue;
- } else {
- return url + "&" + paramName + "=" + paramValue;
- }
- }
-}
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java
new file mode 100644
index 00000000..68d61bef
--- /dev/null
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java
@@ -0,0 +1,84 @@
+/*
+ * 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.gui;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.net.MalformedURLException;
+import java.net.URL;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ *
+ * @author Clemens Orthacker
+ */
+public abstract class AbstractHelpListener implements ActionListener {
+
+ protected final static Log log = LogFactory.getLog(AbstractHelpListener.class);
+ protected String helpURLBase;
+ protected String locale;
+
+ public AbstractHelpListener(URL baseURL, String locale) {
+ if (baseURL == null || "".equals(baseURL)) {
+ throw new RuntimeException("no help URL provided");
+ }
+ this.helpURLBase = baseURL.toString();
+ this.locale = locale;
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ log.debug("received help action: " + e.getActionCommand());
+ URL helpURL;
+ try {
+ String urlString = helpURLBase;
+ if (locale != null) {
+ urlString = appendParameter(urlString, "locale", locale);
+ }
+ if (e.getActionCommand() != null && !"".equals(e.getActionCommand())) {
+ urlString = appendParameter(urlString, "topic", e.getActionCommand());
+ }
+ helpURL = new URL(urlString);
+ } catch (MalformedURLException ex) {
+ try {
+ log.error("failed to create help URL: " + ex.getMessage());
+ helpURL = new URL(helpURLBase);
+ } catch (MalformedURLException ex1) {
+ log.error("failed to create default help URL, requested help will not be displayed");
+ return;
+ }
+ }
+ try {
+ showDocument(helpURL);
+ } catch (Exception ex) {
+ log.error("could not display help document " + helpURL + ": " + ex.getMessage());
+ }
+ }
+
+ private String appendParameter(String url, String paramName, String paramValue) {
+ if (url.indexOf('?') < 0) {
+ return url + "?" + paramName + "=" + paramValue;
+ } else {
+ return url + "&" + paramName + "=" + paramValue;
+ }
+ }
+
+ public abstract void showDocument(URL helpDocument) throws Exception;
+
+}
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
index 872f1874..4ef1b7d9 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
@@ -35,6 +35,8 @@ public interface BKUGUIFacade {
public static final String ERR_DISPLAY_HASHDATA = "error.display.hashdata";
public static final String ERR_WRITE_HASHDATA = "error.write.hashdata";
public static final String ERR_INVALID_HASH = "error.invalid.hash";
+ public static final String ERR_CARD_LOCKED = "error.card.locked";
+ public static final String ERR_CARD_NOTACTIVATED = "error.card.notactivated";
public static final String MESSAGES_BUNDLE = "at/gv/egiz/bku/gui/Messages";
public static final String DEFAULT_BACKGROUND = "/images/BackgroundChipperling.png";
diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
index 5a427360..1f51de77 100644
--- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
+++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
@@ -58,4 +58,6 @@ error.ws.unreachable=Das Web-Service ist nicht erreichbar: {0}
error.pcsc=Java(TM) scheint keine PC/SC Schnittstelle f\u00FCr den Smartcard-Zugriff zur Verf\u00FCgung zu stellen.
error.cardterminal=Es konnte kein Smartcard-Leser gefunden werden.Entweder ist kein Leser angeschlossen oder kein PC/SC Treiber installiert.
error.unknown=Leider trat ein Fehler auf: {0}
-error.test=Fehler1 {0} - Fehler2 {1}
\ No newline at end of file
+error.test=Fehler1 {0} - Fehler2 {1}
+error.card.locked=B\u00FCrgerkarte ist gesperrt
+error.card.notactivated=B\u00FCrgerkartenfunktion ist nicht aktiviert
\ No newline at end of file
diff --git a/BKULocal/pom.xml b/BKULocal/pom.xml
index 204fa6b9..03a6a10b 100644
--- a/BKULocal/pom.xml
+++ b/BKULocal/pom.xml
@@ -1,25 +1,22 @@
-
-
- bku
- at.gv.egiz
- 1.0-SNAPSHOT
-
- 4.0.0
- at.gv.egiz
- BKULocal
- war
- BKU Local
- 1.0-SNAPSHOT
-
+
+
+ bku
+ at.gv.egiz
+ 1.0-SNAPSHOT
+
+ 4.0.0
+ at.gv.egiz
+ BKULocal
+ war
+ BKU Local
+ 1.0-SNAPSHOT
scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal
scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal
scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal
-
+
@@ -27,15 +24,11 @@
2.0.2
-
- true
-
+ true
-
- ${project.version}-r${buildNumber}
-
+ ${project.version}-r${buildNumber}
@@ -59,47 +52,47 @@
-
-
-
- at.gv.egiz
- STAL
- 1.0-SNAPSHOT
-
-
- at.gv.egiz
- bkucommon
- 1.0-SNAPSHOT
-
-
- at.gv.egiz
- smcc
- 1.0-SNAPSHOT
+
+
+
+ at.gv.egiz
+ STAL
+ 1.0-SNAPSHOT
+
+
+ at.gv.egiz
+ bkucommon
+ 1.0-SNAPSHOT
+
+
+ at.gv.egiz
+ smcc
+ 1.0-SNAPSHOT
at.gv.egiz
smccSTAL
1.0-SNAPSHOT
-
-
- org.springframework
- spring-core
- 2.5.5
-
-
- javax.servlet
- servlet-api
- 2.5
- provided
-
-
- org.springframework
- spring-web
- 2.5.5
-
-
- commons-logging
- commons-logging
+
+
+ org.springframework
+ spring-core
+ 2.5.5
+
+
+ javax.servlet
+ servlet-api
+ 2.5
+ provided
+
+
+ org.springframework
+ spring-web
+ 2.5.5
+
+
+ commons-logging
+ commons-logging
at.gv.egiz
@@ -110,6 +103,10 @@
at.gv.egiz
BKUViewer
1.0-SNAPSHOT
-
-
-
\ No newline at end of file
+
+
+
+
+ Tomcat60
+
+
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java
new file mode 100644
index 00000000..ebec9c65
--- /dev/null
+++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java
@@ -0,0 +1,41 @@
+/*
+ * 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.local.gui;
+
+import at.gv.egiz.bku.gui.AbstractHelpListener;
+import java.awt.Desktop;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+/**
+ *
+ * @author Clemens Orthacker
+ */
+public class LocalHelpListener extends AbstractHelpListener {
+
+ public LocalHelpListener(URL baseURL, String locale) {
+ super(baseURL, locale);
+ }
+
+ @Override
+ public void showDocument(URL helpDocument) throws IOException, URISyntaxException {
+ Desktop.getDesktop().browse(helpDocument.toURI());
+ }
+
+}
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java
index df5c2b28..d3530332 100644
--- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java
+++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java
@@ -18,6 +18,7 @@ package at.gv.egiz.bku.local.stal;
import java.awt.Dimension;
import java.awt.Toolkit;
+import java.net.MalformedURLException;
import java.util.Locale;
import java.util.ResourceBundle;
@@ -26,9 +27,11 @@ import javax.swing.WindowConstants;
import at.gv.egiz.bku.gui.BKUGUIFacade;
import at.gv.egiz.bku.gui.BKUGUIFactory;
+import at.gv.egiz.bku.local.gui.LocalHelpListener;
import at.gv.egiz.bku.online.applet.BKUApplet;
import at.gv.egiz.stal.STAL;
import at.gv.egiz.stal.STALFactory;
+import java.net.URL;
public class SMCCSTALFactory implements STALFactory {
@@ -48,7 +51,13 @@ public class SMCCSTALFactory implements STALFactory {
}
dialog = new JDialog();
BKUGUIFacade gui = BKUGUIFactory.createGUI(BKUGUIFactory.ADVANCED_GUI);
- gui.init(dialog.getContentPane(), locale.toString(), null, null);
+ LocalHelpListener helpListener =null;
+ try {
+ helpListener = new LocalHelpListener(new URL("http://localhost:3495/help"), "en");
+ } catch (MalformedURLException ex) {
+ ex.printStackTrace();
+ }
+ gui.init(dialog.getContentPane(), locale.toString(), null, helpListener);
stal = new SMCCSTAL(new BKUGuiProxy(dialog, gui), dialog, resourceBundle);
dialog.setPreferredSize(new Dimension(400, 200));
dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
diff --git a/BKUOnline/src/main/webapp/HTTP-ohne.html b/BKUOnline/src/main/webapp/HTTP-ohne.html
index 044432ce..47c059f2 100644
--- a/BKUOnline/src/main/webapp/HTTP-ohne.html
+++ b/BKUOnline/src/main/webapp/HTTP-ohne.html
@@ -98,7 +98,7 @@ legend {
advanced
-
+
external
internal
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 cfac8cf5..cfc5c4bd 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
@@ -16,6 +16,7 @@
*/
package at.gv.egiz.bku.smccstal;
+import at.gv.egiz.bku.gui.BKUGUIFacade;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -104,9 +105,15 @@ public class InfoBoxReadRequestHandler extends AbstractRequestHandler implements
}
} catch (NotActivatedException e) {
log.info("Citizen card not activated.", e);
+ gui.showErrorDialog(BKUGUIFacade.ERR_CARD_NOTACTIVATED, null, this, null);
+ waitForAction();
+ gui.showWaitDialog(null);
return new ErrorResponse(6001);
} catch (LockedException e) {
log.info("Citizen card locked.", e);
+ gui.showErrorDialog(BKUGUIFacade.ERR_CARD_LOCKED, null, this, null);
+ waitForAction();
+ gui.showWaitDialog(null);
return new ErrorResponse(6001);
} catch (CancelledException cx) {
log.debug("User cancelled request", cx);
diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java
index 466ec2a9..dbc70bff 100644
--- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java
+++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java
@@ -94,9 +94,15 @@ public abstract class SignRequestHandler extends AbstractRequestHandler implemen
return stalResp;
} catch (NotActivatedException e) {
log.info("Citizen card not activated.", e);
+ gui.showErrorDialog(BKUGUIFacade.ERR_CARD_NOTACTIVATED, null, this, null);
+ waitForAction();
+ gui.showWaitDialog(null);
return new ErrorResponse(6001);
} catch (LockedException e) {
log.info("Citizen card locked.", e);
+ gui.showErrorDialog(BKUGUIFacade.ERR_CARD_LOCKED, null, this, null);
+ waitForAction();
+ gui.showWaitDialog(null);
return new ErrorResponse(6001);
} catch (CancelledException cx) {
log.debug("User cancelled request");
--
cgit v1.2.3