diff options
author | mcentner <mcentner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2008-08-29 12:11:34 +0000 |
---|---|---|
committer | mcentner <mcentner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2008-08-29 12:11:34 +0000 |
commit | 32d17447a258188b2d534bcb0bf65a659ba7b7d0 (patch) | |
tree | 4ad8bb267eb29f7091a7da283f6d7eec1e2188e1 | |
download | mocca-32d17447a258188b2d534bcb0bf65a659ba7b7d0.tar.gz mocca-32d17447a258188b2d534bcb0bf65a659ba7b7d0.tar.bz2 mocca-32d17447a258188b2d534bcb0bf65a659ba7b7d0.zip |
Initial import.
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@1 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
628 files changed, 79271 insertions, 0 deletions
diff --git a/BKUApplet/keystore.ks b/BKUApplet/keystore.ks Binary files differnew file mode 100644 index 00000000..824c3a40 --- /dev/null +++ b/BKUApplet/keystore.ks diff --git a/BKUApplet/pom.xml b/BKUApplet/pom.xml new file mode 100644 index 00000000..35672e51 --- /dev/null +++ b/BKUApplet/pom.xml @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>bku</artifactId>
+ <groupId>at.gv.egiz</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>at.gv.egiz</groupId>
+ <artifactId>BKUApplet</artifactId>
+ <name>BKU Applet</name>
+ <version>1.0-SNAPSHOT</version>
+ <description />
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack</id>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.outputDirectory}</outputDirectory>
+ <excludes>META-INF\/</excludes>
+ <artifactItems>
+ <artifactItem>
+ <groupId>at.gv.egiz</groupId>
+ <artifactId>smcc</artifactId>
+ <type>jar</type>
+ </artifactItem>
+ <artifactItem>
+ <groupId>at.gv.egiz</groupId>
+ <artifactId>smccSTAL</artifactId>
+ <type>jar</type>
+ </artifactItem>
+ <artifactItem>
+ <groupId>at.gv.egiz</groupId>
+ <artifactId>STAL</artifactId>
+ <type>jar</type>
+ </artifactItem>
+ <artifactItem>
+ <groupId>at.gv.egiz</groupId>
+ <artifactId>STALService</artifactId>
+ <type>jar</type>
+ </artifactItem>
+ <artifactItem>
+ <groupId>at.gv.egiz</groupId>
+ <artifactId>BKUCommonGUI</artifactId>
+ <type>jar</type>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>sign</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <archive>
+ <addMavenDescriptor>false</addMavenDescriptor>
+ <index>false</index>
+ <manifest>
+ <addClasspath>false</addClasspath>
+ <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+ </manifest>
+ </archive>
+ <alias>test-applet signer</alias>
+ <keystore>./keystore.ks</keystore>
+ <storepass>storepass</storepass>
+ <keypass>keypass</keypass>
+ <verify>true</verify>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>at.gv.egiz</groupId>
+ <artifactId>smcc</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>at.gv.egiz</groupId>
+ <artifactId>STAL</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>at.gv.egiz</groupId>
+ <artifactId>STALService</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>at.gv.egiz</groupId>
+ <artifactId>smccSTAL</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>at.gv.egiz</groupId>
+ <artifactId>BKUCommonGUI</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file diff --git a/BKUApplet/src/main/java/META-INF/MANIFEST.MF b/BKUApplet/src/main/java/META-INF/MANIFEST.MF new file mode 100644 index 00000000..5e949512 --- /dev/null +++ b/BKUApplet/src/main/java/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0
+Class-Path:
+
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 new file mode 100644 index 00000000..56cc5ea2 --- /dev/null +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java @@ -0,0 +1,101 @@ +/* +* 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.util.Locale; +import java.util.ResourceBundle; + +import javax.net.ssl.HttpsURLConnection; +import javax.swing.JApplet; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import at.gv.egiz.bku.gui.BKUGUIFacade; +import at.gv.egiz.bku.gui.BKUGUIFactory; + +/** + * + * + * + */ +public class BKUApplet extends JApplet { + + private static Log log = LogFactory.getLog(BKUApplet.class); + + public final static String RESOURCE_BUNDLE_BASE = "at/gv/egiz/bku/online/applet/Messages"; + + public final static String LOCALE_PARAM_KEY = "Locale"; + public final static String LOGO_URL_KEY="LogoURL"; + public final static String WSDL_URL="WSDL_URL"; + public final static String SESSION_ID="SessionID"; + + protected ResourceBundle resourceBundle; + protected BKUWorker worker; + protected Thread workerThread; + + public BKUApplet() { + } + + public void init() { + log.debug("Called init()"); + try { + HttpsURLConnection.setDefaultSSLSocketFactory(InternalSSLSocketFactory.getSocketFactory()); + HttpsURLConnection.setDefaultHostnameVerifier(InternalSSLSocketFactory.getHostNameVerifier()); + } catch (InternalSSLSocketFactoryException e) { + log.error(e); + } + String localeString = getMyAppletParameter(LOCALE_PARAM_KEY); + if (localeString != null) { + resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_BASE, + new Locale(localeString)); + } else { + resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_BASE); + } + BKUGUIFacade gui = BKUGUIFactory.createGUI(); + gui.init(getContentPane(), localeString); + worker = new BKUWorker(gui, this, resourceBundle); + } + + public void start() { + log.debug("Called start()"); + workerThread = new Thread(worker); + workerThread.start(); + } + + public void stop() { + log.debug("Called stop()"); + if ((workerThread != null) && (workerThread.isAlive())) { + workerThread.interrupt(); + } + } + + public void destroy() { + log.debug("Called destroy()"); + } + + /** + * Applet configuration parameters + * + * @param paramKey + * @return + */ + public String getMyAppletParameter(String paramKey) { + log.info("Getting parameter: "+paramKey+ ": "+ getParameter(paramKey)); + return getParameter(paramKey); + } +} diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java new file mode 100644 index 00000000..38fd6428 --- /dev/null +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java @@ -0,0 +1,286 @@ +/* +* 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.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ResourceBundle;
+
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import at.gv.egiz.bku.gui.BKUGUIFacade;
+import at.gv.egiz.bku.smccstal.AbstractSMCCSTAL;
+import at.gv.egiz.bku.smccstal.SMCCSTALRequestHandler;
+import at.gv.egiz.smcc.SignatureCard;
+import at.gv.egiz.smcc.util.SMCCHelper;
+import at.gv.egiz.stal.QuitRequest;
+import at.gv.egiz.stal.STALRequest;
+import at.gv.egiz.stal.STALResponse;
+import at.gv.egiz.stal.service.GetNextRequestResponseType;
+import at.gv.egiz.stal.service.GetNextRequestType;
+import at.gv.egiz.stal.service.ObjectFactory;
+import at.gv.egiz.stal.service.STALPortType;
+import at.gv.egiz.stal.service.STALService;
+
+public class BKUWorker extends AbstractSMCCSTAL implements Runnable,
+ ActionListener, SMCCSTALRequestHandler {
+
+ private static Log log = LogFactory.getLog(BKUWorker.class);
+
+ protected BKUGUIFacade gui;
+ protected BKUApplet parent;
+ private STALPortType stalPort;
+ protected List<String> actionCommandList = new ArrayList<String>();
+ protected Boolean actionPerformed = false;
+ protected boolean finished = false;
+ protected ResourceBundle errorMessages;
+
+ /**
+ *
+ * @param gui
+ * must not be null
+ */
+ public BKUWorker(BKUGUIFacade gui, BKUApplet parent,
+ ResourceBundle errorMessageBundle) {
+ if ((gui == null) || (parent == null) || (errorMessageBundle == null)) {
+ throw new NullPointerException("Parameter must not be set to null");
+ }
+ this.gui = gui;
+ this.parent = parent;
+ this.errorMessages = errorMessageBundle;
+ addRequestHandler(QuitRequest.class, this);
+ }
+
+ private STALPortType getSTALPort() throws MalformedURLException {
+ URL wsdlURL = null;
+ String wsdlLocation = parent.getMyAppletParameter(BKUApplet.WSDL_URL);
+ URL codebase = parent.getCodeBase();
+ log.debug("Connecting to webservice: " + wsdlLocation);
+ if (wsdlLocation != null) {
+ try {
+ if (codebase.getProtocol().equalsIgnoreCase("file")) {
+ // for debugging in appletrunner
+ wsdlURL = new URL(wsdlLocation);
+ } else {
+ wsdlURL = new URL(codebase, wsdlLocation);
+ }
+ } catch (MalformedURLException ex) {
+ log.fatal("Paremeter 'wsdlLocation' is not a vailid URL.", ex);
+ throw new MalformedURLException(ex.getMessage());
+ }
+ } else {
+ log.fatal("Paremeter 'wsdlLocation' is not set.");
+ throw new MalformedURLException("Null WSDL url");
+ }
+ log.debug("Found WSDL url: " + wsdlURL);
+ QName endpointName = new QName("http://www.egiz.gv.at/wsdl/stal",
+ "STALService");
+ STALService stal = new STALService(wsdlURL, endpointName);
+ return stal.getSTALPort();
+ }
+
+ @Override
+ public void run() {
+ gui.showWelcomeDialog();
+ try {
+ stalPort = getSTALPort();
+ } catch (Exception e) {
+ log.fatal("Failed to call STAL service.", e);
+ actionCommandList.clear();
+ actionCommandList.add("ok");
+ gui.showErrorDialog(errorMessages.getString("failed.WS"));
+ try {
+ waitForAction();
+ } catch (InterruptedException e1) {
+ log.error(e1);
+ }
+ return;
+ }
+
+ ObjectFactory factory = new ObjectFactory();
+ GetNextRequestType nextRequest = factory.createGetNextRequestType();
+
+ String sessionId = parent.getMyAppletParameter(BKUApplet.SESSION_ID);
+ if (sessionId == null) {
+ // use the testsession for testing
+ sessionId = "TestSession";
+ }
+ nextRequest.setSessionId(sessionId);
+ do {
+ GetNextRequestResponseType resp = stalPort.getNextRequest(nextRequest);
+ log.info("Got " + resp.getRequest().size() + " requests from server.");
+ List<STALRequest> stalRequests = resp.getRequest();
+ List<STALResponse> responses = handleRequest(stalRequests);
+ log.info("Got " + responses.size() + " responses.");
+ nextRequest = factory.createGetNextRequestType();
+ nextRequest.setSessionId(sessionId);
+ nextRequest.getResponse().addAll(responses);
+ } while (!finished);
+ log.info("Done " + Thread.currentThread().getName());
+ gui.showWelcomeDialog();
+ sendRedirect();
+ }
+
+ protected void sendRedirect() {
+ log.info("Done, sending redirect to get BKU response");
+ String redirectURL = parent.getMyAppletParameter("redirectURL");
+ String redirectTarget = parent.getMyAppletParameter("redirectTarget");
+ log.info("Redirecting to: " + redirectURL + " target: " + redirectTarget);
+ URL url = null;
+ if (redirectURL != null) {
+ try {
+ url = new URL(parent.getCodeBase(),redirectURL + ";jsessionid="
+ + parent.getMyAppletParameter(BKUApplet.SESSION_ID));
+ } catch (MalformedURLException ex) {
+ log.warn("Parameter 'redirectURL': " + redirectURL
+ + " not a valid URL.", ex);
+ // gui.showErrorDialog(errorMsg, okListener, actionCommand)
+ }
+ if (url != null) {
+ if (redirectTarget == null) {
+ log.info("Done. Trying to redirect to " + url + " ...");
+ parent.getAppletContext().showDocument(url);
+ } else {
+ log.info("Done. Trying to redirect to " + url + " (target="
+ + redirectTarget + ") ...");
+ parent.getAppletContext().showDocument(url, redirectTarget);
+ }
+ }
+ } else {
+ log.error("No redirect URL set");
+ }
+ }
+
+ protected synchronized void waitForAction() throws InterruptedException {
+ log.info("Waiting for Action");
+ while (!actionPerformed) {
+ wait();
+ }
+ actionPerformed = false;
+ }
+
+ protected synchronized void actionOccured() {
+ log.info("Received Action");
+ actionPerformed = true;
+ notifyAll();
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ log.info("Action: " + e);
+ if (actionCommandList != null) {
+ if (actionCommandList.contains(e.getActionCommand())) {
+ actionOccured();
+ }
+ } else {
+ actionOccured();
+ }
+ }
+
+ @Override
+ protected boolean waitForCard() {
+ SMCCHelper smccHelper = new SMCCHelper();
+ actionCommandList.clear();
+ actionCommandList.add("cancel");
+ // while no sigcard found or cancel button pressed
+ int oldValue = SMCCHelper.PC_SC_NOT_SUPPORTED; // this is a save default
+ while ((signatureCard == null) && (!actionPerformed)) {
+ switch (smccHelper.getResultCode()) {
+ case SMCCHelper.PC_SC_NOT_SUPPORTED:
+ actionCommandList.clear();
+ actionCommandList.add("ok");
+ gui.showErrorDialog(errorMessages.getString("nopcscsupport"), this,
+ "ok");
+ try {
+ waitForAction();
+ } catch (InterruptedException e) {
+ log.error(e);
+ }
+ return true;
+ case SMCCHelper.TERMINAL_NOT_PRESENT:
+ actionCommandList.clear();
+ actionCommandList.add("ok");
+ gui.showErrorDialog(errorMessages.getString("nocardterminal"), this,
+ "ok");
+ try {
+ waitForAction();
+ } catch (InterruptedException e) {
+ log.error(e);
+ }
+ return true;
+ case SMCCHelper.CARD_NOT_SUPPORTED:
+ if (oldValue != SMCCHelper.CARD_NOT_SUPPORTED) {
+ actionCommandList.clear();
+ actionCommandList.add("cancel");
+ gui.showCardNotSupportedDialog(this, "cancel");
+ oldValue = SMCCHelper.CARD_NOT_SUPPORTED;
+ }
+ break;
+ case SMCCHelper.NO_CARD:
+ if (oldValue != SMCCHelper.NO_CARD) {
+ actionCommandList.clear();
+ actionCommandList.add("cancel");
+ gui.showInsertCardDialog(this, "cancel");
+ oldValue = SMCCHelper.NO_CARD;
+ }
+ break;
+ case SMCCHelper.CARD_FOUND:
+ gui.showWelcomeDialog();
+ signatureCard = smccHelper.getSignatureCard(errorMessages.getLocale());
+ return false;
+ }
+ smccHelper.update(3000);
+ }
+ return signatureCard == null;
+ }
+
+ @Override
+ public STALResponse handleRequest(STALRequest request) {
+ if (request instanceof QuitRequest) {
+ finished = true;
+ } else {
+ log.error("Unexpected request to handle: " + request);
+ }
+ return null;
+ }
+
+ @Override
+ public void init(SignatureCard sc, BKUGUIFacade gui) {
+ }
+
+ @Override
+ public SMCCSTALRequestHandler newInstance() {
+ return this;
+ }
+
+ @Override
+ public boolean requireCard() {
+ return false;
+ }
+
+ @Override
+ protected BKUGUIFacade getGUI() {
+ return gui;
+ }
+}
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactory.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactory.java new file mode 100644 index 00000000..ab04d2b6 --- /dev/null +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactory.java @@ -0,0 +1,101 @@ +/* +* 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. +*/ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package at.gv.egiz.bku.online.applet; + +import java.io.IOException; +import java.security.KeyManagementException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.UnrecoverableKeyException; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; + +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; +import javax.net.ssl.SSLSocketFactory; +import javax.net.ssl.X509TrustManager; + +public class InternalSSLSocketFactory { + + private SSLSocketFactory factory; + + public static SSLSocketFactory getSocketFactory() throws InternalSSLSocketFactoryException { + return new InternalSSLSocketFactory().factory; + } + + public static HostnameVerifier getHostNameVerifier() throws InternalSSLSocketFactoryException { + return (new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }); + } + + public InternalSSLSocketFactory() throws InternalSSLSocketFactoryException { + SSLContext sslContext; + try { + sslContext = SSLContext.getInstance("TLSv1"); + sslContext.getClientSessionContext().setSessionTimeout(0); + KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance("SunX509"); + + KeyStore keyStore = KeyStore.getInstance("JKS"); + keyStore.load(null, null); + keyManagerFactory.init(keyStore, null); + + sslContext.init(keyManagerFactory.getKeyManagers(), + new X509TrustManager[] { new AcceptAllTrustManager() }, + null); + } catch (NoSuchAlgorithmException e) { + throw new InternalSSLSocketFactoryException(e); + } catch (CertificateException e) { + throw new InternalSSLSocketFactoryException(e); + } catch (IOException e) { + throw new InternalSSLSocketFactoryException(e); + } catch (KeyStoreException e) { + throw new InternalSSLSocketFactoryException(e); + } catch (UnrecoverableKeyException e) { + throw new InternalSSLSocketFactoryException(e); + } catch (KeyManagementException e) { + throw new InternalSSLSocketFactoryException(e); + } + + this.factory = sslContext.getSocketFactory(); + } + + class AcceptAllTrustManager implements X509TrustManager { + + public X509Certificate[] getAcceptedIssuers() { + return null; + } + + public void checkClientTrusted(X509Certificate[] chain, String authType) { + } + + public void checkServerTrusted(X509Certificate[] chain, String authType) { + //FIXME + } + } +}; diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactoryException.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactoryException.java new file mode 100644 index 00000000..c620284a --- /dev/null +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactoryException.java @@ -0,0 +1,45 @@ +/* +* 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. +*/ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package at.gv.egiz.bku.online.applet; + +/** + * + * @author mcentner + */ +public class InternalSSLSocketFactoryException extends Exception { + + public InternalSSLSocketFactoryException(Throwable cause) { + super(cause); + } + + public InternalSSLSocketFactoryException(String message, Throwable cause) { + super(message, cause); + } + + public InternalSSLSocketFactoryException(String message) { + super(message); + } + + public InternalSSLSocketFactoryException() { + } + +} diff --git a/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/Messages.properties b/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/Messages.properties new file mode 100644 index 00000000..752004e8 --- /dev/null +++ b/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/Messages.properties @@ -0,0 +1,58 @@ +# 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. + +# -------- BEGIN bootstrap applet -----------# +java16required=<html>This Applet requires Java 1.6 or higher to run. \ + Please download and install a recent version of Java. \ + <p>For Windows, Linux and Solaris plattforms you can download Java from \ + <a href='http://java.sun.com/javase/downloads'>http://java.sun.com/javase/downloads</a>.\ + </p></html> + +failedtostart=<html>Failed to start Applet. \ + <p><pre>{0}</pre></p></html> +# -------- END bootstrap applet -----------# + + +applet.name=Online Citicen Card Environment (CCE) + +nopcscsupport=The Java plattform does not seem to provide \ +a PC/SC interface to acces a smartcard. + +nocardterminal=Can not find a connected smartcard reader.\ + <p>Either there is no smartcard reader connected, or \ + no PC/SC driver is installed for a connected smartcard reader.</p> + +insertcard=Please insert your citicen card (B\u00FCrgerkarte) into your \ + smartcard reader. + +unsupportedcard=The inserted smartcard is not supported.\ + <p>Please insert your citicen card (B\u00FCrgerkarte) \ + into your smartcard reader.</p> + +enterpin=Please enter {0} \(min {1}, max {2} digits\). + +enterpinretries=Please enter {0} \(min {1}, max {2} digits, {3} retries left\). + +pinwrong=Entered PIN is wrong. + +button.ok=Ok + +button.cancel=Cancel + +status.findpcsc=Looking for PC/SC support + +status.findsupportedcard=Looking for a supported smartcard + +failed.WS=Webservice cannot be reached.
\ No newline at end of file diff --git a/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/Messages_de.properties b/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/Messages_de.properties new file mode 100644 index 00000000..e6b815e9 --- /dev/null +++ b/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/Messages_de.properties @@ -0,0 +1,42 @@ +# 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. + +# -------- BEGIN bootstrap applet -----------# +java16required=<html>Dieses Applet ben\u00F6tigt Java Version 1.6 oder h\u00F6her. \ + Bitte installieren sie eine aktulle Version von Java. \ + <p>F\u00FCr Windows, Linux and Solaris kann Java von \ + <a href='http://java.sun.com/javase/downloads'>http://java.sun.com/javase/downloads</a> \ + heruntergeladen werden.</p></html> + +failedtostart=<html>Das Applet konnte nicht gestartet werden. \ + <p><pre>{0}</pre></p></html> +# -------- END bootstrap applet -----------# + +applet.name=Online B\u00FCrgerkartenumgebung (BKU) + +nopcscsupport=Die Java-Installation stellt keine \ + PC/SC-Schnittstelle zum Zugriff auf eine Chipkarte zur Verf\u00FCgung. + +nocardterminal=Es konnte kein Chipkartenleser gefunden werden.\ + <p>Entweder, es ist kein Chipkartenleser angeschlossen, oder \ + f\u00FCr den angeschlossenen Chipkartenleser ist kein PC/SC-Treiber \ + installiert.</p> + +insertcard=Bitte stecken Sie ihre B\u00FCrgerkarte in den Chipkartenleser. + +unsupportedcard=Die gesteckte Chipkarte wird nicht unterst\u00FCtzt.\ + <p>Bitte stecken Sie ihre B\u00FCrgerkare in den Chipkartenleser</p> + +failed.WS=Das Webservice kann nicht erreicht werden.
\ No newline at end of file diff --git a/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/images/logo.png b/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/images/logo.png Binary files differnew file mode 100644 index 00000000..eee4be4f --- /dev/null +++ b/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/images/logo.png diff --git a/BKUApplet/src/test/java/at/gv/egiz/stal/client/STALServiceTest.java b/BKUApplet/src/test/java/at/gv/egiz/stal/client/STALServiceTest.java new file mode 100644 index 00000000..9b58798d --- /dev/null +++ b/BKUApplet/src/test/java/at/gv/egiz/stal/client/STALServiceTest.java @@ -0,0 +1,96 @@ +/* +* 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. +*/ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package at.gv.egiz.stal.client; + +import static org.junit.Assert.assertNotNull; + +import java.net.MalformedURLException; +import java.net.URL; + +import javax.xml.namespace.QName; + +import org.junit.Test; + +import at.gv.egiz.stal.InfoboxReadRequest; +import at.gv.egiz.stal.STALRequest; +import at.gv.egiz.stal.service.GetHashDataInputFault; +import at.gv.egiz.stal.service.GetHashDataInputResponseType; +import at.gv.egiz.stal.service.GetHashDataInputType; +import at.gv.egiz.stal.service.GetNextRequestResponseType; +import at.gv.egiz.stal.service.GetNextRequestType; +import at.gv.egiz.stal.service.STALPortType; +import at.gv.egiz.stal.service.STALService; + +/** + * + * @author clemens + */ +public class STALServiceTest { + +// @Test + public void callSTAL() { + try { + URL endpointURL = new URL("http://localhost:8080/bkuonline/stal?wsdl"); + QName endpointName = new QName("http://www.egiz.gv.at/wsdl/stal", "STALService"); + STALService stal = new STALService(endpointURL, endpointName); +// stal = new STALService(); + STALPortType port = stal.getSTALPort(); + + GetNextRequestType nrReq = new GetNextRequestType(); + nrReq.setSessionId("TestSession"); //STALServiceImpl.TEST_SESSION_ID); +// req.getResponse().add(new ErrorResponse(1234)); + GetNextRequestResponseType nrResp = port.getNextRequest(nrReq); + assertNotNull(nrResp); + System.out.println("got response: " + nrResp.getRequest().size()); + for (STALRequest stalReq : nrResp.getRequest()) { + if (stalReq instanceof InfoboxReadRequest) { + String ibid = ((InfoboxReadRequest) stalReq).getInfoboxIdentifier(); + String did = ((InfoboxReadRequest) stalReq).getDomainIdentifier(); + System.out.println(" received InfoboxReadRequest for " + ibid + ", " + did); + } else { + System.out.println(" received STAL request " + stalReq.getClass().getName()); + } + } + + GetHashDataInputType hdReq = new GetHashDataInputType(); + hdReq.setSessionId("TestSession"); //STALServiceImpl.TEST_SESSION_ID); + GetHashDataInputType.Reference ref = new GetHashDataInputType.Reference(); + ref.setID("refId"); + hdReq.getReference().add(ref); + GetHashDataInputResponseType hdResp = port.getHashDataInput(hdReq); + GetHashDataInputResponseType.Reference hdRef = hdResp.getReference().get(0); + System.out.println("got HashDataInput " + new String(hdRef.getValue())); + + + } catch (GetHashDataInputFault ex) { + ex.printStackTrace(); + } catch (MalformedURLException ex) { + ex.printStackTrace(); + } + } + + @Test + public void testSTAL() { + //TODO + } + +} diff --git a/BKUCommonGUI/pom.xml b/BKUCommonGUI/pom.xml new file mode 100644 index 00000000..bd579c51 --- /dev/null +++ b/BKUCommonGUI/pom.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>bku</artifactId>
+ <groupId>at.gv.egiz</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>at.gv.egiz</groupId>
+ <artifactId>BKUCommonGUI</artifactId>
+ <name>BKU Common GUI</name>
+ <version>1.0-SNAPSHOT</version>
+ <description />
+ <dependencies>
+ <dependency>
+ <groupId>at.gv.egiz</groupId>
+ <artifactId>smcc</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+ <!--build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build-->
+</project>
\ No newline at end of file diff --git a/BKUCommonGUI/src/main/java/META-INF/MANIFEST.MF b/BKUCommonGUI/src/main/java/META-INF/MANIFEST.MF new file mode 100644 index 00000000..5e949512 --- /dev/null +++ b/BKUCommonGUI/src/main/java/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0
+Class-Path:
+
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java new file mode 100644 index 00000000..87b4eab4 --- /dev/null +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java @@ -0,0 +1,909 @@ +/* +* 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. +*/ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package at.gv.egiz.bku.gui; + +import at.gv.egiz.smcc.PINSpec; +import java.awt.Color; +import java.awt.Container; +import java.awt.Cursor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.text.MessageFormat; +import java.util.List; +import java.util.Locale; +import java.util.ResourceBundle; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import javax.swing.GroupLayout; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JPasswordField; +import javax.swing.LayoutStyle; +import javax.swing.SwingUtilities; +import javax.swing.filechooser.FileFilter; +import javax.swing.text.AttributeSet; +import javax.swing.text.BadLocationException; +import javax.swing.text.PlainDocument; + +/** + * + * @author clemens + */ +public class BKUGUI implements BKUGUIFacade { + + public static final String MESSAGES_BUNDLE = "at/gv/egiz/bku/gui/Messages"; + public static final String LOGO_RESOURCE = "/images/logo.png"; + + public static final int MAIN_PANEL_WIDTH = 100; +// public static final int MAIN_PANEL_HEIGHT = 20; + public static final int PREF_SIZE_PINFIELD = 118; + public static final Color ERROR_COLOR = Color.RED; + public static final Color HYPERLINK_COLOR = Color.BLUE; + + private static final String TITLE_WELCOME = "title.welcome"; + private static final String TITLE_INSERTCARD = "title.insertcard"; + private static final String TITLE_CARD_NOT_SUPPORTED = "title.cardnotsupported"; + private static final String TITLE_CARDPIN = "title.cardpin"; + private static final String TITLE_SIGN = "title.sign"; + private static final String TITLE_ERROR = "title.error"; + private static final String TITLE_RETRY = "title.retry"; + private static final String WINDOWTITLE_SAVE = "windowtitle.save"; + + private static final String MESSAGE_WAIT="message.wait"; + private static final String MESSAGE_INSERTCARD="message.insertcard"; + private static final String MESSAGE_HASHDATALINK="message.hashdatalink"; + private static final String MESSAGE_RETRIES="message.retries"; + private static final String LABEL_PIN="label.pin"; + private static final String LABEL_PINSIZE="label.pinsize"; +// private static final String LABEL_CARDPINSIZE="label.cardpinsize"; +// private static final String LABEL_SIGNPIN="label.signpin"; +// private static final String LABEL_SIGNPINSIZE="label.signpinsize"; + private static final String BUTTON_OK = "button.ok"; + private static final String BUTTON_CANCEL = "button.cancel"; + private static final String BUTTON_SIGN = "button.sign"; + + private static final String MIMETYPE_DESC_XML = "mimetype.desc.xml"; + private static final String MIMETYPE_DESC_TXT = "mimetype.desc.txt"; + private static final String MIMETYPE_DESC_PDF = "mimetype.desc.pdf"; + private static final String MIMETYPE_DESC_BIN = "mimetype.desc.bin"; + private static final String SAVE_HASHDATAINPUT_PREFIX = "save.hashdatainput.prefix"; + + protected Container contentPane; + protected ResourceBundle messages; + + /** left and right side main panels */ + protected JPanel iconPanel; + protected JPanel contentPanel; + /** right side content panels and layouts */ + protected JPanel headerPanel; + protected JPanel mainPanel; + protected JPanel buttonPanel; + /** right side fixed labels */ + protected JLabel titleLabel; + /** remember the pinfield to return to worker */ + protected JPasswordField pinField; + + /** + * @param contentPane + * @param localeString may be null + */ + @Override + public void init(final Container contentPane, String localeString) { + + if (localeString != null) { + messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, new Locale(localeString)); + } else { + messages = ResourceBundle.getBundle(MESSAGES_BUNDLE); + } + + this.contentPane = contentPane; + + try { + + SwingUtilities.invokeAndWait(new Runnable() { + + public void run() { + + initIconPanel(); + initContentPanel(); + + GroupLayout layout = new GroupLayout(contentPane); + contentPane.setLayout(layout); + layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(iconPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(contentPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); + layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(iconPanel, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(contentPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); + } + }); + } catch (Exception ex) { + throw new RuntimeException("Failed to init GUI: " + ex.getMessage()); + } + } + + protected void initIconPanel() { + iconPanel = new JPanel(); + JLabel iconLabel = new JLabel(); + iconLabel.setIcon(new ImageIcon(getClass().getResource(LOGO_RESOURCE))); // NOI18N + + GroupLayout iconPanelLayout = new GroupLayout(iconPanel); + iconPanel.setLayout(iconPanelLayout); + iconPanelLayout.setHorizontalGroup( + iconPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(iconPanelLayout.createSequentialGroup().addContainerGap().addComponent(iconLabel).addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); + iconPanelLayout.setVerticalGroup( + iconPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(iconPanelLayout.createSequentialGroup().addContainerGap().addComponent(iconLabel, GroupLayout.PREFERRED_SIZE, 105, GroupLayout.PREFERRED_SIZE).addContainerGap(41, Short.MAX_VALUE))); + } + + protected void initContentPanel() { + + contentPanel = new JPanel(); + + headerPanel = new JPanel(); + mainPanel = new JPanel(); + buttonPanel = new JPanel(); + +// headerPanel.setBorder(new TitledBorder("header")); +// mainPanel.setBorder(new TitledBorder("main")); +// buttonPanel.setBorder(new TitledBorder("button")); + + titleLabel = new JLabel(); + titleLabel.setFont(titleLabel.getFont().deriveFont(titleLabel.getFont().getStyle() | + java.awt.Font.BOLD, titleLabel.getFont().getSize() + 2)); +// titleLabel.setForeground(defaultForground); + + GroupLayout headerPanelLayout = new GroupLayout(headerPanel); + headerPanel.setLayout(headerPanelLayout); + + headerPanelLayout.setHorizontalGroup( + headerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(titleLabel, GroupLayout.DEFAULT_SIZE, 225, Short.MAX_VALUE)); + headerPanelLayout.setVerticalGroup( + headerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(titleLabel)); + +// mainPanel.setPreferredSize(new Dimension(MAIN_PANEL_WIDTH, MAIN_PANEL_HEIGHT)); + + GroupLayout contentPanelLayout = new GroupLayout(contentPanel); + contentPanel.setLayout(contentPanelLayout); + contentPanelLayout.setHorizontalGroup( + contentPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(contentPanelLayout.createSequentialGroup() + .addContainerGap() + .addGroup(contentPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(headerPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(mainPanel, GroupLayout.DEFAULT_SIZE, MAIN_PANEL_WIDTH, Short.MAX_VALUE) + .addComponent(buttonPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))); + contentPanelLayout.setVerticalGroup( + contentPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(contentPanelLayout.createSequentialGroup() + .addContainerGap() + .addComponent(headerPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(mainPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) //79, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(buttonPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addContainerGap())); + } + + @Override + public void showLoginDialog(ActionListener loginListener, String actionCommand) { + SwingUtilities.invokeLater(new Runnable() { + + public void run() { + mainPanel.removeAll(); + buttonPanel.removeAll(); + + titleLabel.setText(messages.getString(TITLE_ERROR)); +// titleLabel.setForeground(defaultForground); + + JLabel waitMsgLabel = new JLabel(); + waitMsgLabel.setFont(waitMsgLabel.getFont().deriveFont(waitMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + waitMsgLabel.setText("<html>LoginDialog not supported yet.</html>"); + waitMsgLabel.setForeground(ERROR_COLOR); + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(waitMsgLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)); + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(waitMsgLabel)); + + contentPanel.validate(); + } + }); + } + + @Override + public void showWelcomeDialog() { + SwingUtilities.invokeLater(new Runnable() { + + public void run() { + mainPanel.removeAll(); + buttonPanel.removeAll(); + + titleLabel.setText(messages.getString(TITLE_WELCOME)); +// titleLabel.setForeground(defaultForground); + + JLabel waitMsgLabel = new JLabel(); + waitMsgLabel.setFont(waitMsgLabel.getFont().deriveFont(waitMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + waitMsgLabel.setText(messages.getString(MESSAGE_WAIT)); + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(waitMsgLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)); + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(waitMsgLabel)); + + contentPanel.validate(); + + } + }); + } + + @Override + public void showInsertCardDialog(final ActionListener cancelListener, final String cancelCommand) { + SwingUtilities.invokeLater(new Runnable() { + + public void run() { + mainPanel.removeAll(); + buttonPanel.removeAll(); + + titleLabel.setText(messages.getString(TITLE_INSERTCARD)); +// titleLabel.setForeground(defaultForground); + + JButton cancelButton = new JButton(); + cancelButton.setFont(cancelButton.getFont()); + cancelButton.setText(messages.getString(BUTTON_CANCEL)); + cancelButton.addActionListener(cancelListener); + cancelButton.setActionCommand(cancelCommand); + + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); + + buttonPanelLayout.setHorizontalGroup( + buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup() + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(cancelButton) + .addContainerGap())); + buttonPanelLayout.setVerticalGroup( + buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(cancelButton)); + + contentPanel.validate(); + } + }); + } + + @Override + public void showCardNotSupportedDialog(final ActionListener cancelListener, final String cancelCommand) { + SwingUtilities.invokeLater(new Runnable() { + + public void run() { + mainPanel.removeAll(); + buttonPanel.removeAll(); + + titleLabel.setText(messages.getString(TITLE_CARD_NOT_SUPPORTED)); +// titleLabel.setForeground(defaultForground); + + JButton cancelButton = new JButton(); + cancelButton.setFont(cancelButton.getFont()); + cancelButton.setText(messages.getString(BUTTON_CANCEL)); + cancelButton.addActionListener(cancelListener); + cancelButton.setActionCommand(cancelCommand); + + JLabel errorMsgLabel = new JLabel(); + errorMsgLabel.setFont(errorMsgLabel.getFont().deriveFont(errorMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + errorMsgLabel.setText(messages.getString(MESSAGE_INSERTCARD)); + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(errorMsgLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)); + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(errorMsgLabel)); + + + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); + + buttonPanelLayout.setHorizontalGroup( + buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup() + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(cancelButton) + .addContainerGap())); + buttonPanelLayout.setVerticalGroup( + buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(cancelButton)); + + contentPanel.validate(); + } + }); + } + + private void showCardPINDialog(final PINSpec pinSpec, final int numRetries, final ActionListener okListener, final String okCommand, final ActionListener cancelListener, final String cancelCommand) { + SwingUtilities.invokeLater(new Runnable() { + + public void run() { + + mainPanel.removeAll(); + buttonPanel.removeAll(); + + if (numRetries < 0) { + String cardpinTitle = messages.getString(TITLE_CARDPIN); + titleLabel.setText(MessageFormat.format(cardpinTitle, new Object[] {pinSpec.getLocalizedName()})); + } else { + titleLabel.setText(messages.getString(TITLE_RETRY)); + } + + JButton cancelButton = new JButton(); + cancelButton.setFont(cancelButton.getFont()); + cancelButton.setText(messages.getString(BUTTON_CANCEL)); + cancelButton.setActionCommand(cancelCommand); + cancelButton.addActionListener(cancelListener); + + JButton okButton = new JButton(); + okButton.setEnabled(false); + okButton.setFont(okButton.getFont()); + okButton.setText(messages.getString(BUTTON_OK)); + okButton.setActionCommand(okCommand); + okButton.addActionListener(okListener); + + JLabel cardPinLabel = new JLabel(); + cardPinLabel.setFont(cardPinLabel.getFont().deriveFont(cardPinLabel.getFont().getStyle() | java.awt.Font.BOLD)); + String pinLabel = messages.getString(LABEL_PIN); + cardPinLabel.setText(MessageFormat.format(pinLabel, new Object[] {pinSpec.getLocalizedName()})); + +// JPasswordField cardPINField = new JPasswordField(); + pinField = new JPasswordField(); + pinField.setText(""); + pinField.setDocument(new PINDocument(pinSpec, okButton)); + pinField.setActionCommand(okCommand); + pinField.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + if (pinField.getPassword().length >= pinSpec.getMinLength()) { + okListener.actionPerformed(e); + } + } + }); + + JLabel infoLabel = new JLabel(); + if (numRetries < 0) { + infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + String pinsizePattern = messages.getString(LABEL_PINSIZE); + String pinSize = String.valueOf(pinSpec.getMinLength()); + if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { + pinSize += "-" + pinSpec.getMaxLength(); + } + infoLabel.setText(MessageFormat.format(pinsizePattern, new Object[] {pinSize})); + } else { + infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[] {String.valueOf(numRetries)})); + infoLabel.setForeground(ERROR_COLOR); + } + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + +// GroupLayout.ParallelGroup mainGroup = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING); +// mainGroup.addComponent(pinSizeLabel) //, GroupLayout.DEFAULT_SIZE, PREF_SIZE_PINFIELD, Short.MAX_VALUE) +// .addComponent(pinField, GroupLayout.DEFAULT_SIZE, PREF_SIZE_PINFIELD, Short.MAX_VALUE); + + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(mainPanelLayout.createSequentialGroup() // .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + // .addComponent(hashDataLabel) + // .addGroup(GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup() + .addComponent(cardPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) //RELATED) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) //TRAILING) + .addComponent(infoLabel) //, GroupLayout.DEFAULT_SIZE, PREF_SIZE_PINFIELD, Short.MAX_VALUE) + .addComponent(pinField, GroupLayout.DEFAULT_SIZE, PREF_SIZE_PINFIELD, Short.MAX_VALUE)) //)) + .addContainerGap())); + + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(mainPanelLayout.createSequentialGroup() + .addContainerGap() // .addComponent(hashDataLabel).addGap(14, 14, 14) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) //, false) + .addComponent(cardPinLabel) //, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) + .addComponent(pinField)) //, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(infoLabel).addGap(cardPinLabel.getFont().getSize()))); //10, 10, 10))); + + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); + + buttonPanelLayout.setHorizontalGroup( + buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup() + .addContainerGap(15, Short.MAX_VALUE) + .addComponent(okButton) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(cancelButton).addContainerGap())); + buttonPanelLayout.setVerticalGroup( + buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(okButton).addComponent(cancelButton))); + + pinField.requestFocusInWindow(); + contentPanel.validate(); + + } + }); + } + + @Override + public void showCardPINDialog(PINSpec pinSpec, ActionListener okListener, String okCommand, ActionListener cancelListener, String cancelCommand) { + showCardPINDialog(pinSpec, -1, okListener, okCommand, cancelListener, cancelCommand); + } + + @Override + public void showCardPINRetryDialog(PINSpec pinSpec, int numRetries, ActionListener okListener, String okCommand, ActionListener cancelListener, String cancelCommand) { + showCardPINDialog(pinSpec, numRetries, okListener, okCommand, cancelListener, cancelCommand); + } + + @Override + public void showSignaturePINDialog(PINSpec pinSpec, ActionListener signListener, String signCommand, ActionListener cancelListener, String cancelCommand, ActionListener hashdataListener, String hashdataCommand) { + showSignaturePINDialog(pinSpec, -1, signListener, signCommand, cancelListener, cancelCommand, hashdataListener, hashdataCommand); + } + + @Override + public void showSignaturePINRetryDialog(PINSpec pinSpec, int numRetries, ActionListener okListener, String okCommand, ActionListener cancelListener, String cancelCommand, ActionListener hashdataListener, String hashdataCommand) { + showSignaturePINDialog(pinSpec, numRetries, okListener, okCommand, cancelListener, cancelCommand, hashdataListener, hashdataCommand); + } + + + + private void showSignaturePINDialog(final PINSpec pinSpec, final int numRetries, final ActionListener signListener, final String signCommand, final ActionListener cancelListener, final String cancelCommand, final ActionListener hashdataListener, final String hashdataCommand) { + SwingUtilities.invokeLater(new Runnable() { + + public void run() { + mainPanel.removeAll(); + buttonPanel.removeAll(); + + if (numRetries < 0) { + titleLabel.setText(messages.getString(TITLE_SIGN)); + } else { + titleLabel.setText(messages.getString(TITLE_RETRY)); + } + + JButton cancelButton = new JButton(); + cancelButton.setFont(cancelButton.getFont()); + cancelButton.setText(messages.getString(BUTTON_CANCEL)); + cancelButton.setActionCommand(cancelCommand); + cancelButton.addActionListener(cancelListener); + + JButton signButton = new JButton(); + signButton.setEnabled(false); + signButton.setFont(signButton.getFont()); + signButton.setText(messages.getString(BUTTON_SIGN)); + signButton.setActionCommand(signCommand); + signButton.addActionListener(signListener); + + JLabel signPinLabel = new JLabel(); + signPinLabel.setFont(signPinLabel.getFont().deriveFont(signPinLabel.getFont().getStyle() | java.awt.Font.BOLD)); + String pinLabel = messages.getString(LABEL_PIN); + signPinLabel.setText(MessageFormat.format(pinLabel, new Object[] {pinSpec.getLocalizedName()})); + + pinField = new JPasswordField(); + pinField.setText(""); + pinField.setDocument(new PINDocument(pinSpec, signButton)); + pinField.setActionCommand(signCommand); + pinField.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + if (pinField.getPassword().length >= pinSpec.getMinLength()) { + signListener.actionPerformed(e); + } + } + }); + + //pinsize or error label + JLabel infoLabel = new JLabel(); + infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + if (numRetries < 0) { + String pinsizePattern = messages.getString(LABEL_PINSIZE); + String pinSize = String.valueOf(pinSpec.getMinLength()); + if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { + pinSize += "-" + pinSpec.getMaxLength(); + } + infoLabel.setText(MessageFormat.format(pinsizePattern, new Object[] {pinSize})); + } else { + infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[] {String.valueOf(numRetries)})); + infoLabel.setForeground(ERROR_COLOR); + } + + JLabel hashDataLabel = new JLabel(); + hashDataLabel.setFont(hashDataLabel.getFont().deriveFont(hashDataLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + hashDataLabel.setText(messages.getString(MESSAGE_HASHDATALINK)); + hashDataLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + hashDataLabel.setForeground(HYPERLINK_COLOR); + hashDataLabel.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent me) { + ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, hashdataCommand); + hashdataListener.actionPerformed(e); + } + }); + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(mainPanelLayout.createSequentialGroup().addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(hashDataLabel).addGroup(GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup().addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING).addComponent(infoLabel) //, GroupLayout.DEFAULT_SIZE, 118, Short.MAX_VALUE) + .addComponent(pinField, GroupLayout.DEFAULT_SIZE, PREF_SIZE_PINFIELD, Short.MAX_VALUE)))).addContainerGap())); + + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(mainPanelLayout.createSequentialGroup().addComponent(hashDataLabel).addGap(hashDataLabel.getFont().getSize()) //14, 14, 14) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE, false).addComponent(signPinLabel) //, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) + .addComponent(pinField)) //, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(infoLabel).addGap(signPinLabel.getFont().getSize()))); //10, 10, 10))); + + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); + + buttonPanelLayout.setHorizontalGroup( + buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup().addContainerGap(15, Short.MAX_VALUE).addComponent(signButton).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(cancelButton).addContainerGap())); + buttonPanelLayout.setVerticalGroup( + buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(signButton).addComponent(cancelButton))); + + pinField.requestFocusInWindow(); + contentPanel.validate(); + + } + +// private ParallelGroup createMainGroup(GroupLayout mainPanelLayout, JLabel hashDataLabel, JLabel signPinLabel, JLabel pinSizeLabel, JLabel errorLabel) { +// ParallelGroup mainGroup = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING); +// mainGroup.addComponent(hashDataLabel); +// if (errorLabel != null) { +// mainGroup.addComponent(errorLabel); +// } +// mainGroup.addGroup(GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup() +// .addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) +// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) +// .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) +// .addComponent(pinSizeLabel) +// .addComponent(pinField, GroupLayout.DEFAULT_SIZE, PREF_SIZE_PINFIELD, Short.MAX_VALUE))); +// return mainGroup; +// } + +// private GroupLayout.SequentialGroup createVerticalMainGroup(GroupLayout mainPanelLayout, JLabel hashDataLabel, JLabel signPinLabel, JLabel pinSizeLabel, JLabel errorLabel) { +// GroupLayout.SequentialGroup mainGroup = mainPanelLayout.createSequentialGroup(); +// mainGroup.addComponent(hashDataLabel) +// .addGap(hashDataLabel.getFont().getSize()); //14, 14, 14) +// +// if (errorLabel != null) { +// mainGroup.addComponent(errorLabel) +// .addGap(errorLabel.getFont().getSize()); +// } +// mainGroup.addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE, false) +// .addComponent(signPinLabel) //, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) +// .addComponent(pinField)) //, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE)) +// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) +// .addComponent(pinSizeLabel) +// .addGap(signPinLabel.getFont().getSize()); +// +// return mainGroup; +//// mainPanelLayout.createSequentialGroup() +//// .addComponent(hashDataLabel) +//// .addGap(hashDataLabel.getFont().getSize()) //14, 14, 14) +//// .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE, false) +//// .addComponent(signPinLabel) //, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) +//// .addComponent(pinField)) //, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE)) +//// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) +//// .addComponent(pinSizeLabel) +//// .addGap(signPinLabel.getFont().getSize()) +//// +//// +// } + }); + } + + @Override + public void showErrorDialog(final String errorMsg, final ActionListener okListener, final String okCommand) { + SwingUtilities.invokeLater(new Runnable() { + + public void run() { + mainPanel.removeAll(); + buttonPanel.removeAll(); + + titleLabel.setText(messages.getString(TITLE_ERROR)); +// titleLabel.setForeground(defaultForground); + + JLabel errorMsgLabel = new JLabel(); + errorMsgLabel.setFont(errorMsgLabel.getFont().deriveFont(errorMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + errorMsgLabel.setText("<html>" + errorMsg + "</html>"); + errorMsgLabel.setForeground(ERROR_COLOR); + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(errorMsgLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)); + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(errorMsgLabel)); + + JButton okButton = new JButton(); + okButton.setFont(okButton.getFont()); + okButton.setText(messages.getString(BUTTON_OK)); + okButton.setActionCommand(okCommand); + okButton.addActionListener(okListener); + + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); + + buttonPanelLayout.setHorizontalGroup( + buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup() + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(okButton) + .addContainerGap())); + buttonPanelLayout.setVerticalGroup( + buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(okButton)); + + contentPanel.validate(); + } + }); + } + + @Override + public void showErrorDialog(final String errorMsg) { + SwingUtilities.invokeLater(new Runnable() { + + public void run() { + mainPanel.removeAll(); + buttonPanel.removeAll(); + + titleLabel.setText(messages.getString(TITLE_ERROR)); +// titleLabel.setForeground(defaultForground); + + JLabel errorMsgLabel = new JLabel(); + errorMsgLabel.setFont(errorMsgLabel.getFont().deriveFont(errorMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + errorMsgLabel.setText("<html>" + errorMsg + "</html>"); + errorMsgLabel.setForeground(ERROR_COLOR); + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(errorMsgLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)); + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(errorMsgLabel)); + + contentPanel.validate(); + } + }); + } + + @Override + public void showHashDataInputDialog(final List<HashDataInput> signedReferences, final ActionListener okListener, final String okCommand) { + SwingUtilities.invokeLater(new Runnable() { + + public void run() { + + if (signedReferences != null && signedReferences.size() == 1) { + FileOutputStream fos = null; + try { + HashDataInput signedRef = signedReferences.get(0); + final String mimeType = signedRef.getMimeType(); + String dir = System.getProperty("user.home"); + JFileChooser fileDialog = new JFileChooser(dir); + fileDialog.setFileSelectionMode(JFileChooser.FILES_ONLY); + fileDialog.setMultiSelectionEnabled(false); + fileDialog.setDialogTitle(messages.getString(WINDOWTITLE_SAVE)); + fileDialog.setDialogType(JFileChooser.SAVE_DIALOG); + fileDialog.setFileHidingEnabled(true); + MimeFilter mimeFilter = new MimeFilter(mimeType); + fileDialog.setFileFilter(mimeFilter); + String filename = messages.getString(SAVE_HASHDATAINPUT_PREFIX) + mimeFilter.getExtension(); + fileDialog.setSelectedFile(new File(dir, filename)); + switch (fileDialog.showSaveDialog(contentPane)) { + case JFileChooser.APPROVE_OPTION: + File f = fileDialog.getSelectedFile(); +// if (f.exists()) { +// //TODO +// } + + fos = new FileOutputStream(f); + BufferedOutputStream bos = new BufferedOutputStream(fos); + InputStream hdi = signedRef.getHashDataInput(); + int b; + while ((b = hdi.read()) != -1) { + bos.write(b); + } + bos.flush(); + bos.close(); + } + } catch (IOException ex) { + showErrorDialog("Failed to write signed reference to file: " + ex.getMessage(), null, null); + ex.printStackTrace(); + } finally { + try { + fos.close(); + } catch (IOException ex) {} + } + } else { + mainPanel.removeAll(); + buttonPanel.removeAll(); + + titleLabel.setText(messages.getString(TITLE_ERROR)); + // titleLabel.setForeground(defaultForground); + + JLabel errorMsgLabel = new JLabel(); + errorMsgLabel.setFont(errorMsgLabel.getFont().deriveFont(errorMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + errorMsgLabel.setText("<html>HashDataInputDialog not supported yet.</html>"); + errorMsgLabel.setForeground(ERROR_COLOR); + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(errorMsgLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)); + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(errorMsgLabel)); + + JButton okButton = new JButton(); + okButton.setFont(okButton.getFont()); + okButton.setText(messages.getString(BUTTON_OK)); + okButton.setActionCommand(okCommand); + okButton.addActionListener(okListener); + + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); + + buttonPanelLayout.setHorizontalGroup( + buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup() + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(okButton) + .addContainerGap())); + buttonPanelLayout.setVerticalGroup( + buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(okButton)); + + contentPanel.validate(); + } + } + }); + } + + @Override + public char[] getPin() { + if (pinField != null) + return pinField.getPassword(); + return null; + } + + class PINDocument extends PlainDocument { + + private PINSpec pinSpec; + private Pattern pinPattern; + private JButton enterButton; + + public PINDocument(PINSpec pinSpec, JButton enterButton) { + this.pinSpec = pinSpec; + if (pinSpec.getRexepPattern() != null) { + pinPattern = Pattern.compile(pinSpec.getRexepPattern()); + } else { + pinPattern = Pattern.compile("."); + } + this.enterButton = enterButton; + } + + @Override + public void insertString(int offs, String str, AttributeSet a) throws BadLocationException { + if (pinSpec.getMaxLength() >= (getLength() + str.length())) { + boolean matches = true; + for (int i = 0; i < str.length(); i++) { + Matcher m = pinPattern.matcher(str.substring(i, i+1)); + if (!m.matches()) { + matches = false; + } + } + if (matches) { + super.insertString(offs, str, a); + } + } + enterButton.setEnabled(getLength() >= pinSpec.getMinLength()); + } + + @Override + public void remove(int offs, int len) throws BadLocationException { + super.remove(offs, len); + enterButton.setEnabled(getLength() >= pinSpec.getMinLength()); + } + } + + class MimeFilter extends FileFilter { + + protected String mimeType; + + public MimeFilter(String mimeType) { + this.mimeType = mimeType; + } + + @Override + public boolean accept(File f) { + + if (f.isDirectory()) { + return true; + } else if ("text/xml".equals(mimeType)) { + return "xml".equals(getExtension(f)); + } else if ("text/plain".equals(mimeType)) { + return "txt".equals(getExtension(f)); + } else if ("application/pdf".equals(mimeType)) { + return "pdf".equals(getExtension(f)); + } else { + return "bin".equals(getExtension(f)); + } + } + + private String getExtension(File f) { + String ext = null; + String s = f.getName(); + int i = s.lastIndexOf('.'); + + if (i > 0 && i < s.length() - 1) { + ext = s.substring(i+1).toLowerCase(); + } + return ext; + } + + @Override + public String getDescription() { + if ("text/xml".equals(mimeType)) { + return messages.getString(MIMETYPE_DESC_XML); + } else if ("text/plain".equals(mimeType)) { + return messages.getString(MIMETYPE_DESC_TXT); + } else if ("application/pdf".equals(mimeType)) { + return messages.getString(MIMETYPE_DESC_PDF); + } else { + return messages.getString(MIMETYPE_DESC_BIN); + } + } + + public String getExtension() { + if ("text/xml".equals(mimeType)) { + return ".xml"; + } else if ("text/plain".equals(mimeType)) { + return ".txt"; + } else if ("application/pdf".equals(mimeType)) { + return ".pdf"; + } else { + return ".bin"; + } + } + } +} 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 new file mode 100644 index 00000000..3766e905 --- /dev/null +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java @@ -0,0 +1,66 @@ +/* +* 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. +*/ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package at.gv.egiz.bku.gui; + +//import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PINSpec; +import java.awt.Container; +import java.awt.event.ActionListener; +import java.util.List; +import javax.swing.JPasswordField; + +/** + * + * @author clemens + */ +public interface BKUGUIFacade { + + public void init(Container contentPane, String localeString); + + public void showWelcomeDialog(); + + /** + * MOA-ID only + * @param loginListener + */ + public void showLoginDialog(ActionListener loginListener, String actionCommand); + + public void showInsertCardDialog(ActionListener cancelListener, String actionCommand); + + public void showCardNotSupportedDialog(ActionListener cancelListener, String actionCommand); + + public void showCardPINDialog(PINSpec pinSpec, ActionListener okListener, String okCommand, ActionListener cancelListener, String cancelCommand); + + public void showCardPINRetryDialog(PINSpec pinSpec, int numRetries, ActionListener okListener, String okCommand, ActionListener cancelListener, String cancelCommand); + + public void showSignaturePINDialog(PINSpec pinSpec, ActionListener signListener, String signCommand, ActionListener cancelListener, String cancelCommand, ActionListener hashdataListener, String hashdataCommand); + + public void showSignaturePINRetryDialog(PINSpec pinSpec, int numRetries, ActionListener okListener, String okCommand, ActionListener cancelListener, String cancelCommand, ActionListener hashdataListener, String hashdataCommand); + + public char[] getPin(); + + public void showHashDataInputDialog(List<HashDataInput> signedReferences, ActionListener okListener, String actionCommand); + + public void showErrorDialog(String errorMsg, ActionListener okListener, String actionCommand); + + public void showErrorDialog(String errorMsg); + +} diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java new file mode 100644 index 00000000..478b949b --- /dev/null +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java @@ -0,0 +1,32 @@ +/* +* 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;
+
+public class BKUGUIFactory {
+ private static BKUGUIFactory instance = new BKUGUIFactory();
+
+ private BKUGUIFactory() {
+ }
+
+ protected BKUGUIFacade createNewGUI() {
+ return new BKUGUI();
+ }
+
+ public static BKUGUIFacade createGUI() {
+ return instance.createNewGUI();
+ }
+}
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataInput.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataInput.java new file mode 100644 index 00000000..d916e81c --- /dev/null +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataInput.java @@ -0,0 +1,36 @@ +/* +* 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. +*/ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package at.gv.egiz.bku.gui; + +import java.io.InputStream; + +/** + * + * @author clemens + */ +public interface HashDataInput { + + public InputStream getHashDataInput(); + + public String getMimeType(); + +} 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 new file mode 100644 index 00000000..62c5a670 --- /dev/null +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties @@ -0,0 +1,39 @@ +# 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. + +# To change this template, choose Tools | Templates +# and open the template in the editor. +title.welcome=<html>Willkommen</html> +title.insertcard=<html>Bitte B\u00FCrgerkarte in den Kartenleser stecken</html> +title.cardnotsupported=<html>Die Karte wird nicht unterst\u00FCtzt</html> +title.cardpin=<html>{0} eingeben</html> +title.sign=<html>Signatur erstellen</html> +title.error=<html>Ein Fehler trat auf</html> +title.retry=<html>Falscher PIN</html> +windowtitle.save=Signaturdaten speichern +message.wait=<html>Bitte warten...</html> +message.insertcard=<html>Bitte B\u00FCrgerkarte in den Kartenleser stecken.</html> +message.hashdatalink=<html><a href=\"anzeige\">Signaturdaten anzeigen...</a></html> +message.retries=<html>Noch {0} Versuche</html> +label.pin=<html>{0}:</html> +label.pinsize=<html>({0} stellig)</html> +button.ok=OK +button.cancel=Abbrechen +button.sign=Signieren +mimetype.desc.xml=XML-Dateien (*.xml) +mimetype.desc.txt=Textdateien (*.txt) +mimetype.desc.pdf=Adobe PDF-Dateien (*.pdf) +mimetype.desc.bin=Bin\u00E4rdateien (*.bin) +save.hashdatainput.prefix=Signaturdaten diff --git a/BKUCommonGUI/src/main/resources/images/logo.png b/BKUCommonGUI/src/main/resources/images/logo.png Binary files differnew file mode 100644 index 00000000..eee4be4f --- /dev/null +++ b/BKUCommonGUI/src/main/resources/images/logo.png diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java new file mode 100644 index 00000000..4dc1f8b3 --- /dev/null +++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java @@ -0,0 +1,53 @@ +/* +* 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. +*/ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package at.gv.egiz.bku.gui; + +import javax.swing.JFrame; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * + * @author clemens + */ +public class BKUGUITest { + + @Ignore + public void testBKUGUI() { + JFrame testFrame = new JFrame("BKUGUITest"); + BKUGUI gui = new BKUGUI(); + gui.init(testFrame.getContentPane(), null); + BKUGUIWorker worker = new BKUGUIWorker(); + worker.init(gui); + testFrame.pack(); + testFrame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + testFrame.setVisible(true); + new Thread(worker).start(); + + while(true) ; + } + + @Test + public void dummyTest() { + } +} diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java new file mode 100644 index 00000000..50771216 --- /dev/null +++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java @@ -0,0 +1,136 @@ +/* +* 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. +*/ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package at.gv.egiz.bku.gui; + +import at.gv.egiz.smcc.PINSpec; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.util.Collections; + +/** + * + * @author clemens + */ +public class BKUGUIWorker implements Runnable { + + BKUGUIFacade gui; + + public void init(BKUGUIFacade gui) { + this.gui = gui; + } + + @Override + public void run() { + try { + + final PINSpec signPinSpec = new PINSpec(6, 10, "[0-9]", "Signatur-PIN"); + + + final ActionListener cancelListener = new ActionListener() { + + public void actionPerformed(ActionEvent e) { + System.out.println("CANCEL EVENT OCCURED: " + e); + } + }; + ActionListener okListener = new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + System.out.println("OK EVENT OCCURED: " + e); + } + }; + final ActionListener signListener = new ActionListener() { + + public void actionPerformed(ActionEvent e) { + System.out.println("SIGN EVENT OCCURED: " + e); + } + }; + ActionListener hashdataListener = new ActionListener() { + + public void actionPerformed(ActionEvent e) { + System.out.println("HASHDATA EVENT OCCURED: " + e); + ActionListener returnListener = new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", null, "hashdata"); + } + }; + HashDataInput signedRef = new HashDataInput() { + + @Override + public InputStream getHashDataInput() { + return new ByteArrayInputStream("<xml>HashDataInput_002</xml>".getBytes()); + } + + @Override + public String getMimeType() { + return "text/xml"; + } + }; + gui.showHashDataInputDialog(Collections.singletonList(signedRef), returnListener, "return"); + } + }; + + + +// gui.showWelcomeDialog(); +// +// Thread.sleep(2000); + + gui.showInsertCardDialog(cancelListener, "cancel"); + + Thread.sleep(2000); + + gui.showCardNotSupportedDialog(cancelListener, "cancel"); + + Thread.sleep(2000); + +// PINSpec cardPinSpec = new PINSpec(4, 4, "[0-9]", "Karten-PIN"); +// +// gui.showCardPINDialog(cardPinSpec, okListener, "ok", cancelListener, "cancel"); +// +// Thread.sleep(2000); +// + +// gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata"); +// +// Thread.sleep(2000); +// +// gui.showSignaturePINRetryDialog(signPinSpec, 2, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata"); +// +// Thread.sleep(2000); +//// +// gui.showErrorDialog("Testfehler occured", null, null); +// +// Thread.sleep(2000); +// +// gui.showErrorDialog("Testfehler occured"); + + } catch (InterruptedException ex) { + ex.printStackTrace(); + } + } +} diff --git a/BKULocal/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch b/BKULocal/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch new file mode 100644 index 00000000..8ad2c6e2 --- /dev/null +++ b/BKULocal/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType">
+<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_DISABLED_BUILDER" value="org.eclipse.wst.jsdt.core.javascriptValidator"/>
+<mapAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS"/>
+<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
+</launchConfiguration>
diff --git a/BKULocal/pom.xml b/BKULocal/pom.xml new file mode 100644 index 00000000..3f77752a --- /dev/null +++ b/BKULocal/pom.xml @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <parent> + <artifactId>bku</artifactId> + <groupId>at.gv.egiz</groupId> + <version>1.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <groupId>at.gv.egiz</groupId> + <artifactId>BKULocal</artifactId> + <packaging>war</packaging> + <name>BKU Local</name> + <version>1.0-SNAPSHOT</version> + <description /> + <dependencies> + <dependency> + <groupId>at.gv.egiz</groupId> + <artifactId>STAL</artifactId> + <version>1.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>at.gv.egiz</groupId> + <artifactId>bkucommon</artifactId> + <version>1.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>at.gv.egiz</groupId> + <artifactId>smcc</artifactId> + <version>1.0-SNAPSHOT</version> + </dependency>
+ <dependency>
+ <groupId>at.gv.egiz</groupId>
+ <artifactId>smccSTAL</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + <version>2.5.5</version> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + <version>2.5</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-web</artifactId> + <version>2.5.5</version> + </dependency> + <dependency> + <groupId>commons-configuration</groupId> + <artifactId>commons-configuration</artifactId> + <version>1.5</version> + </dependency> + <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-support</artifactId>
+ <version>2.0.8</version>
+ </dependency>
+ <dependency>
+ <groupId>opensymphony</groupId>
+ <artifactId>quartz</artifactId>
+ <version>1.5.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-tx</artifactId>
+ <version>2.5.5</version>
+ </dependency> + </dependencies> +</project>
\ No newline at end of file diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/conf/ConfigurationUpdater.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/conf/ConfigurationUpdater.java new file mode 100644 index 00000000..3214f4bc --- /dev/null +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/conf/ConfigurationUpdater.java @@ -0,0 +1,44 @@ +/* +* 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.conf;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.scheduling.quartz.QuartzJobBean;
+
+public class ConfigurationUpdater extends QuartzJobBean {
+ private static Log log = LogFactory.getLog(ConfigurationUpdater.class);
+ private Configurator config;
+
+ @Override
+ protected void executeInternal(JobExecutionContext arg0)
+ throws JobExecutionException {
+ log.trace("Checking config update");
+ config.checkUpdate();
+ }
+
+ public Configurator getConfig() {
+ return config;
+ }
+
+ public void setConfig(Configurator config) {
+ this.config = config;
+ }
+
+}
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/conf/Configurator.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/conf/Configurator.java new file mode 100644 index 00000000..e9510101 --- /dev/null +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/conf/Configurator.java @@ -0,0 +1,274 @@ +/* +* 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.conf;
+
+import iaik.security.ecc.provider.ECCProvider;
+import iaik.xml.crypto.XSecProvider;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.security.KeyStore;
+import java.security.Provider;
+import java.security.Security;
+import java.security.cert.CertStore;
+import java.security.cert.CertificateFactory;
+import java.security.cert.CollectionCertStoreParameters;
+import java.security.cert.PKIXBuilderParameters;
+import java.security.cert.X509CertSelector;
+import java.security.cert.X509Certificate;
+import java.util.Enumeration;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.net.ssl.CertPathTrustManagerParameters;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.KeyManager;
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.ManagerFactoryParameters;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManagerFactory;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.XMLConfiguration;
+import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import at.gv.egiz.bku.slcommands.impl.xsect.STALProvider;
+import at.gv.egiz.smcc.SWCard;
+import at.gv.egiz.smcc.util.SMCCHelper;
+
+public class Configurator {
+ private Log log = LogFactory.getLog(Configurator.class);
+ private XMLConfiguration baseConfig;
+ private XMLConfiguration specialConfig;
+ private boolean autoSave = false;
+
+ public Configurator() {
+ super();
+ init();
+ configure();
+ }
+
+ private void init() {
+ log.debug("Initializing configuration");
+
+ baseConfig = new XMLConfiguration();
+ try {
+ baseConfig.load(getClass().getClassLoader().getResourceAsStream(
+ "./at/gv/egiz/bku/local/baseconfig.xml"));
+ log.debug("Successfully loaded base configuration");
+ } catch (ConfigurationException e) {
+ log.error("Cannot load base configuration", e);
+ }
+ autoSave = baseConfig.getBoolean("OverrideConfigurationFile[@autosave]");
+ try {
+ specialConfig = new XMLConfiguration();
+ specialConfig.setFileName(baseConfig
+ .getString("OverrideConfigurationFile"));
+ specialConfig.load();
+ } catch (Exception e) {
+ log.debug("Cannot get special configuration at: "
+ + baseConfig.getString("OverrideConfigurationFile") + ": " + e);
+ log.debug("Creating new special configuration");
+ try {
+ specialConfig = new XMLConfiguration(baseConfig);
+ specialConfig.setFileName(baseConfig
+ .getString("OverrideConfigurationFile"));
+ specialConfig.save();
+ } catch (ConfigurationException e1) {
+ log.error("Cannot load defaults " + e1);
+ }
+ }
+ specialConfig.setReloadingStrategy(new FileChangedReloadingStrategy());
+ specialConfig.setAutoSave(autoSave);
+ }
+
+ protected void configUrlConnections() {
+ HttpsURLConnection.setFollowRedirects(false);
+ HttpURLConnection.setFollowRedirects(false);
+ }
+
+ protected KeyStore loadKeyStore(String fileName, String type, String password) {
+ KeyStore ks = null;
+ try {
+ ks = KeyStore.getInstance(type);
+ InputStream is = new FileInputStream(fileName);
+ if (is == null) {
+ log.warn("Cannot load keystore from: " + fileName);
+ }
+ ks.load(is, password.toCharArray());
+ for (Enumeration<String> alias = ks.aliases(); alias.hasMoreElements();) {
+ log.debug("Found keystore alias: " + alias.nextElement());
+ }
+ } catch (Exception e) {
+ log.error("Cannot config keystore", e);
+ return null;
+ }
+ return ks;
+ }
+
+ protected void configSSL() {
+ String trustStoreName = specialConfig.getString("SSL.trustStoreFile");
+ String trustStoreType = specialConfig.getString("SSL.trustStoreType");
+ String trustStorePass = specialConfig.getString("SSL.trustStorePass");
+ String certStoreDirectory = specialConfig
+ .getString("SSL.certStoreDirectory");
+ String keyStoreName = specialConfig.getString("SSL.keyStoreFile");
+ String keyStoreType = specialConfig.getString("SSL.keyStoreType");
+ String keyStorePass = specialConfig.getString("SSL.keyStorePass");
+
+ String caIncludeDir = specialConfig.getString("SSL.caIncludeDirectory");
+
+ KeyStore trustStore = loadKeyStore(trustStoreName, trustStoreType,
+ trustStorePass);
+ KeyStore keyStore = null;
+ if (keyStoreName != null) {
+ keyStore = loadKeyStore(keyStoreName, keyStoreType, keyStorePass);
+ }
+
+ try {
+ PKIXBuilderParameters pkixParams = new PKIXBuilderParameters(trustStore,
+ new X509CertSelector());
+
+ if (certStoreDirectory != null) {
+ File dir = new File(certStoreDirectory);
+ if (dir.isDirectory()) {
+ List<X509Certificate> certCollection = new LinkedList<X509Certificate>();
+ CertificateFactory cf = CertificateFactory.getInstance("X.509");
+ for (File f : dir.listFiles()) {
+ log.debug("adding " + f.getName());
+ certCollection.add((X509Certificate) cf
+ .generateCertificate(new FileInputStream(f)));
+ }
+ CollectionCertStoreParameters csp = new CollectionCertStoreParameters(
+ certCollection);
+ CertStore cs = CertStore.getInstance("Collection", csp);
+ pkixParams.addCertStore(cs);
+ log.debug("Added collection certstore");
+ } else {
+ log.error("CertstoreDirectory " + certStoreDirectory
+ + " is not a directory");
+ }
+ }
+
+ if (caIncludeDir != null) {
+ File dir = new File(caIncludeDir);
+ if (dir.exists() && dir.isDirectory()) {
+ CertificateFactory cf = CertificateFactory.getInstance("X.509");
+ try {
+ for (File f : dir.listFiles()) {
+ FileInputStream fis = new FileInputStream(f);
+ X509Certificate cert = (X509Certificate) cf
+ .generateCertificate(fis);
+ fis.close();
+ log.debug("Adding trusted cert " + cert.getSubjectDN());
+ trustStore.setCertificateEntry(cert.getSubjectDN().getName(),
+ cert);
+ f.delete();
+ }
+ } finally {
+ trustStore.store(new FileOutputStream(trustStoreName),
+ trustStorePass.toCharArray());
+ }
+ }
+ }
+
+ pkixParams.setRevocationEnabled(specialConfig
+ .getBoolean("SSL.revocation"));
+ if (specialConfig.getBoolean("SSL.revocation")) {
+ System.setProperty("com.sun.security.enableCRLDP ", "true");
+ Security.setProperty("ocsp.enable", "true");
+ }
+ System.setProperty("com.sun.security.enableAIAcaIssuers", "true");
+ log.debug("Setting revocation check to: "
+ + pkixParams.isRevocationEnabled());
+ ManagerFactoryParameters trustParams = new CertPathTrustManagerParameters(
+ pkixParams);
+ TrustManagerFactory trustFab = TrustManagerFactory.getInstance("PKIX");
+ trustFab.init(trustParams);
+
+ KeyManager[] km = null;
+ SSLContext sslCtx = SSLContext.getInstance(specialConfig
+ .getString("SSL.sslProtocol"));
+ if (keyStore != null) {
+ KeyManagerFactory keyFab = KeyManagerFactory.getInstance("SunX509");
+ keyFab.init(keyStore, keyStorePass.toCharArray());
+ km = keyFab.getKeyManagers();
+ }
+ sslCtx.init(km, trustFab.getTrustManagers(), null);
+ HttpsURLConnection.setDefaultSSLSocketFactory(sslCtx.getSocketFactory());
+ log.info("Successfully configured ssl");
+ } catch (Exception e) {
+ log.debug("Cannot init ssl", e);
+ }
+ }
+
+ protected void configureProviders() {
+ log.debug("Registering security providers");
+ ECCProvider.addAsProvider(false);
+ Security.addProvider(new STALProvider());
+ XSecProvider.addAsProvider(false);
+ StringBuffer sb = new StringBuffer();
+ sb.append("Following providers are now registered: ");
+ int i = 1;
+ for (Provider prov : Security.getProviders()) {
+ sb.append((i++) + ". : " + prov);
+ }
+ log.debug("Configured provider" + sb.toString());
+ }
+
+ protected void configureBKU() {
+ if (specialConfig.containsKey("BKU.useSWCard")) {
+ boolean useSWCard = specialConfig.getBoolean("BKU.useSWCard");
+ log.info("Setting SW Card to: "+useSWCard);
+ SMCCHelper.setUseSWCard(useSWCard);
+ }
+ if (specialConfig.containsKey("BKU.SWCardDirectory")) {
+ //SWCard.
+ }
+ }
+
+ public void configure() {
+ configureProviders();
+ configSSL();
+ configUrlConnections();
+ configureBKU();
+
+ }
+
+ public void checkUpdate() {
+ if (specialConfig.getReloadingStrategy().reloadingRequired()) {
+ log.info("Reloading configuration: " + specialConfig.getFileName());
+ specialConfig.setAutoSave(false);
+ specialConfig.clear();
+ try {
+ specialConfig.load();
+ } catch (ConfigurationException e) {
+ log.fatal(e);
+ }
+ specialConfig.setAutoSave(specialConfig
+ .getBoolean("OverrideConfigurationFile[@autosave]"));
+ configure();
+ specialConfig.getReloadingStrategy().reloadingPerformed();
+ }
+ }
+
+}
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/PINDialog.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/PINDialog.java new file mode 100644 index 00000000..5bc6bab5 --- /dev/null +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/PINDialog.java @@ -0,0 +1,214 @@ +/* +* 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.stal;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.swing.JButton;
+import javax.swing.JPasswordField;
+import javax.swing.text.AttributeSet;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.PlainDocument;
+
+import at.gv.egiz.smcc.PINSpec;
+
+public class PINDialog extends javax.swing.JDialog implements ActionListener {
+
+ // Variables declaration - do not modify
+ private javax.swing.JButton okButton;
+ private javax.swing.JButton cancelButton;
+ private javax.swing.JLabel label;
+ private javax.swing.JPasswordField password;
+ // End of variables declaration
+
+ private PINSpec pinSpec;
+ private String pinString;
+ private boolean finished = false;
+
+ class PinDocument extends PlainDocument {
+ private Pattern pattern;
+
+ public PinDocument() {
+ pattern = Pattern.compile(pinSpec.getRexepPattern());
+ }
+
+ public void insertString(int offs, String str, AttributeSet a)
+ throws BadLocationException {
+ if (pinSpec.getMaxLength() >= (getLength() + str.length())) {
+ Matcher matcher = pattern.matcher(str);
+ if (matcher.matches()) {
+ super.insertString(offs, str, a);
+ }
+ }
+ okButton.setEnabled(getLength() >= pinSpec.getMinLength());
+ }
+
+ @Override
+ public void remove(int offs, int len) throws BadLocationException {
+ super.remove(offs, len);
+ okButton.setEnabled(getLength() >= pinSpec.getMinLength());
+ }
+ }
+
+ public PINDialog() {
+ }
+
+ private synchronized void finished(boolean ok) {
+ if (ok) {
+ pinString = password.getText();
+ } else {
+ pinString = null;
+ }
+ finished = true;
+ notifyAll();
+ }
+
+ public synchronized void waitFinished() {
+ while (!finished) {
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public String getPIN() {
+ return pinString;
+ }
+
+ /** Creates new form NewJDialog */
+ public PINDialog(java.awt.Frame parent, boolean modal, PINSpec pinSpec,
+ int retries) {
+ super(parent, modal);
+ this.pinSpec = pinSpec;
+ initComponents();
+ }
+
+ private void initComponents() {
+ okButton = new javax.swing.JButton();
+ cancelButton = new javax.swing.JButton();
+ password = new javax.swing.JPasswordField();
+ label = new javax.swing.JLabel();
+ setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
+
+ setTitle("PIN Dialog"); // NOI18N
+ setName("Form"); // NOI18N
+
+ okButton.setText("OK"); // NOI18N
+ okButton.setName("okButton"); // NOI18N
+ okButton.setEnabled(false);
+ okButton.addActionListener(this);
+
+ cancelButton.setText("Cancel"); // NOI18N
+ cancelButton.setName("cancelButton"); // NOI18N
+ cancelButton.addActionListener(this);
+
+ password.setText(""); // NOI18N
+ password.setName("password"); // NOI18N
+ password.addActionListener(this);
+ password.setDocument(new PinDocument());
+
+ label.setText("PIN: "); // NOI18N
+ label.setName("jLabel1"); // NOI18N
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(
+ getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(layout.createParallelGroup(
+ javax.swing.GroupLayout.Alignment.LEADING).addGroup(
+ layout.createSequentialGroup().addContainerGap().addGroup(
+ layout.createParallelGroup(
+ javax.swing.GroupLayout.Alignment.LEADING).addGroup(
+ layout.createSequentialGroup().addComponent(label,
+ javax.swing.GroupLayout.PREFERRED_SIZE, 61,
+ javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(
+ javax.swing.LayoutStyle.ComponentPlacement.RELATED,
+ javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(password,
+ javax.swing.GroupLayout.PREFERRED_SIZE, 127,
+ javax.swing.GroupLayout.PREFERRED_SIZE)).addGroup(
+ javax.swing.GroupLayout.Alignment.TRAILING,
+ layout.createSequentialGroup().addComponent(cancelButton)
+ .addPreferredGap(
+ javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(okButton))).addContainerGap()));
+ layout.setVerticalGroup(layout.createParallelGroup(
+ javax.swing.GroupLayout.Alignment.LEADING).addGroup(
+ layout.createSequentialGroup().addContainerGap().addGroup(
+ layout.createParallelGroup(
+ javax.swing.GroupLayout.Alignment.BASELINE).addComponent(label,
+ javax.swing.GroupLayout.PREFERRED_SIZE, 33,
+ javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(password,
+ javax.swing.GroupLayout.PREFERRED_SIZE,
+ javax.swing.GroupLayout.DEFAULT_SIZE,
+ javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(
+ javax.swing.LayoutStyle.ComponentPlacement.RELATED, 14,
+ Short.MAX_VALUE).addGroup(
+ layout.createParallelGroup(
+ javax.swing.GroupLayout.Alignment.BASELINE).addComponent(
+ okButton).addComponent(cancelButton)).addContainerGap()));
+
+ pack();
+ }
+
+ /**
+ * @param args
+ * the command line arguments
+ */
+ public static void main(String args[]) {
+ java.awt.EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ PINDialog dialog = new PINDialog(new javax.swing.JFrame(), true,
+ new PINSpec(1, 5, "[0-9]*", "Hansi"), 10);
+ dialog.setResizable(false);
+ dialog.addWindowListener(new java.awt.event.WindowAdapter() {
+ public void windowClosing(java.awt.event.WindowEvent e) {
+ System.exit(0);
+ }
+ });
+ dialog.setVisible(true);
+ }
+ });
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource() instanceof JButton) {
+ JButton pressed = (JButton) e.getSource();
+ if (pressed.getName().equals("okButton")) {
+ finished(true);
+ } else if (pressed.getName().equals("cancelButton")) {
+ finished(false);
+ }
+ } else if (e.getSource() instanceof JPasswordField) {
+ JPasswordField pwf = (JPasswordField) e.getSource();
+ if (pwf.getName().equals("password")) {
+ if (password.getPassword().length >= pinSpec.getMinLength()) {
+ finished(true);
+ }
+ }
+ }
+ }
+
+}
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/QuitRequestHandler.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/QuitRequestHandler.java new file mode 100644 index 00000000..5596b7bb --- /dev/null +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/QuitRequestHandler.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.stal;
+
+import at.gv.egiz.bku.smccstal.AbstractRequestHandler;
+import at.gv.egiz.bku.smccstal.SMCCSTALRequestHandler;
+import at.gv.egiz.stal.STALRequest;
+import at.gv.egiz.stal.STALResponse;
+
+public class QuitRequestHandler extends AbstractRequestHandler {
+
+ @Override
+ public STALResponse handleRequest(STALRequest request) {
+ return null;
+ }
+
+ @Override
+ public boolean requireCard() {
+ return false;
+ }
+
+ @Override
+ public SMCCSTALRequestHandler newInstance() {
+ return this;
+ }
+
+}
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTAL.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTAL.java new file mode 100644 index 00000000..26ec2aa8 --- /dev/null +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTAL.java @@ -0,0 +1,95 @@ +/* +* 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.stal;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Locale;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import at.gv.egiz.bku.gui.BKUGUIFacade;
+import at.gv.egiz.bku.local.ui.TrayIconDialog;
+import at.gv.egiz.bku.smccstal.AbstractRequestHandler;
+import at.gv.egiz.bku.smccstal.AbstractSMCCSTAL;
+import at.gv.egiz.bku.smccstal.STALMessageConsumer;
+import at.gv.egiz.smcc.PINProvider;
+import at.gv.egiz.smcc.util.SMCCHelper;
+import at.gv.egiz.stal.QuitRequest;
+
+public class SMCCSTAL extends AbstractSMCCSTAL implements STALMessageConsumer {
+ private static Log log = LogFactory.getLog(SMCCSTAL.class);
+
+ protected PINProvider pinProvider = new SwingPINProvider();
+ protected SwingInsertCardDialog insertCard = new SwingInsertCardDialog();
+ private boolean canceled = false;
+
+ static {
+ addRequestHandler(QuitRequest.class, new QuitRequestHandler());
+ }
+
+ public SMCCSTAL() {
+ AbstractRequestHandler.setMessageConsumer(this);
+ }
+
+ /**
+ *
+ * @return if the user canceled
+ */
+ protected boolean waitForCard() {
+ canceled = false;
+ while ((smccHelper.getResultCode() != SMCCHelper.CARD_FOUND) && (!canceled)) {
+ insertCard.setVisible(true);
+ insertCard.setAlwaysOnTop(true);
+ insertCard.addCanceledListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ canceled = true;
+ }
+ });
+ try {
+ smccHelper.update(1000);
+ } catch (Exception ex) {
+ log.info(ex);
+ }
+ }
+ insertCard.setVisible(false);
+ signatureCard = smccHelper.getSignatureCard(locale);
+ return canceled;
+ }
+
+ @Override
+ public void setLocale(Locale locale) {
+ super.setLocale(locale);
+ if (pinProvider instanceof SwingPINProvider) {
+ ((SwingPINProvider) pinProvider).setLocale(locale);
+ }
+ }
+
+ @Override
+ public void consumeNewSTALMessage(String captionId, String messageId) {
+ TrayIconDialog.getInstance().displayInfo(captionId, messageId);
+ }
+
+ @Override
+ protected BKUGUIFacade getGUI() {
+ // TODO Auto-generated method stub
+ //FIXME
+ return null;
+ }
+}
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 new file mode 100644 index 00000000..014d884a --- /dev/null +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java @@ -0,0 +1,27 @@ +/* +* 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.stal;
+
+import at.gv.egiz.stal.STAL;
+import at.gv.egiz.stal.STALFactory;
+
+public class SMCCSTALFactory implements STALFactory {
+ @Override
+ public STAL createSTAL() {
+ return new SMCCSTAL();
+ }
+}
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SwingInsertCardDialog.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SwingInsertCardDialog.java new file mode 100644 index 00000000..eb76f2f2 --- /dev/null +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SwingInsertCardDialog.java @@ -0,0 +1,147 @@ +/* +* 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.stal;
+
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Toolkit;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.event.WindowListener;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import javax.swing.ImageIcon;
+import javax.swing.JDialog;
+
+import at.gv.egiz.bku.utils.StreamUtil;
+
+public class SwingInsertCardDialog extends JDialog {
+
+ private javax.swing.JButton cancelButton;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel2;
+ private Locale locale = Locale.getDefault();
+
+ public SwingInsertCardDialog() {
+ super((java.awt.Frame) null, false);
+ initComponents();
+ }
+
+ public void setLocale(Locale locale) {
+ this.locale = locale;
+ }
+
+ private void initComponents() {
+ ResourceBundle rb = ResourceBundle.getBundle(
+ "at/gv/egiz/bku/local/Userdialog", locale);
+ setTitle(rb.getString("Insert.Header"));
+ jLabel1 = new javax.swing.JLabel();
+ jLabel2 = new javax.swing.JLabel();
+ cancelButton = new javax.swing.JButton();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
+ setName("Form"); // NOI18N
+ setUndecorated(true);
+
+ jLabel1.setFont(new Font("Tahoma", Font.BOLD, 14));
+ jLabel1.setText(rb.getString("Insert.Text")); // NOI18N
+ jLabel1.setName("text"); // NOI18N
+
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ InputStream is = getClass().getClassLoader().getResourceAsStream(
+ "at/gv/egiz/bku/local/logo.png");
+ try {
+ StreamUtil.copyStream(is, os);
+ jLabel2.setIcon(new ImageIcon(os.toByteArray())); // NOI18N
+ } catch (IOException e) {
+ jLabel2.setText("Chipperling image missing"); // NOI18N
+ }
+ jLabel2.setName("jLabel2"); // NOI18N
+ cancelButton.setText(rb.getString("Insert.Button.Cancel")); // NOI18N
+ cancelButton.setName("jButton1"); // NOI18N
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(
+ getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(layout.createParallelGroup(
+ javax.swing.GroupLayout.Alignment.LEADING).addGroup(
+ layout.createSequentialGroup().addContainerGap().addComponent(jLabel2)
+ .addGroup(
+ layout.createParallelGroup(
+ javax.swing.GroupLayout.Alignment.TRAILING).addGroup(
+ layout.createSequentialGroup().addGap(35, 35, 35)
+ .addComponent(jLabel1,
+ javax.swing.GroupLayout.DEFAULT_SIZE,
+ javax.swing.GroupLayout.DEFAULT_SIZE,
+ Short.MAX_VALUE)).addGroup(
+ layout.createSequentialGroup().addPreferredGap(
+ javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(cancelButton))).addGap(29, 29, 29)));
+ layout.setVerticalGroup(layout.createParallelGroup(
+ javax.swing.GroupLayout.Alignment.LEADING).addGroup(
+ javax.swing.GroupLayout.Alignment.TRAILING,
+ layout.createSequentialGroup().addContainerGap().addGroup(
+ layout.createParallelGroup(
+ javax.swing.GroupLayout.Alignment.TRAILING).addComponent(
+ jLabel2).addGroup(
+ layout.createSequentialGroup().addComponent(jLabel1,
+ javax.swing.GroupLayout.DEFAULT_SIZE, 53, Short.MAX_VALUE)
+ .addGap(35, 35, 35).addComponent(cancelButton).addGap(9, 9,
+ 9))).addContainerGap()));
+
+ Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+ Dimension frameSize = getSize();
+ if (frameSize.height > screenSize.height) {
+ frameSize.height = screenSize.height;
+ }
+ if (frameSize.width > screenSize.width) {
+ frameSize.width = screenSize.width;
+ }
+ setLocation((screenSize.width - frameSize.width) / 2,
+ (screenSize.height - frameSize.height) / 2);
+ setUndecorated(false);
+ pack();
+ }
+
+ public void addCanceledListener(ActionListener al) {
+ cancelButton.addActionListener(al);
+ }
+
+ /**
+ * @param args
+ * the command line arguments
+ */
+ public static void main(String args[]) {
+ java.awt.EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ SwingInsertCardDialog dialog = new SwingInsertCardDialog();
+ dialog.addWindowListener(new java.awt.event.WindowAdapter() {
+ public void windowClosing(java.awt.event.WindowEvent e) {
+ System.exit(0);
+ }
+ });
+ //
+ }
+ });
+ }
+
+}
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SwingPINProvider.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SwingPINProvider.java new file mode 100644 index 00000000..7d36e68e --- /dev/null +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SwingPINProvider.java @@ -0,0 +1,57 @@ +/* +* 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.stal;
+
+import java.util.Locale;
+
+import at.gv.egiz.smcc.PINProvider;
+import at.gv.egiz.smcc.PINSpec;
+
+public class SwingPINProvider implements PINProvider {
+
+ private Locale locale = Locale.getDefault();
+ SwingPinDialog dialog;
+
+ public SwingPINProvider() {
+ this.locale = Locale.getDefault();
+
+ }
+
+ public Locale getLocale() {
+ return locale;
+ }
+
+ public void setLocale(Locale locale) {
+ this.locale = locale;
+ }
+
+ @Override
+ public String providePIN(PINSpec pinSpec, int retries) {
+ dialog = new SwingPinDialog(null, false);
+ dialog.setResizable(false);
+ dialog.setRetries(retries);
+ dialog.setPinSpec(pinSpec);
+ dialog.initComponents();
+ dialog.setVisible(true);
+ dialog.requestFocus();
+ dialog.setAlwaysOnTop(true);
+ dialog.waitFinished();
+ dialog.dispose();
+ return dialog.getPIN();
+ }
+
+}
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SwingPinDialog.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SwingPinDialog.java new file mode 100644 index 00000000..3e91972c --- /dev/null +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SwingPinDialog.java @@ -0,0 +1,265 @@ +/* +* 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.stal;
+
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JPasswordField;
+import javax.swing.text.AttributeSet;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.PlainDocument;
+
+import at.gv.egiz.bku.utils.StreamUtil;
+import at.gv.egiz.smcc.PINSpec;
+
+public class SwingPinDialog extends javax.swing.JDialog implements
+ ActionListener {
+
+ private javax.swing.JButton okButton;
+ private javax.swing.JButton cancelButton;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel2;
+ private javax.swing.JPasswordField password;
+
+ private PINSpec pinSpec;
+ private String pinString;
+ private boolean finished = false;
+ private int retries = -1;
+ private Locale locale = Locale.getDefault();
+ private boolean setUp = false;
+
+ class PinDocument extends PlainDocument {
+ private Pattern pattern;
+
+ public PinDocument() {
+ if ((pinSpec != null) && (pinSpec.getRexepPattern() != null)) {
+ pattern = Pattern.compile(pinSpec.getRexepPattern());
+ } else {
+ pattern = Pattern.compile(".");
+ }
+ }
+
+ public void insertString(int offs, String str, AttributeSet a)
+ throws BadLocationException {
+ if (pinSpec.getMaxLength() >= (getLength() + str.length())) {
+ Matcher matcher = pattern.matcher(str);
+ if (matcher.matches()) {
+ super.insertString(offs, str, a);
+ }
+ }
+ okButton.setEnabled(getLength() >= pinSpec.getMinLength());
+ }
+
+ @Override
+ public void remove(int offs, int len) throws BadLocationException {
+ super.remove(offs, len);
+ okButton.setEnabled(getLength() >= pinSpec.getMinLength());
+ }
+ }
+
+ /**
+ * Make sure to call initComponents
+ *
+ * @param parent
+ * @param modal
+ */
+ public SwingPinDialog(java.awt.Frame parent, boolean modal) {
+ super(parent, modal);
+ }
+
+ public void setLocale(Locale locale) {
+ this.locale = locale;
+ }
+
+ public void setPinSpec(PINSpec pinSpec) {
+ this.pinSpec = pinSpec;
+ }
+
+ public void setRetries(int retries) {
+ this.retries = retries;
+ }
+
+ public void initComponents() {
+ ResourceBundle rb = ResourceBundle.getBundle(
+ "at/gv/egiz/bku/local/Userdialog", locale);
+ okButton = new javax.swing.JButton();
+ cancelButton = new javax.swing.JButton();
+ password = new javax.swing.JPasswordField();
+ jLabel1 = new javax.swing.JLabel();
+ jLabel2 = new javax.swing.JLabel();
+
+ setTitle(rb.getString("Pin.Header"));
+ setName("Form");
+ setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
+
+ okButton.setText(rb.getString("Pin.Button.OK"));
+ okButton.setName("okButton");
+ okButton.setEnabled(false);
+ okButton.addActionListener(this);
+
+ cancelButton.setText(rb.getString("Pin.Button.Cancel"));
+ cancelButton.setName("cancelButton");
+ cancelButton.addActionListener(this);
+
+ password.setText("");
+ password.setDocument(new PinDocument());
+ password.setName("password");
+ password.addActionListener(this);
+ password.setDocument(new PinDocument());
+ password.setRequestFocusEnabled(true);
+ password.requestFocus();
+
+ jLabel1.setFont(new Font("Tahoma", Font.BOLD, 14));
+ String text = null;
+ Object[] args;
+ if (retries > 0) {
+ text = rb.getString("Pin.Text.Retries");
+ args = new Object[2];
+ args[0] = pinSpec.getLocalizedName();
+ args[1] = new Integer(retries);
+ } else {
+ text = rb.getString("Pin.Text.NoRetries");
+ args = new Object[1];
+ args[0] = pinSpec.getLocalizedName();
+ }
+ text = MessageFormat.format(text, args);
+ jLabel1.setText(text); // NOI18N
+ jLabel1.setName("jLabel1"); // NOI18N
+
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ InputStream is = getClass().getClassLoader().getResourceAsStream(
+ "at/gv/egiz/bku/local/logo.png");
+ try {
+ StreamUtil.copyStream(is, os);
+ jLabel2.setIcon(new ImageIcon(os.toByteArray())); // NOI18N
+ } catch (Exception e) {
+ jLabel2.setText("Chipperling image missing"); // NOI18N
+ }
+ jLabel2.setName("jLabel2"); // NOI18N
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(
+ getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(layout.createParallelGroup(
+ javax.swing.GroupLayout.Alignment.LEADING).addGroup(
+ layout.createSequentialGroup().addContainerGap().addComponent(jLabel2)
+ .addGap(73, 73, 73).addGroup(
+ layout.createParallelGroup(
+ javax.swing.GroupLayout.Alignment.LEADING).addComponent(
+ jLabel1).addGroup(
+ layout.createParallelGroup(
+ javax.swing.GroupLayout.Alignment.TRAILING, false)
+ .addComponent(password,
+ javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(
+ javax.swing.GroupLayout.Alignment.LEADING,
+ layout.createSequentialGroup().addComponent(
+ cancelButton).addGap(18, 18, 18).addComponent(
+ okButton)))).addContainerGap(31,
+ Short.MAX_VALUE)));
+ layout.setVerticalGroup(layout.createParallelGroup(
+ javax.swing.GroupLayout.Alignment.LEADING).addGroup(
+ layout.createSequentialGroup().addContainerGap().addGroup(
+ layout.createParallelGroup(
+ javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jLabel2).addGroup(
+ layout.createSequentialGroup().addPreferredGap(
+ javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jLabel1,
+ javax.swing.GroupLayout.PREFERRED_SIZE, 33,
+ javax.swing.GroupLayout.PREFERRED_SIZE).addGap(18,
+ 18, 18).addComponent(password,
+ javax.swing.GroupLayout.PREFERRED_SIZE,
+ javax.swing.GroupLayout.DEFAULT_SIZE,
+ javax.swing.GroupLayout.PREFERRED_SIZE).addGap(20,
+ 20, 20).addGroup(
+ layout.createParallelGroup(
+ javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(cancelButton).addComponent(
+ okButton)))).addGap(36, 36, 36)));
+ Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+ Dimension frameSize = getSize();
+ if (frameSize.height > screenSize.height) {
+ frameSize.height = screenSize.height;
+ }
+ if (frameSize.width > screenSize.width) {
+ frameSize.width = screenSize.width;
+ }
+ setLocation((screenSize.width - frameSize.width) / 2,
+ (screenSize.height - frameSize.height) / 2);
+ setUndecorated(false);
+ pack();
+ }
+
+ public String getPIN() {
+ return pinString;
+ }
+
+ private synchronized void finished(boolean ok) {
+ if (ok) {
+ pinString = password.getText();
+ } else {
+ pinString = null;
+ }
+ finished = true;
+ notifyAll();
+ }
+
+ public synchronized void waitFinished() {
+ while (!finished) {
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource() instanceof JButton) {
+ JButton pressed = (JButton) e.getSource();
+ if (pressed.getName().equals("okButton")) {
+ finished(true);
+ } else if (pressed.getName().equals("cancelButton")) {
+ finished(false);
+ }
+ } else if (e.getSource() instanceof JPasswordField) {
+ JPasswordField pwf = (JPasswordField) e.getSource();
+ if (pwf.getName().equals("password")) {
+ if (password.getPassword().length >= pinSpec.getMinLength()) {
+ finished(true);
+ }
+ }
+ }
+ }
+
+}
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/BKURequestHandler.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/BKURequestHandler.java new file mode 100644 index 00000000..8529949d --- /dev/null +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/BKURequestHandler.java @@ -0,0 +1,100 @@ +/* +* 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.webapp;
+
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.web.HttpRequestHandler;
+
+import at.gv.egiz.bku.binding.BindingProcessorManager;
+import at.gv.egiz.bku.binding.HTTPBindingProcessor;
+import at.gv.egiz.bku.binding.HttpUtil;
+import at.gv.egiz.bku.utils.StreamUtil;
+import at.gv.egiz.org.apache.tomcat.util.http.AcceptLanguage;
+
+public abstract class BKURequestHandler extends HttpServlet {
+
+ public final static String ENCODING = "UTF-8";
+
+ protected Log log = LogFactory.getLog(BKURequestHandler.class);
+
+ protected abstract BindingProcessorManager getBindingProcessorManager();
+
+ protected void doPost(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException, java.io.IOException {
+ log.debug("Got new request");
+ String lang = req.getHeader("Accept-Language");
+ Locale locale = AcceptLanguage.getLocale(lang);
+ log.debug("Using locale: "+locale);
+ HTTPBindingProcessor bindingProcessor;
+ if (req.isSecure()) {
+ bindingProcessor = (HTTPBindingProcessor) getBindingProcessorManager()
+ .createBindingProcessor("https", null, locale);
+ } else {
+ bindingProcessor = (HTTPBindingProcessor) getBindingProcessorManager()
+ .createBindingProcessor("http", null, locale);
+ }
+ Map<String, String> headerMap = new HashMap<String, String>();
+ for (Enumeration<String> headerName = req.getHeaderNames(); headerName
+ .hasMoreElements();) {
+ String header = headerName.nextElement();
+ if (header != null) {
+ headerMap.put(header, req.getHeader(header));
+ }
+ }
+ headerMap.put(HttpUtil.HTTP_HEADER_CONTENT_TYPE, req.getContentType()+";"+req.getCharacterEncoding());
+ bindingProcessor.setHTTPHeaders(headerMap);
+ bindingProcessor.consumeRequestStream(req.getInputStream());
+
+ // fixxme just for testing
+ bindingProcessor.run();
+ if (bindingProcessor.getRedirectURL() != null) {
+ resp.sendRedirect(bindingProcessor.getRedirectURL());
+ return;
+ }
+ resp.setStatus(bindingProcessor.getResponseCode());
+ for (Iterator<String> it = bindingProcessor.getResponseHeaders().keySet()
+ .iterator(); it.hasNext();) {
+ String header = it.next();
+ resp.setHeader(header, bindingProcessor.getResponseHeaders().get(header));
+ }
+ resp.setContentType(bindingProcessor.getResultContentType());
+ resp.setCharacterEncoding(ENCODING);
+ bindingProcessor.writeResultTo(resp.getOutputStream(), ENCODING);
+ req.getInputStream().close();
+ resp.getOutputStream().flush();
+ resp.getOutputStream().close();
+ log.debug("Finished Request");
+ }
+
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException, java.io.IOException {
+ doPost(req, resp);
+ }
+}
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/SpringBKUServlet.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/SpringBKUServlet.java new file mode 100644 index 00000000..c573e52f --- /dev/null +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/SpringBKUServlet.java @@ -0,0 +1,30 @@ +/* +* 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.webapp;
+
+import at.gv.egiz.bku.binding.BindingProcessorManager;
+
+public class SpringBKUServlet extends BKURequestHandler {
+
+ public final static String BEAN_NAME="bindingProcessorManager";
+
+ @Override
+ protected BindingProcessorManager getBindingProcessorManager() {
+ return (BindingProcessorManager) getServletContext().getAttribute(BEAN_NAME);
+ }
+
+}
diff --git a/BKULocal/src/main/resources/at/gv/egiz/bku/local/Userdialog.properties b/BKULocal/src/main/resources/at/gv/egiz/bku/local/Userdialog.properties new file mode 100644 index 00000000..9db6f100 --- /dev/null +++ b/BKULocal/src/main/resources/at/gv/egiz/bku/local/Userdialog.properties @@ -0,0 +1,27 @@ +# 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. + +#------- Insert Card Dialog -------#
+Insert.Header = Citizen Card Required
+Insert.Button.Cancel = Cancel
+Insert.Text = Please insert your Citizen Card!
+
+
+#------- PIN Dialog -------#
+Pin.Header = Please Enter PIN
+Pin.Button.OK = OK
+Pin.Button.Cancel = Cancel
+Pin.Text.Retries = <html><body>Please enter {0}.<p>{1} retries left.</body></html>
+Pin.Text.NoRetries = Please enter {0}.
\ No newline at end of file diff --git a/BKULocal/src/main/resources/at/gv/egiz/bku/local/baseconfig.xml b/BKULocal/src/main/resources/at/gv/egiz/bku/local/baseconfig.xml new file mode 100644 index 00000000..792bbccc --- /dev/null +++ b/BKULocal/src/main/resources/at/gv/egiz/bku/local/baseconfig.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!-- + 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. +--> +<BKUConfig>
+ <!-- Allows individual configuration -->
+ <OverrideConfigurationFile autosave="true">
+ ${sys:user.home}/.bku/conf/bkuconfig.xml</OverrideConfigurationFile>
+ <SSL>
+ <!--
+ <trustStoreFile>truststore.jks</trustStoreFile>
+ <trustStoreType>JKS</trustStoreType>
+ <trustStorePass>changeMe</trustStorePass>
+ <caIncludeDirectory></caIncludeDirectory>
+ <certStoreDirectory></certStoreDirectory>
+ <keyStoreFile>keyStore.jks</keyStoreFile>
+ <keyStoreType>JKS</keyStoreType>
+ <keyStorePass>changeMe</keyStorePass>
+ -->
+ <revocation>true</revocation>
+ <sslProtocol>TLS</sslProtocol>
+ </SSL>
+ <BKU>
+ </BKU>
+</BKUConfig>
\ No newline at end of file diff --git a/BKULocal/src/main/resources/at/gv/egiz/bku/local/logo.png b/BKULocal/src/main/resources/at/gv/egiz/bku/local/logo.png Binary files differnew file mode 100644 index 00000000..eee4be4f --- /dev/null +++ b/BKULocal/src/main/resources/at/gv/egiz/bku/local/logo.png diff --git a/BKULocal/src/main/resources/at/gv/egiz/bku/local/truststore.jks b/BKULocal/src/main/resources/at/gv/egiz/bku/local/truststore.jks Binary files differnew file mode 100644 index 00000000..c773f037 --- /dev/null +++ b/BKULocal/src/main/resources/at/gv/egiz/bku/local/truststore.jks diff --git a/BKULocal/src/main/resources/log4j.properties b/BKULocal/src/main/resources/log4j.properties new file mode 100644 index 00000000..49d763f8 --- /dev/null +++ b/BKULocal/src/main/resources/log4j.properties @@ -0,0 +1,31 @@ +# 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. + +# loglever DEBUG, appender STDOUT +log4j.rootLogger=TRACE, STDOUT, file + +# STDOUT appender +log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender +log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout +#log4j.appender.STDOUT.layout.ConversionPattern=%5p | %d{dd HH:mm:ss,SSS} | %20c | %10t | %m%n +#log4j.appender.STDOUT.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n +log4j.appender.STDOUT.layout.ConversionPattern=%-5p |%d | %t | %c %x- %m%n + +### FILE appender +log4j.appender.file=org.apache.log4j.DailyRollingFileAppender +log4j.appender.file.datePattern='.'yyyy-MM-dd +log4j.appender.file.File=${user.home}/.bku/logs/bku.log +log4j.appender.file.layout=org.apache.log4j.PatternLayout +log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
\ No newline at end of file diff --git a/BKULocal/src/main/webapp/META-INF/MANIFEST.MF b/BKULocal/src/main/webapp/META-INF/MANIFEST.MF new file mode 100644 index 00000000..5e949512 --- /dev/null +++ b/BKULocal/src/main/webapp/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0
+Class-Path:
+
diff --git a/BKULocal/src/main/webapp/WEB-INF/applicationContext.xml b/BKULocal/src/main/webapp/WEB-INF/applicationContext.xml new file mode 100644 index 00000000..c0ffc927 --- /dev/null +++ b/BKULocal/src/main/webapp/WEB-INF/applicationContext.xml @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!-- + 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. +--> +<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
+ <bean id="STALFactory" class="at.gv.egiz.bku.local.stal.SMCCSTALFactory"
+ scope="singleton" />
+ <bean id="commandInvoker" class="at.gv.egiz.bku.binding.SLCommandInvokerImpl" />
+ <bean id="bindingProcessorManager" class="at.gv.egiz.bku.binding.BindingProcessorManagerImpl"
+ scope="singleton">
+ <constructor-arg ref="STALFactory"></constructor-arg>
+ <constructor-arg ref="commandInvoker"></constructor-arg>
+ </bean>
+ <bean
+ class="org.springframework.web.context.support.ServletContextAttributeExporter">
+ <property name="attributes">
+ <map>
+ <entry key="bindingProcessorManager">
+ <ref bean="bindingProcessorManager" />
+ </entry>
+ </map>
+ </property>
+ </bean>
+
+ <!-- Configure Configuration -->
+ <bean id="configurator" class="at.gv.egiz.bku.local.conf.Configurator"
+ scope="singleton">
+ </bean>
+
+ <!-- Configure timer to check config update -->
+ <bean id="configUpdater"
+ class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
+ <property name="targetObject" ref="configurator" />
+ <property name="targetMethod" value="checkUpdate" />
+ </bean>
+ <bean id="configTrigger"
+ class="org.springframework.scheduling.quartz.SimpleTriggerBean">
+ <property name="jobDetail" ref="configUpdater"></property>
+ <property name="startDelay" value="10000"></property>
+ <property name="repeatInterval" value="30000"></property>
+ </bean>
+ <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
+ <property name="triggers">
+ <list>
+ <ref bean="configTrigger" />
+ </list>
+ </property>
+ <property name="quartzProperties">
+ <props>
+ <prop key="org.quartz.threadPool.threadCount">1</prop>
+ </props>
+ </property>
+ </bean>
+</beans>
\ No newline at end of file diff --git a/BKULocal/src/main/webapp/WEB-INF/web.xml b/BKULocal/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000..64f9a581 --- /dev/null +++ b/BKULocal/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!-- + 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. +--> +<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app id="WebApp_ID">
+ <display-name>http-security-layer-request</display-name>
+
+ <!-- Begin Spring Config -->
+ <context-param>
+ <param-name>contextConfigLocation</param-name>
+ <param-value>/WEB-INF/applicationContext.xml</param-value>
+ </context-param>
+ <listener>
+ <listener-class>
+ org.springframework.web.context.ContextLoaderListener
+ </listener-class>
+ </listener>
+ <!-- End Spring Config -->
+
+ <!-- Begin BKU Config -->
+ <servlet>
+ <servlet-name>BKUServlet</servlet-name>
+ <servlet-class>at.gv.egiz.bku.local.webapp.SpringBKUServlet</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>BKUServlet</servlet-name>
+ <url-pattern>/http-security-layer-request</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>BKUServlet</servlet-name>
+ <url-pattern>/https-security-layer-request</url-pattern>
+ </servlet-mapping>
+ <!-- Begin BKU Config -->
+
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ <welcome-file>index.htm</welcome-file>
+ <welcome-file>index.jsp</welcome-file>
+ <welcome-file>default.html</welcome-file>
+ <welcome-file>default.htm</welcome-file>
+ <welcome-file>default.jsp</welcome-file>
+ </welcome-file-list>
+</web-app>
\ No newline at end of file diff --git a/BKULocal/src/test/java/ConfigTest.java b/BKULocal/src/test/java/ConfigTest.java new file mode 100644 index 00000000..558d1c47 --- /dev/null +++ b/BKULocal/src/test/java/ConfigTest.java @@ -0,0 +1,49 @@ +/* +* 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. +*/ +import java.net.URL;
+
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.ConfigurationFactory;
+import org.junit.Ignore;
+
+@Ignore
+public class ConfigTest {
+
+
+ private void testConfig() throws ConfigurationException {
+ ConfigurationFactory factory = new ConfigurationFactory();
+ URL configURL = getClass().getResource("/config.xml");
+ factory.setConfigurationURL(configURL);
+ Configuration config = factory.getConfiguration();
+ System.out.println("-------->: "+config.getInt("hans"));
+ }
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+ ConfigTest ct = new ConfigTest();
+ try {
+ ct.testConfig();
+ } catch (ConfigurationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/BKULocal/src/test/java/JustASandbox.java b/BKULocal/src/test/java/JustASandbox.java new file mode 100644 index 00000000..b151df92 --- /dev/null +++ b/BKULocal/src/test/java/JustASandbox.java @@ -0,0 +1,78 @@ +/* +* 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. +*/ +import java.io.ByteArrayOutputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.net.ssl.HttpsURLConnection;
+
+import org.junit.Ignore;
+
+import at.gv.egiz.bku.local.conf.Configurator;
+import at.gv.egiz.bku.local.stal.SMCCSTALFactory;
+import at.gv.egiz.bku.utils.StreamUtil;
+import at.gv.egiz.stal.InfoboxReadRequest;
+import at.gv.egiz.stal.STAL;
+import at.gv.egiz.stal.STALRequest;
+import at.gv.egiz.stal.STALResponse;
+import at.gv.egiz.stal.SignRequest;
+import at.gv.egiz.stal.SignResponse;
+
+@Ignore
+public class JustASandbox {
+
+ /**
+ * @param args
+ * @throws IOException
+ */
+ public static void main(String[] args) throws IOException {
+
+ Configurator cfg = new Configurator();
+ URL url = new URL("https://demo.egiz.gv.at");
+ HttpsURLConnection uc = (HttpsURLConnection) url.openConnection();
+ uc.connect();
+ System.exit(-1);
+
+ InfoboxReadRequest req = new InfoboxReadRequest();
+ req.setInfoboxIdentifier("SecureSignatureKeypair");
+
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ InputStream is = JustASandbox.class.getClassLoader().getResourceAsStream("at/gv/egiz/bku/local/stal/sigInfo.xml");
+ StreamUtil.copyStream(is, os);
+ SignRequest sr = new SignRequest();
+ sr.setSignedInfo(os.toByteArray());
+ sr.setKeyIdentifier("SecureSignatureKeypair"); //os.toByteArray(), "SecureSignatureKeypair", null);
+ STAL stal = (new SMCCSTALFactory()).createSTAL();
+
+ List<STALRequest> reqList = new ArrayList<STALRequest>(2);
+ reqList.add(req);
+ reqList.add(sr);
+
+ List<STALResponse> resp = stal.handleRequest(reqList);
+ System.out.println(resp.get(0));
+ System.out.println(resp.get(1));
+ FileOutputStream fos = new FileOutputStream("c:/tmp/seq_now.der");
+ SignResponse sir = (SignResponse) resp.get(1);
+ fos.write(sir.getSignatureValue());
+ fos.close();
+ }
+
+}
diff --git a/BKULocal/src/test/java/at/gv/egiz/bku/local/stal/TestSignRequest.java b/BKULocal/src/test/java/at/gv/egiz/bku/local/stal/TestSignRequest.java new file mode 100644 index 00000000..51e7ff7d --- /dev/null +++ b/BKULocal/src/test/java/at/gv/egiz/bku/local/stal/TestSignRequest.java @@ -0,0 +1,55 @@ +/* +* 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.stal;
+
+import java.io.ByteArrayOutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Ignore;
+
+import at.gv.egiz.bku.utils.StreamUtil;
+import at.gv.egiz.smcc.SignatureCard;
+import at.gv.egiz.stal.STALRequest;
+import at.gv.egiz.stal.SignRequest;
+
+@Ignore
+public class TestSignRequest {
+
+ public void test() throws Exception {
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ StreamUtil.copyStream(getClass().getClassLoader().getResourceAsStream("at/gv/egiz/bku/local/stal/sigInfo.xml"), os);
+ byte[] signedInfo = os.toByteArray();
+ SignRequest sr = new SignRequest();
+ sr.setSignedInfo(signedInfo);
+ sr.setKeyIdentifier(SignatureCard.KeyboxName.SECURE_SIGNATURE_KEYPAIR.getKeyboxName());
+ List<STALRequest> reqList = new ArrayList<STALRequest>(1);
+ reqList.add(sr);
+ System.out.println((new SMCCSTALFactory()).createSTAL().handleRequest(reqList));
+ }
+
+ public static void main(String[] args) {
+ TestSignRequest tsr = new TestSignRequest();
+ try {
+ tsr.test();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/BKULocal/src/test/resources/at/gv/egiz/bku/local/stal/sigInfo.xml b/BKULocal/src/test/resources/at/gv/egiz/bku/local/stal/sigInfo.xml new file mode 100644 index 00000000..623a78bc --- /dev/null +++ b/BKULocal/src/test/resources/at/gv/egiz/bku/local/stal/sigInfo.xml @@ -0,0 +1,79 @@ +<dsig:SignedInfo xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/><dsig:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1"/><dsig:Reference Id="signed-data-reference-0-1214921265-27289015-14960" URI=""><dsig:Transforms><dsig:Transform Algorithm="http://www.w3.org/TR/1999/REC-xslt-19991116"><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:pr="http://reference.e-government.gv.at/namespace/persondata/20020228#" xmlns:xa="http://www.egiz.gv.at/namespaces/20060713#"> + <xsl:output method="xml"/> + <xsl:template match="/"> + <html xmlns="http://www.w3.org/1999/xhtml" xmlns:etsi="http://uri.etsi.org/01903/v1.1.1#"> + <head> + <title> + <xsl:value-of select="/xa:Antrag/xa:Titel"/></title></head> + <body> + <table align="left" border="0" width="100%"> + <tr> + <td align="left" colspan="3"> + <h2> + <xsl:value-of select="/xa:Antrag/xa:Titel"/></h2></td></tr> + <tr> + <td bgcolor="silver" colspan="3" text="black">Absender/in</td></tr> + <tr> + <td align="right" width="17%">Vorname</td> + <td width="3%"/> + <td width="80%"> + <xsl:value-of select="/xa:Antrag/xa:Antragssteller/pr:PersonData/pr:PhysicalPerson/pr:Name/pr:GivenName"/></td></tr> + <tr> + <td align="right" width="17%">Familienname</td> + <td width="3%"/> + <td width="80%"> + <xsl:value-of select="Von/Title"/> + <xsl:value-of select="/xa:Antrag/xa:Antragssteller/pr:PersonData/pr:PhysicalPerson/pr:Name/pr:FamilyName"/></td></tr> + <tr> + <td align="right" width="17%">Geburtsdatum</td> + <td width="3%"/> + <td width="80%"> + <xsl:value-of select="/xa:Antrag/xa:Antragssteller/pr:PersonData/pr:PhysicalPerson/pr:DateOfBirth"/></td></tr> + <tr> + <td align="right" width="17%">Geburtsort</td> + <td width="3%"/> + <td width="80%"> + <xsl:value-of select="/xa:Antrag/xa:Antragssteller/pr:PersonData/pr:PhysicalPerson/pr:PlaceOfBirth"/></td></tr> + <tr> + <td align="right" width="17%">E-Mail zur Kontaktaufnahme</td> + <td width="3%"/> + <td width="80%"> + <xsl:value-of select="/xa:Antrag/xa:Antragssteller/pr:PersonData/pr:InternetAddress/pr:Address"/></td></tr> + <tr> + <td bgcolor="silver" colspan="3" text="black">Dieser Antrag ergeht an:</td></tr> + <tr> + <td align="right" width="17%">Adressat</td> + <td width="3%"/> + <td width="80%"> + <xsl:value-of select="/xa:Antrag/xa:Empfaenger/pr:PersonData/pr:CorporateBody/pr:FullName"/></td></tr> + <tr> + <td bgcolor="silver" colspan="3" text="black">Hauptwohnsitz des Antragsstellers (laut ZMR):</td></tr> + <tr> + <td align="right" width="17%">Strasse</td> + <td nowrap="nowrap" valign="middle" width="3%"/> + <td width="80%"> + <xsl:value-of select="/xa:Antrag/xa:Antragssteller/pr:PersonData/pr:CompactPostalAddress/pr:DeliveryAddress/pr:StreetName"/></td></tr> + <tr> + <td align="right" width="17%">Hausnummer</td> + <td nowrap="nowrap" valign="middle" width="3%"/> + <td width="80%"> + <xsl:value-of select="/xa:Antrag/xa:Antragssteller/pr:PersonData/pr:CompactPostalAddress/pr:DeliveryAddress/pr:BuildingNumber"/> + <xsl:if test="/xa:Antrag/xa:Antragssteller/pr:PersonData/pr:CompactPostalAddress/pr:DeliveryAddress/pr:Unit != ''">/ + <xsl:value-of select="/xa:Antrag/xa:Antragssteller/pr:PersonData/pr:CompactPostalAddress/pr:DeliveryAddress/pr:Unit"/></xsl:if> + <xsl:if test="/xa:Antrag/xa:Antragssteller/pr:PersonData/pr:CompactPostalAddress/pr:DeliveryAddress/pr:DoorNumber != ''">/ + <xsl:value-of select="/xa:Antrag/xa:Antragssteller/pr:PersonData/pr:CompactPostalAddress/pr:DeliveryAddress/pr:DoorNumber"/></xsl:if></td></tr> + <tr> + <td align="right" width="17%">Postleitzahl</td> + <td nowrap="nowrap" valign="middle" width="3%"/> + <td width="80%"> + <xsl:value-of select="/xa:Antrag/xa:Antragssteller/pr:PersonData/pr:CompactPostalAddress/pr:PostalCode"/></td></tr> + <tr> + <td align="right" width="17%">Ort</td> + <td nowrap="nowrap" valign="middle" width="3%"/> + <td width="80%"> + <xsl:value-of select="/xa:Antrag/xa:Antragssteller/pr:PersonData/pr:CompactPostalAddress/pr:Municipality"/></td></tr> + <tr> + <td align="right" width="17%">Staat</td> + <td nowrap="nowrap" valign="middle" width="3%"/> + <td width="80%"> + <xsl:value-of select="/xa:Antrag/xa:Antragssteller/pr:PersonData/pr:CompactPostalAddress/pr:CountryName"/></td></tr></table></body></html></xsl:template></xsl:stylesheet></dsig:Transform><dsig:Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/></dsig:Transforms><dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/><dsig:DigestValue>GPYZB80vaYfGObhjlfu4lLLpAHs=</dsig:DigestValue></dsig:Reference><dsig:Reference Id="etsi-data-reference-0-1214921265-27289015-29753" Type="http://uri.etsi.org/01903/v1.1.1#SignedProperties" URI="#xmlns(etsi=http://uri.etsi.org/01903/v1.1.1%23)%20xpointer(id('etsi-data-object-0-1214921265-27289015-3533')/child::etsi:QualifyingProperties/child::etsi:SignedProperties)"><dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/><dsig:DigestValue>8DWtjO0ki1U/lxn+Y34We6GsfxU=</dsig:DigestValue></dsig:Reference></dsig:SignedInfo>
\ No newline at end of file diff --git a/BKUOnline/catalog.xml b/BKUOnline/catalog.xml new file mode 100644 index 00000000..38c98894 --- /dev/null +++ b/BKUOnline/catalog.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="system"> + <nextCatalog catalog="private/cache/retriever/catalog.xml"/> +</catalog>
\ No newline at end of file diff --git a/BKUOnline/nb-configuration.xml b/BKUOnline/nb-configuration.xml new file mode 100644 index 00000000..4bfb3c58 --- /dev/null +++ b/BKUOnline/nb-configuration.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project-shared-configuration> +This file contains additional configuration written by modules in the NetBeans IDE. +The configuration is intended to be shared among all the users of project and +therefore it is assumed to be part of version control checkout. +Without this configuration present, some functionality in the IDE may be limited or fail altogether. + + +<spring-data xmlns="http://www.netbeans.org/ns/spring-data/1"> + <config-files> + <config-file>src/main/webapp/WEB-INF/applicationContext.xml</config-file> + </config-files> + <config-file-groups/> + </spring-data> +</project-shared-configuration> diff --git a/BKUOnline/pom.xml b/BKUOnline/pom.xml new file mode 100644 index 00000000..dacdbaf5 --- /dev/null +++ b/BKUOnline/pom.xml @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>bku</artifactId>
+ <groupId>at.gv.egiz</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>at.gv.egiz</groupId>
+ <artifactId>BKUOnline</artifactId>
+ <packaging>war</packaging>
+ <name>BKU Online</name>
+ <version>1.0-SNAPSHOT</version>
+ <dependencies>
+ <dependency>
+ <groupId>at.gv.egiz</groupId>
+ <artifactId>bkucommon</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>2.5.5</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ <version>2.5.5</version>
+ </dependency>
+ <dependency>
+ <groupId>at.gv.egiz</groupId>
+ <artifactId>STALService</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <!--
+ | see https://wsit.dev.java.net/issues/show_bug.cgi?id=970
+ -->
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <!--artifactId>webservices-rt</artifactId>
+ <version>1.2</version-->
+ <artifactId>jaxws-rt</artifactId>
+ <version>2.1.4</version>
+ </dependency>
+ <!--dependency>
+ <groupId>at.gv.egiz</groupId>
+ <artifactId>BKUApplet</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency-->
+ </dependencies>
+ <properties>
+ <netbeans.hint.deploy.server>Tomcat60</netbeans.hint.deploy.server>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copyapplet</id>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>at.gv.egiz</groupId>
+ <artifactId>BKUApplet</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/${project.build.finalName}/applet</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <!--plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jaxws-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>wsimport</goal>
+ </goals>
+ <configuration>
+ <verbose>true</verbose>
+ <bindingDirectory>${basedir}/src/main/custom-binding</bindingDirectory>
+ <bindingFiles>
+ <bindingFile>stalservice-custom.xml</bindingFile>
+ <bindingFile>staltypes-custom.xml</bindingFile>
+ </bindingFiles>
+ <wsdlDirectory>${basedir}/src/main/webapp/WEB-INF/wsdl</wsdlDirectory>
+ <wsdlFiles>
+ <wsdlFile>stal.wsdl</wsdlFile>
+ </wsdlFiles>
+ <sourceDestDir>${project.build.directory}/generated-sources/wsimport</sourceDestDir>
+ <staleFile>${project.build.directory}/generated-sources/wsimport/.staleFlag</staleFile>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin-->
+ </plugins>
+ </build>
+</project>
diff --git a/BKUOnline/private/cache/retriever/catalog.xml b/BKUOnline/private/cache/retriever/catalog.xml new file mode 100644 index 00000000..c40b0d50 --- /dev/null +++ b/BKUOnline/private/cache/retriever/catalog.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="system"> + <system systemId="http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd" uri="java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd"/> + <system systemId="http://www.w3.org/2001/XMLSchema.xsd" uri="www.w3.org/2001/XMLSchema.xsd"/> +</catalog>
\ No newline at end of file diff --git a/BKUOnline/private/cache/retriever/java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd b/BKUOnline/private/cache/retriever/java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd new file mode 100644 index 00000000..f9a884c0 --- /dev/null +++ b/BKUOnline/private/cache/retriever/java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd @@ -0,0 +1,362 @@ +<?xml version = "1.0" encoding = "UTF-8"?>
+<xs:schema
+ targetNamespace = "http://java.sun.com/xml/ns/jaxb"
+ xmlns:jaxb = "http://java.sun.com/xml/ns/jaxb"
+ xmlns:xs = "http://www.w3.org/2001/XMLSchema"
+ elementFormDefault = "qualified"
+ attributeFormDefault = "unqualified">
+ <xs:annotation><xs:documentation>
+ Schema for JAXB 2.0 binding declarations.
+ </xs:documentation></xs:annotation>
+ <xs:group name = "declaration">
+ <xs:annotation><xs:documentation>
+Model group that represents a binding declaration. Each new binding
+declaration added to the jaxb namespace that is not restricted to
+globalBindings should be added as a child element to this model group.
+ </xs:documentation></xs:annotation>
+ <!-- each new binding declaration, not restricted to
+ globalBindings, should be added here -->
+ <xs:choice>
+ <xs:element ref = "jaxb:globalBindings"/>
+ <xs:element ref = "jaxb:schemaBindings"/>
+ <xs:element ref = "jaxb:class"/>
+ <xs:element ref = "jaxb:property"/>
+ <xs:element ref = "jaxb:typesafeEnumClass"/>
+ <xs:element ref = "jaxb:typesafeEnumMember"/>
+ <xs:element ref = "jaxb:javaType"/>
+ <xs:element ref = "jaxb:dom"/>
+ <xs:element ref = "jaxb:inlineBinaryData"/>
+ <xs:any namespace = "##other" processContents = "lax"/>
+ </xs:choice>
+ </xs:group>
+ <xs:attribute name = "version" type="xs:token" >
+ <xs:annotation><xs:documentation>
+Used to specify the version of the binding schema on the schema element for
+inline annotations or jaxb:bindings for external binding.
+ </xs:documentation></xs:annotation>
+ </xs:attribute>
+ <xs:attributeGroup name = "propertyAttributes">
+ <xs:annotation><xs:documentation>
+Attributes used for property customization. The attribute group can be
+referenced either from the globalBindings declaration or from the
+property declaration. The following defaults are defined by the JAXB
+specification in global scope only. Thus they apply when the
+propertyAttributes group is referenced from the globalBindings declaration
+but not when referenced from the property declaration.
+ collectionType a class that implements java.util.List.
+ fixedAttributeAsConstantProperty false
+ enableFailFastCheck false
+ generateIsSetMethod false
+ optionalProperty wrapper
+ generateElementProperty false
+ attachmentRef default
+ </xs:documentation></xs:annotation>
+ <xs:attribute name = "collectionType" type="jaxb:referenceCollectionType"/>
+ <xs:attribute name = "fixedAttributeAsConstantProperty" type = "xs:boolean"/>
+ <xs:attribute name = "enableFailFastCheck" type = "xs:boolean"/>
+ <xs:attribute name = "generateIsSetMethod" type = "xs:boolean"/>
+ <xs:attribute name = "optionalProperty">
+ <xs:simpleType>
+ <xs:restriction base="xs:NCName">
+ <xs:enumeration value="wrapper"/>
+ <xs:enumeration value="primitive"/>
+ <xs:enumeration value="isSet"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name = "generateElementProperty" type="xs:boolean"/>
+ <xs:attribute name = "attachmentRef">
+ <xs:simpleType>
+ <xs:restriction base="xs:NCName">
+ <xs:enumeration value="resolve"/>
+ <xs:enumeration value="doNotResolve"/>
+ <xs:enumeration value="default"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:attributeGroup>
+ <xs:attributeGroup name = "XMLNameToJavaIdMappingDefaults">
+ <xs:annotation><xs:documentation>Customize XMLNames to Java id mapping
+ </xs:documentation></xs:annotation>
+ <xs:attribute name = "underscoreBinding" default = "asWordSeparator" type = "jaxb:underscoreBindingType"/>
+ </xs:attributeGroup>
+ <xs:attributeGroup name = "typesafeEnumClassDefaults">
+ <xs:attribute name = "typesafeEnumMemberName" default = "skipGeneration" type = "jaxb:typesafeEnumMemberNameType"/>
+ <xs:attribute name = "typesafeEnumBase" default = "xs:string" type = "jaxb:typesafeEnumBaseType"/>
+ <xs:attribute name = "typesafeEnumMaxMembers" type="xs:int" default="256"/>
+ </xs:attributeGroup>
+ <xs:element name = "globalBindings">
+ <xs:annotation><xs:documentation>Customization values defined in global scope.</xs:documentation></xs:annotation>
+ <xs:complexType>
+ <xs:sequence minOccurs = "0">
+ <xs:element ref = "jaxb:javaType" minOccurs = "0" maxOccurs = "unbounded"/>
+ <xs:element ref = "jaxb:serializable" minOccurs = "0"/>
+ <xs:any namespace = "##other" processContents = "lax">
+ <xs:annotation> <xs:documentation>allows extension binding declarations to be specified.</xs:documentation></xs:annotation>
+ </xs:any>
+ </xs:sequence>
+ <xs:attributeGroup ref = "jaxb:XMLNameToJavaIdMappingDefaults"/>
+ <xs:attributeGroup ref = "jaxb:typesafeEnumClassDefaults"/>
+ <xs:attributeGroup ref = "jaxb:propertyAttributes"/>
+ <xs:attribute name="generateValueClass" type="xs:boolean"
+ default= "true"/>
+ <xs:attribute name="generateElementClass" type="xs:boolean"
+ default= "false"/>
+ <xs:attribute name="mapSimpleTypeDef" type="xs:boolean"
+ default= "false"/>
+ <xs:attribute name="localScoping" default= "nested">
+ <xs:simpleType>
+ <xs:restriction base="xs:NCName">
+ <xs:enumeration value="nested"/>
+ <xs:enumeration value="toplevel"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name = "enableJavaNamingConventions" default = "true" type = "xs:boolean"/>
+<!-- Removed from JAXB 2.0
+ <xs:attribute name = "bindingStyle" default = "elementBinding" type = "jaxb:bindingStyleType"/>
+-->
+ <xs:attribute name = "choiceContentProperty" default = "false" type = "xs:boolean"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name = "schemaBindings">
+ <xs:annotation><xs:documentation>Customization values with schema scope</xs:documentation></xs:annotation>
+ <xs:complexType>
+ <xs:all>
+ <xs:element name = "package" type = "jaxb:packageType" minOccurs = "0"/>
+ <xs:element name = "nameXmlTransform" type = "jaxb:nameXmlTransformType" minOccurs = "0"/>
+ </xs:all>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name = "class">
+ <xs:annotation><xs:documentation>Customize interface and implementation class.</xs:documentation></xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name = "javadoc" type = "xs:string" minOccurs = "0"/>
+ </xs:sequence>
+ <xs:attribute name = "name" type = "jaxb:javaIdentifierType">
+ <xs:annotation><xs:documentation>Java class name without package prefix.</xs:documentation></xs:annotation>
+ </xs:attribute>
+ <xs:attribute name = "implClass" type = "jaxb:javaIdentifierType">
+ <xs:annotation><xs:documentation>Implementation class name including package prefix.</xs:documentation></xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="generateValueClass" type="xs:boolean">
+ <xs:annotation><xs:documentation>Default value derived from [jaxb:globalBindings]@generateValueClass.</xs:documentation></xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name = "property">
+ <xs:annotation><xs:documentation>Customize property.</xs:documentation></xs:annotation>
+ <xs:complexType>
+ <xs:all>
+ <xs:element name = "javadoc" type = "xs:string" minOccurs="0"/>
+ <xs:element name = "baseType" type="jaxb:propertyBaseType" minOccurs="0"/>
+ </xs:all>
+ <xs:attribute name = "name" type = "jaxb:javaIdentifierType"/>
+ <xs:attributeGroup ref = "jaxb:propertyAttributes"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name = "javaType">
+ <xs:annotation><xs:documentation>Data type conversions; overriding builtins</xs:documentation></xs:annotation>
+ <xs:complexType>
+ <xs:attribute name = "name" use = "required" type = "jaxb:javaIdentifierType">
+ <xs:annotation><xs:documentation>name of the java type to which xml type is to be bound.</xs:documentation></xs:annotation>
+ </xs:attribute>
+ <xs:attribute name = "xmlType" type = "xs:QName">
+ <xs:annotation><xs:documentation> xml type to which java datatype has to be bound.Must be present when javaType is scoped to globalBindings</xs:documentation></xs:annotation>
+ </xs:attribute>
+ <xs:attribute name = "parseMethod" type = "jaxb:javaIdentifierType"/>
+ <xs:attribute name = "printMethod" type = "jaxb:javaIdentifierType"/>
+ <xs:attribute name = "hasNsContext" default = "false" type = "xs:boolean" >
+ <xs:annotation><xs:documentation>
+If true, the parsMethod and printMethod must reference a method
+signtature that has a second parameter of type NamespaceContext.
+ </xs:documentation></xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name = "typesafeEnumClass">
+ <xs:annotation><xs:documentation> Bind to a type safe enumeration class.</xs:documentation></xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name = "javadoc" type = "xs:string" minOccurs = "0"/>
+ <xs:element ref = "jaxb:typesafeEnumMember" minOccurs = "0" maxOccurs = "unbounded"/>
+ </xs:sequence>
+ <xs:attribute name = "name" type = "jaxb:javaIdentifierType"/>
+ <xs:attribute name = "map" type = "xs:boolean" default = "true"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name = "typesafeEnumMember">
+ <xs:annotation><xs:documentation> Enumeration member name in a type safe enumeration class.</xs:documentation></xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name = "javadoc" type = "xs:string" minOccurs = "0"/>
+ </xs:sequence>
+ <xs:attribute name = "value" type="xs:anySimpleType"/>
+ <xs:attribute name = "name" use = "required" type = "jaxb:javaIdentifierType"/>
+ </xs:complexType>
+ </xs:element>
+
+ <!-- TYPE DEFINITIONS -->
+
+ <xs:complexType name = "propertyBaseType">
+ <xs:all>
+ <xs:element ref = "jaxb:javaType" minOccurs = "0"/>
+ </xs:all>
+ <xs:attribute name = "name" type = "jaxb:javaIdentifierType">
+ <xs:annotation><xs:documentation>
+The name attribute for [baseType] enables more precise control over the actual base type for a JAXB property. This customization enables specifying a more general base type than the property's default base type. The name attribute value must be a fully qualified Java class name. Additionally, this Java class must be a super interface/class of the default Java base type for the property. When the default base type is a primitive type, consider the default Java base type to be the Java wrapper class of that primitive type.This customization is useful to enable simple type substitution for a JAXB property representing with too restrictive of a default base type.
+ </xs:documentation></xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+
+<!-- Removed in JAXB 2.0. modelGroupBinding no longer exists.
+ <xs:simpleType name = "bindingStyleType">
+ <xs:annotation><xs:documentation>Allows selection of a binding algorithm</xs:documentation></xs:annotation>
+ <xs:restriction base = "xs:string">
+ <xs:enumeration value = "elementBinding"/>
+ <xs:enumeration value = "modelGroupBinding"/>
+ </xs:restriction>
+ </xs:simpleType>
+-->
+
+ <xs:complexType name = "packageType">
+ <xs:sequence>
+ <xs:element name = "javadoc" type = "xs:string" minOccurs = "0"/>
+ </xs:sequence>
+ <xs:attribute name = "name" type = "jaxb:javaIdentifierType"/>
+ </xs:complexType>
+ <xs:simpleType name = "underscoreBindingType">
+ <xs:annotation><xs:documentation>Treate underscore in XML Name to Java identifier mapping.</xs:documentation></xs:annotation>
+ <xs:restriction base = "xs:string">
+ <xs:enumeration value = "asWordSeparator"/>
+ <xs:enumeration value = "asCharInWord"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name = "typesafeEnumBaseType">
+ <xs:annotation><xs:documentation>
+XML types or types derived from them which have enumeration facet(s) which are be mapped to typesafeEnumClass by default. The following types cannot be specified in this list: "xsd:QName", "xsd:base64Binary", "xsd:hexBinary", "xsd:date", "xsd:time", "xsd:dateTime", "xsd:duration","xsd:gDay", "xsd:gMonth", "xsd:Year", "xsd:gMonthDay", "xsd:YearMonth", "xsd:ID", "xsd:IDREF", "xsd:NOTATION"
+ </xs:documentation></xs:annotation>
+ <xs:list itemType = "xs:QName"/>
+ </xs:simpleType>
+ <xs:simpleType name = "typesafeEnumMemberNameType">
+ <xs:annotation><xs:documentation>Used to customize how to handle name collisions.</xs:documentation></xs:annotation>
+ <xs:restriction base = "xs:string">
+ <xs:enumeration value = "generateName"/>
+ <xs:enumeration value = "generateError"/>
+ <xs:enumeration value = "skipGeneration"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name = "javaIdentifierType">
+ <xs:annotation><xs:documentation>Placeholder type to indicate Legal Java identifier.</xs:documentation></xs:annotation>
+ <xs:list itemType = "xs:NCName"/>
+ </xs:simpleType>
+ <xs:complexType name = "nameXmlTransformRule">
+ <xs:annotation><xs:documentation>Rule to transform an Xml name into another Xml name</xs:documentation></xs:annotation>
+ <xs:attribute name = "prefix" type = "xs:string">
+ <xs:annotation><xs:documentation>prepend the string to QName.</xs:documentation></xs:annotation>
+ </xs:attribute>
+ <xs:attribute name = "suffix" type = "xs:string">
+ <xs:annotation><xs:documentation>Append the string to QName.</xs:documentation></xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+ <xs:complexType name = "nameXmlTransformType">
+ <xs:annotation><xs:documentation>Allows transforming an xml name into another xml name. Use case UDDI 2.0 schema.</xs:documentation></xs:annotation>
+ <xs:all>
+ <xs:element name = "typeName" type = "jaxb:nameXmlTransformRule" minOccurs = "0">
+ <xs:annotation><xs:documentation>Mapping rule for type definitions.</xs:documentation></xs:annotation>
+ </xs:element>
+ <xs:element name = "elementName" type = "jaxb:nameXmlTransformRule" minOccurs = "0">
+ <xs:annotation><xs:documentation>Mapping rule for elements</xs:documentation></xs:annotation>
+ </xs:element>
+ <xs:element name = "modelGroupName" type = "jaxb:nameXmlTransformRule" minOccurs = "0">
+ <xs:annotation><xs:documentation>Mapping rule for model group</xs:documentation></xs:annotation>
+ </xs:element>
+ <xs:element name = "anonymousTypeName" type = "jaxb:nameXmlTransformRule" minOccurs = "0">
+ <xs:annotation><xs:documentation>Mapping rule for class names generated for an anonymous type.</xs:documentation></xs:annotation>
+ </xs:element>
+ </xs:all>
+ </xs:complexType>
+ <xs:attribute name = "extensionBindingPrefixes">
+ <xs:annotation><xs:documentation>
+A binding compiler only processes this attribute when it occurs on an
+an instance of xs:schema element. The value of this attribute is a
+whitespace-separated list of namespace prefixes. The namespace bound
+to each of the prefixes is designated as a customization declaration
+namespace.</xs:documentation></xs:annotation>
+ <xs:simpleType>
+ <xs:list itemType = "xs:normalizedString"/>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:element name = "bindings">
+ <xs:annotation><xs:documentation>
+Binding declaration(s) for a remote schema.
+If attribute node is set, the binding declaraions
+are associated with part of the remote schema
+designated by schemaLocation attribute. The node
+attribute identifies the node in the remote schema
+to associate the binding declaration(s) with.
+ </xs:documentation></xs:annotation>
+ <!-- a <bindings> element can contain arbitrary number of binding declarations or nested <bindings> elements -->
+ <xs:complexType>
+ <xs:sequence>
+ <xs:choice minOccurs = "0" maxOccurs = "unbounded">
+ <xs:group ref = "jaxb:declaration"/>
+ <xs:element ref = "jaxb:bindings"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:attribute name = "schemaLocation" type = "xs:anyURI">
+ <xs:annotation><xs:documentation>
+Location of the remote schema to associate binding declarations with.
+ </xs:documentation></xs:annotation>
+ </xs:attribute>
+ <xs:attribute name = "node" type = "xs:string">
+ <xs:annotation><xs:documentation>
+The value of the string is an XPATH 1.0 compliant string that
+resolves to a node in a remote schema to associate
+binding declarations with. The remote schema is specified
+by the schemaLocation attribute occuring in the current
+element or in a parent of this element.
+ </xs:documentation></xs:annotation>
+ </xs:attribute>
+ <xs:attribute name = "version" type = "xs:token">
+ <xs:annotation><xs:documentation>
+Used to indicate the version of binding declarations. Only valid on root level bindings element. Either this or "jaxb:version" attribute but not both may be specified.
+ </xs:documentation></xs:annotation>
+ </xs:attribute>
+ <xs:attribute ref = "jaxb:version">
+ <xs:annotation><xs:documentation>
+Used to indicate the version of binding declarations. Only valid on root level bindings element. Either this attribute or "version" attribute but not both may be specified.</xs:documentation></xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ <xs:simpleType name="referenceCollectionType">
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="indexed"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:restriction base="jaxb:javaIdentifierType"/>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+ <xs:element name="dom">
+ <xs:complexType>
+ <xs:attribute name = "type" type="xs:NCName" default="w3c">
+ <xs:annotation><xs:documentation>Specify DOM API to bind to JAXB property to.</xs:documentation></xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="inlineBinaryData">
+ <xs:annotation><xs:documentation>Disable MTOM/XOP encoding for this binary data. Annotation can be placed on a type defintion that derives from a W3C XSD binary data type or on an element that has a type that is or derives from a W3C XSD binary data type.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name = "serializable">
+ <xs:complexType>
+ <xs:attribute name="uid" type="xs:long" default="1"/>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
+
diff --git a/BKUOnline/private/cache/retriever/www.w3.org/2001/XMLSchema.xsd b/BKUOnline/private/cache/retriever/www.w3.org/2001/XMLSchema.xsd new file mode 100644 index 00000000..2e9a2729 --- /dev/null +++ b/BKUOnline/private/cache/retriever/www.w3.org/2001/XMLSchema.xsd @@ -0,0 +1,2534 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!-- XML Schema schema for XML Schemas: Part 1: Structures --> +<!-- Note this schema is NOT the normative structures schema. --> +<!-- The prose copy in the structures REC is the normative --> +<!-- version (which shouldn't differ from this one except for --> +<!-- this comment and entity expansions, but just in case --> +<!DOCTYPE xs:schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN" "XMLSchema.dtd" [ + +<!-- provide ID type information even for parsers which only read the + internal subset --> +<!ATTLIST xs:schema id ID #IMPLIED> +<!ATTLIST xs:complexType id ID #IMPLIED> +<!ATTLIST xs:complexContent id ID #IMPLIED> +<!ATTLIST xs:simpleContent id ID #IMPLIED> +<!ATTLIST xs:extension id ID #IMPLIED> +<!ATTLIST xs:element id ID #IMPLIED> +<!ATTLIST xs:group id ID #IMPLIED> +<!ATTLIST xs:all id ID #IMPLIED> +<!ATTLIST xs:choice id ID #IMPLIED> +<!ATTLIST xs:sequence id ID #IMPLIED> +<!ATTLIST xs:any id ID #IMPLIED> +<!ATTLIST xs:anyAttribute id ID #IMPLIED> +<!ATTLIST xs:attribute id ID #IMPLIED> +<!ATTLIST xs:attributeGroup id ID #IMPLIED> +<!ATTLIST xs:unique id ID #IMPLIED> +<!ATTLIST xs:key id ID #IMPLIED> +<!ATTLIST xs:keyref id ID #IMPLIED> +<!ATTLIST xs:selector id ID #IMPLIED> +<!ATTLIST xs:field id ID #IMPLIED> +<!ATTLIST xs:include id ID #IMPLIED> +<!ATTLIST xs:import id ID #IMPLIED> +<!ATTLIST xs:redefine id ID #IMPLIED> +<!ATTLIST xs:notation id ID #IMPLIED> +<!-- + keep this schema XML1.0 DTD valid + --> + <!ENTITY % schemaAttrs 'xmlns:hfp CDATA #IMPLIED'> + + <!ELEMENT hfp:hasFacet EMPTY> + <!ATTLIST hfp:hasFacet + name NMTOKEN #REQUIRED> + + <!ELEMENT hfp:hasProperty EMPTY> + <!ATTLIST hfp:hasProperty + name NMTOKEN #REQUIRED + value CDATA #REQUIRED> +<!-- + Make sure that processors that do not read the external + subset will know about the various IDs we declare + --> + <!ATTLIST xs:simpleType id ID #IMPLIED> + <!ATTLIST xs:maxExclusive id ID #IMPLIED> + <!ATTLIST xs:minExclusive id ID #IMPLIED> + <!ATTLIST xs:maxInclusive id ID #IMPLIED> + <!ATTLIST xs:minInclusive id ID #IMPLIED> + <!ATTLIST xs:totalDigits id ID #IMPLIED> + <!ATTLIST xs:fractionDigits id ID #IMPLIED> + <!ATTLIST xs:length id ID #IMPLIED> + <!ATTLIST xs:minLength id ID #IMPLIED> + <!ATTLIST xs:maxLength id ID #IMPLIED> + <!ATTLIST xs:enumeration id ID #IMPLIED> + <!ATTLIST xs:pattern id ID #IMPLIED> + <!ATTLIST xs:appinfo id ID #IMPLIED> + <!ATTLIST xs:documentation id ID #IMPLIED> + <!ATTLIST xs:list id ID #IMPLIED> + <!ATTLIST xs:union id ID #IMPLIED> + ]> +<xs:schema targetNamespace="http://www.w3.org/2001/XMLSchema" blockDefault="#all" elementFormDefault="qualified" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xml:lang="EN" xmlns:hfp="http://www.w3.org/2001/XMLSchema-hasFacetAndProperty"> + <xs:annotation> + <xs:documentation> + Part 1 version: Id: structures.xsd,v 1.2 2004/01/15 11:34:25 ht Exp + Part 2 version: Id: datatypes.xsd,v 1.3 2004/01/23 18:11:13 ht Exp + </xs:documentation> + </xs:annotation> + + <xs:annotation> + <xs:documentation source="http://www.w3.org/TR/2004/PER-xmlschema-1-20040318/structures.html"> + The schema corresponding to this document is normative, + with respect to the syntactic constraints it expresses in the + XML Schema language. The documentation (within <documentation> elements) + below, is not normative, but rather highlights important aspects of + the W3C Recommendation of which this is a part</xs:documentation> + </xs:annotation> + + <xs:annotation> + <xs:documentation> + The simpleType element and all of its members are defined + towards the end of this schema document</xs:documentation> + </xs:annotation> + + <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"> + <xs:annotation> + <xs:documentation> + Get access to the xml: attribute groups for xml:lang + as declared on 'schema' and 'documentation' below + </xs:documentation> + </xs:annotation> + </xs:import> + + <xs:complexType name="openAttrs"> + <xs:annotation> + <xs:documentation> + This type is extended by almost all schema types + to allow attributes from other namespaces to be + added to user schemas. + </xs:documentation> + </xs:annotation> + <xs:complexContent> + <xs:restriction base="xs:anyType"> + <xs:anyAttribute namespace="##other" processContents="lax"/> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="annotated"> + <xs:annotation> + <xs:documentation> + This type is extended by all types which allow annotation + other than <schema> itself + </xs:documentation> + </xs:annotation> + <xs:complexContent> + <xs:extension base="xs:openAttrs"> + <xs:sequence> + <xs:element ref="xs:annotation" minOccurs="0"/> + </xs:sequence> + <xs:attribute name="id" type="xs:ID"/> + </xs:extension> + </xs:complexContent> + </xs:complexType> + + <xs:group name="schemaTop"> + <xs:annotation> + <xs:documentation> + This group is for the + elements which occur freely at the top level of schemas. + All of their types are based on the "annotated" type by extension.</xs:documentation> + </xs:annotation> + <xs:choice> + <xs:group ref="xs:redefinable"/> + <xs:element ref="xs:element"/> + <xs:element ref="xs:attribute"/> + <xs:element ref="xs:notation"/> + </xs:choice> + </xs:group> + + <xs:group name="redefinable"> + <xs:annotation> + <xs:documentation> + This group is for the + elements which can self-redefine (see <redefine> below).</xs:documentation> + </xs:annotation> + <xs:choice> + <xs:element ref="xs:simpleType"/> + <xs:element ref="xs:complexType"/> + <xs:element ref="xs:group"/> + <xs:element ref="xs:attributeGroup"/> + </xs:choice> + </xs:group> + + <xs:simpleType name="formChoice"> + <xs:annotation> + <xs:documentation> + A utility type, not for public use</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:NMTOKEN"> + <xs:enumeration value="qualified"/> + <xs:enumeration value="unqualified"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="reducedDerivationControl"> + <xs:annotation> + <xs:documentation> + A utility type, not for public use</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:derivationControl"> + <xs:enumeration value="extension"/> + <xs:enumeration value="restriction"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="derivationSet"> + <xs:annotation> + <xs:documentation> + A utility type, not for public use</xs:documentation> + <xs:documentation> + #all or (possibly empty) subset of {extension, restriction}</xs:documentation> + </xs:annotation> + <xs:union> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="#all"/> + </xs:restriction> + </xs:simpleType> + <xs:simpleType> + <xs:list itemType="xs:reducedDerivationControl"/> + </xs:simpleType> + </xs:union> + </xs:simpleType> + + <xs:simpleType name="typeDerivationControl"> + <xs:annotation> + <xs:documentation> + A utility type, not for public use</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:derivationControl"> + <xs:enumeration value="extension"/> + <xs:enumeration value="restriction"/> + <xs:enumeration value="list"/> + <xs:enumeration value="union"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="fullDerivationSet"> + <xs:annotation> + <xs:documentation> + A utility type, not for public use</xs:documentation> + <xs:documentation> + #all or (possibly empty) subset of {extension, restriction, list, union}</xs:documentation> + </xs:annotation> + <xs:union> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="#all"/> + </xs:restriction> + </xs:simpleType> + <xs:simpleType> + <xs:list itemType="xs:typeDerivationControl"/> + </xs:simpleType> + </xs:union> + </xs:simpleType> + + <xs:element name="schema" id="schema"> + <xs:annotation> + <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-schema"/> + </xs:annotation> + <xs:complexType> + <xs:complexContent> + <xs:extension base="xs:openAttrs"> + <xs:sequence> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:element ref="xs:include"/> + <xs:element ref="xs:import"/> + <xs:element ref="xs:redefine"/> + <xs:element ref="xs:annotation"/> + </xs:choice> + <xs:sequence minOccurs="0" maxOccurs="unbounded"> + <xs:group ref="xs:schemaTop"/> + <xs:element ref="xs:annotation" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + </xs:sequence> + <xs:attribute name="targetNamespace" type="xs:anyURI"/> + <xs:attribute name="version" type="xs:token"/> + <xs:attribute name="finalDefault" type="xs:fullDerivationSet" use="optional" default=""/> + <xs:attribute name="blockDefault" type="xs:blockSet" use="optional" default=""/> + <xs:attribute name="attributeFormDefault" type="xs:formChoice" use="optional" default="unqualified"/> + <xs:attribute name="elementFormDefault" type="xs:formChoice" use="optional" default="unqualified"/> + <xs:attribute name="id" type="xs:ID"/> + <xs:attribute ref="xml:lang"/> + </xs:extension> + </xs:complexContent> + </xs:complexType> + + <xs:key name="element"> + <xs:selector xpath="xs:element"/> + <xs:field xpath="@name"/> + </xs:key> + + <xs:key name="attribute"> + <xs:selector xpath="xs:attribute"/> + <xs:field xpath="@name"/> + </xs:key> + + <xs:key name="type"> + <xs:selector xpath="xs:complexType|xs:simpleType"/> + <xs:field xpath="@name"/> + </xs:key> + + <xs:key name="group"> + <xs:selector xpath="xs:group"/> + <xs:field xpath="@name"/> + </xs:key> + + <xs:key name="attributeGroup"> + <xs:selector xpath="xs:attributeGroup"/> + <xs:field xpath="@name"/> + </xs:key> + + <xs:key name="notation"> + <xs:selector xpath="xs:notation"/> + <xs:field xpath="@name"/> + </xs:key> + + <xs:key name="identityConstraint"> + <xs:selector xpath=".//xs:key|.//xs:unique|.//xs:keyref"/> + <xs:field xpath="@name"/> + </xs:key> + + </xs:element> + + <xs:simpleType name="allNNI"> + <xs:annotation><xs:documentation> + for maxOccurs</xs:documentation></xs:annotation> + <xs:union memberTypes="xs:nonNegativeInteger"> + <xs:simpleType> + <xs:restriction base="xs:NMTOKEN"> + <xs:enumeration value="unbounded"/> + </xs:restriction> + </xs:simpleType> + </xs:union> + </xs:simpleType> + + <xs:attributeGroup name="occurs"> + <xs:annotation><xs:documentation> + for all particles</xs:documentation></xs:annotation> + <xs:attribute name="minOccurs" type="xs:nonNegativeInteger" use="optional" default="1"/> + <xs:attribute name="maxOccurs" type="xs:allNNI" use="optional" default="1"/> + </xs:attributeGroup> + + <xs:attributeGroup name="defRef"> + <xs:annotation><xs:documentation> + for element, group and attributeGroup, + which both define and reference</xs:documentation></xs:annotation> + <xs:attribute name="name" type="xs:NCName"/> + <xs:attribute name="ref" type="xs:QName"/> + </xs:attributeGroup> + + <xs:group name="typeDefParticle"> + <xs:annotation> + <xs:documentation> + 'complexType' uses this</xs:documentation></xs:annotation> + <xs:choice> + <xs:element name="group" type="xs:groupRef"/> + <xs:element ref="xs:all"/> + <xs:element ref="xs:choice"/> + <xs:element ref="xs:sequence"/> + </xs:choice> + </xs:group> + + + + <xs:group name="nestedParticle"> + <xs:choice> + <xs:element name="element" type="xs:localElement"/> + <xs:element name="group" type="xs:groupRef"/> + <xs:element ref="xs:choice"/> + <xs:element ref="xs:sequence"/> + <xs:element ref="xs:any"/> + </xs:choice> + </xs:group> + + <xs:group name="particle"> + <xs:choice> + <xs:element name="element" type="xs:localElement"/> + <xs:element name="group" type="xs:groupRef"/> + <xs:element ref="xs:all"/> + <xs:element ref="xs:choice"/> + <xs:element ref="xs:sequence"/> + <xs:element ref="xs:any"/> + </xs:choice> + </xs:group> + + <xs:complexType name="attribute"> + <xs:complexContent> + <xs:extension base="xs:annotated"> + <xs:sequence> + <xs:element name="simpleType" minOccurs="0" type="xs:localSimpleType"/> + </xs:sequence> + <xs:attributeGroup ref="xs:defRef"/> + <xs:attribute name="type" type="xs:QName"/> + <xs:attribute name="use" use="optional" default="optional"> + <xs:simpleType> + <xs:restriction base="xs:NMTOKEN"> + <xs:enumeration value="prohibited"/> + <xs:enumeration value="optional"/> + <xs:enumeration value="required"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:attribute name="default" type="xs:string"/> + <xs:attribute name="fixed" type="xs:string"/> + <xs:attribute name="form" type="xs:formChoice"/> + </xs:extension> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="topLevelAttribute"> + <xs:complexContent> + <xs:restriction base="xs:attribute"> + <xs:sequence> + <xs:element ref="xs:annotation" minOccurs="0"/> + <xs:element name="simpleType" minOccurs="0" type="xs:localSimpleType"/> + </xs:sequence> + <xs:attribute name="ref" use="prohibited"/> + <xs:attribute name="form" use="prohibited"/> + <xs:attribute name="use" use="prohibited"/> + <xs:attribute name="name" use="required" type="xs:NCName"/> + <xs:anyAttribute namespace="##other" processContents="lax"/> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + + <xs:group name="attrDecls"> + <xs:sequence> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:element name="attribute" type="xs:attribute"/> + <xs:element name="attributeGroup" type="xs:attributeGroupRef"/> + </xs:choice> + <xs:element ref="xs:anyAttribute" minOccurs="0"/> + </xs:sequence> + </xs:group> + + <xs:element name="anyAttribute" type="xs:wildcard" id="anyAttribute"> + <xs:annotation> + <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-anyAttribute"/> + </xs:annotation> + </xs:element> + + <xs:group name="complexTypeModel"> + <xs:choice> + <xs:element ref="xs:simpleContent"/> + <xs:element ref="xs:complexContent"/> + <xs:sequence> + <xs:annotation> + <xs:documentation> + This branch is short for + <complexContent> + <restriction base="xs:anyType"> + ... + </restriction> + </complexContent></xs:documentation> + </xs:annotation> + <xs:group ref="xs:typeDefParticle" minOccurs="0"/> + <xs:group ref="xs:attrDecls"/> + </xs:sequence> + </xs:choice> + </xs:group> + + <xs:complexType name="complexType" abstract="true"> + <xs:complexContent> + <xs:extension base="xs:annotated"> + <xs:group ref="xs:complexTypeModel"/> + <xs:attribute name="name" type="xs:NCName"> + <xs:annotation> + <xs:documentation> + Will be restricted to required or forbidden</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="mixed" type="xs:boolean" use="optional" default="false"> + <xs:annotation> + <xs:documentation> + Not allowed if simpleContent child is chosen. + May be overriden by setting on complexContent child.</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="abstract" type="xs:boolean" use="optional" default="false"/> + <xs:attribute name="final" type="xs:derivationSet"/> + <xs:attribute name="block" type="xs:derivationSet"/> + </xs:extension> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="topLevelComplexType"> + <xs:complexContent> + <xs:restriction base="xs:complexType"> + <xs:sequence> + <xs:element ref="xs:annotation" minOccurs="0"/> + <xs:group ref="xs:complexTypeModel"/> + </xs:sequence> + <xs:attribute name="name" type="xs:NCName" use="required"/> + <xs:anyAttribute namespace="##other" processContents="lax"/> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="localComplexType"> + <xs:complexContent> + <xs:restriction base="xs:complexType"> + <xs:sequence> + <xs:element ref="xs:annotation" minOccurs="0"/> + <xs:group ref="xs:complexTypeModel"/> + </xs:sequence> + <xs:attribute name="name" use="prohibited"/> + <xs:attribute name="abstract" use="prohibited"/> + <xs:attribute name="final" use="prohibited"/> + <xs:attribute name="block" use="prohibited"/> + <xs:anyAttribute namespace="##other" processContents="lax"/> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="restrictionType"> + <xs:complexContent> + <xs:extension base="xs:annotated"> + <xs:sequence> + <xs:choice minOccurs="0"> + <xs:group ref="xs:typeDefParticle"/> + <xs:group ref="xs:simpleRestrictionModel"/> + </xs:choice> + <xs:group ref="xs:attrDecls"/> + </xs:sequence> + <xs:attribute name="base" type="xs:QName" use="required"/> + </xs:extension> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="complexRestrictionType"> + <xs:complexContent> + <xs:restriction base="xs:restrictionType"> + <xs:sequence> + <xs:element ref="xs:annotation" minOccurs="0"/> + <xs:choice minOccurs="0"> + <xs:annotation> + <xs:documentation>This choice is added simply to + make this a valid restriction per the REC</xs:documentation> + </xs:annotation> + <xs:group ref="xs:typeDefParticle"/> + </xs:choice> + <xs:group ref="xs:attrDecls"/> + </xs:sequence> + <xs:anyAttribute namespace="##other" processContents="lax"/> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="extensionType"> + <xs:complexContent> + <xs:extension base="xs:annotated"> + <xs:sequence> + <xs:group ref="xs:typeDefParticle" minOccurs="0"/> + <xs:group ref="xs:attrDecls"/> + </xs:sequence> + <xs:attribute name="base" type="xs:QName" use="required"/> + </xs:extension> + </xs:complexContent> + </xs:complexType> + + <xs:element name="complexContent" id="complexContent"> + <xs:annotation> + <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-complexContent"/> + </xs:annotation> + <xs:complexType> + <xs:complexContent> + <xs:extension base="xs:annotated"> + <xs:choice> + <xs:element name="restriction" type="xs:complexRestrictionType"/> + <xs:element name="extension" type="xs:extensionType"/> + </xs:choice> + <xs:attribute name="mixed" type="xs:boolean"> + <xs:annotation> + <xs:documentation> + Overrides any setting on complexType parent.</xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:extension> + </xs:complexContent> + </xs:complexType> + </xs:element> + + <xs:complexType name="simpleRestrictionType"> + <xs:complexContent> + <xs:restriction base="xs:restrictionType"> + <xs:sequence> + <xs:element ref="xs:annotation" minOccurs="0"/> + <xs:choice minOccurs="0"> + <xs:annotation> + <xs:documentation>This choice is added simply to + make this a valid restriction per the REC</xs:documentation> + </xs:annotation> + <xs:group ref="xs:simpleRestrictionModel"/> + </xs:choice> + <xs:group ref="xs:attrDecls"/> + </xs:sequence> + <xs:anyAttribute namespace="##other" processContents="lax"/> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="simpleExtensionType"> + <xs:complexContent> + <xs:restriction base="xs:extensionType"> + <xs:sequence> + <xs:annotation> + <xs:documentation> + No typeDefParticle group reference</xs:documentation> + </xs:annotation> + <xs:element ref="xs:annotation" minOccurs="0"/> + <xs:group ref="xs:attrDecls"/> + </xs:sequence> + <xs:anyAttribute namespace="##other" processContents="lax"/> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + + <xs:element name="simpleContent" id="simpleContent"> + <xs:annotation> + <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-simpleContent"/> + </xs:annotation> + <xs:complexType> + <xs:complexContent> + <xs:extension base="xs:annotated"> + <xs:choice> + <xs:element name="restriction" type="xs:simpleRestrictionType"/> + <xs:element name="extension" type="xs:simpleExtensionType"/> + </xs:choice> + </xs:extension> + </xs:complexContent> + </xs:complexType> + </xs:element> + + <xs:element name="complexType" type="xs:topLevelComplexType" id="complexType"> + <xs:annotation> + <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-complexType"/> + </xs:annotation> + </xs:element> + + + <xs:simpleType name="blockSet"> + <xs:annotation> + <xs:documentation> + A utility type, not for public use</xs:documentation> + <xs:documentation> + #all or (possibly empty) subset of {substitution, extension, + restriction}</xs:documentation> + </xs:annotation> + <xs:union> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="#all"/> + </xs:restriction> + </xs:simpleType> + <xs:simpleType> + <xs:list> + <xs:simpleType> + <xs:restriction base="xs:derivationControl"> + <xs:enumeration value="extension"/> + <xs:enumeration value="restriction"/> + <xs:enumeration value="substitution"/> + </xs:restriction> + </xs:simpleType> + </xs:list> + </xs:simpleType> + </xs:union> + </xs:simpleType> + + <xs:complexType name="element" abstract="true"> + <xs:annotation> + <xs:documentation> + The element element can be used either + at the top level to define an element-type binding globally, + or within a content model to either reference a globally-defined + element or type or declare an element-type binding locally. + The ref form is not allowed at the top level.</xs:documentation> + </xs:annotation> + + <xs:complexContent> + <xs:extension base="xs:annotated"> + <xs:sequence> + <xs:choice minOccurs="0"> + <xs:element name="simpleType" type="xs:localSimpleType"/> + <xs:element name="complexType" type="xs:localComplexType"/> + </xs:choice> + <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + <xs:attributeGroup ref="xs:defRef"/> + <xs:attribute name="type" type="xs:QName"/> + <xs:attribute name="substitutionGroup" type="xs:QName"/> + <xs:attributeGroup ref="xs:occurs"/> + <xs:attribute name="default" type="xs:string"/> + <xs:attribute name="fixed" type="xs:string"/> + <xs:attribute name="nillable" type="xs:boolean" use="optional" default="false"/> + <xs:attribute name="abstract" type="xs:boolean" use="optional" default="false"/> + <xs:attribute name="final" type="xs:derivationSet"/> + <xs:attribute name="block" type="xs:blockSet"/> + <xs:attribute name="form" type="xs:formChoice"/> + </xs:extension> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="topLevelElement"> + <xs:complexContent> + <xs:restriction base="xs:element"> + <xs:sequence> + <xs:element ref="xs:annotation" minOccurs="0"/> + <xs:choice minOccurs="0"> + <xs:element name="simpleType" type="xs:localSimpleType"/> + <xs:element name="complexType" type="xs:localComplexType"/> + </xs:choice> + <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + <xs:attribute name="ref" use="prohibited"/> + <xs:attribute name="form" use="prohibited"/> + <xs:attribute name="minOccurs" use="prohibited"/> + <xs:attribute name="maxOccurs" use="prohibited"/> + <xs:attribute name="name" use="required" type="xs:NCName"/> + <xs:anyAttribute namespace="##other" processContents="lax"/> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="localElement"> + <xs:complexContent> + <xs:restriction base="xs:element"> + <xs:sequence> + <xs:element ref="xs:annotation" minOccurs="0"/> + <xs:choice minOccurs="0"> + <xs:element name="simpleType" type="xs:localSimpleType"/> + <xs:element name="complexType" type="xs:localComplexType"/> + </xs:choice> + <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + <xs:attribute name="substitutionGroup" use="prohibited"/> + <xs:attribute name="final" use="prohibited"/> + <xs:attribute name="abstract" use="prohibited"/> + <xs:anyAttribute namespace="##other" processContents="lax"/> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + + <xs:element name="element" type="xs:topLevelElement" id="element"> + <xs:annotation> + <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-element"/> + </xs:annotation> + </xs:element> + + <xs:complexType name="group" abstract="true"> + <xs:annotation> + <xs:documentation> + group type for explicit groups, named top-level groups and + group references</xs:documentation> + </xs:annotation> + <xs:complexContent> + <xs:extension base="xs:annotated"> + <xs:group ref="xs:particle" minOccurs="0" maxOccurs="unbounded"/> + <xs:attributeGroup ref="xs:defRef"/> + <xs:attributeGroup ref="xs:occurs"/> + </xs:extension> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="realGroup"> + <xs:complexContent> + <xs:restriction base="xs:group"> + <xs:sequence> + <xs:element ref="xs:annotation" minOccurs="0"/> + <xs:choice minOccurs="0" maxOccurs="1"> + <xs:element ref="xs:all"/> + <xs:element ref="xs:choice"/> + <xs:element ref="xs:sequence"/> + </xs:choice> + </xs:sequence> + <xs:anyAttribute namespace="##other" processContents="lax"/> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="namedGroup"> + <xs:complexContent> + <xs:restriction base="xs:realGroup"> + <xs:sequence> + <xs:element ref="xs:annotation" minOccurs="0"/> + <xs:choice minOccurs="1" maxOccurs="1"> + <xs:element name="all"> + <xs:complexType> + <xs:complexContent> + <xs:restriction base="xs:all"> + <xs:group ref="xs:allModel"/> + <xs:attribute name="minOccurs" use="prohibited"/> + <xs:attribute name="maxOccurs" use="prohibited"/> + <xs:anyAttribute namespace="##other" processContents="lax"/> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + </xs:element> + <xs:element name="choice" type="xs:simpleExplicitGroup"/> + <xs:element name="sequence" type="xs:simpleExplicitGroup"/> + </xs:choice> + </xs:sequence> + <xs:attribute name="name" use="required" type="xs:NCName"/> + <xs:attribute name="ref" use="prohibited"/> + <xs:attribute name="minOccurs" use="prohibited"/> + <xs:attribute name="maxOccurs" use="prohibited"/> + <xs:anyAttribute namespace="##other" processContents="lax"/> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="groupRef"> + <xs:complexContent> + <xs:restriction base="xs:realGroup"> + <xs:sequence> + <xs:element ref="xs:annotation" minOccurs="0"/> + </xs:sequence> + <xs:attribute name="ref" use="required" type="xs:QName"/> + <xs:attribute name="name" use="prohibited"/> + <xs:anyAttribute namespace="##other" processContents="lax"/> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="explicitGroup"> + <xs:annotation> + <xs:documentation> + group type for the three kinds of group</xs:documentation> + </xs:annotation> + <xs:complexContent> + <xs:restriction base="xs:group"> + <xs:sequence> + <xs:element ref="xs:annotation" minOccurs="0"/> + <xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + <xs:attribute name="name" type="xs:NCName" use="prohibited"/> + <xs:attribute name="ref" type="xs:QName" use="prohibited"/> + <xs:anyAttribute namespace="##other" processContents="lax"/> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="simpleExplicitGroup"> + <xs:complexContent> + <xs:restriction base="xs:explicitGroup"> + <xs:sequence> + <xs:element ref="xs:annotation" minOccurs="0"/> + <xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + <xs:attribute name="minOccurs" use="prohibited"/> + <xs:attribute name="maxOccurs" use="prohibited"/> + <xs:anyAttribute namespace="##other" processContents="lax"/> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + + <xs:group name="allModel"> + <xs:sequence> + <xs:element ref="xs:annotation" minOccurs="0"/> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation>This choice with min/max is here to + avoid a pblm with the Elt:All/Choice/Seq + Particle derivation constraint</xs:documentation> + </xs:annotation> + <xs:element name="element" type="xs:narrowMaxMin"/> + </xs:choice> + </xs:sequence> + </xs:group> + + + <xs:complexType name="narrowMaxMin"> + <xs:annotation> + <xs:documentation>restricted max/min</xs:documentation> + </xs:annotation> + <xs:complexContent> + <xs:restriction base="xs:localElement"> + <xs:sequence> + <xs:element ref="xs:annotation" minOccurs="0"/> + <xs:choice minOccurs="0"> + <xs:element name="simpleType" type="xs:localSimpleType"/> + <xs:element name="complexType" type="xs:localComplexType"/> + </xs:choice> + <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + <xs:attribute name="minOccurs" use="optional" default="1"> + <xs:simpleType> + <xs:restriction base="xs:nonNegativeInteger"> + <xs:enumeration value="0"/> + <xs:enumeration value="1"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:attribute name="maxOccurs" use="optional" default="1"> + <xs:simpleType> + <xs:restriction base="xs:allNNI"> + <xs:enumeration value="0"/> + <xs:enumeration value="1"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:anyAttribute namespace="##other" processContents="lax"/> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="all"> + <xs:annotation> + <xs:documentation> + Only elements allowed inside</xs:documentation> + </xs:annotation> + <xs:complexContent> + <xs:restriction base="xs:explicitGroup"> + <xs:group ref="xs:allModel"/> + <xs:attribute name="minOccurs" use="optional" default="1"> + <xs:simpleType> + <xs:restriction base="xs:nonNegativeInteger"> + <xs:enumeration value="0"/> + <xs:enumeration value="1"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:attribute name="maxOccurs" use="optional" default="1"> + <xs:simpleType> + <xs:restriction base="xs:allNNI"> + <xs:enumeration value="1"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:anyAttribute namespace="##other" processContents="lax"/> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + + <xs:element name="all" id="all" type="xs:all"> + <xs:annotation> + <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-all"/> + </xs:annotation> + </xs:element> + + <xs:element name="choice" type="xs:explicitGroup" id="choice"> + <xs:annotation> + <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-choice"/> + </xs:annotation> + </xs:element> + + <xs:element name="sequence" type="xs:explicitGroup" id="sequence"> + <xs:annotation> + <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-sequence"/> + </xs:annotation> + </xs:element> + + <xs:element name="group" type="xs:namedGroup" id="group"> + <xs:annotation> + <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-group"/> + </xs:annotation> + </xs:element> + + <xs:complexType name="wildcard"> + <xs:complexContent> + <xs:extension base="xs:annotated"> + <xs:attribute name="namespace" type="xs:namespaceList" use="optional" default="##any"/> + <xs:attribute name="processContents" use="optional" default="strict"> + <xs:simpleType> + <xs:restriction base="xs:NMTOKEN"> + <xs:enumeration value="skip"/> + <xs:enumeration value="lax"/> + <xs:enumeration value="strict"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:extension> + </xs:complexContent> + </xs:complexType> + + <xs:element name="any" id="any"> + <xs:annotation> + <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-any"/> + </xs:annotation> + <xs:complexType> + <xs:complexContent> + <xs:extension base="xs:wildcard"> + <xs:attributeGroup ref="xs:occurs"/> + </xs:extension> + </xs:complexContent> + </xs:complexType> + </xs:element> + + <xs:annotation> + <xs:documentation> + simple type for the value of the 'namespace' attr of + 'any' and 'anyAttribute'</xs:documentation> + </xs:annotation> + <xs:annotation> + <xs:documentation> + Value is + ##any - - any non-conflicting WFXML/attribute at all + + ##other - - any non-conflicting WFXML/attribute from + namespace other than targetNS + + ##local - - any unqualified non-conflicting WFXML/attribute + + one or - - any non-conflicting WFXML/attribute from + more URI the listed namespaces + references + (space separated) + + ##targetNamespace or ##local may appear in the above list, to + refer to the targetNamespace of the enclosing + schema or an absent targetNamespace respectively</xs:documentation> + </xs:annotation> + + <xs:simpleType name="namespaceList"> + <xs:annotation> + <xs:documentation> + A utility type, not for public use</xs:documentation> + </xs:annotation> + <xs:union> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="##any"/> + <xs:enumeration value="##other"/> + </xs:restriction> + </xs:simpleType> + <xs:simpleType> + <xs:list> + <xs:simpleType> + <xs:union memberTypes="xs:anyURI"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="##targetNamespace"/> + <xs:enumeration value="##local"/> + </xs:restriction> + </xs:simpleType> + </xs:union> + </xs:simpleType> + </xs:list> + </xs:simpleType> + </xs:union> + </xs:simpleType> + + <xs:element name="attribute" type="xs:topLevelAttribute" id="attribute"> + <xs:annotation> + <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-attribute"/> + </xs:annotation> + </xs:element> + + <xs:complexType name="attributeGroup" abstract="true"> + <xs:complexContent> + <xs:extension base="xs:annotated"> + <xs:group ref="xs:attrDecls"/> + <xs:attributeGroup ref="xs:defRef"/> + </xs:extension> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="namedAttributeGroup"> + <xs:complexContent> + <xs:restriction base="xs:attributeGroup"> + <xs:sequence> + <xs:element ref="xs:annotation" minOccurs="0"/> + <xs:group ref="xs:attrDecls"/> + </xs:sequence> + <xs:attribute name="name" use="required" type="xs:NCName"/> + <xs:attribute name="ref" use="prohibited"/> + <xs:anyAttribute namespace="##other" processContents="lax"/> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="attributeGroupRef"> + <xs:complexContent> + <xs:restriction base="xs:attributeGroup"> + <xs:sequence> + <xs:element ref="xs:annotation" minOccurs="0"/> + </xs:sequence> + <xs:attribute name="ref" use="required" type="xs:QName"/> + <xs:attribute name="name" use="prohibited"/> + <xs:anyAttribute namespace="##other" processContents="lax"/> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + + <xs:element name="attributeGroup" type="xs:namedAttributeGroup" id="attributeGroup"> + <xs:annotation> + <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-attributeGroup"/> + </xs:annotation> + </xs:element> + + <xs:element name="include" id="include"> + <xs:annotation> + <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-include"/> + </xs:annotation> + <xs:complexType> + <xs:complexContent> + <xs:extension base="xs:annotated"> + <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/> + </xs:extension> + </xs:complexContent> + </xs:complexType> + </xs:element> + + <xs:element name="redefine" id="redefine"> + <xs:annotation> + <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-redefine"/> + </xs:annotation> + <xs:complexType> + <xs:complexContent> + <xs:extension base="xs:openAttrs"> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:element ref="xs:annotation"/> + <xs:group ref="xs:redefinable"/> + </xs:choice> + <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/> + <xs:attribute name="id" type="xs:ID"/> + </xs:extension> + </xs:complexContent> + </xs:complexType> + </xs:element> + + <xs:element name="import" id="import"> + <xs:annotation> + <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-import"/> + </xs:annotation> + <xs:complexType> + <xs:complexContent> + <xs:extension base="xs:annotated"> + <xs:attribute name="namespace" type="xs:anyURI"/> + <xs:attribute name="schemaLocation" type="xs:anyURI"/> + </xs:extension> + </xs:complexContent> + </xs:complexType> + </xs:element> + + <xs:element name="selector" id="selector"> + <xs:annotation> + <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-selector"/> + </xs:annotation> + <xs:complexType> + <xs:complexContent> + <xs:extension base="xs:annotated"> + <xs:attribute name="xpath" use="required"> + <xs:simpleType> + <xs:annotation> + <xs:documentation>A subset of XPath expressions for use +in selectors</xs:documentation> + <xs:documentation>A utility type, not for public +use</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:token"> + <xs:annotation> + <xs:documentation>The following pattern is intended to allow XPath + expressions per the following EBNF: + Selector ::= Path ( '|' Path )* + Path ::= ('.//')? Step ( '/' Step )* + Step ::= '.' | NameTest + NameTest ::= QName | '*' | NCName ':' '*' + child:: is also allowed + </xs:documentation> + </xs:annotation> + <xs:pattern value="(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*(\|(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*)*"> + </xs:pattern> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:extension> + </xs:complexContent> + </xs:complexType> + </xs:element> + + <xs:element name="field" id="field"> + <xs:annotation> + <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-field"/> + </xs:annotation> + <xs:complexType> + <xs:complexContent> + <xs:extension base="xs:annotated"> + <xs:attribute name="xpath" use="required"> + <xs:simpleType> + <xs:annotation> + <xs:documentation>A subset of XPath expressions for use +in fields</xs:documentation> + <xs:documentation>A utility type, not for public +use</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:token"> + <xs:annotation> + <xs:documentation>The following pattern is intended to allow XPath + expressions per the same EBNF as for selector, + with the following change: + Path ::= ('.//')? ( Step '/' )* ( Step | '@' NameTest ) + </xs:documentation> + </xs:annotation> + <xs:pattern value="(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*))))(\|(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*)))))*"> + </xs:pattern> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:extension> + </xs:complexContent> + </xs:complexType> + </xs:element> + + <xs:complexType name="keybase"> + <xs:complexContent> + <xs:extension base="xs:annotated"> + <xs:sequence> + <xs:element ref="xs:selector"/> + <xs:element ref="xs:field" minOccurs="1" maxOccurs="unbounded"/> + </xs:sequence> + <xs:attribute name="name" type="xs:NCName" use="required"/> + </xs:extension> + </xs:complexContent> + </xs:complexType> + + <xs:group name="identityConstraint"> + <xs:annotation> + <xs:documentation>The three kinds of identity constraints, all with + type of or derived from 'keybase'. + </xs:documentation> + </xs:annotation> + <xs:choice> + <xs:element ref="xs:unique"/> + <xs:element ref="xs:key"/> + <xs:element ref="xs:keyref"/> + </xs:choice> + </xs:group> + + <xs:element name="unique" type="xs:keybase" id="unique"> + <xs:annotation> + <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-unique"/> + </xs:annotation> + </xs:element> + <xs:element name="key" type="xs:keybase" id="key"> + <xs:annotation> + <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-key"/> + </xs:annotation> + </xs:element> + <xs:element name="keyref" id="keyref"> + <xs:annotation> + <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-keyref"/> + </xs:annotation> + <xs:complexType> + <xs:complexContent> + <xs:extension base="xs:keybase"> + <xs:attribute name="refer" type="xs:QName" use="required"/> + </xs:extension> + </xs:complexContent> + </xs:complexType> + </xs:element> + + <xs:element name="notation" id="notation"> + <xs:annotation> + <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-notation"/> + </xs:annotation> + <xs:complexType> + <xs:complexContent> + <xs:extension base="xs:annotated"> + <xs:attribute name="name" type="xs:NCName" use="required"/> + <xs:attribute name="public" type="xs:public"/> + <xs:attribute name="system" type="xs:anyURI"/> + </xs:extension> + </xs:complexContent> + </xs:complexType> + </xs:element> + + <xs:simpleType name="public"> + <xs:annotation> + <xs:documentation> + A utility type, not for public use</xs:documentation> + <xs:documentation> + A public identifier, per ISO 8879</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:token"/> + </xs:simpleType> + + <xs:element name="appinfo" id="appinfo"> + <xs:annotation> + <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-appinfo"/> + </xs:annotation> + <xs:complexType mixed="true"> + <xs:sequence minOccurs="0" maxOccurs="unbounded"> + <xs:any processContents="lax"/> + </xs:sequence> + <xs:attribute name="source" type="xs:anyURI"/> + <xs:anyAttribute namespace="##other" processContents="lax"/> + </xs:complexType> + </xs:element> + + <xs:element name="documentation" id="documentation"> + <xs:annotation> + <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-documentation"/> + </xs:annotation> + <xs:complexType mixed="true"> + <xs:sequence minOccurs="0" maxOccurs="unbounded"> + <xs:any processContents="lax"/> + </xs:sequence> + <xs:attribute name="source" type="xs:anyURI"/> + <xs:attribute ref="xml:lang"/> + <xs:anyAttribute namespace="##other" processContents="lax"/> + </xs:complexType> + </xs:element> + + <xs:element name="annotation" id="annotation"> + <xs:annotation> + <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-annotation"/> + </xs:annotation> + <xs:complexType> + <xs:complexContent> + <xs:extension base="xs:openAttrs"> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:element ref="xs:appinfo"/> + <xs:element ref="xs:documentation"/> + </xs:choice> + <xs:attribute name="id" type="xs:ID"/> + </xs:extension> + </xs:complexContent> + </xs:complexType> + </xs:element> + + <xs:annotation> + <xs:documentation> + notations for use within XML Schema schemas</xs:documentation> + </xs:annotation> + + <xs:notation name="XMLSchemaStructures" public="structures" system="http://www.w3.org/2000/08/XMLSchema.xsd"/> + <xs:notation name="XML" public="REC-xml-19980210" system="http://www.w3.org/TR/1998/REC-xml-19980210"/> + + <xs:complexType name="anyType" mixed="true"> + <xs:annotation> + <xs:documentation> + Not the real urType, but as close an approximation as we can + get in the XML representation</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/> + </xs:sequence> + <xs:anyAttribute processContents="lax"/> + </xs:complexType> + + <xs:annotation> + <xs:documentation> + First the built-in primitive datatypes. These definitions are for + information only, the real built-in definitions are magic. + </xs:documentation> + + <xs:documentation> + For each built-in datatype in this schema (both primitive and + derived) can be uniquely addressed via a URI constructed + as follows: + 1) the base URI is the URI of the XML Schema namespace + 2) the fragment identifier is the name of the datatype + + For example, to address the int datatype, the URI is: + + http://www.w3.org/2001/XMLSchema#int + + Additionally, each facet definition element can be uniquely + addressed via a URI constructed as follows: + 1) the base URI is the URI of the XML Schema namespace + 2) the fragment identifier is the name of the facet + + For example, to address the maxInclusive facet, the URI is: + + http://www.w3.org/2001/XMLSchema#maxInclusive + + Additionally, each facet usage in a built-in datatype definition + can be uniquely addressed via a URI constructed as follows: + 1) the base URI is the URI of the XML Schema namespace + 2) the fragment identifier is the name of the datatype, followed + by a period (".") followed by the name of the facet + + For example, to address the usage of the maxInclusive facet in + the definition of int, the URI is: + + http://www.w3.org/2001/XMLSchema#int.maxInclusive + + </xs:documentation> + </xs:annotation> + + <xs:simpleType name="string" id="string"> + <xs:annotation> + <xs:appinfo> + <hfp:hasFacet name="length"/> + <hfp:hasFacet name="minLength"/> + <hfp:hasFacet name="maxLength"/> + <hfp:hasFacet name="pattern"/> + <hfp:hasFacet name="enumeration"/> + <hfp:hasFacet name="whiteSpace"/> + <hfp:hasProperty name="ordered" value="false"/> + <hfp:hasProperty name="bounded" value="false"/> + <hfp:hasProperty name="cardinality" value="countably infinite"/> + <hfp:hasProperty name="numeric" value="false"/> + </xs:appinfo> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#string"/> + </xs:annotation> + <xs:restriction base="xs:anySimpleType"> + <xs:whiteSpace value="preserve" id="string.preserve"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="boolean" id="boolean"> + <xs:annotation> + <xs:appinfo> + <hfp:hasFacet name="pattern"/> + <hfp:hasFacet name="whiteSpace"/> + <hfp:hasProperty name="ordered" value="false"/> + <hfp:hasProperty name="bounded" value="false"/> + <hfp:hasProperty name="cardinality" value="finite"/> + <hfp:hasProperty name="numeric" value="false"/> + </xs:appinfo> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#boolean"/> + </xs:annotation> + <xs:restriction base="xs:anySimpleType"> + <xs:whiteSpace value="collapse" fixed="true" + id="boolean.whiteSpace"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="float" id="float"> + <xs:annotation> + <xs:appinfo> + <hfp:hasFacet name="pattern"/> + <hfp:hasFacet name="enumeration"/> + <hfp:hasFacet name="whiteSpace"/> + <hfp:hasFacet name="maxInclusive"/> + <hfp:hasFacet name="maxExclusive"/> + <hfp:hasFacet name="minInclusive"/> + <hfp:hasFacet name="minExclusive"/> + <hfp:hasProperty name="ordered" value="total"/> + <hfp:hasProperty name="bounded" value="true"/> + <hfp:hasProperty name="cardinality" value="finite"/> + <hfp:hasProperty name="numeric" value="true"/> + </xs:appinfo> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#float"/> + </xs:annotation> + <xs:restriction base="xs:anySimpleType"> + <xs:whiteSpace value="collapse" fixed="true" + id="float.whiteSpace"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="double" id="double"> + <xs:annotation> + <xs:appinfo> + <hfp:hasFacet name="pattern"/> + <hfp:hasFacet name="enumeration"/> + <hfp:hasFacet name="whiteSpace"/> + <hfp:hasFacet name="maxInclusive"/> + <hfp:hasFacet name="maxExclusive"/> + <hfp:hasFacet name="minInclusive"/> + <hfp:hasFacet name="minExclusive"/> + <hfp:hasProperty name="ordered" value="total"/> + <hfp:hasProperty name="bounded" value="true"/> + <hfp:hasProperty name="cardinality" value="finite"/> + <hfp:hasProperty name="numeric" value="true"/> + </xs:appinfo> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#double"/> + </xs:annotation> + <xs:restriction base="xs:anySimpleType"> + <xs:whiteSpace value="collapse" fixed="true" + id="double.whiteSpace"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="decimal" id="decimal"> + <xs:annotation> + <xs:appinfo> + <hfp:hasFacet name="totalDigits"/> + <hfp:hasFacet name="fractionDigits"/> + <hfp:hasFacet name="pattern"/> + <hfp:hasFacet name="whiteSpace"/> + <hfp:hasFacet name="enumeration"/> + <hfp:hasFacet name="maxInclusive"/> + <hfp:hasFacet name="maxExclusive"/> + <hfp:hasFacet name="minInclusive"/> + <hfp:hasFacet name="minExclusive"/> + <hfp:hasProperty name="ordered" value="total"/> + <hfp:hasProperty name="bounded" value="false"/> + <hfp:hasProperty name="cardinality" + value="countably infinite"/> + <hfp:hasProperty name="numeric" value="true"/> + </xs:appinfo> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#decimal"/> + </xs:annotation> + <xs:restriction base="xs:anySimpleType"> + <xs:whiteSpace value="collapse" fixed="true" + id="decimal.whiteSpace"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="duration" id="duration"> + <xs:annotation> + <xs:appinfo> + <hfp:hasFacet name="pattern"/> + <hfp:hasFacet name="enumeration"/> + <hfp:hasFacet name="whiteSpace"/> + <hfp:hasFacet name="maxInclusive"/> + <hfp:hasFacet name="maxExclusive"/> + <hfp:hasFacet name="minInclusive"/> + <hfp:hasFacet name="minExclusive"/> + <hfp:hasProperty name="ordered" value="partial"/> + <hfp:hasProperty name="bounded" value="false"/> + <hfp:hasProperty name="cardinality" + value="countably infinite"/> + <hfp:hasProperty name="numeric" value="false"/> + </xs:appinfo> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#duration"/> + </xs:annotation> + <xs:restriction base="xs:anySimpleType"> + <xs:whiteSpace value="collapse" fixed="true" + id="duration.whiteSpace"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="dateTime" id="dateTime"> + <xs:annotation> + <xs:appinfo> + <hfp:hasFacet name="pattern"/> + <hfp:hasFacet name="enumeration"/> + <hfp:hasFacet name="whiteSpace"/> + <hfp:hasFacet name="maxInclusive"/> + <hfp:hasFacet name="maxExclusive"/> + <hfp:hasFacet name="minInclusive"/> + <hfp:hasFacet name="minExclusive"/> + <hfp:hasProperty name="ordered" value="partial"/> + <hfp:hasProperty name="bounded" value="false"/> + <hfp:hasProperty name="cardinality" + value="countably infinite"/> + <hfp:hasProperty name="numeric" value="false"/> + </xs:appinfo> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#dateTime"/> + </xs:annotation> + <xs:restriction base="xs:anySimpleType"> + <xs:whiteSpace value="collapse" fixed="true" + id="dateTime.whiteSpace"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="time" id="time"> + <xs:annotation> + <xs:appinfo> + <hfp:hasFacet name="pattern"/> + <hfp:hasFacet name="enumeration"/> + <hfp:hasFacet name="whiteSpace"/> + <hfp:hasFacet name="maxInclusive"/> + <hfp:hasFacet name="maxExclusive"/> + <hfp:hasFacet name="minInclusive"/> + <hfp:hasFacet name="minExclusive"/> + <hfp:hasProperty name="ordered" value="partial"/> + <hfp:hasProperty name="bounded" value="false"/> + <hfp:hasProperty name="cardinality" + value="countably infinite"/> + <hfp:hasProperty name="numeric" value="false"/> + </xs:appinfo> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#time"/> + </xs:annotation> + <xs:restriction base="xs:anySimpleType"> + <xs:whiteSpace value="collapse" fixed="true" + id="time.whiteSpace"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="date" id="date"> + <xs:annotation> + <xs:appinfo> + <hfp:hasFacet name="pattern"/> + <hfp:hasFacet name="enumeration"/> + <hfp:hasFacet name="whiteSpace"/> + <hfp:hasFacet name="maxInclusive"/> + <hfp:hasFacet name="maxExclusive"/> + <hfp:hasFacet name="minInclusive"/> + <hfp:hasFacet name="minExclusive"/> + <hfp:hasProperty name="ordered" value="partial"/> + <hfp:hasProperty name="bounded" value="false"/> + <hfp:hasProperty name="cardinality" + value="countably infinite"/> + <hfp:hasProperty name="numeric" value="false"/> + </xs:appinfo> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#date"/> + </xs:annotation> + <xs:restriction base="xs:anySimpleType"> + <xs:whiteSpace value="collapse" fixed="true" + id="date.whiteSpace"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="gYearMonth" id="gYearMonth"> + <xs:annotation> + <xs:appinfo> + <hfp:hasFacet name="pattern"/> + <hfp:hasFacet name="enumeration"/> + <hfp:hasFacet name="whiteSpace"/> + <hfp:hasFacet name="maxInclusive"/> + <hfp:hasFacet name="maxExclusive"/> + <hfp:hasFacet name="minInclusive"/> + <hfp:hasFacet name="minExclusive"/> + <hfp:hasProperty name="ordered" value="partial"/> + <hfp:hasProperty name="bounded" value="false"/> + <hfp:hasProperty name="cardinality" + value="countably infinite"/> + <hfp:hasProperty name="numeric" value="false"/> + </xs:appinfo> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#gYearMonth"/> + </xs:annotation> + <xs:restriction base="xs:anySimpleType"> + <xs:whiteSpace value="collapse" fixed="true" + id="gYearMonth.whiteSpace"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="gYear" id="gYear"> + <xs:annotation> + <xs:appinfo> + <hfp:hasFacet name="pattern"/> + <hfp:hasFacet name="enumeration"/> + <hfp:hasFacet name="whiteSpace"/> + <hfp:hasFacet name="maxInclusive"/> + <hfp:hasFacet name="maxExclusive"/> + <hfp:hasFacet name="minInclusive"/> + <hfp:hasFacet name="minExclusive"/> + <hfp:hasProperty name="ordered" value="partial"/> + <hfp:hasProperty name="bounded" value="false"/> + <hfp:hasProperty name="cardinality" + value="countably infinite"/> + <hfp:hasProperty name="numeric" value="false"/> + </xs:appinfo> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#gYear"/> + </xs:annotation> + <xs:restriction base="xs:anySimpleType"> + <xs:whiteSpace value="collapse" fixed="true" + id="gYear.whiteSpace"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="gMonthDay" id="gMonthDay"> + <xs:annotation> + <xs:appinfo> + <hfp:hasFacet name="pattern"/> + <hfp:hasFacet name="enumeration"/> + <hfp:hasFacet name="whiteSpace"/> + <hfp:hasFacet name="maxInclusive"/> + <hfp:hasFacet name="maxExclusive"/> + <hfp:hasFacet name="minInclusive"/> + <hfp:hasFacet name="minExclusive"/> + <hfp:hasProperty name="ordered" value="partial"/> + <hfp:hasProperty name="bounded" value="false"/> + <hfp:hasProperty name="cardinality" + value="countably infinite"/> + <hfp:hasProperty name="numeric" value="false"/> + </xs:appinfo> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#gMonthDay"/> + </xs:annotation> + <xs:restriction base="xs:anySimpleType"> + <xs:whiteSpace value="collapse" fixed="true" + id="gMonthDay.whiteSpace"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="gDay" id="gDay"> + <xs:annotation> + <xs:appinfo> + <hfp:hasFacet name="pattern"/> + <hfp:hasFacet name="enumeration"/> + <hfp:hasFacet name="whiteSpace"/> + <hfp:hasFacet name="maxInclusive"/> + <hfp:hasFacet name="maxExclusive"/> + <hfp:hasFacet name="minInclusive"/> + <hfp:hasFacet name="minExclusive"/> + <hfp:hasProperty name="ordered" value="partial"/> + <hfp:hasProperty name="bounded" value="false"/> + <hfp:hasProperty name="cardinality" + value="countably infinite"/> + <hfp:hasProperty name="numeric" value="false"/> + </xs:appinfo> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#gDay"/> + </xs:annotation> + <xs:restriction base="xs:anySimpleType"> + <xs:whiteSpace value="collapse" fixed="true" + id="gDay.whiteSpace"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="gMonth" id="gMonth"> + <xs:annotation> + <xs:appinfo> + <hfp:hasFacet name="pattern"/> + <hfp:hasFacet name="enumeration"/> + <hfp:hasFacet name="whiteSpace"/> + <hfp:hasFacet name="maxInclusive"/> + <hfp:hasFacet name="maxExclusive"/> + <hfp:hasFacet name="minInclusive"/> + <hfp:hasFacet name="minExclusive"/> + <hfp:hasProperty name="ordered" value="partial"/> + <hfp:hasProperty name="bounded" value="false"/> + <hfp:hasProperty name="cardinality" + value="countably infinite"/> + <hfp:hasProperty name="numeric" value="false"/> + </xs:appinfo> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#gMonth"/> + </xs:annotation> + <xs:restriction base="xs:anySimpleType"> + <xs:whiteSpace value="collapse" fixed="true" + id="gMonth.whiteSpace"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="hexBinary" id="hexBinary"> + <xs:annotation> + <xs:appinfo> + <hfp:hasFacet name="length"/> + <hfp:hasFacet name="minLength"/> + <hfp:hasFacet name="maxLength"/> + <hfp:hasFacet name="pattern"/> + <hfp:hasFacet name="enumeration"/> + <hfp:hasFacet name="whiteSpace"/> + <hfp:hasProperty name="ordered" value="false"/> + <hfp:hasProperty name="bounded" value="false"/> + <hfp:hasProperty name="cardinality" + value="countably infinite"/> + <hfp:hasProperty name="numeric" value="false"/> + </xs:appinfo> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#binary"/> + </xs:annotation> + <xs:restriction base="xs:anySimpleType"> + <xs:whiteSpace value="collapse" fixed="true" + id="hexBinary.whiteSpace"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="base64Binary" id="base64Binary"> + <xs:annotation> + <xs:appinfo> + <hfp:hasFacet name="length"/> + <hfp:hasFacet name="minLength"/> + <hfp:hasFacet name="maxLength"/> + <hfp:hasFacet name="pattern"/> + <hfp:hasFacet name="enumeration"/> + <hfp:hasFacet name="whiteSpace"/> + <hfp:hasProperty name="ordered" value="false"/> + <hfp:hasProperty name="bounded" value="false"/> + <hfp:hasProperty name="cardinality" + value="countably infinite"/> + <hfp:hasProperty name="numeric" value="false"/> + </xs:appinfo> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#base64Binary"/> + </xs:annotation> + <xs:restriction base="xs:anySimpleType"> + <xs:whiteSpace value="collapse" fixed="true" + id="base64Binary.whiteSpace"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="anyURI" id="anyURI"> + <xs:annotation> + <xs:appinfo> + <hfp:hasFacet name="length"/> + <hfp:hasFacet name="minLength"/> + <hfp:hasFacet name="maxLength"/> + <hfp:hasFacet name="pattern"/> + <hfp:hasFacet name="enumeration"/> + <hfp:hasFacet name="whiteSpace"/> + <hfp:hasProperty name="ordered" value="false"/> + <hfp:hasProperty name="bounded" value="false"/> + <hfp:hasProperty name="cardinality" + value="countably infinite"/> + <hfp:hasProperty name="numeric" value="false"/> + </xs:appinfo> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#anyURI"/> + </xs:annotation> + <xs:restriction base="xs:anySimpleType"> + <xs:whiteSpace value="collapse" fixed="true" + id="anyURI.whiteSpace"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="QName" id="QName"> + <xs:annotation> + <xs:appinfo> + <hfp:hasFacet name="length"/> + <hfp:hasFacet name="minLength"/> + <hfp:hasFacet name="maxLength"/> + <hfp:hasFacet name="pattern"/> + <hfp:hasFacet name="enumeration"/> + <hfp:hasFacet name="whiteSpace"/> + <hfp:hasProperty name="ordered" value="false"/> + <hfp:hasProperty name="bounded" value="false"/> + <hfp:hasProperty name="cardinality" + value="countably infinite"/> + <hfp:hasProperty name="numeric" value="false"/> + </xs:appinfo> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#QName"/> + </xs:annotation> + <xs:restriction base="xs:anySimpleType"> + <xs:whiteSpace value="collapse" fixed="true" + id="QName.whiteSpace"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="NOTATION" id="NOTATION"> + <xs:annotation> + <xs:appinfo> + <hfp:hasFacet name="length"/> + <hfp:hasFacet name="minLength"/> + <hfp:hasFacet name="maxLength"/> + <hfp:hasFacet name="pattern"/> + <hfp:hasFacet name="enumeration"/> + <hfp:hasFacet name="whiteSpace"/> + <hfp:hasProperty name="ordered" value="false"/> + <hfp:hasProperty name="bounded" value="false"/> + <hfp:hasProperty name="cardinality" + value="countably infinite"/> + <hfp:hasProperty name="numeric" value="false"/> + </xs:appinfo> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#NOTATION"/> + <xs:documentation> + NOTATION cannot be used directly in a schema; rather a type + must be derived from it by specifying at least one enumeration + facet whose value is the name of a NOTATION declared in the + schema. + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:anySimpleType"> + <xs:whiteSpace value="collapse" fixed="true" + id="NOTATION.whiteSpace"/> + </xs:restriction> + </xs:simpleType> + + <xs:annotation> + <xs:documentation> + Now the derived primitive types + </xs:documentation> + </xs:annotation> + + <xs:simpleType name="normalizedString" id="normalizedString"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#normalizedString"/> + </xs:annotation> + <xs:restriction base="xs:string"> + <xs:whiteSpace value="replace" + id="normalizedString.whiteSpace"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="token" id="token"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#token"/> + </xs:annotation> + <xs:restriction base="xs:normalizedString"> + <xs:whiteSpace value="collapse" id="token.whiteSpace"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="language" id="language"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#language"/> + </xs:annotation> + <xs:restriction base="xs:token"> + <xs:pattern + value="[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*" + id="language.pattern"> + <xs:annotation> + <xs:documentation + source="http://www.ietf.org/rfc/rfc3066.txt"> + pattern specifies the content of section 2.12 of XML 1.0e2 + and RFC 3066 (Revised version of RFC 1766). + </xs:documentation> + </xs:annotation> + </xs:pattern> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="IDREFS" id="IDREFS"> + <xs:annotation> + <xs:appinfo> + <hfp:hasFacet name="length"/> + <hfp:hasFacet name="minLength"/> + <hfp:hasFacet name="maxLength"/> + <hfp:hasFacet name="enumeration"/> + <hfp:hasFacet name="whiteSpace"/> + <hfp:hasFacet name="pattern"/> + <hfp:hasProperty name="ordered" value="false"/> + <hfp:hasProperty name="bounded" value="false"/> + <hfp:hasProperty name="cardinality" + value="countably infinite"/> + <hfp:hasProperty name="numeric" value="false"/> + </xs:appinfo> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#IDREFS"/> + </xs:annotation> + <xs:restriction> + <xs:simpleType> + <xs:list itemType="xs:IDREF"/> + </xs:simpleType> + <xs:minLength value="1" id="IDREFS.minLength"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="ENTITIES" id="ENTITIES"> + <xs:annotation> + <xs:appinfo> + <hfp:hasFacet name="length"/> + <hfp:hasFacet name="minLength"/> + <hfp:hasFacet name="maxLength"/> + <hfp:hasFacet name="enumeration"/> + <hfp:hasFacet name="whiteSpace"/> + <hfp:hasFacet name="pattern"/> + <hfp:hasProperty name="ordered" value="false"/> + <hfp:hasProperty name="bounded" value="false"/> + <hfp:hasProperty name="cardinality" + value="countably infinite"/> + <hfp:hasProperty name="numeric" value="false"/> + </xs:appinfo> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#ENTITIES"/> + </xs:annotation> + <xs:restriction> + <xs:simpleType> + <xs:list itemType="xs:ENTITY"/> + </xs:simpleType> + <xs:minLength value="1" id="ENTITIES.minLength"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="NMTOKEN" id="NMTOKEN"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#NMTOKEN"/> + </xs:annotation> + <xs:restriction base="xs:token"> + <xs:pattern value="\c+" id="NMTOKEN.pattern"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/REC-xml#NT-Nmtoken"> + pattern matches production 7 from the XML spec + </xs:documentation> + </xs:annotation> + </xs:pattern> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="NMTOKENS" id="NMTOKENS"> + <xs:annotation> + <xs:appinfo> + <hfp:hasFacet name="length"/> + <hfp:hasFacet name="minLength"/> + <hfp:hasFacet name="maxLength"/> + <hfp:hasFacet name="enumeration"/> + <hfp:hasFacet name="whiteSpace"/> + <hfp:hasFacet name="pattern"/> + <hfp:hasProperty name="ordered" value="false"/> + <hfp:hasProperty name="bounded" value="false"/> + <hfp:hasProperty name="cardinality" + value="countably infinite"/> + <hfp:hasProperty name="numeric" value="false"/> + </xs:appinfo> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#NMTOKENS"/> + </xs:annotation> + <xs:restriction> + <xs:simpleType> + <xs:list itemType="xs:NMTOKEN"/> + </xs:simpleType> + <xs:minLength value="1" id="NMTOKENS.minLength"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="Name" id="Name"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#Name"/> + </xs:annotation> + <xs:restriction base="xs:token"> + <xs:pattern value="\i\c*" id="Name.pattern"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/REC-xml#NT-Name"> + pattern matches production 5 from the XML spec + </xs:documentation> + </xs:annotation> + </xs:pattern> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="NCName" id="NCName"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#NCName"/> + </xs:annotation> + <xs:restriction base="xs:Name"> + <xs:pattern value="[\i-[:]][\c-[:]]*" id="NCName.pattern"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/REC-xml-names/#NT-NCName"> + pattern matches production 4 from the Namespaces in XML spec + </xs:documentation> + </xs:annotation> + </xs:pattern> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="ID" id="ID"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#ID"/> + </xs:annotation> + <xs:restriction base="xs:NCName"/> + </xs:simpleType> + + <xs:simpleType name="IDREF" id="IDREF"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#IDREF"/> + </xs:annotation> + <xs:restriction base="xs:NCName"/> + </xs:simpleType> + + <xs:simpleType name="ENTITY" id="ENTITY"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#ENTITY"/> + </xs:annotation> + <xs:restriction base="xs:NCName"/> + </xs:simpleType> + + <xs:simpleType name="integer" id="integer"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#integer"/> + </xs:annotation> + <xs:restriction base="xs:decimal"> + <xs:fractionDigits value="0" fixed="true" id="integer.fractionDigits"/> + <xs:pattern value="[\-+]?[0-9]+"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="nonPositiveInteger" id="nonPositiveInteger"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#nonPositiveInteger"/> + </xs:annotation> + <xs:restriction base="xs:integer"> + <xs:maxInclusive value="0" id="nonPositiveInteger.maxInclusive"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="negativeInteger" id="negativeInteger"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#negativeInteger"/> + </xs:annotation> + <xs:restriction base="xs:nonPositiveInteger"> + <xs:maxInclusive value="-1" id="negativeInteger.maxInclusive"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="long" id="long"> + <xs:annotation> + <xs:appinfo> + <hfp:hasProperty name="bounded" value="true"/> + <hfp:hasProperty name="cardinality" value="finite"/> + </xs:appinfo> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#long"/> + </xs:annotation> + <xs:restriction base="xs:integer"> + <xs:minInclusive value="-9223372036854775808" id="long.minInclusive"/> + <xs:maxInclusive value="9223372036854775807" id="long.maxInclusive"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="int" id="int"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#int"/> + </xs:annotation> + <xs:restriction base="xs:long"> + <xs:minInclusive value="-2147483648" id="int.minInclusive"/> + <xs:maxInclusive value="2147483647" id="int.maxInclusive"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="short" id="short"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#short"/> + </xs:annotation> + <xs:restriction base="xs:int"> + <xs:minInclusive value="-32768" id="short.minInclusive"/> + <xs:maxInclusive value="32767" id="short.maxInclusive"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="byte" id="byte"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#byte"/> + </xs:annotation> + <xs:restriction base="xs:short"> + <xs:minInclusive value="-128" id="byte.minInclusive"/> + <xs:maxInclusive value="127" id="byte.maxInclusive"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="nonNegativeInteger" id="nonNegativeInteger"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#nonNegativeInteger"/> + </xs:annotation> + <xs:restriction base="xs:integer"> + <xs:minInclusive value="0" id="nonNegativeInteger.minInclusive"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="unsignedLong" id="unsignedLong"> + <xs:annotation> + <xs:appinfo> + <hfp:hasProperty name="bounded" value="true"/> + <hfp:hasProperty name="cardinality" value="finite"/> + </xs:appinfo> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#unsignedLong"/> + </xs:annotation> + <xs:restriction base="xs:nonNegativeInteger"> + <xs:maxInclusive value="18446744073709551615" + id="unsignedLong.maxInclusive"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="unsignedInt" id="unsignedInt"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#unsignedInt"/> + </xs:annotation> + <xs:restriction base="xs:unsignedLong"> + <xs:maxInclusive value="4294967295" + id="unsignedInt.maxInclusive"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="unsignedShort" id="unsignedShort"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#unsignedShort"/> + </xs:annotation> + <xs:restriction base="xs:unsignedInt"> + <xs:maxInclusive value="65535" + id="unsignedShort.maxInclusive"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="unsignedByte" id="unsignedByte"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#unsignedByte"/> + </xs:annotation> + <xs:restriction base="xs:unsignedShort"> + <xs:maxInclusive value="255" id="unsignedByte.maxInclusive"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="positiveInteger" id="positiveInteger"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#positiveInteger"/> + </xs:annotation> + <xs:restriction base="xs:nonNegativeInteger"> + <xs:minInclusive value="1" id="positiveInteger.minInclusive"/> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="derivationControl"> + <xs:annotation> + <xs:documentation> + A utility type, not for public use</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:NMTOKEN"> + <xs:enumeration value="substitution"/> + <xs:enumeration value="extension"/> + <xs:enumeration value="restriction"/> + <xs:enumeration value="list"/> + <xs:enumeration value="union"/> + </xs:restriction> + </xs:simpleType> + + <xs:group name="simpleDerivation"> + <xs:choice> + <xs:element ref="xs:restriction"/> + <xs:element ref="xs:list"/> + <xs:element ref="xs:union"/> + </xs:choice> + </xs:group> + + <xs:simpleType name="simpleDerivationSet"> + <xs:annotation> + <xs:documentation> + #all or (possibly empty) subset of {restriction, union, list} + </xs:documentation> + <xs:documentation> + A utility type, not for public use</xs:documentation> + </xs:annotation> + <xs:union> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="#all"/> + </xs:restriction> + </xs:simpleType> + <xs:simpleType> + <xs:list> + <xs:simpleType> + <xs:restriction base="xs:derivationControl"> + <xs:enumeration value="list"/> + <xs:enumeration value="union"/> + <xs:enumeration value="restriction"/> + </xs:restriction> + </xs:simpleType> + </xs:list> + </xs:simpleType> + </xs:union> + </xs:simpleType> + + <xs:complexType name="simpleType" abstract="true"> + <xs:complexContent> + <xs:extension base="xs:annotated"> + <xs:group ref="xs:simpleDerivation"/> + <xs:attribute name="final" type="xs:simpleDerivationSet"/> + <xs:attribute name="name" type="xs:NCName"> + <xs:annotation> + <xs:documentation> + Can be restricted to required or forbidden + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:extension> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="topLevelSimpleType"> + <xs:complexContent> + <xs:restriction base="xs:simpleType"> + <xs:sequence> + <xs:element ref="xs:annotation" minOccurs="0"/> + <xs:group ref="xs:simpleDerivation"/> + </xs:sequence> + <xs:attribute name="name" use="required" + type="xs:NCName"> + <xs:annotation> + <xs:documentation> + Required at the top level + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:anyAttribute namespace="##other" processContents="lax"/> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="localSimpleType"> + <xs:complexContent> + <xs:restriction base="xs:simpleType"> + <xs:sequence> + <xs:element ref="xs:annotation" minOccurs="0"/> + <xs:group ref="xs:simpleDerivation"/> + </xs:sequence> + <xs:attribute name="name" use="prohibited"> + <xs:annotation> + <xs:documentation> + Forbidden when nested + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="final" use="prohibited"/> + <xs:anyAttribute namespace="##other" processContents="lax"/> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + + <xs:element name="simpleType" type="xs:topLevelSimpleType" id="simpleType"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#element-simpleType"/> + </xs:annotation> + </xs:element> + + <xs:group name="facets"> + <xs:annotation> + <xs:documentation> + We should use a substitution group for facets, but + that's ruled out because it would allow users to + add their own, which we're not ready for yet. + </xs:documentation> + </xs:annotation> + <xs:choice> + <xs:element ref="xs:minExclusive"/> + <xs:element ref="xs:minInclusive"/> + <xs:element ref="xs:maxExclusive"/> + <xs:element ref="xs:maxInclusive"/> + <xs:element ref="xs:totalDigits"/> + <xs:element ref="xs:fractionDigits"/> + <xs:element ref="xs:length"/> + <xs:element ref="xs:minLength"/> + <xs:element ref="xs:maxLength"/> + <xs:element ref="xs:enumeration"/> + <xs:element ref="xs:whiteSpace"/> + <xs:element ref="xs:pattern"/> + </xs:choice> + </xs:group> + + <xs:group name="simpleRestrictionModel"> + <xs:sequence> + <xs:element name="simpleType" type="xs:localSimpleType" minOccurs="0"/> + <xs:group ref="xs:facets" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + </xs:group> + + <xs:element name="restriction" id="restriction"> + <xs:complexType> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#element-restriction"> + base attribute and simpleType child are mutually + exclusive, but one or other is required + </xs:documentation> + </xs:annotation> + <xs:complexContent> + <xs:extension base="xs:annotated"> + <xs:group ref="xs:simpleRestrictionModel"/> + <xs:attribute name="base" type="xs:QName" use="optional"/> + </xs:extension> + </xs:complexContent> + </xs:complexType> + </xs:element> + + <xs:element name="list" id="list"> + <xs:complexType> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#element-list"> + itemType attribute and simpleType child are mutually + exclusive, but one or other is required + </xs:documentation> + </xs:annotation> + <xs:complexContent> + <xs:extension base="xs:annotated"> + <xs:sequence> + <xs:element name="simpleType" type="xs:localSimpleType" + minOccurs="0"/> + </xs:sequence> + <xs:attribute name="itemType" type="xs:QName" use="optional"/> + </xs:extension> + </xs:complexContent> + </xs:complexType> + </xs:element> + + <xs:element name="union" id="union"> + <xs:complexType> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#element-union"> + memberTypes attribute must be non-empty or there must be + at least one simpleType child + </xs:documentation> + </xs:annotation> + <xs:complexContent> + <xs:extension base="xs:annotated"> + <xs:sequence> + <xs:element name="simpleType" type="xs:localSimpleType" + minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + <xs:attribute name="memberTypes" use="optional"> + <xs:simpleType> + <xs:list itemType="xs:QName"/> + </xs:simpleType> + </xs:attribute> + </xs:extension> + </xs:complexContent> + </xs:complexType> + </xs:element> + + <xs:complexType name="facet"> + <xs:complexContent> + <xs:extension base="xs:annotated"> + <xs:attribute name="value" use="required"/> + <xs:attribute name="fixed" type="xs:boolean" use="optional" + default="false"/> + </xs:extension> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="noFixedFacet"> + <xs:complexContent> + <xs:restriction base="xs:facet"> + <xs:sequence> + <xs:element ref="xs:annotation" minOccurs="0"/> + </xs:sequence> + <xs:attribute name="fixed" use="prohibited"/> + <xs:anyAttribute namespace="##other" processContents="lax"/> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + + <xs:element name="minExclusive" id="minExclusive" type="xs:facet"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#element-minExclusive"/> + </xs:annotation> + </xs:element> + <xs:element name="minInclusive" id="minInclusive" type="xs:facet"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#element-minInclusive"/> + </xs:annotation> + </xs:element> + + <xs:element name="maxExclusive" id="maxExclusive" type="xs:facet"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#element-maxExclusive"/> + </xs:annotation> + </xs:element> + <xs:element name="maxInclusive" id="maxInclusive" type="xs:facet"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#element-maxInclusive"/> + </xs:annotation> + </xs:element> + + <xs:complexType name="numFacet"> + <xs:complexContent> + <xs:restriction base="xs:facet"> + <xs:sequence> + <xs:element ref="xs:annotation" minOccurs="0"/> + </xs:sequence> + <xs:attribute name="value" type="xs:nonNegativeInteger" use="required"/> + <xs:anyAttribute namespace="##other" processContents="lax"/> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + + <xs:element name="totalDigits" id="totalDigits"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#element-totalDigits"/> + </xs:annotation> + <xs:complexType> + <xs:complexContent> + <xs:restriction base="xs:numFacet"> + <xs:sequence> + <xs:element ref="xs:annotation" minOccurs="0"/> + </xs:sequence> + <xs:attribute name="value" type="xs:positiveInteger" use="required"/> + <xs:anyAttribute namespace="##other" processContents="lax"/> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + </xs:element> + <xs:element name="fractionDigits" id="fractionDigits" type="xs:numFacet"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#element-fractionDigits"/> + </xs:annotation> + </xs:element> + + <xs:element name="length" id="length" type="xs:numFacet"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#element-length"/> + </xs:annotation> + </xs:element> + <xs:element name="minLength" id="minLength" type="xs:numFacet"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#element-minLength"/> + </xs:annotation> + </xs:element> + <xs:element name="maxLength" id="maxLength" type="xs:numFacet"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#element-maxLength"/> + </xs:annotation> + </xs:element> + + <xs:element name="enumeration" id="enumeration" type="xs:noFixedFacet"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#element-enumeration"/> + </xs:annotation> + </xs:element> + + <xs:element name="whiteSpace" id="whiteSpace"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#element-whiteSpace"/> + </xs:annotation> + <xs:complexType> + <xs:complexContent> + <xs:restriction base="xs:facet"> + <xs:sequence> + <xs:element ref="xs:annotation" minOccurs="0"/> + </xs:sequence> + <xs:attribute name="value" use="required"> + <xs:simpleType> + <xs:restriction base="xs:NMTOKEN"> + <xs:enumeration value="preserve"/> + <xs:enumeration value="replace"/> + <xs:enumeration value="collapse"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:anyAttribute namespace="##other" processContents="lax"/> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + </xs:element> + + <xs:element name="pattern" id="pattern"> + <xs:annotation> + <xs:documentation + source="http://www.w3.org/TR/xmlschema-2/#element-pattern"/> + </xs:annotation> + <xs:complexType> + <xs:complexContent> + <xs:restriction base="xs:noFixedFacet"> + <xs:sequence> + <xs:element ref="xs:annotation" minOccurs="0"/> + </xs:sequence> + <xs:attribute name="value" type="xs:string" use="required"/> + <xs:anyAttribute namespace="##other" processContents="lax"/> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + </xs:element> + +</xs:schema> diff --git a/BKUOnline/src/main/custom-binding/stalservice-custom.xml b/BKUOnline/src/main/custom-binding/stalservice-custom.xml new file mode 100644 index 00000000..384b04f7 --- /dev/null +++ b/BKUOnline/src/main/custom-binding/stalservice-custom.xml @@ -0,0 +1,102 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<!-- + Binding customization for STAL service (stal.wsdl) + JAX-WS does not yet support "schema component designator"s (SCD, http://www.w3.org/TR/xmlschema-ref/) +--> +<bindings xmlns="http://java.sun.com/xml/ns/jaxws" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + wsdlLocation="../webapp/WEB-INF/wsdl/stal.wsdl"> + + + <!-- default settings + <enableWrapperStyle>true</enableWrapperStyle> + <enableAsyncMapping>false</enableAsyncMapping--> + <package name="at.gv.egiz.stal.service" /> + + <!-- wsdl:portType customization --> + <bindings node="wsdl:definitions/wsdl:portType[@name='STALPortType']"> + <!-- change generated SEI class --> + <!--class name="STALServiceI" /--> + + <!-- override default settings --> + <enableWrapperStyle>true</enableWrapperStyle> + <enableAsyncMapping>false</enableAsyncMapping> + </bindings> + + <!-- wsdl:portType operation customization --> + <bindings node="wsdl:definitions/wsdl:portType[@name='STALPortType']/wsdl:operation[@name='nextRequest']"> + <!-- rename method name --> + <method name="getNextRequest"> + <javadoc>Fetch the next request.</javadoc> + </method> + + <!-- rename method params --> + <parameter part="wsdl:definitions/wsdl:message[@name='NextRequestRequest']/wsdl:part[@name='part1']" name="request" /> + + <!-- override default settings --> + <enableWrapperStyle>true</enableWrapperStyle> + <enableAsyncMapping>false</enableAsyncMapping> + </bindings> + + <bindings node="wsdl:definitions/wsdl:portType[@name='STALPortType']/wsdl:operation[@name='getHashDataInput']"> + <!-- rename method name --> + <method name="getHashDataInput"> + <javadoc>Fetch the signed references corresponding to the previous SignatureRequest.</javadoc> + </method> + + <!-- rename method params --> + <parameter part="wsdl:definitions/wsdl:message[@name='GetHashDataInputRequest']/wsdl:part[@name='part1']" name="request" /> + + <!-- override default settings --> + <enableWrapperStyle>true</enableWrapperStyle> + <enableAsyncMapping>false</enableAsyncMapping> + </bindings> + + <!-- wsdl:service customization --> + <!--bindings node="wsdl:definitions/wsdl:service[@name='STALService']"> + <class name="STALService"/> + </bindings--> + + <!-- change the port accessor method --> + <!-- bindings node="wsdl:definitions/wsdl:service[@name='STALService']/wsdl:port[@name='STALPort']"> + <method name="getSTALServicePort"/> + </bindings --> + + <!-- INLINED SCHEMA CUSTOMIZATION + <bindings node="wsdl:definitions/wsdl:types/xsd:schema[@targetNamespace='http://danu.iaik.tugraz.at/xml']"> + <jaxb:schemaBindings> + <jaxb:package name="iaik.ws.sample.sandbox.generated.service.jaxb" /> + </jaxb:schemaBindings> + </bindings--> + + <!-- EXTERNAL SCHEMA CUSTOMIZATION in custom-jaxb.xml --> + + <!--bindings node="wsdl:definitions" xmlns:jws="http://java.sun.com/xml/ns/javaee"> + <jws:handler-chains> + <jws:handler-chain> + <jws:handler> + <jws:handler-class>fromwsdlhandler.common.LoggingHandler</jws:handler-class> + </jws:handler> + </jws:handler-chain> + </jws:handler-chains> + </bindings--> + +</bindings>
\ No newline at end of file diff --git a/BKUOnline/src/main/custom-binding/staltypes-custom.xml b/BKUOnline/src/main/custom-binding/staltypes-custom.xml new file mode 100644 index 00000000..2ea42082 --- /dev/null +++ b/BKUOnline/src/main/custom-binding/staltypes-custom.xml @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<!-- + Binding customization for STAL schema (stal.xsd) + Use JAXB version 2.1 which supports "schema component designator" (SCD, http://www.w3.org/TR/xmlschema-ref/) + + All request/response types are generated to at.gv.egiz.stal + and renamed (...Type suffix removed), + except for the base types of the modified implClasses ErrorResponse and SignRequest + + IMPORTANT: WHEN REGENERATING CLASSES MAKE SURE TO BACKUP MODIFIED IMPLCLASSES (ErrorResponse and SignRequest) +--> +<bindings xmlns='http://java.sun.com/xml/ns/jaxb' version='2.1' + xmlns:xs='http://www.w3.org/2001/XMLSchema' + xmlns:stal="http://www.egiz.gv.at/stal" + xmlns:xjc='http://java.sun.com/xml/ns/jaxb/xjc' + xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' + xsi:schemaLocation='http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd + http://www.w3.org/2001/XMLSchema http://www.w3.org/2001/XMLSchema.xsd'> + <bindings scd="x-schema::stal" xmlns:stal="http://www.egiz.gv.at/stal"> + <schemaBindings> + <!-- generate all classes to at.gv.egiz.stal, then move service-only classes to at.gv.egiz.stal.service --> + <package name="at.gv.egiz.stal"/> + </schemaBindings> + </bindings> + <bindings scd="/type::stal:RequestType"> + <class name="STALRequest"/> + </bindings> + <bindings scd="/type::stal:ResponseType"> + <class name="STALResponse"/> + </bindings> + <bindings scd="/type::stal:InfoboxReadResponseType"> + <class name="InfoboxReadResponse"/> + </bindings> + <bindings scd="/type::stal:SignResponseType"> + <class name="SignResponse"/> + </bindings> + <bindings scd="/type::stal:ErrorResponseType"> + <class name="ErrorResponse"/> + <!--class implClass="at.gv.egiz.stal.types.ErrorResponse"/--> + </bindings> + <bindings scd="/type::stal:InfoboxReadRequestType" > + <class name="InfoboxReadRequest"/> + </bindings> + <bindings scd="/type::stal:SignRequestType" > + <class name="SignRequest"/> + <!--class implClass="at.gv.egiz.stal.types.SignRequest"/--> + </bindings> + <bindings scd="/type::stal:QuitRequestType" > + <class name="QuitRequest"/> + </bindings> + <!--bindings scd="/type::stal:GetHashDataInputFaultType" > + <class name="GetHashDataInputFault"/> + </bindings--> +</bindings> diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/conf/Configurator.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/conf/Configurator.java new file mode 100644 index 00000000..0cb717c4 --- /dev/null +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/conf/Configurator.java @@ -0,0 +1,69 @@ +/* +* 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.conf;
+
+import iaik.security.ecc.provider.ECCProvider;
+import iaik.xml.crypto.XSecProvider;
+
+import java.net.HttpURLConnection;
+import java.security.Provider;
+import java.security.Security;
+
+import javax.net.ssl.HttpsURLConnection;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import at.gv.egiz.bku.slcommands.impl.xsect.STALProvider;
+
+/**
+ *
+ * TODO currently only the code to get started.
+ */
+public class Configurator {
+ private Log log = LogFactory.getLog(Configurator.class);
+
+ public Configurator() {
+ configure();
+ }
+
+ protected void configUrlConnections() {
+ HttpsURLConnection.setFollowRedirects(false);
+ HttpURLConnection.setFollowRedirects(false);
+ }
+
+ protected void configureProviders() {
+ log.debug("Registering security providers");
+ Security.addProvider(new STALProvider());
+ XSecProvider.addAsProvider(false);
+ Security.insertProviderAt(new ECCProvider(false), 1);
+ StringBuffer sb = new StringBuffer();
+ sb.append("Following providers are now registered: ");
+ int i = 1;
+ for (Provider prov : Security.getProviders()) {
+ sb.append((i++) + ". : " + prov);
+ }
+ log.debug("Configured provider" + sb.toString());
+ }
+
+ public void configure() {
+ configureProviders();
+ configUrlConnections();
+
+ }
+
+}
diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java new file mode 100644 index 00000000..53a7c164 --- /dev/null +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java @@ -0,0 +1,91 @@ +/* +* 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.webapp;
+
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import at.gv.egiz.bku.binding.HTTPBindingProcessor;
+import at.gv.egiz.bku.binding.HttpUtil;
+import at.gv.egiz.org.apache.tomcat.util.http.AcceptLanguage;
+
+/**
+ * Handles SL requests and instantiates BindingProcessors
+ *
+ */
+public class BKURequestHandler extends SpringBKUServlet {
+
+ public final static String REDIRECT_URL ="appletPage.jsp";
+
+ protected Log log = LogFactory.getLog(BKURequestHandler.class);
+
+ protected void doPost(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException, java.io.IOException {
+ log.debug("Got new request");
+ String lang = req.getHeader("Accept-Language");
+ Locale locale = AcceptLanguage.getLocale(lang);
+ log.debug("Using locale: "+locale);
+ HttpSession session = req.getSession();
+ if (session != null) {
+ session.invalidate();
+ }
+ String id = req.getSession(true).getId();
+ log.debug("Using session id: "+id);
+ HTTPBindingProcessor bindingProcessor;
+ if (req.isSecure()) {
+ bindingProcessor = (HTTPBindingProcessor) getBindingProcessorManager()
+ .createBindingProcessor("https", id, locale);
+ } else {
+ bindingProcessor = (HTTPBindingProcessor) getBindingProcessorManager()
+ .createBindingProcessor("http", id, locale);
+ }
+ Map<String, String> headerMap = new HashMap<String, String>();
+ for (Enumeration<String> headerName = req.getHeaderNames(); headerName
+ .hasMoreElements();) {
+ String header = headerName.nextElement();
+ if (header != null) {
+ headerMap.put(header, req.getHeader(header));
+ }
+ }
+ String charset = req.getCharacterEncoding();
+ String contentType = req.getContentType();
+ if (charset != null) {
+ contentType += ";"+charset;
+ }
+ headerMap.put(HttpUtil.HTTP_HEADER_CONTENT_TYPE, contentType);
+ bindingProcessor.setHTTPHeaders(headerMap);
+ bindingProcessor.consumeRequestStream(req.getInputStream());
+ req.getInputStream().close();
+ getBindingProcessorManager().process(bindingProcessor);
+ resp.sendRedirect(REDIRECT_URL);
+ }
+
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException, java.io.IOException {
+ doPost(req, resp);
+ }
+}
diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java new file mode 100644 index 00000000..6c1a4c3a --- /dev/null +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java @@ -0,0 +1,120 @@ +/* +* 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.webapp;
+
+import java.io.IOException;
+import java.util.Iterator;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import at.gv.egiz.bku.binding.HTTPBindingProcessor;
+import at.gv.egiz.bku.binding.IdFactory;
+
+/**
+ * Delivers the result to the browser
+ *
+ */
+public class ResultServlet extends SpringBKUServlet {
+
+ private final static Log log = LogFactory.getLog(ResultServlet.class);
+
+ private String encoding = "UTF-8";
+ private String expiredPage = "./expiredError.jsp";
+
+ public ResultServlet() {
+ }
+
+ private void myInit() {
+ String enc = getServletContext().getInitParameter("responseEncoding");
+ if (enc != null) {
+ log.debug("Init default encoding to: "+enc);
+ encoding = enc;
+ }
+ String expP = getServletConfig().getInitParameter("expiredPage");
+ if (expP != null) {
+ log.debug("Init expired page to: "+expP);
+ expiredPage = expP;
+ }
+ }
+
+ @Override
+ public void init() throws ServletException {
+ super.init();
+ myInit();
+ }
+
+ @Override
+ public void init(ServletConfig config) throws ServletException {
+ super.init(config);
+ myInit();
+ }
+
+
+
+ protected void doPost(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException, IOException {
+ doGet(req, resp);
+ }
+
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException, java.io.IOException {
+
+ HttpSession session = req.getSession(false);
+ if (session == null) {
+ resp.sendRedirect(expiredPage);
+ return;
+ }
+ String sessionId = session.getId();
+ if (sessionId == null) {
+ resp.sendRedirect(expiredPage);
+ return;
+ }
+ log.debug("Got a result request for session: " + sessionId);
+ HTTPBindingProcessor bp = (HTTPBindingProcessor) getBindingProcessorManager().getBindingProcessor(
+ IdFactory.getInstance().createId(sessionId));
+ if (bp == null) {
+ session.invalidate();
+ resp.sendRedirect(expiredPage);
+ return;
+ }
+
+ if (bp.getRedirectURL() != null) {
+ resp.sendRedirect(bp.getRedirectURL());
+ return;
+ }
+ resp.setStatus(bp.getResponseCode());
+ resp.setHeader("Cache-Control","no-store"); //HTTP 1.1
+ resp.setHeader("Pragma","no-cache"); //HTTP 1.0
+ resp.setDateHeader ("Expires", 0);
+ for (Iterator<String> it = bp.getResponseHeaders().keySet()
+ .iterator(); it.hasNext();) {
+ String header = it.next();
+ resp.setHeader(header, bp.getResponseHeaders().get(header));
+ }
+ resp.setContentType(bp.getResultContentType());
+ resp.setCharacterEncoding(encoding);
+ bp.writeResultTo(resp.getOutputStream(), encoding);
+ session.invalidate();
+ }
+}
diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/SessionTimeout.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/SessionTimeout.java new file mode 100644 index 00000000..2b56166c --- /dev/null +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/SessionTimeout.java @@ -0,0 +1,49 @@ +/* +* 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.webapp;
+
+import javax.servlet.http.HttpSessionEvent;
+import javax.servlet.http.HttpSessionListener;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import at.gv.egiz.bku.binding.BindingProcessorManager;
+import at.gv.egiz.bku.binding.IdFactory;
+
+/**
+ * Session listener to trigger the removal of the BindingProcessor
+ *
+ */
+public class SessionTimeout implements HttpSessionListener {
+
+ private static Log log = LogFactory.getLog(SessionTimeout.class);
+
+ @Override
+ public void sessionCreated(HttpSessionEvent arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void sessionDestroyed(HttpSessionEvent event) {
+ BindingProcessorManager manager = (BindingProcessorManager) event.getSession().getServletContext().getAttribute(SpringBKUServlet.BEAN_NAME);
+ log.info("Removing session: "+event.getSession().getId());
+ manager.removeBindingProcessor(IdFactory.getInstance().createId(event.getSession().getId()));
+ }
+
+}
diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/SpringBKUServlet.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/SpringBKUServlet.java new file mode 100644 index 00000000..6ee537b1 --- /dev/null +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/SpringBKUServlet.java @@ -0,0 +1,31 @@ +/* +* 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.webapp;
+
+import javax.servlet.http.HttpServlet;
+
+import at.gv.egiz.bku.binding.BindingProcessorManager;
+
+public abstract class SpringBKUServlet extends HttpServlet {
+
+ public final static String BEAN_NAME="bindingProcessorManager";
+
+ protected BindingProcessorManager getBindingProcessorManager() {
+ return (BindingProcessorManager) getServletContext().getAttribute(BEAN_NAME);
+ }
+
+}
diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/RequestBrokerSTALFactory.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/RequestBrokerSTALFactory.java new file mode 100644 index 00000000..38c568ab --- /dev/null +++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/RequestBrokerSTALFactory.java @@ -0,0 +1,38 @@ +/* +* 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. +*/ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package at.gv.egiz.stal.service.impl; + +import at.gv.egiz.stal.STAL; +import at.gv.egiz.stal.STALFactory; + +/** + * + * @author clemens + */ +public class RequestBrokerSTALFactory implements STALFactory { + + @Override + public STAL createSTAL() { + return new STALRequestBrokerImpl(); + } + +} diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBroker.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBroker.java new file mode 100644 index 00000000..aad9b874 --- /dev/null +++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBroker.java @@ -0,0 +1,43 @@ +/* +* 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. +*/ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package at.gv.egiz.stal.service.impl; + +import at.gv.egiz.stal.STAL; +import at.gv.egiz.stal.STALRequest; +import at.gv.egiz.stal.STALResponse; +import at.gv.egiz.stal.HashDataInputCallback; +import java.util.List; +import java.util.concurrent.TimeoutException; + +/** + * + * @author clemens + */ +public interface STALRequestBroker extends STAL { + + public static final int ERR_6000 = 6000; + public static final long TIMEOUT_MS = 1000*60*5; //300000; + + public List<STALRequest> nextRequest(List<STALResponse> response); +// public void setResponse(List<STALResponse> response) throws TimeoutException; +// public void interruptRequestHandling(ErrorResponseType error); + public HashDataInputCallback getHashDataInput(); +} diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java new file mode 100644 index 00000000..19548247 --- /dev/null +++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java @@ -0,0 +1,554 @@ +/* +* 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. +*/ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package at.gv.egiz.stal.service.impl; + +import at.gv.egiz.stal.ErrorResponse; +import at.gv.egiz.stal.QuitRequest; +import at.gv.egiz.stal.STALRequest; +import at.gv.egiz.stal.STALResponse; +import at.gv.egiz.stal.HashDataInputCallback; +import at.gv.egiz.stal.SignRequest; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Locale; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * An instance of STALRequestBroker is shared between a producer threads (SLCommand) + * and multiple consumer threads (STALService). + * This implementation assures that handleRequest is executed only once the previous invocation returned. + * The BindingProcessor assures that a new SLCommand calls handleRequest() only once + * the bindingProcessor called handleRequest(QUIT) after the previous SLCommand's handleRequest() returned. + * + * Multiple STALService threads might call nextRequest()/getSignedReferences() in any order. + * + * @author clemens + */ +public class STALRequestBrokerImpl implements STALRequestBroker { + + private static final Log log = LogFactory.getLog(STALRequestBrokerImpl.class); +// protected RequestResponseBroker broker; + protected List<STALRequest> requests = null; + protected List<STALResponse> responses = null; + protected HashDataInputCallback currentHashDataInputCallback; + private boolean isHandlingRequest = false; + private boolean expectingResponse = false; +// private Object handleRequestCondition = new Object(); +// private Object gotResponsesCondition = new Object(); +// public STALRequestBrokerImpl() { +// broker = new RequestResponseBroker(); +// new Thread(handler).start(); +// } + +// @Override +// public HashDataInputCallback getCurrentHashDataInputCallback() { +// return broker.getCurrentHashDataInputCallback(); +// } + /** + * Produce requests (and HashDataInputCallback) and wait for responses. + * The next thread may enter once we consumed the responses. + * + * @param requests + * @return + * + * @pre requests either single SignRequest, QuitRequest or multiple ReadInfoboxRequests + */ + @Override + public synchronized List<STALResponse> handleRequest(List<STALRequest> requests) { + while (isHandlingRequest) { + log.trace("waiting to produce request"); + try { + long beforeWait = System.currentTimeMillis(); + wait(TIMEOUT_MS); + if (System.currentTimeMillis() - beforeWait >= TIMEOUT_MS) { + log.warn("timeout while waiting to produce request"); + return Collections.singletonList((STALResponse) new ErrorResponse(ERR_6000)); + } + } catch (InterruptedException ex) { + log.warn("interrupt while waiting to produce request: " + ex.getMessage()); + } + } + log.trace("produce request"); + isHandlingRequest = true; + + this.requests = requests; + currentHashDataInputCallback = null; + for (STALRequest request : requests) { + if (request instanceof SignRequest) { + log.trace("Received SignRequest, keep HashDataInput callback."); + currentHashDataInputCallback = ((SignRequest) request).getHashDataInput(); + break; + } else if (request instanceof QuitRequest) { + //alternative1: + //for QUIT requests, do not wait for responses, but for request consumation + // (i.e. set isHandlingReq to false once QUIT is consumed) + log.trace("Received QuitRequest, do not wait for responses."); + log.trace("notifying request consumers"); + notify(); + //alternative2: + //wait for QUIT to be consumed + // (i.e. notify me noce QUIT is consumed) +// while (this.requests != null) { +// try { +// long beforeWait = System.currentTimeMillis(); +// wait(TIMEOUT_MS); +// if (System.currentTimeMillis() - beforeWait >= TIMEOUT_MS) { +// log.warn("timeout while waiting for QUIT to be consumed"); +// this.requests = null; +// isHandlingRequest = false; +// return Collections.singletonList((STALResponse) new ErrorResponse(ERR_6000)); +// } +// } catch (InterruptedException ex) { +// log.warn("interrupt while waiting for QUIT to be consumed: " + ex.getMessage()); +// } +// } +// isHandlingRequest = false; + return new ArrayList<STALResponse>(); + } else if (log.isTraceEnabled()) { + log.trace("Received STAL request: " + request.getClass().getName()); + } + } + log.trace("notifying request consumers"); + notify(); + + while (this.responses == null) { + log.trace("waiting to consume response"); + try { + long beforeWait = System.currentTimeMillis(); + wait(TIMEOUT_MS); + if (System.currentTimeMillis() - beforeWait >= TIMEOUT_MS) { + log.warn("timeout while waiting to consume response"); + this.requests = null; + currentHashDataInputCallback = null; + isHandlingRequest = false; + return Collections.singletonList((STALResponse) new ErrorResponse(ERR_6000)); + } + } catch (InterruptedException ex) { + log.warn("interrupt while waiting to consume response: " + ex.getMessage()); + } + } + log.trace("consuming responses"); + List<STALResponse> resps = responses; + responses = null; + log.trace("notifying response producers"); + notify(); + + isHandlingRequest = false; + log.trace("notifying request producers"); + notify(); + + return resps; + } + + /** + * + * @param responses + * @return QUIT if expected responses are not provided + */ + @Override + public synchronized List<STALRequest> nextRequest(List<STALResponse> responses) { + if (responses != null && responses.size() > 0) { + if (!expectingResponse) { + log.warn("Received unexpected response in nextRequest()"); + return Collections.singletonList((STALRequest) new QuitRequest()); + } + while (this.responses != null) { + log.trace("waiting to produce response"); + try { + long beforeWait = System.currentTimeMillis(); + wait(TIMEOUT_MS); + if (System.currentTimeMillis() - beforeWait >= TIMEOUT_MS) { + log.warn("timeout while waiting to produce response"); + return Collections.singletonList((STALRequest) new QuitRequest()); + } + } catch (InterruptedException ex) { + log.warn("interrupt while waiting to produce response: " + ex.getMessage()); + } + } + log.trace("produce response"); + this.responses = responses; + //reset HashDataInputCallback + if (log.isTraceEnabled()) { + for (STALResponse response : responses) { + log.trace("Received STAL response: " + response.getClass().getName()); + } + } + log.trace("notifying response consumers"); + notify(); + } else { + if (expectingResponse) { + // while (expectingResponse) wait(); + log.warn("No expected response received in nextRequest()"); + return Collections.singletonList((STALRequest) new QuitRequest()); + } + log.trace("expecting non-null response in next nextRequest(response)"); + expectingResponse = true; + } + while (this.requests == null) { + log.trace("waiting to consume request"); + try { + long beforeWait = System.currentTimeMillis(); + wait(TIMEOUT_MS); + if (System.currentTimeMillis() - beforeWait >= TIMEOUT_MS) { + log.warn("timeout while waiting to consume request"); + return Collections.singletonList((STALRequest) new QuitRequest()); + } + } catch (InterruptedException ex) { + log.warn("interrupt while waiting to consume request: " + ex.getMessage()); + } + } + log.trace("consume request"); + List<STALRequest> reqs = requests; + //TODO check if QUIT and set isHandlingReq to false here? + // (rename isHandlingReq -> produce) + // handleReq(QUIT) doesn't wait() and returns immediately + // cf. handleReq(QUIT) + requests = null; + //no need to notify; request producer is waiting for isHandlingRequest + //(alt2: the QUIT producer returned immediately and didn't notify) + //(alt1: the QUIT producer is waiting for notification on QUIT consumption) + if (reqs.size() > 0 && reqs.get(0) instanceof QuitRequest) { + isHandlingRequest = false; + log.trace("consumed QUIT, notifying request producers"); + notify(); + log.trace("expecting no response in next nextRequest()"); + expectingResponse = false; + //notify no-response request consumers + } + return reqs; + } + + @Override + public synchronized HashDataInputCallback getHashDataInput() { + log.trace("return current HashDataInput callback"); + return currentHashDataInputCallback; + } +// /** +// * Causes the calling thread to sleep until response is passed via nextRequest() +// * (except for QUIT request, which returns immediately). +// * The requestList may contain at most one signRequest. +// * The signRequest's signedRefCallback is stored until a response to the signRequest is provided (2nd nextRequest() call), +// * i.e. until handleRequest() returns. +// * +// * @param aRequestList +// * @return +// * @pre requestList contains at most one signRequest +// */ +// @Override +// public List<STALResponse> handleRequest(List<STALRequest> requestList) { +// try { +// if (log.isTraceEnabled()) { +// log.trace("HandleRequest (" + requestList.size() + " requests)"); +// } +// +// broker.produceRequests(requestList); +// +// // QUIT returns immediately +// if (requestList.size() == 1 && requestList.get(0) instanceof QuitRequest) { +// log.trace("Received QUIT request, do not wait for responses."); +// return new ArrayList<STALResponse>(); +// } +// return broker.consumeResponses(); +// } catch (InterruptedException ex) { +// log.error("Interrupted while handling STAL request list: " + ex.getMessage()); +// return Collections.singletonList((STALResponse) new ErrorResponse()); +// } catch (TimeoutException ex) { +// log.error("Timeout during handle request: " + ex.getMessage()); +// ErrorResponse err = new ErrorResponse(); +// err.setErrorCode(ERR_6000); +// return Collections.singletonList((STALResponse) err); +// } +// } +// +// @Override +// public void setResponse(List<STALResponse> responses) { +// try { +//// if (responses != null && responses.size() > 0) { +//// List<STALResponse> stalResponses = translateResponses(responses); +// broker.produceResponses(responses); +//// } else { +//// log.trace("Received emtpy responses list, do not add."); +//// } +// } catch (InterruptedException ex) { +// log.error("Interrupted while setting STAL response: " + ex.getMessage()); +//// broker.interrupt(new ErrorResponse()); +// } catch (TimeoutException ex) { +// log.error("Timeout during setResponse: " + ex.getMessage()); +// } +// } +// +// /** +// * TODO split in nextRequest(void) and setResponses(responses) +// * <br/> +// * Translate (possibly empty) STAL-WS response list to STAL responses and +// * wait until request(s) are available and translate to STAL-WS requests. +// * @param prevResponse if null or zero-length, they are not passed to the handler +// * @return +// */ +// @Override +// public List<STALRequest> nextRequest() { //List<ResponseType> responses) { +// try { +//// if (responses != null && responses.size() > 0) { +//// List<STALResponse> stalResponses = translateResponses(responses); +//// broker.produceResponses(stalResponses); +//// } else { +//// log.trace("Received emtpy responses list, do not add."); +//// } +// +//// List<? extends STALRequest> stalRequests = broker.consumeRequests(); +//// List<RequestType> requests = translateRequests(stalRequests); +// return broker.consumeRequests(); +//// } catch (InterruptedException ex) { +//// log.error("Interrupted while requesting next STAL request: " + ex.getMessage()); +//// return Collections.singletonList((STALResponse) new ErrorResponse()); +// } catch (InterruptedException ex) { +// log.error("Interrupted while requesting next STAL request: " + ex.getMessage()); +//// broker.interrupt(new ErrorResponse()); +// return new ArrayList<STALRequest>(); +// } catch (TimeoutException ex) { +// log.error("Timeout during nextRequest: " + ex.getMessage()); +// return new ArrayList<STALRequest>(); +// } +// } +// +//// @Override +//// public void interruptRequestHandling(ErrorResponseType error) { +//// if (log.isTraceEnabled()) { +//// log.trace("Received Error: " + error.getErrorMessage()); +//// } +//// broker.interrupt(new ErrorResponse(error.getErrorCode())); +//// } +// +// //TODO +//// private List<RequestType> translateRequests(List<? extends STALRequest> stalRequests) { +//// List<RequestType> requests = new ArrayList<RequestType>(stalRequests.size()); +//// for (STALRequest stalRequest : stalRequests) { +//// if (stalRequest instanceof InfoboxReadRequest) { +//// InfoboxReadRequestType req = new InfoboxReadRequestType(); +//// req.setInfoboxIdentifier(((InfoboxReadRequest) stalRequest).getInfoboxIdentifier()); +//// log.warn("TODO consider domain identifier for infobox " + req.getInfoboxIdentifier()); +//// req.setDomainIdentifier("TODO"); +//// requests.add(req); +//// } else if (stalRequest instanceof SignRequest) { +//// //TODO +//// //remember current sign request for getSignedReferences() +//// throw new UnsupportedOperationException("SignRequest unsupported"); +//// } else if (stalRequest instanceof QuitRequest) { +//// requests.add(new QuitRequestType()); +//// } else { +//// log.error("Unknown STAL request: " + stalRequest.getClass().getName()); +//// } +//// } +//// return requests; +//// } +// +//// private List<STALResponse> translateResponses(List<ResponseType> responses) { +//// List<STALResponse> stalResponses = new ArrayList<STALResponse>(responses.size()); +//// for (ResponseType response : responses) { +//// if (response instanceof InfoboxReadResponseType) { +//// byte[] infoboxValue = ((InfoboxReadResponseType) response).getInfoboxValue(); +//// stalResponses.add(new InfoboxReadResponse(infoboxValue)); +//// } else if (response instanceof SignResponseType) { +//// byte[] signatureValue = ((SignResponseType) response).getSignatureValue(); +//// stalResponses.add(new SignResponse(signatureValue)); +//// } else if (response instanceof ErrorResponseType) { +//// int errorCode = ((ErrorResponseType) response).getErrorCode(); +//// log.warn("TODO consider error msg: " + ((ErrorResponseType) response).getErrorMessage()); +//// stalResponses.add(new ErrorResponse(errorCode)); +//// } else { +//// log.error("Unknown STAL service response " + response.getId() + ": " + response.getClass().getName()); +//// } +//// } +//// return stalResponses; +//// } +// /** +// * synchronize on this, not on request/response lists since they are nulled +// */ +// // protected since outer handler field is protected +// protected class RequestResponseBroker { //implements Runnable { +// +// protected List<STALRequest> requests = null; +// protected List<STALResponse> responses = null; +// protected HashDataInputCallback currentHashDataInputCallback; +// +//// @Override +//// public void run() { +//// while (true) { +//// ; +//// } +//// //TODO handler lifecycle in run()? +//// } +// /** +// * wait until requests are consumed, +// * produce requests, remember sigRefCallback and notify consumer +// * (no need for synchronized?) +// * @param requests +// */ +// public synchronized void produceRequests(List<STALRequest> requests) throws InterruptedException, TimeoutException { +//// synchronized (requests) { +// +// // requests is null, since there's only one producer thread calling handleRequests() +// // and handleRequest() returns only if nextRequest() was called +// while (this.requests != null) { +//// requests.wait(); +// long before = System.currentTimeMillis(); +// log.trace("waiting to produce requests ..."); +// wait(); //TIMEOUT_MS); +// if (System.currentTimeMillis() - before >= TIMEOUT_MS) { +// log.error("Timeout while waiting to produce requests."); +// throw new TimeoutException(); +// } +// } +// log.trace("producing requests"); +// this.requests = requests; +// // getSignedReferences does not produce responses, +// // so the command thread will not continue (and no further signRequest can possibly be produced) +// // once the ws-client sends nextRequest with responses to the signRequest, the callback is invalidated +// +// // reset callback if for some reason produceResponse() wasn't called +// currentHashDataInputCallback = null; +// for (STALRequest request : requests) { +// if (request instanceof SignRequest) { +// log.trace("keep hashdatainput callback"); +// currentHashDataInputCallback = ((SignRequest) request).getHashDataInput(); +// break; +// } +// } +// +//// requests.notify(); +// log.trace("notifying request consumers (TODO not only consumers)"); +// notify(); +//// } +// } +// +// /** +// * wait until requests are produced and consume them +// * @return +// */ +// public synchronized List<STALRequest> consumeRequests() throws InterruptedException, TimeoutException { +// List<STALRequest> retVal = null; +//// synchronized (requests) { +// while (requests == null) { +//// requests.wait(); +// long before = System.currentTimeMillis(); +// log.trace("waiting to consumer requests ..."); +// wait(); //TIMEOUT_MS); +// if (System.currentTimeMillis() - before >= TIMEOUT_MS) { +// log.error("Timeout while waiting to consume requests."); +// throw new TimeoutException(); +// } +// } +// log.trace("consuming requests"); +// retVal = requests; +// requests = null; +//// } +// log.trace("???notify request producers???"); +// return retVal; +// } +// +// /** +// * wait until previous responses are consumed, +// * produce responses and notify consumer +// * @param responses +// */ +// public synchronized void produceResponses(List<STALResponse> responses) throws InterruptedException, TimeoutException { +//// synchronized (responses) { +// while (this.responses != null) { +//// responses.wait(); +// long before = System.currentTimeMillis(); +// log.trace("waiting to produce responses ..."); +// wait(); //TIMEOUT_MS); +// if (System.currentTimeMillis() - before >= TIMEOUT_MS) { +// log.error("Timeout while waiting to produce responses."); +// throw new TimeoutException(); +// } +// } +// log.trace("producing responses"); +// this.responses = responses; +// //invalidate sigrefcallback (from now on handleRequest() may be called, producing new requests) +// //make sure the provided responses are for the corresponding signrequest +// if (this.requests == null) {//requests already consumed=>responses correspond to these +// log.trace("resetting current hashdatainput"); +// currentHashDataInputCallback = null; +// } +//// responses.notify(); +// log.trace("notify response consumers (TODO only consumers?)"); +// notify(); +//// } +// } +// +// /** +// * wait until responses are available, consume them +// * @return +// * @throws java.lang.Exception +// */ +// public synchronized List<STALResponse> consumeResponses() throws InterruptedException, TimeoutException { +// List<STALResponse> retVal = null; +//// synchronized (responses) { +// while (responses == null) { +//// responses.wait(); +// long before = System.currentTimeMillis(); +// log.trace("waiting to consume responses ..."); +// wait(); //TIMEOUT_MS); +// if (System.currentTimeMillis() - before >= TIMEOUT_MS) { +// log.error("Timeout while waiting to consume responses."); +// throw new TimeoutException(); +// } +// } +// log.trace("consuming responses"); +// retVal = responses; +// responses = null; +//// } +// log.trace("???notify response producers???"); +// return retVal; +// } +// +// /** +// * get the signrefcallback until handleRequest() is called the next time. +// * @return null if last request was not a signRequest +// */ +// public synchronized HashDataInputCallback getCurrentHashDataInputCallback() { +// log.trace("obtain current hashdatainput"); +// return currentHashDataInputCallback; +// } +// /** +// * add the error to responses and notify (response-) consumers +// * @param error +// */ +//// public synchronized void interrupt(ErrorResponse error) { +////// synchronized (responses) { +//// if (responses == null) { +//// responses = Collections.singletonList((STALResponse) error); +//// } else { +//// responses.add(error); +//// } +////// responses.notify(); +//// notify(); +////// } +//// } +// } + @Override + public void setLocale(Locale locale) { + // TODO Auto-generated method stub + } +} diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java new file mode 100644 index 00000000..3e8ad6f3 --- /dev/null +++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java @@ -0,0 +1,220 @@ +/* +* 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. +*/ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package at.gv.egiz.stal.service.impl; + +import at.gv.egiz.bku.binding.BindingProcessor; +import at.gv.egiz.bku.binding.BindingProcessorManager; +import at.gv.egiz.stal.service.*; +import at.gv.egiz.bku.binding.Id; +import at.gv.egiz.bku.binding.IdFactory; +import at.gv.egiz.stal.ErrorResponse; +import at.gv.egiz.stal.STALRequest; +import at.gv.egiz.stal.STALResponse; +import at.gv.egiz.stal.HashDataInputCallback; +import at.gv.egiz.stal.InfoboxReadRequest; +import at.gv.egiz.stal.QuitRequest; +import at.gv.egiz.stal.SignRequest; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.List; +import javax.annotation.Resource; +import javax.jws.WebService; +import javax.servlet.ServletContext; +import javax.xml.ws.WebServiceContext; +import javax.xml.ws.handler.MessageContext; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * + * @author clemens + */ +@WebService(endpointInterface = "at.gv.egiz.stal.service.STALPortType") +public class STALServiceImpl implements STALPortType { + + public static final String BINDING_PROCESSOR_MANAGER = "bindingProcessorManager"; + public static final String TEST_SESSION_ID = "TestSession"; + protected static final Log log = LogFactory.getLog(STALServiceImpl.class); + @Resource + WebServiceContext wsContext; + protected IdFactory idF = IdFactory.getInstance(); + + @Override + public GetNextRequestResponseType getNextRequest(GetNextRequestType request) { + + // HttpSession session = ((HttpServletRequest) + // mCtx.get(MessageContext.SERVLET_REQUEST)).getSession(); + String sessId = request.getSessionId(); + List<STALResponse> responses = request.getResponse(); + if (log.isDebugEnabled()) { + log.debug("Received GetNextRequest for session " + sessId + + " containing " + responses.size() + " responses"); + } + + GetNextRequestResponseType response = new GetNextRequestResponseType(); + response.setSessionId(sessId); + + if (TEST_SESSION_ID.equals(sessId)) { + if (responses.size() > 0 && responses.get(0) instanceof ErrorResponse) { + log + .info("Received TestSession GetNextRequest(ErrorResponse), returning QuitRequest"); + response.getRequest().add(new QuitRequest()); + } else { + log + .info("Received TestSession GetNextRequest, returning InfoboxReadRequest "); + SignRequest sig = new SignRequest(); + sig.setKeyIdentifier("SecureSignatureKeypair"); + sig.setSignedInfo("<dsig:SignedInfo xmlns:dsig=\"http://www.w3.org/2000/09/xmldsig#\" xmlns:xpf=\"http://www.w3.org/2002/06/xmldsig-filter2\"><dsig:CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\" /> <dsig:SignatureMethod Algorithm=\"http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1\" /> <dsig:Reference Id=\"signed-data-reference-0-1214921968-27971781-24309\" URI=\"#signed-data-object-0-1214921968-27971781-13578\"><dsig:Transforms> <dsig:Transform Algorithm=\"http://www.w3.org/2002/06/xmldsig-filter2\"> <xpf:XPath xmlns:xpf=\"http://www.w3.org/2002/06/xmldsig-filter2\" Filter=\"intersect\">id('signed-data-object-0-1214921968-27971781-13578')/node()</xpf:XPath></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /> <dsig:DigestValue>H1IePEEfGQ2SG03H6LTzw1TpCuM=</dsig:DigestValue></dsig:Reference><dsig:Reference Id=\"etsi-data-reference-0-1214921968-27971781-25439\" Type=\"http://uri.etsi.org/01903/v1.1.1#SignedProperties\" URI=\"#xmlns(etsi=http://uri.etsi.org/01903/v1.1.1%23)%20xpointer(id('etsi-data-object-0-1214921968-27971781-3095')/child::etsi:QualifyingProperties/child::etsi:SignedProperties)\"><dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><dsig:DigestValue>yV6Q+I60buqR4mMaxA7fi+CV35A=</dsig:DigestValue></dsig:Reference></dsig:SignedInfo>".getBytes()); + response.getRequest().add(sig); + InfoboxReadRequest req = new InfoboxReadRequest(); + req.setInfoboxIdentifier("IdentityLink"); + req.setDomainIdentifier("hansiwurzel"); + response.getRequest().add(req); + req = new InfoboxReadRequest(); + req.setInfoboxIdentifier("CertifiedKeypair"); + response.getRequest().add(req); + req = new InfoboxReadRequest(); + req.setInfoboxIdentifier("SecureSignatureKeypair"); + response.getRequest().add(req); + } + return response; + } + + // get Session Id + Id sessionId = idF.createId(sessId); + STALRequestBroker stal = getStal(sessionId); + + if (stal == null) { + log.error("Failed to get STAL for session " + sessId + + ", returning QuitRequest"); + response.getRequest().add(new QuitRequest()); + } else { + List<STALResponse> responsesIn = request.getResponse(); + for (STALResponse resp : responsesIn) { + log.debug(resp); + } + List<STALRequest> requestsOut = ((STALRequestBroker) stal) + .nextRequest(responsesIn); + response.getRequest().addAll(requestsOut); + if (log.isDebugEnabled()) { + log.debug("Returning GetNextRequestResponse for session " + sessId + + " containing " + requestsOut.size() + " requests"); + } + } + return response; + } + + @Override + public GetHashDataInputResponseType getHashDataInput( + GetHashDataInputType request) throws GetHashDataInputFault { + + String sessId = request.getSessionId(); + if (log.isDebugEnabled()) { + log.debug("Received GetHashDataInputRequest for session " + sessId + + " containing " + request.getReference().size() + " referencese"); + } + + // get Session Id + Id sessionId = idF.createId(sessId); + STALRequestBroker stal = getStal(sessionId); + + if (stal == null) { + String msg = "Failed to get STAL for session " + sessId; + log.error(msg); + GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType(); + faultInfo.setErrorCode(1); + faultInfo.setErrorMessage(msg); + throw new GetHashDataInputFault(msg, faultInfo); + } else { + GetHashDataInputResponseType response = new GetHashDataInputResponseType(); + response.setSessionId(sessId); + + HashDataInputCallback hashDataInput = stal.getHashDataInput(); + if (TEST_SESSION_ID.equals(sessId)) { + log + .debug("Received TestSession GetHashDataInput, setting dummy HashDataInputCallback"); + hashDataInput = new HashDataInputCallback() { + + @Override + public InputStream getHashDataInput(String referenceId) { + byte[] hd = ("dummyhashdatainput_" + referenceId).getBytes(); + return new ByteArrayInputStream(hd); + } + }; + } + if (hashDataInput != null) { + List<GetHashDataInputType.Reference> references = request + .getReference(); + for (GetHashDataInputType.Reference reference : references) { + String refId = reference.getID(); + if (log.isDebugEnabled()) { + log.debug("Resolving HashDataInput for reference " + refId); + } + ByteArrayOutputStream baos = null; + try { + InputStream hdi = hashDataInput.getHashDataInput(refId); + baos = new ByteArrayOutputStream(hdi.available()); + int c; + while ((c = hdi.read()) != -1) { + baos.write(c); + } + GetHashDataInputResponseType.Reference ref = new GetHashDataInputResponseType.Reference(); + ref.setID(refId); + ref.setValue(baos.toByteArray()); + response.getReference().add(ref); + } catch (IOException ex) { + String msg = "Failed to get HashDataInput for reference " + refId; + log.error(msg, ex); + GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType(); + faultInfo.setErrorCode(1); + faultInfo.setErrorMessage(msg); + throw new GetHashDataInputFault(msg, faultInfo, ex); + } finally { + try { + baos.close(); + } catch (IOException ex) { + } + } + } + } else { + log.warn("Could not resolve any HashDataInputs for session " + sessId + + ", no callback provided."); + } + return response; + } + } + + private STALRequestBroker getStal(Id sessionId) { + // log.warn("RETURNING DUMMY STAL REQUEST BROKER"); + // return new STALRequestBrokerImpl(); + + MessageContext mCtx = wsContext.getMessageContext(); + ServletContext sCtx = (ServletContext) mCtx + .get(MessageContext.SERVLET_CONTEXT); + BindingProcessorManager bpMgr = (BindingProcessorManager) sCtx + .getAttribute(BINDING_PROCESSOR_MANAGER); + BindingProcessor bp = bpMgr.getBindingProcessor(sessionId); + return (bp == null) ? null : (STALRequestBroker) bp.getSTAL(); + } +} diff --git a/BKUOnline/src/main/resources/commons-logging.properties b/BKUOnline/src/main/resources/commons-logging.properties new file mode 100644 index 00000000..0d497b1b --- /dev/null +++ b/BKUOnline/src/main/resources/commons-logging.properties @@ -0,0 +1,16 @@ +# 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. + +org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger diff --git a/BKUOnline/src/main/resources/log4j.properties b/BKUOnline/src/main/resources/log4j.properties new file mode 100644 index 00000000..ed14b424 --- /dev/null +++ b/BKUOnline/src/main/resources/log4j.properties @@ -0,0 +1,34 @@ +# 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. + +# loglever DEBUG, appender STDOUT +log4j.rootLogger=TRACE, STDOUT +#log4j.logger.at.gv.egiz.slbinding.RedirectEventFilter=DEBUG, STDOUT + +# STDOUT appender +log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender +log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout +#log4j.appender.STDOUT.layout.ConversionPattern=%5p | %d{dd HH:mm:ss,SSS} | %20c | %10t | %m%n +#log4j.appender.STDOUT.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n +log4j.appender.STDOUT.layout.ConversionPattern=%-5p | %t | %c %x - %m%n + +### FILE appender +#log4j.appender.file=org.apache.log4j.RollingFileAppender +#log4j.appender.file.maxFileSize=100KB +#log4j.appender.file.maxBackupIndex=9 +#log4j.appender.file.File=egovbus_ca.log +#log4j.appender.file.threshold=info +#log4j.appender.file.layout=org.apache.log4j.PatternLayout +#log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
\ No newline at end of file diff --git a/BKUOnline/src/main/webapp/HTTP-ohne.html b/BKUOnline/src/main/webapp/HTTP-ohne.html new file mode 100644 index 00000000..9cdd67ab --- /dev/null +++ b/BKUOnline/src/main/webapp/HTTP-ohne.html @@ -0,0 +1,85 @@ +<!-- + 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. +--> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> +<title>Infobox Requests</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +</head> +<body> +<h1>Securitykapsel - HTTP-Bindung</h1> +<style type="text/css"> +fieldset { + padding: 1em; + font: 80%/ 1 sans-serif; + background-color: #F2EFE9; + padding-left: 5em; +} + +fieldset.submit { + float: none; + width: auto; + border: 0 none #FFF; + padding-left: 14em; + border-style: none; + background-color: transparent; +} + +label { + float: left; + width: 8em; + margin-right: 0.5em; + padding-top: 0.2em; + text-align: right; + font-weight: bold; + color: #000; + padding-top: 0.2em; +} + +legend { + border: 1px solid; + padding: 2px 6px +} +</style> + +<p> +<form action="./http-security-layer-request" method="Post" + enctype="application/x-www-form-urlencoded"> +<fieldset><legend>Enter XML Request</legend> +<p><label for="XMLRequest">XML Request</label> <textarea + name="XMLRequest" rows=15 cols="60" id="XMLRequest"> +<?xml version="1.0" encoding="UTF-8" ?> +<sl:InfoboxReadRequest + xmlns:sl="http://www.buergerkarte.at/namespaces/securitylayer/1.2#"> +<sl:InfoboxIdentifier>IdentityLink</sl:InfoboxIdentifier> +<sl:BinaryFileParameters ContentIsXMLEntity="true" /> +</sl:InfoboxReadRequest> +</textarea></p> +<!-- +<p><label for="RedirectURL">RedirectURL</label> <input + name="RedirectURL" value="" id="RedirectURL"></p> +<p><label for="DataURL">DataURL</label> <input name="DataURL" + value="" id="DataURL"></p> +<p><label for="StyleSheetURL">StyleSheetURL</label> <input + name="StyleSheetURL" value="" id="StyleSheetURL"></p> +<p> + --></fieldset> +<fieldset class="submit"><input type="submit" class="submit"></fieldset> +</form> + +</body> +</html> diff --git a/BKUOnline/src/main/webapp/META-INF/MANIFEST.MF b/BKUOnline/src/main/webapp/META-INF/MANIFEST.MF new file mode 100644 index 00000000..5e949512 --- /dev/null +++ b/BKUOnline/src/main/webapp/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0
+Class-Path:
+
diff --git a/BKUOnline/src/main/webapp/META-INF/context.xml b/BKUOnline/src/main/webapp/META-INF/context.xml new file mode 100644 index 00000000..3568c9ec --- /dev/null +++ b/BKUOnline/src/main/webapp/META-INF/context.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<Context path="/bkuonline"/> diff --git a/BKUOnline/src/main/webapp/WEB-INF/applicationContext.xml b/BKUOnline/src/main/webapp/WEB-INF/applicationContext.xml new file mode 100644 index 00000000..7a2f12b8 --- /dev/null +++ b/BKUOnline/src/main/webapp/WEB-INF/applicationContext.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!-- + 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. +--> +<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
+ <bean id="STALFactory" class="at.gv.egiz.stal.service.impl.RequestBrokerSTALFactory"
+ scope="singleton" />
+ <bean id="commandInvoker" class="at.gv.egiz.bku.binding.SLCommandInvokerImpl" />
+ <bean id="bindingProcessorManager" class="at.gv.egiz.bku.binding.BindingProcessorManagerImpl"
+ scope="singleton">
+ <constructor-arg ref="STALFactory"></constructor-arg>
+ <constructor-arg ref="commandInvoker"></constructor-arg>
+ </bean>
+ <bean
+ class="org.springframework.web.context.support.ServletContextAttributeExporter">
+ <property name="attributes">
+ <map>
+ <entry key="bindingProcessorManager">
+ <ref bean="bindingProcessorManager" />
+ </entry>
+ </map>
+ </property>
+ </bean>
+ <!-- Configure Configuration -->
+ <bean id="configurator" class="at.gv.egiz.bku.online.conf.Configurator"
+ scope="singleton">
+ </bean>
+</beans>
\ No newline at end of file diff --git a/BKUOnline/src/main/webapp/WEB-INF/sun-jaxws.xml b/BKUOnline/src/main/webapp/WEB-INF/sun-jaxws.xml new file mode 100644 index 00000000..6e8f8b69 --- /dev/null +++ b/BKUOnline/src/main/webapp/WEB-INF/sun-jaxws.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> + +<!-- + Description: tomcat deployement +--> + +<endpoints + xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime" + version="2.0"> + + <endpoint + name="STALPort" + interface="at.gv.egiz.stal.service.STALPortType" + implementation="at.gv.egiz.stal.service.impl.STALServiceImpl" + wsdl="WEB-INF/wsdl/stal.wsdl" + service="{http://www.egiz.gv.at/wsdl/stal}STALService" + port="{http://www.egiz.gv.at/wsdl/stal}STALPort" + url-pattern="/stal" /> + +</endpoints> diff --git a/BKUOnline/src/main/webapp/WEB-INF/web.xml b/BKUOnline/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000..417dabb8 --- /dev/null +++ b/BKUOnline/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<web-app id="bkuonline" version="2.5" + xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> + <display-name>http-security-layer-request</display-name> + + <!-- Begin Spring Config --> + <context-param> + <param-name>contextConfigLocation</param-name> + <param-value>/WEB-INF/applicationContext.xml</param-value> + </context-param> + <listener> + <listener-class> + org.springframework.web.context.ContextLoaderListener + </listener-class> + </listener> + <!-- End Spring Config --> + + <!-- Begin BKU Config --> + <listener> + <listener-class>at.gv.egiz.bku.online.webapp.SessionTimeout</listener-class> + </listener> + <servlet> + <servlet-name>BKUServlet</servlet-name> + <servlet-class>at.gv.egiz.bku.online.webapp.BKURequestHandler</servlet-class> + </servlet> + <servlet> + <servlet-name>ResultServlet</servlet-name> + <servlet-class>at.gv.egiz.bku.online.webapp.ResultServlet</servlet-class> + <init-param> + <param-name>responseEncoding</param-name> + <param-value>UTF-8</param-value> + </init-param> + <init-param> + <param-name>expiredPage</param-name> + <!-- FIXME --> + <param-value>expired.html</param-value> + </init-param> + </servlet> + <servlet-mapping> + <servlet-name>BKUServlet</servlet-name> + <url-pattern>/http-security-layer-request</url-pattern> + </servlet-mapping> + <servlet-mapping> + <servlet-name>BKUServlet</servlet-name> + <url-pattern>/https-security-layer-request</url-pattern> + </servlet-mapping> + <servlet-mapping> + <servlet-name>ResultServlet</servlet-name> + <url-pattern>/bkuResult</url-pattern> + </servlet-mapping> + <!-- End BKU Config --> + + + + <!-- Begin STAL Config --> + <listener> + <listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class> + </listener> + <servlet> + <servlet-name>STALPort</servlet-name> + <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class> + <load-on-startup>1</load-on-startup> + </servlet> + <servlet-mapping> + <servlet-name>STALPort</servlet-name> + <url-pattern>/stal</url-pattern> + </servlet-mapping> + <!-- End STAL Config --> + <welcome-file-list> + <welcome-file>index.html</welcome-file> + <welcome-file>index.htm</welcome-file> + <welcome-file>index.jsp</welcome-file> + <welcome-file>default.html</welcome-file> + <welcome-file>default.htm</welcome-file> + <welcome-file>default.jsp</welcome-file> + </welcome-file-list> + <session-config> + <session-timeout>3</session-timeout> + </session-config> +</web-app>
\ No newline at end of file diff --git a/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal.wsdl b/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal.wsdl new file mode 100644 index 00000000..a9f16a12 --- /dev/null +++ b/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal.wsdl @@ -0,0 +1,82 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<definitions name="stal" targetNamespace="http://www.egiz.gv.at/wsdl/stal" + xmlns="http://schemas.xmlsoap.org/wsdl/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.egiz.gv.at/wsdl/stal" xmlns:ns="http://www.egiz.gv.at/stal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> + <types> + <xsd:schema targetNamespace="http://www.egiz.gv.at/wsdl/stal"> + <xsd:import namespace="http://www.egiz.gv.at/stal" schemaLocation="stal.xsd"/> + </xsd:schema> + </types> + <message name="NextRequestRequest"> + <part name="part1" element="ns:GetNextRequest"/> + </message> + <message name="NextRequestResponse"> + <part name="part1" element="ns:GetNextRequestResponse"/> + </message> + <message name="GetHashDataInputRequest"> + <part name="part1" element="ns:GetHashDataInput"/> + </message> + <message name="GetHashDataInputResponse"> + <part name="part1" element="ns:GetHashDataInputResponse"/> + </message> + <message name="GetHashDataInputFault"> + <part name="part1" element="ns:GetHashDataInputFault"/> + </message> + <portType name="STALPortType"> + <operation name="nextRequest"> + <input name="input1" message="tns:NextRequestRequest"/> + <output name="output1" message="tns:NextRequestResponse"/> + </operation> + <operation name="getHashDataInput"> + <input name="input2" message="tns:GetHashDataInputRequest"/> + <output name="output2" message="tns:GetHashDataInputResponse"/> + <fault name="fault1" message="tns:GetHashDataInputFault"/> + </operation> + </portType> + <binding name="STALBinding" type="tns:STALPortType"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> + <operation name="nextRequest"> + <soap:operation/> + <input name="input1"> + <soap:body use="literal"/> + </input> + <output name="output1"> + <soap:body use="literal"/> + </output> + </operation> + <operation name="getHashDataInput"> + <soap:operation/> + <input name="input2"> + <soap:body use="literal"/> + </input> + <output name="output2"> + <soap:body use="literal"/> + </output> + <fault name="fault1"> + <soap:fault name="fault1"/> + </fault> + </operation> + </binding> + <service name="STALService"> + <port name="STALPort" binding="tns:STALBinding"> + <soap:address location="http://localhost:${HttpDefaultPort}/stal"/> + </port> + </service> +</definitions> diff --git a/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal.xsd b/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal.xsd new file mode 100644 index 00000000..6627db00 --- /dev/null +++ b/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal.xsd @@ -0,0 +1,135 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.egiz.gv.at/stal" + xmlns:tns="http://www.egiz.gv.at/stal" + elementFormDefault="qualified"> + <element name="GetNextRequest" type="tns:GetNextRequestType"/> + <element name="GetNextRequestResponse" type="tns:GetNextRequestResponseType"/> + <element name="GetHashDataInput" type="tns:GetHashDataInputType"/> + <element name="GetHashDataInputResponse" type="tns:GetHashDataInputResponseType"/> + <element name="GetHashDataInputFault" type="tns:GetHashDataInputFaultType"/> + <complexType name="GetNextRequestType"> + <sequence> + <element name="Response" type="tns:ResponseType" minOccurs="0" maxOccurs="unbounded"/> + </sequence> + <attribute name="sessionId" type="string"/> + <!--choice maxOccurs="unbounded"> + <element name="InfoboxReadResponse" type="tns:InfoboxReadResponseType"/> + <element name="SignResponse" type="tns:SignResponseType"/> + <element name="ErrorResponse" type="tns:ErrorResponseType"/> + </choice--> + </complexType> + <complexType name="ResponseType" abstract="true"> + <attribute name="Id" type="ID"/> + </complexType> + <complexType name="InfoboxReadResponseType"> + <complexContent> + <extension base="tns:ResponseType"> + <sequence> + <element name="InfoboxValue" type="base64Binary"/> + </sequence> + </extension> + </complexContent> + </complexType> + <complexType name="SignResponseType"> + <complexContent> + <extension base="tns:ResponseType"> + <sequence> + <element name="SignatureValue" type="base64Binary"/> + </sequence> + </extension> + </complexContent> + </complexType> + <complexType name="ErrorResponseType"> + <complexContent> + <extension base="tns:ResponseType"> + <sequence> + <element name="ErrorCode" type="int"/> + <element name="ErrorMessage" type="string"/> + </sequence> + </extension> + </complexContent> + </complexType> + <complexType name="GetNextRequestResponseType"> + <sequence> + <element name="Request" type="tns:RequestType" minOccurs="0" maxOccurs="unbounded"/> + </sequence> + <attribute name="sessionId" type="string"/> + <!--choice maxOccurs="unbounded"> + <element name="InfoboxReadRequest" type="tns:InfoboxReadRequestType"/> + <element name="SignRequest" type="tns:SignRequestType"/> + <element name="QuitRequest" type="tns:QuitRequestType"/> + </choice--> + </complexType> + <complexType name="RequestType" abstract="true"/> + <complexType name="InfoboxReadRequestType"> + <complexContent> + <extension base="tns:RequestType"> + <sequence> + <element name="InfoboxIdentifier" type="string"/> + <element name="DomainIdentifier" type="string" minOccurs="0"/> + </sequence> + </extension> + </complexContent> + </complexType> + <complexType name="SignRequestType"> + <complexContent> + <extension base="tns:RequestType"> + <sequence> + <element name="KeyIdentifier" type="string"/> + <element name="SignedInfo" type="base64Binary"/> + </sequence> + </extension> + </complexContent> + </complexType> + <complexType name="QuitRequestType"> + <complexContent> + <extension base="tns:RequestType"/> + </complexContent> + </complexType> + <complexType name="GetHashDataInputType"> + <sequence> + <element name="Reference" maxOccurs="unbounded"> + <complexType> + <attribute name="ID" type="string"/> + </complexType> + </element> + </sequence> + <attribute name="sessionId" type="string"/> + </complexType> + <complexType name="GetHashDataInputResponseType"> + <sequence> + <element name="Reference" maxOccurs="unbounded"> + <complexType> + <simpleContent> + <extension base="base64Binary"> + <attribute name="ID" type="ID"/> + </extension> + </simpleContent> + </complexType> + </element> + </sequence> + <attribute name="sessionId" type="string"/> + </complexType> + <complexType name="GetHashDataInputFaultType"> + <sequence> + <element name="ErrorCode" type="int"/> + <element name="ErrorMessage" type="string"/> + </sequence> + </complexType> +</schema> diff --git a/BKUOnline/src/main/webapp/appletPage.jsp b/BKUOnline/src/main/webapp/appletPage.jsp new file mode 100644 index 00000000..684a8dca --- /dev/null +++ b/BKUOnline/src/main/webapp/appletPage.jsp @@ -0,0 +1,65 @@ +<!-- + 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. +--> +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>Applet BKU Test</title> +</head> +<body> +<script src="./js/deployJava.js"></script> +<script> + if (!deployJava.versionCheck('1.6.0')) { + document + .write('<b>Diese Anwendung benötigt die Java Platform Version 1.6.0 oder höher.</b>' + '<input type="submit" value="Java Platform 1.6.0 installieren" onclick="deployJava.installLatestJRE();">'); + } else { + var attributes = { + codebase :'applet', + code :'at.gv.egiz.bku.online.applet.BKUApplet.class', + archive :'BKUApplet-1.0-SNAPSHOT.jar, commons-logging-1.1.1.jar, iaik_jce_me4se-3.04.jar', + width :500, + height :200 + }; + var parameters = { + WSDL_URL :'../stal?wsdl', + SessionID : '<%= session.getId() %>', + redirectURL : '../bkuResult' + }; + var version = '1.6.0'; + deployJava.runApplet(attributes, parameters, version); + } +</script> +<br /> +<script> + document.write('App Name: ' + navigator.appName + '<BR>'); + document.write('User Agent: ' + navigator.userAgent + '<BR>'); + var list = deployJava.getJREs(); + if (list.length == 0) { + document.write('No Detectable Java Platforms are Installed<BR>'); + } else { + var result = list[0]; + for ( var i = 1; i < list.length; i++) { + result += ", " + list[i]; + } + document.write("You have the following Java Platform(s) installed:" + + result + "<BR>"); + } +</script> +</body> +</html> diff --git a/BKUOnline/src/main/webapp/expired.html b/BKUOnline/src/main/webapp/expired.html new file mode 100644 index 00000000..67ca94bc --- /dev/null +++ b/BKUOnline/src/main/webapp/expired.html @@ -0,0 +1,28 @@ +<!-- + 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. +--> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Session Expired</title>
+</head>
+<body>
+ <p>
+ Ihre Sitzung ist abgelaufen. Ein neuer BKU request kann im <a href="HTTP-ohne.html">Requestformular</a> erstellt werden.
+ </p>
+</body>
+</html>
\ No newline at end of file diff --git a/BKUOnline/src/main/webapp/index.html b/BKUOnline/src/main/webapp/index.html new file mode 100644 index 00000000..8f1a338e --- /dev/null +++ b/BKUOnline/src/main/webapp/index.html @@ -0,0 +1,59 @@ +<!-- + 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. +--> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> +<title>BKU Online</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +</head> +<body> +<style type="text/css"> + .box { + margin-top: 10px; + color: #292929; + width: 300px; + border: 1px solid #BABABA; + background-color: #ddd; + padding-left: 10px; + padding-right: 10px; + margin-left: 10px; + margin-bottom: 1em; + -o-border-radius: 10px; + -moz-border-radius: 12px; + -webkit-border-radius: 10px; + -webkit-box-shadow: 0px 3px 7px #adadad; + border-radius: 10px; + -moz-box-sizing: border-box; + -opera-sizing: border-box; + -webkit-box-sizing: border-box; + -khtml-box-sizing: border-box; + box-sizing: border-box; + overflow: hidden; + } +</style> +<div id="animDiv" class="box"> +<p> +<h1>TestRequest</h1> +<a href="HTTP-ohne.html">Security Layer Request</a> +<h1>STAL Service</h1> +<a href="stal">STAL Service Endpoint Information</a> +</p> +</div> + + +</body> +</html> diff --git a/BKUOnline/src/main/webapp/js/deployJava.js b/BKUOnline/src/main/webapp/js/deployJava.js new file mode 100644 index 00000000..4d8a0ca3 --- /dev/null +++ b/BKUOnline/src/main/webapp/js/deployJava.js @@ -0,0 +1,886 @@ +/* + * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of Sun Microsystems nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * deployJava.js + * + * This file is part of the Deployment Toolkit. It provides functions for web + * pages to detect the presence of a JRE, install the latest JRE, and easily run + * applets or Web Start programs. Usage guide may be found at http://<TBD>/. + * + * The "live" copy of this file may be found at + * http://java.com/js/deployJava.js. + * You are encouraged to link directly to the live copy of the file. + * + * @version @(#)deployJava.js 1.11 08/07/11 + */ + +var deployJava = { + debug: null, + + myInterval: null, + preInstallJREList: null, + returnPage: null, + brand: null, + locale: null, + installType: null, + + EAInstallEnabled: false, + EarlyAccessURL: null, + + // GetJava page + getJavaURL: 'http://java.sun.com/webapps/getjava/BrowserRedirect?host=java.com', + + // Apple redirect page + appleRedirectPage: 'http://www.apple.com/support/downloads/', + + // mime-type of the DeployToolkit plugin object + mimeType: 'application/npruntime-scriptable-plugin;DeploymentToolkit', + + // location of the Java Web Start launch button graphic + launchButtonPNG: 'http://java.sun.com/products/jfc/tsc/articles/swing2d/webstart.png', + + + /** + * Returns an array of currently-installed JRE version strings. + * Version strings are of the form #.#[.#[_#]], with the function returning + * as much version information as it can determine, from just family + * versions ("1.4.2", "1.5") through the full version ("1.5.0_06"). + * + * Detection is done on a best-effort basis. Under some circumstances + * only the highest installed JRE version will be detected, and + * JREs older than 1.4.2 will not always be detected. + */ + getJREs: function() { + var list = new Array(); + if (deployJava.isPluginInstalled()) { + var plugin = deployJava.getPlugin(); + for (var i = 0; i < plugin.jvms.getLength(); i++) { + list[i] = plugin.jvms.get(i).version; + } + } else { + var browser = deployJava.getBrowser(); + + if (browser == 'MSIE') { + if (deployJava.testUsingActiveX('1.8.0')) { + list[0] = '1.8.0'; + } else if (deployJava.testUsingActiveX('1.7.0')) { + list[0] = '1.7.0'; + } else if (deployJava.testUsingActiveX('1.6.0')) { + list[0] = '1.6.0'; + } else if (deployJava.testUsingActiveX('1.5.0')) { + list[0] = '1.5.0'; + } else if (deployJava.testUsingActiveX('1.4.2')) { + list[0] = '1.4.2'; + } else if (deployJava.testForMSVM()) { + list[0] = '1.1'; + } + } + else if (browser == 'Netscape Family') { + if (deployJava.testUsingMimeTypes('1.8')) { + list[0] = '1.8.0'; + } else if (deployJava.testUsingMimeTypes('1.7')) { + list[0] = '1.7.0'; + } else if (deployJava.testUsingMimeTypes('1.6')) { + list[0] = '1.6.0'; + } else if (deployJava.testUsingMimeTypes('1.5')) { + list[0] = '1.5.0'; + } else if (deployJava.testUsingMimeTypes('1.4.2')) { + list[0] = '1.4.2'; + } + } else if (browser == 'Safari') { + if (deployJava.testUsingPluginsArray('1.8.0')) { + list[0] = '1.8.0'; + } else if (deployJava.testUsingPluginsArray('1.7.0')) { + list[0] = '1.7.0'; + } else if (deployJava.testUsingPluginsArray('1.6.0')) { + list[0] = '1.6.0'; + } else if (deployJava.testUsingPluginsArray('1.5.0')) { + list[0] = '1.5.0'; + } else if (deployJava.testUsingPluginsArray('1.4.2')) { + list[0] = '1.4.2'; + } + } + } + + if (deployJava.debug) { + for (var i = 0; i < list.length; ++i) { + alert('We claim to have detected Java SE ' + list[i]); + } + } + + return list; + }, + + /** + * Triggers a JRE installation. The exact effect of triggering an + * installation varies based on platform, browser, and if the + * Deployment Toolkit plugin is installed. + * + * The requestVersion string is of the form #[.#[.#[_#]]][+|*], + * which includes strings such as "1.4", "1.5.0*", and "1.6.0_02+". + * A star (*) means "any version starting within this family" and + * a plus (+) means "any version greater or equal to this". + * "1.5.0*" * matches 1.5.0_06 but not 1.6.0_01, whereas + * "1.5.0+" matches both. + * + * If the Deployment Toolkit plugin is not present, this will just call + * deployJava.installLatestJRE(). + */ + installJRE: function(requestVersion) { + var ret = false; + if (deployJava.isPluginInstalled()) { + if (deployJava.getPlugin().installJRE(requestVersion)) { + deployJava.refresh(); + if (deployJava.returnPage != null) { + document.location = deployJava.returnPage; + } + return true; + } else { + return false; + } + } else { + return deployJava.installLatestJRE(); + } + }, + + + /** + * Triggers a JRE installation. The exact effect of triggering an + * installation varies based on platform, browser, and if the + * Deployment Toolkit plugin is installed. + * + * In the simplest case, the browser window will be redirected to the + * java.com JRE installation page, and (if possible) a redirect back to + * the current URL upon successful installation. The return redirect is + * not always possible, as the JRE installation may require the browser to + * be restarted. + * + * In the best case (when the Deployment Toolkit plugin is present), this + * function will immediately cause a progress dialog to be displayed + * as the JRE is downloaded and installed. + */ + installLatestJRE: function() { + if (deployJava.isPluginInstalled()) { + if (deployJava.getPlugin().installLatestJRE()) { + deployJava.refresh(); + if (deployJava.returnPage != null) { + document.location = deployJava.returnPage; + } + return true; + } else { + return false; + } + } else { + var browser = deployJava.getBrowser(); + var platform = navigator.platform.toLowerCase(); + if ((deployJava.EAInstallEnabled == 'true') && + (platform.indexOf('win') != -1) && + (deployJava.EarlyAccessURL != null)) { + + deployJava.preInstallJREList = deployJava.getJREs(); + if (deployJava.returnPage != null) { + deployJava.myInterval = + setInterval("deployJava.poll()", 3000); + } + + location.href = deployJava.EarlyAccessURL; + + // we have to return false although there may be an install + // in progress now, when complete it may go to return page + return false; + } else { + if (browser == 'MSIE') { + return deployJava.IEInstall(); + } else if ((browser == 'Netscape Family') && + (platform.indexOf('win32') != -1)) { + return deployJava.FFInstall(); + } else { + location.href = deployJava.getJavaURL + + ((deployJava.returnPage != null) ? + ('&returnPage=' + deployJava.returnPage) : '') + + ((deployJava.locale != null) ? + ('&locale=' + deployJava.locale) : '') + + ((deployJava.brand != null) ? + ('&brand=' + deployJava.brand) : ''); + } + // we have to return false although there may be an install + // in progress now, when complete it may go to return page + return false; + } + } + }, + + + /** + * Ensures that an appropriate JRE is installed and then runs an applet. + * minimumVersion is of the form #[.#[.#[_#]]], and is the minimum + * JRE version necessary to run this applet. minimumVersion is optional, + * defaulting to the value "1.1" (which matches any JRE). + * If an equal or greater JRE is detected, runApplet() will call + * writeAppletTag(attributes, parameters) to output the applet tag, + * otherwise it will call installJRE(minimumVersion + '+'). + * + * After installJRE() is called, the script will attempt to detect that the + * JRE installation has completed and begin running the applet, but there + * are circumstances (such as when the JRE installation requires a browser + * restart) when this cannot be fulfilled. + * + * As with writeAppletTag(), this function should only be called prior to + * the web page being completely rendered. Note that version wildcards + * (star (*) and plus (+)) are not supported, and including them in the + * minimumVersion will result in an error message. + */ + runApplet: function(attributes, parameters, minimumVersion) { + if (minimumVersion == 'undefined' || minimumVersion == null) { + minimumVersion = '1.1'; + } + + var regex = "^(\\d+)(?:\\.(\\d+)(?:\\.(\\d+)(?:_(\\d+))?)?)?$"; + + var matchData = minimumVersion.match(regex); + + if (deployJava.returnPage == null) { + // if there is an install, come back here and run the applet + deployJava.returnPage = document.location; + } + + if (matchData != null) { + var browser = deployJava.getBrowser(); + if ((browser != '?') && (browser != 'Safari')) { + if (deployJava.versionCheck(minimumVersion + '+')) { + deployJava.writeAppletTag(attributes, parameters); + } else if (deployJava.installJRE(minimumVersion + '+')) { + // after successfull install we need to refresh page to pick + // pick up new plugin + deployJava.refresh(); + location.href = document.location; + deployJava.writeAppletTag(attributes, parameters); + } + } else { + // for unknown or Safari - just try to show applet + deployJava.writeAppletTag(attributes, parameters); + } + } else { + if (deployJava.debug) { + alert('Invalid minimumVersion argument to runApplet():' + + minimumVersion); + } + } + }, + + + /** + * Outputs an applet tag with the specified attributes and parameters, where + * both attributes and parameters are associative arrays. Each key/value + * pair in attributes becomes an attribute of the applet tag itself, while + * key/value pairs in parameters become <PARAM> tags. No version checking + * or other special behaviors are performed; the tag is simply written to + * the page using document.writeln(). + * + * As document.writeln() is generally only safe to use while the page is + * being rendered, you should never call this function after the page + * has been completed. + */ + writeAppletTag: function(attributes, parameters) { + var s = '<' + 'applet '; + for (var attribute in attributes) { + s += (' ' + attribute + '="' + attributes[attribute] + '"'); + } + s += '>'; + document.write(s); + + if (parameters != 'undefined' && parameters != null) { + for (var parameter in parameters) { + s = '<param name="' + parameter + '" value="' + + parameters[parameter] + '">'; + document.write(s); + } + } + document.write('<' + '/' + 'applet' + '>'); + }, + + + /** + * Returns true if there is a matching JRE version currently installed + * (among those detected by getJREs()). The versionPattern string is + * of the form #[.#[.#[_#]]][+|*], which includes strings such as "1.4", + * "1.5.0*", and "1.6.0_02+". + * A star (*) means "any version within this family" and a plus (+) means + * "any version greater or equal to the specified version". "1.5.0*" + * matches 1.5.0_06 but not 1.6.0_01, whereas "1.5.0+" matches both. + * + * If the versionPattern does not include all four version components + * but does not end with a star or plus, it will be treated as if it + * ended with a star. "1.5" is exactly equivalent to "1.5*", and will + * match any version number beginning with "1.5". + * + * If getJREs() is unable to detect the precise version number, a match + * could be ambiguous. For example if getJREs() detects "1.5", there is + * no way to know whether the JRE matches "1.5.0_06+". versionCheck() + * compares only as much of the version information as could be detected, + * so versionCheck("1.5.0_06+") would return true in in this case. + * + * Invalid versionPattern will result in a JavaScript error alert. + * versionPatterns which are valid but do not match any existing JRE + * release (e.g. "32.65+") will always return false. + */ + versionCheck: function(versionPattern) + { + var index = 0; + var regex = "^(\\d+)(?:\\.(\\d+)(?:\\.(\\d+)(?:_(\\d+))?)?)?(\\*|\\+)?$"; + + var matchData = versionPattern.match(regex); + + if (matchData != null) { + var familyMatch = true; + + var patternArray = new Array(); + + for (var i = 1; i < matchData.length; ++i) { + // browser dependency here. + // Fx sets 'undefined', IE sets '' string for unmatched groups + if ((typeof matchData[i] == 'string') && (matchData[i] != '')) { + patternArray[index] = matchData[i]; + index++; + } + } + + if (patternArray[patternArray.length-1] == '+') { + familyMatch = false; + patternArray.length--; + } else { + if (patternArray[patternArray.length-1] == '*') { + patternArray.length--; + } + } + + var list = deployJava.getJREs(); + for (var i = 0; i < list.length; ++i) { + if (deployJava.compareVersionToPattern(list[i], patternArray, + familyMatch)) { + return true; + } + } + + return false; + } else { + alert('Invalid versionPattern passed to versionCheck: ' + + versionPattern); + return false; + } + }, + + + /** + * Returns true if an installation of Java Web Start of the specified + * minimumVersion can be detected. minimumVersion is optional, and + * if not specified, '1.4.2' will be used. + * (Versions earlier than 1.4.2 may not be detected.) + */ + isWebStartInstalled: function(minimumVersion) { + + var browser = deployJava.getBrowser(); + if ((browser == '?') || (browser == 'Safari')) { + // we really don't know - better to try to use it than reinstall + return true; + } + + if (minimumVersion == 'undefined' || minimumVersion == null) { + minimumVersion = '1.4.2'; + } + + var retval = false; + var regex = "^(\\d+)(?:\\.(\\d+)(?:\\.(\\d+)(?:_(\\d+))?)?)?$"; + var matchData = minimumVersion.match(regex); + + if (matchData != null) { + retval = deployJava.versionCheck(minimumVersion + '+'); + } else { + if (deployJava.debug) { + alert('Invalid minimumVersion argument to isWebStartInstalled(): ' + minimumVersion); + } + retval = deployJava.versionCheck('1.4.2+'); + } + return retval; + }, + + + /** + * Outputs a launch button for the specified JNLP URL. When clicked, the + * button will ensure that an appropriate JRE is installed and then launch + * the JNLP application. minimumVersion is of the form #[.#[.#[_#]]], and + * is the minimum JRE version necessary to run this JNLP application. + * minimumVersion is optional, and if it is not specified, '1.4.2' + * will be used. + * If an appropriate JRE or Web Start installation is detected, + * the JNLP application will be launched, otherwise installLatestJRE() + * will be called. + * + * After installLatestJRE() is called, the script will attempt to detect + * that the JRE installation has completed and launch the JNLP application, + * but there are circumstances (such as when the JRE installation + * requires a browser restart) when this cannot be fulfilled. + */ + createWebStartLaunchButton: function(jnlp, minimumVersion) { + + if (deployJava.returnPage == null) { + // if there is an install, come back and run the jnlp file + deployJava.returnPage = jnlp; + } + + var url = 'javascript:' + + 'if (!deployJava.isWebStartInstalled("' + + minimumVersion + '")) {' + + 'if (deployJava.installLatestJRE()) {' + + 'if (deployJava.launch("' + jnlp + '")) {}' + + '}' + + '} else {' + + 'if (deployJava.launch("' + jnlp + '")) {}' + + '}'; + + document.write('<' + 'a href="' + url + + '" onMouseOver="window.status=\'\'; ' + + 'return true;"><' + 'img ' + + 'src="' + deployJava.launchButtonPNG + '" ' + + 'border="0" /><' + '/' + 'a' + '>'); + }, + + + /** + * Launch a JNLP application, (using the plugin if available) + */ + launch: function(jnlp) { + if (deployJava.isPluginInstalled()) { + return deployJava.getPlugin().launch(jnlp); + } else { + document.location=jnlp; + return true; + } + }, + + + /* + * returns true if the ActiveX or XPI plugin is installed + */ + isPluginInstalled: function() { + var plugin = deployJava.getPlugin(); + if (plugin && plugin.jvms) { + return true; + } else { + return false; + } + }, + + /* + * returns true if the plugin is installed and AutoUpdate is enabled + */ + isAutoUpdateEnabled: function() { + if (deployJava.isPluginInstalled()) { + return deployJava.getPlugin().isAutoUpdateEnabled(); + } + return false; + }, + + /* + * sets AutoUpdate on if plugin is installed + */ + setAutoUpdateEnabled: function() { + if (deployJava.isPluginInstalled()) { + return deployJava.getPlugin().setAutoUpdateEnabled(); + } + return false; + }, + + /* + * sets the preferred install type : null, online, kernel + */ + setInstallerType: function(type) { + deployJava.installType = type; + if (deployJava.isPluginInstalled()) { + return deployJava.getPlugin().setInstallerType(type); + } + return false; + }, + + /* + * sets additional package list - to be used by kernel installer + */ + setAdditionalPackages: function(packageList) { + if (deployJava.isPluginInstalled()) { + return deployJava.getPlugin().setAdditionalPackages( + packageList); + } + return false; + }, + + /* + * sets preference to install Early Access versions if available + */ + setEarlyAccess: function(enabled) { + deployJava.EAInstallEnabled = enabled; + }, + + /* + * Determines if the next generation plugin (Plugin II) is default + */ + isPlugin2: function() { + if (deployJava.isPluginInstalled()) { + try { + return deployJava.getPlugin().isPlugin2(); + } catch (err) { + // older plugin w/o isPlugin2() function - just fall through + } + } + return false; + }, + + + getPlugin: function() { + deployJava.refresh(); + var ret = document.getElementById('deployJavaPlugin'); + return ret; + }, + + compareVersionToPattern: function(version, patternArray, familyMatch) { + var regex = "^(\\d+)(?:\\.(\\d+)(?:\\.(\\d+)(?:_(\\d+))?)?)?$"; + var matchData = version.match(regex); + + if (matchData != null) { + var index = 0; + var result = new Array(); + + for (var i = 1; i < matchData.length; ++i) { + if ((typeof matchData[i] == 'string') && (matchData[i] != '')) + { + result[index] = matchData[i]; + index++; + } + } + + var l = Math.min(result.length, patternArray.length); + + if (familyMatch) { + for (var i = 0; i < l; ++i) { + if (result[i] != patternArray[i]) return false; + } + + return true; + } else { + for (var i = 0; i < l; ++i) { + if (result[i] < patternArray[i]) { + return false; + } else if (result[i] > patternArray[i]) { + return true; + } + } + + return true; + } + } else { + return false; + } + }, + + + getBrowser: function() { + var browser = navigator.userAgent.toLowerCase(); + + if (deployJava.debug) { + alert('userAgent -> ' + browser); + } + + if ((navigator.vendor) && + (navigator.vendor.toLowerCase().indexOf('apple') != -1) && + (browser.indexOf('safari') != -1)) { + if (deployJava.debug) { + alert('We claim to have detected "Safari".'); + } + return 'Safari'; + } else if (browser.indexOf('msie') != -1) { + if (deployJava.debug) { + alert('We claim to have detected "IE".'); + } + return 'MSIE'; + } else if ((browser.indexOf('mozilla') != -1) || + (browser.indexOf('firefox') != -1)) { + if (deployJava.debug) { + alert('We claim to have detected a Netscape family browser.'); + } + return 'Netscape Family'; + } else { + if (deployJava.debug) { + alert('We claim to have failed to detect a browser.'); + } + return '?'; + } + }, + + + testUsingActiveX: function(version) { + var objectName = 'JavaWebStart.isInstalled.' + version + '.0'; + + if (!ActiveXObject) { + if (deployJava.debug) { + alert ('Browser claims to be IE, but no ActiveXObject object?'); + } + return false; + } + + try { + return (new ActiveXObject(objectName) != null); + } catch (exception) { + return false; + } + }, + + + testForMSVM: function() { + var clsid = '{08B0E5C0-4FCB-11CF-AAA5-00401C608500}'; + + if (typeof oClientCaps != 'undefined') { + var v = oClientCaps.getComponentVersion(clsid, "ComponentID"); + if ((v == '') || (v == '5,0,5000,0')) { + return false; + } else { + return true; + } + } else { + return false; + } + }, + + + testUsingMimeTypes: function(version) { + if (!navigator.mimeTypes) { + if (deployJava.debug) { + alert ('Browser claims to be Netscape family, but no mimeTypes[] array?'); + } + return false; + } + + for (var i = 0; i < navigator.mimeTypes.length; ++i) { + s = navigator.mimeTypes[i].type; + var m = s.match(/^application\/x-java-applet\x3Bversion=(1\.8|1\.7|1\.6|1\.5|1\.4\.2)$/); + if (m != null) { + if (deployJava.compareVersions(m[1], version)) { + return true; + } + } + } + return false; + }, + + + testUsingPluginsArray: function(version) { + if ((!navigator.plugins) || (!navigator.plugins.length)) { + if (deployJava.debug) { + alert ('Browser claims to be Safari, but no plugins[] array?'); + } + return false; + } + + for (var i = 0; i < navigator.plugins.length; ++i) { + s = navigator.plugins[i].description; + + if (s.search(/^Java Switchable Plug-in/) != -1) { + return true; + } + + m = s.match(/^Java (1\.4\.2|1\.5|1\.6|1\.7).* Plug-in/); + if (m != null) { + if (deployJava.compareVersions(m[1], version)) return true; + } + } + return false; + }, + + IEInstall: function() { + + location.href = deployJava.getJavaURL + + ((deployJava.returnPage != null) ? + ('&returnPage=' + deployJava.returnPage) : '') + + ((deployJava.locale != null) ? + ('&locale=' + deployJava.locale) : '') + + ((deployJava.brand != null) ? ('&brand=' + deployJava.brand) : '') + + ((deployJava.installType != null) ? + ('&type=' + deployJava.installType) : ''); + + // should not actually get here + return false; + }, + + done: function (name, result) { + }, + + FFInstall: function() { + + location.href = deployJava.getJavaURL + + ((deployJava.returnPage != null) ? + ('&returnPage=' + deployJava.returnPage) : '') + + ((deployJava.locale != null) ? + ('&locale=' + deployJava.locale) : '') + + ((deployJava.brand != null) ? ('&brand=' + deployJava.brand) : '') + + ((deployJava.installType != null) ? + ('&type=' + deployJava.installType) : ''); + + // should not actually get here + return false; + }, + + // return true if 'installed' (considered as a JRE version string) is + // greater than or equal to 'required' (again, a JRE version string). + compareVersions: function(installed, required) { + + var a = installed.split('.'); + var b = required.split('.'); + + for (var i = 0; i < a.length; ++i) { + a[i] = Number(a[i]); + } + for (var i = 0; i < b.length; ++i) { + b[i] = Number(b[i]); + } + if (a.length == 2) { + a[2] = 0; + } + + if (a[0] > b[0]) return true; + if (a[0] < b[0]) return false; + + if (a[1] > b[1]) return true; + if (a[1] < b[1]) return false; + + if (a[2] > b[2]) return true; + if (a[2] < b[2]) return false; + + return true; + }, + + + enableAlerts: function() { + deployJava.debug = true; + }, + + poll: function() { + + deployJava.refresh(); + var postInstallJREList = deployJava.getJREs(); + + if ((deployJava.preInstallJREList.length == 0) && + (postInstallJREList.length != 0)) { + clearInterval(deployJava.myInterval); + if (deployJava.returnPage != null) { + location.href = deployJava.returnPage; + }; + } + + if ((deployJava.preInstallJREList.length != 0) && + (postInstallJREList.length != 0) && + (deployJava.preInstallJREList[0] != postInstallJREList[0])) { + clearInterval(deployJava.myInterval); + if (deployJava.returnPage != null) { + location.href = deployJava.returnPage; + } + } + + }, + + writePluginTag: function() { + var browser = deployJava.getBrowser(); + if (browser == 'MSIE') { + document.write('<' + + 'object classid="clsid:CAFEEFAC-DEC7-0000-0000-ABCDEFFEDCBA" ' + + 'id="deployJavaPlugin" width="0" height="0">' + + '<' + '/' + 'object' + '>'); + } else if (browser == 'Netscape Family') { + if (navigator.mimeTypes != null) for (var i=0; + i < navigator.mimeTypes.length; i++) { + if (navigator.mimeTypes[i].type == deployJava.mimeType) { + if (navigator.mimeTypes[i].enabledPlugin) { + document.write('<' + + 'embed id="deployJavaPlugin" type="' + + deployJava.mimeType + '" hidden="true" />'); + } + } + } + } + }, + + refresh: function() { + navigator.plugins.refresh(false); + + var browser = deployJava.getBrowser(); + if (browser == 'Netscape Family') { + var plugin = document.getElementById('deployJavaPlugin'); + // only do this again if no plugin + if (plugin == null) { + if (navigator.mimeTypes != null) for (var i=0; + i < navigator.mimeTypes.length; i++) { + if (navigator.mimeTypes[i].type == deployJava.mimeType) { + if (navigator.mimeTypes[i].enabledPlugin) { + document.write('<' + + 'embed id="deployJavaPlugin" type="' + + deployJava.mimeType + '" hidden="true" />'); + } + } + } + } + } + }, + + do_initialize: function() { + deployJava.writePluginTag(); + if (deployJava.locale == null) { + var loc = null; + + if (loc == null) try { + loc = navigator.userLanguage; + } catch (err) { } + + if (loc == null) try { + loc = navigator.systemLanguage; + } catch (err) { } + + if (loc == null) try { + loc = navigator.language; + } catch (err) { } + + if (loc != null) { + loc.replace("-","_") + deployJava.locale = loc; + } + } + } + +}; +deployJava.do_initialize(); + diff --git a/BKUOnline/src/test/java/at/gv/egiz/stal/service/STALRequestBrokerTest.java b/BKUOnline/src/test/java/at/gv/egiz/stal/service/STALRequestBrokerTest.java new file mode 100644 index 00000000..cd321c71 --- /dev/null +++ b/BKUOnline/src/test/java/at/gv/egiz/stal/service/STALRequestBrokerTest.java @@ -0,0 +1,362 @@ +/* +* 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. +*/ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package at.gv.egiz.stal.service; + +import at.gv.egiz.stal.service.impl.STALRequestBrokerImpl; +import at.gv.egiz.stal.service.impl.RequestBrokerSTALFactory; +import at.gv.egiz.stal.service.impl.STALRequestBroker; +import at.gv.egiz.stal.ErrorResponse; +import at.gv.egiz.stal.HashDataInputCallback; +import at.gv.egiz.stal.InfoboxReadRequest; +import at.gv.egiz.stal.InfoboxReadResponse; +import at.gv.egiz.stal.QuitRequest; +import at.gv.egiz.stal.STALRequest; +import at.gv.egiz.stal.STALResponse; +import at.gv.egiz.stal.SignResponse; +import at.gv.egiz.stal.SignRequest; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * + * @author clemens + */ +public class STALRequestBrokerTest { + + private static final Log log = LogFactory.getLog(STALRequestBrokerTest.class); + protected static STALRequestBroker stal; + + @BeforeClass + public static void setUp() { + RequestBrokerSTALFactory fac = new RequestBrokerSTALFactory(); + stal = (STALRequestBrokerImpl) fac.createSTAL(); + log.debug("Created STAL " + stal.getClass().getName()); + } + + @Ignore + public void testInfoboxRead() { +// try { + + log.debug("*************** test ReadInfoboxRequest for two infoboxes"); + List<STALRequest> requests = new ArrayList<STALRequest>(); + InfoboxReadRequest r1 = new InfoboxReadRequest(); + r1.setInfoboxIdentifier("infobox1"); + requests.add(r1); + InfoboxReadRequest r2 = new InfoboxReadRequest(); + r2.setInfoboxIdentifier("infobox2"); + requests.add(r2); + + BindingProcessorSimulator bp = new BindingProcessorSimulator(); + bp.setRequests(Collections.singletonList(requests)); + + new Thread(bp, "BindingProcessor").start(); + new Thread(new ServiceSimulator(), "STALService").start(); + + try { + Thread.sleep(1000); + } catch (InterruptedException ex) { + log.error("interrupted: " + ex.getMessage()); + } + } + + @Ignore + public void testSign() { + log.debug("**************** test SignRequest"); + List<STALRequest> requests = new ArrayList<STALRequest>(); + SignRequest r1 = new SignRequest(); + r1.setKeyIdentifier("keybox1"); + r1.setSignedInfo("1234".getBytes()); + r1.setHashDataInput(new HashDataInputCallback() { + + @Override + public InputStream getHashDataInput(String referenceId) { + return new ByteArrayInputStream("hashdatainput1234".getBytes()); + } + }); + requests.add(r1); + + BindingProcessorSimulator bp = new BindingProcessorSimulator(); + bp.setRequests(Collections.singletonList(requests)); + + new Thread(bp, "BindingProcessor").start(); +// new Thread(bp2, "BindingProcessor2").start(); + new Thread(new ServiceSimulator(), "STALService").start(); + + try { + Thread.sleep(1000); + } catch (InterruptedException ex) { + log.error("interrupted: " + ex.getMessage()); + } + } + + @Ignore + public void testResponseTimeout() { + log.debug("**************** test SignRequest with responses timeout"); + List<STALRequest> requests = new ArrayList<STALRequest>(); + SignRequest r1 = new SignRequest(); + r1.setKeyIdentifier("keybox1"); + r1.setSignedInfo("1234".getBytes()); + r1.setHashDataInput(new HashDataInputCallback() { + + @Override + public InputStream getHashDataInput(String referenceId) { + return new ByteArrayInputStream("hashdatainput1234".getBytes()); + } + }); + requests.add(r1); + + BindingProcessorSimulator bp = new BindingProcessorSimulator(); + bp.setRequests(Collections.singletonList(requests)); + + new Thread(bp, "BindingProcessor").start(); + new Thread(new TimeoutServiceSimulator(), "STALService").start(); + + try { + Thread.sleep(STALRequestBroker.TIMEOUT_MS + 1); + } catch (InterruptedException ex) { + log.error("interrupted: " + ex.getMessage()); + } + } + + @Ignore + public void testRequestTimeout() { + log.debug("**************** test requests timeout"); + TimeoutBindingProcessorSimulator bp = new TimeoutBindingProcessorSimulator(); + + new Thread(bp, "BindingProcessor").start(); + new Thread(new ServiceSimulator(), "STALService").start(); + + try { + Thread.sleep(STALRequestBroker.TIMEOUT_MS + 1); + } catch (InterruptedException ex) { + log.error("interrupted: " + ex.getMessage()); + } + } + + @Test + public void testMultipleServices() { + log.debug("**************** test multiple SignRequests"); + List<STALRequest> requests = new ArrayList<STALRequest>(); + SignRequest r1 = new SignRequest(); + r1.setKeyIdentifier("keybox1"); + r1.setSignedInfo("1234".getBytes()); + r1.setHashDataInput(new HashDataInputCallback() { + + @Override + public InputStream getHashDataInput(String referenceId) { + return new ByteArrayInputStream("hashdatainput1234".getBytes()); + } + }); + requests.add(r1); + + List<STALRequest> requests2 = new ArrayList<STALRequest>(); + SignRequest r2 = new SignRequest(); + r2.setKeyIdentifier("keybox2"); + r2.setSignedInfo("6789".getBytes()); + r2.setHashDataInput(new HashDataInputCallback() { + + @Override + public InputStream getHashDataInput(String referenceId) { + return new ByteArrayInputStream("hashdatainput6789".getBytes()); + } + }); + requests2.add(r2); + + BindingProcessorSimulator bp = new BindingProcessorSimulator(); + List<List<STALRequest>> requestList = new ArrayList<List<STALRequest>>(); + requestList.add(requests); + requestList.add(requests2); + bp.setRequests(requestList); + + new Thread(bp, "BindingProcessor").start(); +// new Thread(bp2, "BindingProcessor2").start(); + new Thread(new ServiceSimulator(), "STALService1").start(); + new Thread(new ServiceSimulator(), "STALService2").start(); + + try { + Thread.sleep(1000); + } catch (InterruptedException ex) { + log.error("interrupted: " + ex.getMessage()); + } + } + + class ServiceSimulator implements Runnable { + + @Override + public void run() { + try { + // first call w/ empty response list + log.debug("calling stal.nextRequest"); + List<STALRequest> requests = stal.nextRequest(null); //new ArrayList<ResponseType>()); + log.debug("got " + requests.size() + " requests. processing..."); + Thread.sleep(1); + List<STALResponse> responses = new ArrayList<STALResponse>(); + for (STALRequest request : requests) { + if (request instanceof InfoboxReadRequest) { + InfoboxReadResponse r = new InfoboxReadResponse(); + r.setInfoboxValue("dummyInfobox".getBytes()); + responses.add(r); + } else if (request instanceof SignRequest) { + + log.debug("calling stal.getCurrentHashDataInputCallback"); + HashDataInputCallback cb = stal.getHashDataInput(); + assertNotNull(cb); + InputStream hd = cb.getHashDataInput("1234"); + byte[] data = new byte[hd.available()]; + hd.read(data); + log.debug("got HashDataInput " + new String(data)); + + + SignResponse r = new SignResponse(); + r.setSignatureValue("dummySignature".getBytes()); + responses.add(r); + } else if (request instanceof QuitRequest) { + log.debug("received UNEXPECTED QUIT request"); + return; + } + } + +// if (requests.size() > 0) { +// log.debug("calling stal.setResponse with " + requests.size() + " responses"); +// stal.setResponse(responses); +// } + log.debug("calling stal.nextRequest with " + responses.size() + " responses"); + requests = stal.nextRequest(responses); + for (STALRequest request : requests) { + if (request instanceof QuitRequest) { + log.debug("got QUIT request"); + } else { + log.debug("expected QUIT request, got " + request.getClass().getName()); + } + } + } catch (IOException ex) { + log.error(ex.getMessage()); + } catch (InterruptedException ex) { + log.error(ex.getMessage()); + } + } + } + + class TimeoutServiceSimulator implements Runnable { + + @Override + public void run() { + try { + // first call w/ empty response list + log.debug("calling stal.nextRequest"); + List<STALRequest> requests = stal.nextRequest(null); //new ArrayList<ResponseType>()); + log.debug("got " + requests.size() + " requests. processing..."); + Thread.sleep(1); + for (STALRequest request : requests) { +// if (request instanceof InfoboxReadRequest) { + if (request instanceof SignRequest) { + log.debug("calling stal.getCurrentHashDataInputCallback"); + HashDataInputCallback cb = stal.getHashDataInput(); + assertNotNull(cb); + InputStream hd = cb.getHashDataInput("1234"); + byte[] data = new byte[hd.available()]; + hd.read(data); + log.debug("got HashDataInput " + new String(data)); + } else if (request instanceof QuitRequest) { + log.debug("received UNEXPECTED QUIT requests"); + return; + } + } + log.debug("simulating timeout ..."); + } catch (IOException ex) { + log.error(ex.getMessage()); + } catch (InterruptedException ex) { + log.error(ex.getMessage()); + } + } + } + + class BindingProcessorSimulator implements Runnable { + + List<List<STALRequest>> requestsLists; + + public void setRequests(List<List<STALRequest>> requests) { + this.requestsLists = requests; + } + + @Override + public void run() { + + //simulate SLCommand execution + for (List<STALRequest> requests : requestsLists) { + execSLCommand(requests); + + log.debug("SLCommand finished, calling stal.handleReqeusts(QUIT)"); + stal.handleRequest(Collections.singletonList((STALRequest) new QuitRequest())); + log.debug("QUIT returned (waiting for applet reload)"); + } + + } + + public void execSLCommand(List<STALRequest> requests) { + int numReq = requests.size(); + log.debug("SLCommand calling stal.handleRequests " + numReq + " requests"); + List<STALResponse> responses = stal.handleRequest(requests); + assertEquals(numReq, responses.size()); + for (int i = 0; i < numReq; i++) { + STALRequest request = requests.get(i); + STALResponse response = responses.get(i); + + if (response instanceof ErrorResponse) { + log.warn("SLCommand received unexpected error response from STAL: " + ((ErrorResponse) response).getErrorCode()); + } else if (request instanceof InfoboxReadRequest) { + assertTrue(response instanceof InfoboxReadResponse); + String infobox = new String(((InfoboxReadResponse) response).getInfoboxValue()); + log.debug("SLCommand received expected InfoboxReadResponse from STAL: " + infobox); + } else if (request instanceof SignRequest) { + assertTrue(response instanceof SignResponse); + String signVal = new String(((SignResponse) response).getSignatureValue()); + log.debug("SLCommand received expected SignResponse from STAL: " + signVal); + } else { + log.error("***** RequestType: " + request.getClass() + " TODO"); + } + //TODO + } + + } + } + + class TimeoutBindingProcessorSimulator implements Runnable { + + @Override + public void run() { + + //simulate SLCommand execution + log.debug("simulating timeout ..."); + } + } +} diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/NOTICE.txt b/NOTICE.txt new file mode 100644 index 00000000..2f25af7d --- /dev/null +++ b/NOTICE.txt @@ -0,0 +1,17 @@ +MOCCA Project
+Copyright 2008 Federal Chancellery Austria and Graz University of Technology
+
+This product includes software developed at
+E-Government Innovation Center (www.egiz.gv.at).
+
+E-Government Innovation Center is a joint initiative of
+Federal Chancellery Austria and Graz University of Technology.
+
+
+This product includes software developed by third parties
+and provided under an open source license (www.opensource.org).
+
+
+This product includes software provided by
+Stiftung Secure Information and Communication Technologies SIC
+(www.sic.st).
diff --git a/STAL/catalog.xml b/STAL/catalog.xml new file mode 100644 index 00000000..38c98894 --- /dev/null +++ b/STAL/catalog.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="system"> + <nextCatalog catalog="private/cache/retriever/catalog.xml"/> +</catalog>
\ No newline at end of file diff --git a/STAL/pom.xml b/STAL/pom.xml new file mode 100644 index 00000000..6b49ed47 --- /dev/null +++ b/STAL/pom.xml @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project> + <parent> + <artifactId>bku</artifactId> + <groupId>at.gv.egiz</groupId> + <version>1.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <groupId>at.gv.egiz</groupId> + <artifactId>STAL</artifactId> + <name>STAL</name> + <version>1.0-SNAPSHOT</version> + <dependencies> + <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </dependency> + </dependencies> + <!--build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jaxws-maven-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>wsimport</goal> + </goals> + <configuration> + <verbose>true</verbose> + <bindingDirectory>${basedir}/src/main/custom-binding</bindingDirectory> + <bindingFiles> + <bindingFile>stalservice-custom.xml</bindingFile> + <bindingFile>staltypes-custom.xml</bindingFile> + </bindingFiles> + <wsdlDirectory>${basedir}/src/main/wsdl</wsdlDirectory> + <wsdlFiles> + <wsdlFile>stal.wsdl</wsdlFile> + </wsdlFiles> + <sourceDestDir>${project.build.directory}/generated-sources/wsimport</sourceDestDir> + <staleFile>${project.build.directory}/generated-sources/wsimport/.staleFlag</staleFile> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build--> +</project>
\ No newline at end of file diff --git a/STAL/private/cache/retriever/catalog.xml b/STAL/private/cache/retriever/catalog.xml new file mode 100644 index 00000000..c40b0d50 --- /dev/null +++ b/STAL/private/cache/retriever/catalog.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="system"> + <system systemId="http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd" uri="java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd"/> + <system systemId="http://www.w3.org/2001/XMLSchema.xsd" uri="www.w3.org/2001/XMLSchema.xsd"/> +</catalog>
\ No newline at end of file diff --git a/STAL/private/cache/retriever/java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd b/STAL/private/cache/retriever/java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd new file mode 100644 index 00000000..f9a884c0 --- /dev/null +++ b/STAL/private/cache/retriever/java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd @@ -0,0 +1,362 @@ +<?xml version = "1.0" encoding = "UTF-8"?>
+<xs:schema
+ targetNamespace = "http://java.sun.com/xml/ns/jaxb"
+ xmlns:jaxb = "http://java.sun.com/xml/ns/jaxb"
+ xmlns:xs = "http://www.w3.org/2001/XMLSchema"
+ elementFormDefault = "qualified"
+ attributeFormDefault = "unqualified">
+ <xs:annotation><xs:documentation>
+ Schema for JAXB 2.0 binding declarations.
+ </xs:documentation></xs:annotation>
+ <xs:group name = "declaration">
+ <xs:annotation><xs:documentation>
+Model group that represents a binding declaration. Each new binding
+declaration added to the jaxb namespace that is not restricted to
+globalBindings should be added as a child element to this model group.
+ </xs:documentation></xs:annotation>
+ <!-- each new binding declaration, not restricted to
+ globalBindings, should be added here -->
+ <xs:choice>
+ <xs:element ref = "jaxb:globalBindings"/>
+ <xs:element ref = "jaxb:schemaBindings"/>
+ <xs:element ref = "jaxb:class"/>
+ <xs:element ref = "jaxb:property"/>
+ <xs:element ref = "jaxb:typesafeEnumClass"/>
+ <xs:element ref = "jaxb:typesafeEnumMember"/>
+ <xs:element ref = "jaxb:javaType"/>
+ <xs:element ref = "jaxb:dom"/>
+ <xs:element ref = "jaxb:inlineBinaryData"/>
+ <xs:any namespace = "##other" processContents = "lax"/>
+ </xs:choice>
+ </xs:group>
+ <xs:attribute name = "version" type="xs:token" >
+ <xs:annotation><xs:documentation>
+Used to specify the version of the binding schema on the schema element for
+inline annotations or jaxb:bindings for external binding.
+ </xs:documentation></xs:annotation>
+ </xs:attribute>
+ <xs:attributeGroup name = "propertyAttributes">
+ <xs:annotation><xs:documentation>
+Attributes used for property customization. The attribute group can be
+referenced either from the globalBindings declaration or from the
+property declaration. The following defaults are defined by the JAXB
+specification in global scope only. Thus they apply when the
+propertyAttributes group is referenced from the globalBindings declaration
+but not when referenced from the property declaration.
+ collectionType a class that implements java.util.List.
+ fixedAttributeAsConstantProperty false
+ enableFailFastCheck false
+ generateIsSetMethod false
+ optionalProperty wrapper
+ generateElementProperty false
+ attachmentRef default
+ </xs:documentation></xs:annotation>
+ <xs:attribute name = "collectionType" type="jaxb:referenceCollectionType"/>
+ <xs:attribute name = "fixedAttributeAsConstantProperty" type = "xs:boolean"/>
+ <xs:attribute name = "enableFailFastCheck" type = "xs:boolean"/>
+ <xs:attribute name = "generateIsSetMethod" type = "xs:boolean"/>
+ <xs:attribute name = "optionalProperty">
+ <xs:simpleType>
+ <xs:restriction base="xs:NCName">
+ <xs:enumeration value="wrapper"/>
+ <xs:enumeration value="primitive"/>
+ <xs:enumerat |