From 5bb4d11327fcfe0fdc4234eeb02f4b09d108109e Mon Sep 17 00:00:00 2001 From: clemenso Date: Mon, 9 Nov 2009 17:05:57 +0000 Subject: applet version BKUFonts .project git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@536 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../at/gv/egiz/bku/online/applet/BKUApplet.java | 35 +++++++++++++++++----- BKUApplet/src/test/resources/appletTest.html | 5 ++-- BKUApplet/src/test/resources/appletviewer.policy | 3 ++ 3 files changed, 33 insertions(+), 10 deletions(-) create mode 100644 BKUApplet/src/test/resources/appletviewer.policy (limited to 'BKUApplet/src') 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 7a15f7a5..2094e55c 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 @@ -22,12 +22,14 @@ import at.gv.egiz.bku.gui.DefaultHelpListener; import at.gv.egiz.bku.gui.AbstractHelpListener; import at.gv.egiz.bku.gui.SwitchFocusListener; import at.gv.egiz.stal.service.translator.STALTranslator; + +import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.Locale; -import java.util.logging.Level; -import java.util.logging.Logger; +import java.util.jar.Attributes; +import java.util.jar.Manifest; import javax.net.ssl.HttpsURLConnection; import javax.swing.JApplet; import javax.swing.JPanel; @@ -79,14 +81,30 @@ public class BKUApplet extends JApplet { */ protected static final String TEST_SESSION_ID = "TestSession"; + public static final String VERSION; + public static final String UNKNOWN_VERSION = "UNKNOWN"; + static { - if (log.isTraceEnabled()) { - log.trace("enabling webservice communication dump"); - System.setProperty( - "com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump", - "true"); + String tmp = UNKNOWN_VERSION; + try { + String BKUAppletJar = BKUApplet.class.getProtectionDomain().getCodeSource().getLocation().toString(); + URL manifestURL = new URL("jar:" + BKUAppletJar + "!/META-INF/MANIFEST.MF"); + if (log.isTraceEnabled()) { + log.trace("read version information from " + manifestURL); + } + Manifest manifest = new Manifest(manifestURL.openStream()); + Attributes atts = manifest.getMainAttributes(); + if (atts != null) { + tmp = atts.getValue("Implementation-Build"); + } + } catch (IOException ex) { + log.error("failed to read version", ex); + } finally { + VERSION = tmp; + log.debug("BKU Applet " + VERSION); } } + /** * STAL */ @@ -119,13 +137,14 @@ public class BKUApplet extends JApplet { "URL for locating help files, e.g. '../help/' (no help provided if missing)"}}; } + /** * Factory method to create and wire HelpListener, GUI and BKUWorker. * (Config via applet parameters, see BKUApplet.* constants) */ @Override public void init() { - log.info("Welcome to MOCCA"); + log.info("Welcome to MOCCA " + VERSION); log.trace("Called init()"); showStatus("Initializing MOCCA applet"); diff --git a/BKUApplet/src/test/resources/appletTest.html b/BKUApplet/src/test/resources/appletTest.html index d1a0f6e2..85834763 100644 --- a/BKUApplet/src/test/resources/appletTest.html +++ b/BKUApplet/src/test/resources/appletTest.html @@ -21,6 +21,7 @@ +

Run applet test with appletviewer -J-Djava.security.policy=appletviewer.policy appletTest.html

@@ -29,10 +30,10 @@ - + - + diff --git a/BKUApplet/src/test/resources/appletviewer.policy b/BKUApplet/src/test/resources/appletviewer.policy new file mode 100644 index 00000000..c26e27b7 --- /dev/null +++ b/BKUApplet/src/test/resources/appletviewer.policy @@ -0,0 +1,3 @@ +grant { + permission java.security.AllPermission; +}; \ No newline at end of file -- cgit v1.2.3