Skip to content

Commit

Permalink
Update ICD to Version 1.0 (07.08.2024)
Browse files Browse the repository at this point in the history
Update SEDAP Express Framework project to version 1.0.0
Update misc sample projects
  • Loading branch information
VolkerVoss committed Aug 7, 2024
1 parent 1b5df5e commit 4ea8b77
Show file tree
Hide file tree
Showing 64 changed files with 8,831 additions and 184 deletions.
Binary file modified Documentation/SEDAP-Express ICD v1.0.docx
Binary file not shown.
Binary file modified Documentation/SEDAP-Express ICD v1.0.pdf
Binary file not shown.
48 changes: 48 additions & 0 deletions MessageTool/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,53 @@
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/SEDAPExpress/dist/SEDAPExpress-v1.0.0.jar">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/SEDAPExpress/libs/bcpkix-jdk18on-1.78.1.jar">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/SEDAPExpress/libs/bcprov-jdk18on-1.78.1.jar" sourcepath="/SEDAPExpress/libs/bcprov-jdk18on-1.78.1.jar">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/SEDAPExpress/libs/bcutil-jdk18on-1.78.1.jar">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/SEDAPExpress/libs/gson-2.11.0.jar">
<attributes>
<attribute name="javadoc_location" value="jar:platform:/resource/SEDAPExpress/libs/gson-2.11.0-javadoc.jar!/"/>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/SEDAPExpress/libs/jakarta.validation-api-3.0.2.jar">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/SEDAPExpress/libs/jinput-2.0.10.jar">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/SEDAPExpress/libs/protobuf-java-4.27.3.jar">
<attributes>
<attribute name="javadoc_location" value="jar:platform:/resource/SEDAPExpress/libs/protobuf-java-4.27.3-javadoc.jar!/"/>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/SEDAPExpress/libs/protobuf-java-util-4.27.3.jar">
<attributes>
<attribute name="javadoc_location" value="jar:platform:/resource/SEDAPExpress/libs/protobuf-java-util-4.27.3-javadoc.jar!/"/>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="bin"/>
</classpath>
39 changes: 22 additions & 17 deletions MessageTool/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
/**
* Note: This license has also been called the “Simplified BSD License” and the “FreeBSD License”.
* Note: This license has also been called the “Simplified BSD License” and the
* “FreeBSD License”.
*
* Copyright 2024 MESE POC: Volker Voß, Federal Armed Forces of Germany
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. 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.
* 2. 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.
*
* 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 PURPOSEnARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BEn 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.
* 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
* PURPOSEnARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BEn 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.
*/
module MessageTool {

requires transitive SEDAPExpress;
}
Binary file added SECMockUp/libs/worldwind-javadoc-v2.2.1.zip
Binary file not shown.
Binary file added SECMockUp/libs/worldwind-v2.2.1.zip
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
/*******************************************************************************
* Copyright (C)2012-2024, German Federal Armed Forces - All rights reserved.
*
* MUKdo II
* Wibbelhofstraße 3
* 26384 Wilhelmshaven
* Germany
*
* This source code is part of the MEDAS/SEDAP Project.
* Person of contact (POC): Volker Voß, MUKdo II A, Wilhelmshaven
*
* Unauthorized use, modification, redistributing, copying, selling and
* printing of this file in source and binary form including accompanying
* materials is STRICTLY prohibited.
*
* This source code and it's parts is classified as OFFEN / NATO UNCLASSIFIED!
*******************************************************************************/
package de.bundeswehr.sedap.express.mockup;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.time.Instant;
import java.util.function.Function;

import com.sun.net.httpserver.Filter;
import com.sun.net.httpserver.Headers;
import com.sun.net.httpserver.HttpContext;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer;
import com.sun.net.httpserver.spi.HttpServerProvider;

public class SEDAPExpressMockUpRESTServer {

public static void main(String[] args) throws IOException {

HttpServerProvider provider = HttpServerProvider.provider();
HttpServer server = provider.createHttpServer(new InetSocketAddress(9999), 64);
HttpContext context = server.createContext("/hello");
context.getFilters().add(new TracingFilter());
context.setHandler(SEDAPExpressMockUpRESTServer.respondWith(req -> HttpResponse.ok("Hello " + Instant.now()).text()));
server.start();
}

static HttpHandler respondWith(HttpFunc hf) {
return exchange -> {

var req = HttpRequest.of(exchange);
var res = hf.apply(req);

var bytes = res.body().getBytes(StandardCharsets.UTF_8);
exchange.getResponseHeaders().putAll(res.headers());

try {
exchange.sendResponseHeaders(res.status(), bytes.length);
try (var os = exchange.getResponseBody()) {
os.write(bytes);
}
} catch (IOException e) {
e.printStackTrace();
}
};
}

record HttpRequest(String method, URI requestUri, Headers headers, HttpExchange exchange) {

static HttpRequest of(HttpExchange exchange) {
return new HttpRequest(
exchange.getRequestMethod(),
exchange.getRequestURI(),
exchange.getRequestHeaders(),
exchange);
}
}

interface HttpFunc extends Function<HttpRequest, HttpResponse> {
}

static class TracingFilter extends Filter {

@Override
public void doFilter(HttpExchange exchange, Chain chain) throws IOException {
var req = HttpRequest.of(exchange);
System.out.println(req.toString());
chain.doFilter(exchange);
}

@Override
public String description() {
return "Trace";
}
}

record HttpResponse(int status, Headers headers, String body) {

static HttpResponse ok() {
return HttpResponse.ok("");
}

static HttpResponse ok(String body) {
return new HttpResponse(200, new Headers(), body);
}

HttpResponse header(String name, String value) {
var res = new HttpResponse(status(), headers(), body());
res.headers().add(name, value);
return res;
}

HttpResponse json() {
return header("Content-type", "application/json");
}

HttpResponse text() {
return header("Content-type", "text/plain");
}
}
}
Loading

0 comments on commit 4ea8b77

Please # to comment.