summaryrefslogtreecommitdiff
path: root/BKUWebStart/src/main/java/at/gv
diff options
context:
space:
mode:
Diffstat (limited to 'BKUWebStart/src/main/java/at/gv')
-rw-r--r--BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Launcher.java9
-rw-r--r--BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/PersonIdentityLinkInvoker.java75
-rw-r--r--BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/BKUControllerInterface.java1
-rw-r--r--BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/MOCCAIcon.java21
-rw-r--r--BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/StatusNotifier.java1
5 files changed, 105 insertions, 2 deletions
diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Launcher.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Launcher.java
index f9500f8c..2719e990 100644
--- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Launcher.java
+++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Launcher.java
@@ -65,12 +65,14 @@ public class Launcher implements BKUControllerInterface {
public static final URL HTTPS_SECURITY_LAYER_URL;
public static final URL INSTALL_CERT_URL;
public static final URL PIN_MANAGEMENT_URL;
+ public static final URL IDENTITY_LINK_URL;
public static final URL HELP_URL;
static {
URL http = null;
URL https = null;
URL pin = null;
+ URL ident = null;
URL cert = null;
URL help = null;
try {
@@ -79,12 +81,14 @@ public class Launcher implements BKUControllerInterface {
pin = new URL(http, "/PINManagement");
cert = new URL(http, "/ca.crt");
help = new URL(http, "/help/");
+ ident = new URL(http, "/IdentityLink");
} catch (MalformedURLException ex) {
log.error("Failed to create URL.", ex);
} finally {
HTTP_SECURITY_LAYER_URL = http;
HTTPS_SECURITY_LAYER_URL = https;
PIN_MANAGEMENT_URL = pin;
+ IDENTITY_LINK_URL = ident;
INSTALL_CERT_URL = cert;
HELP_URL = help;
}
@@ -307,4 +311,9 @@ public class Launcher implements BKUControllerInterface {
public boolean setAutostart(boolean doAutostart) {
return autostart.set(doAutostart);
}
+
+ @Override
+ public void personIdentityLink(Locale locale) {
+ new Thread(new PersonIdentityLinkInvoker(status)).start();
+ }
}
diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/PersonIdentityLinkInvoker.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/PersonIdentityLinkInvoker.java
new file mode 100644
index 00000000..249d7a15
--- /dev/null
+++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/PersonIdentityLinkInvoker.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2011 by Graz University of Technology, Austria
+ * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint
+ * initiative of the Federal Chancellery Austria and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
+
+package at.gv.egiz.bku.webstart;
+
+import java.io.IOException;
+import java.net.HttpURLConnection;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import at.gv.egiz.bku.webstart.gui.StatusNotifier;
+
+/**
+ *
+ * @author Andreas Fitzek <andreas.fitzek@iaik.tugraz.at>
+ */
+public class PersonIdentityLinkInvoker implements Runnable {
+
+ private static final Logger log = LoggerFactory.getLogger(PersonIdentityLinkInvoker.class);
+
+ private StatusNotifier status;
+
+ public PersonIdentityLinkInvoker(StatusNotifier status) {
+ this.status = status;
+ }
+
+ @Override
+ public void run() {
+ HttpURLConnection connection = null;
+ try {
+ log.info("Connecting to: " + Launcher.IDENTITY_LINK_URL);
+
+ connection = (HttpURLConnection) Launcher.IDENTITY_LINK_URL.openConnection();
+
+ connection.setRequestMethod("GET");
+ connection.setReadTimeout(0);
+ connection.connect();
+
+ if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
+ log.info("person identity link dialog returned");
+ } else {
+ log.error("unexpected response from person identity link: " + connection.getResponseMessage());
+ }
+ } catch (IOException ex) {
+ log.error("Failed to connect to person identity link", ex);
+ status.error(StatusNotifier.ERROR_IDENTITY_LINK);
+ } finally {
+ if (connection != null) {
+ connection.disconnect();
+ }
+ }
+ }
+}
diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/BKUControllerInterface.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/BKUControllerInterface.java
index a340c980..2d91f2f2 100644
--- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/BKUControllerInterface.java
+++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/BKUControllerInterface.java
@@ -36,6 +36,7 @@ public interface BKUControllerInterface {
public void pinManagement(Locale locale);
+ public void personIdentityLink(Locale locale);
/**
* Check if MOCCA Autostart is possible
diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/MOCCAIcon.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/MOCCAIcon.java
index 64b94424..3c6fe6f0 100644
--- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/MOCCAIcon.java
+++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/MOCCAIcon.java
@@ -57,11 +57,14 @@ public class MOCCAIcon implements StatusNotifier, ActionListener, ItemListener {
public static final String LABEL_ABOUT = "tray.label.about";
public static final String LABEL_SETTINGS = "tray.label.settings";
public static final String LABEL_AUTOSTART = "tray.label.autostart";
+ public static final String LABEL_IDENTITYLINK = "tray.label.identitylink";
+ public static final String LABEL_INFOMENU = "tray.label.infomenu";
public static final String TOOLTIP_DEFAULT = "tray.tooltip.default";
/** action commands for tray menu */
private static enum COMMANDS {
- SHUTDOWN_COMMAND, PIN_COMMAND, ABOUT_COMMAND, HELP_COMMAND, AUTOSTART_COMMAND
+ SHUTDOWN_COMMAND, PIN_COMMAND, ABOUT_COMMAND,
+ HELP_COMMAND, AUTOSTART_COMMAND, IDENTITYLINK_COMMAND
};
private static final Logger log = LoggerFactory.getLogger(MOCCAIcon.class);
@@ -104,6 +107,13 @@ public class MOCCAIcon implements StatusNotifier, ActionListener, ItemListener {
helpItem.addActionListener(this);
helpItem.setActionCommand(COMMANDS.HELP_COMMAND.name());
menu.add(helpItem);
+
+ Menu infoMenu = new Menu(messages.getString(LABEL_INFOMENU));
+
+ MenuItem identityLinkItem = new MenuItem(messages.getString(LABEL_IDENTITYLINK));
+ identityLinkItem.addActionListener(this);
+ identityLinkItem.setActionCommand(COMMANDS.IDENTITYLINK_COMMAND.name());
+ infoMenu.add(identityLinkItem);
MenuItem pinItem = new MenuItem(messages.getString(LABEL_PIN));
pinItem.addActionListener(this);
@@ -114,8 +124,10 @@ public class MOCCAIcon implements StatusNotifier, ActionListener, ItemListener {
messages.getString(LABEL_ABOUT));
aboutItem.setActionCommand(COMMANDS.ABOUT_COMMAND.name());
aboutItem.addActionListener(this);
- menu.add(aboutItem);
+ infoMenu.add(aboutItem);
+ menu.add(infoMenu);
+
menu.addSeparator();
Menu settingsMenu = new Menu(messages.getString(LABEL_SETTINGS));
@@ -232,6 +244,11 @@ public class MOCCAIcon implements StatusNotifier, ActionListener, ItemListener {
controller.showHelp(messages.getLocale());
break;
+ case IDENTITYLINK_COMMAND:
+ log.debug("person identity link dialog requested via tray menu");
+ controller.personIdentityLink(messages.getLocale());
+ break;
+
default:
log.error("unknown tray menu command: " + e.getActionCommand());
}
diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/StatusNotifier.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/StatusNotifier.java
index a089d0b3..b2ee60cb 100644
--- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/StatusNotifier.java
+++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/StatusNotifier.java
@@ -49,6 +49,7 @@ public interface StatusNotifier {
public static final String ERROR_BIND = "tray.error.bind";
public static final String ERROR_CONFIG = "tray.error.config";
public static final String ERROR_PIN = "tray.error.pin.connect";
+ public static final String ERROR_IDENTITY_LINK = "tray.error.identity_link.connect";
public static final String ERROR_OPEN_URL = "tray.error.open.url";