summaryrefslogtreecommitdiff
path: root/BKUApplet
diff options
context:
space:
mode:
Diffstat (limited to 'BKUApplet')
-rw-r--r--BKUApplet/pom.xml19
-rw-r--r--BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java35
-rw-r--r--BKUApplet/src/test/resources/appletTest.html5
-rw-r--r--BKUApplet/src/test/resources/appletviewer.policy3
4 files changed, 52 insertions, 10 deletions
diff --git a/BKUApplet/pom.xml b/BKUApplet/pom.xml
index 4172517b..8f72b7d0 100644
--- a/BKUApplet/pom.xml
+++ b/BKUApplet/pom.xml
@@ -45,6 +45,22 @@
</executions>
</plugin>
<plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>maven-buildnumber-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>validate</phase>
+ <goals>
+ <goal>create</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <doCheck>false</doCheck>
+ <doUpdate>false</doUpdate>
+ </configuration>
+ </plugin>
+ <plugin>
<artifactId>maven-jar-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<executions>
@@ -62,6 +78,9 @@
<addClasspath>false</addClasspath>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
+ <manifestEntries>
+ <Implementation-Build>${project.version}-r${buildNumber}</Implementation-Build>
+ </manifestEntries>
</archive>
<alias>test-applet signer</alias>
<keystore>./keystore.ks</keystore>
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 @@
<link rel="shortcut icon" href="img/chip16.ico" type="image/x-icon">
</head>
<body>
+ <p>Run applet test with appletviewer -J-Djava.security.policy=appletviewer.policy appletTest.html</p>
<applet code="at.gv.egiz.bku.online.applet.BKUApplet.class"
archive="../BKUApplet-1.2.8-SNAPSHOT.jar, commons-logging.jar , iaik_jce_me4se.jar"
width=190 height=130 name="moccaapplet" id="moccaapplet">
@@ -29,10 +30,10 @@
<!--param name="Background" value="jar:file:/home/clemens/workspace/mocca/BKUApplet/target/BKUApplet-1.0-SNAPSHOT.jar!/images/help.png"/-->
<!--param name="Background" value="http://localhost:3495/img/BackgroundChipperling.png"/-->
<param name="BackgroundColor" value="#ff0000"/>
- <param name="WSDL_URL" value="https://danu.gv.at:3496/stal?wsdl"/>
+ <param name="WSDL_URL" value="https://localhost:8080/stal?wsdl"/>
<param name="HelpURL" value="http://apps.egiz.gv.at/bkuonline/help/"/>
<param name="SessionId" value="TestSession"/>
- <param name="RedirectURL" value="http://localhost:3495/bkuResult"/>
+ <param name="RedirectURL" value="http://www.google.com/bkuResult"/>
<param name="RedirectTarget" value="_parent"/>
</applet>
</body>
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