39 | Add New User
--------------------------------------------------------------------------------
/vxms-demos/vxms-container-k8s-discovery-demo/vxms-k8s-read/src/main/fabric8/configmap.yml:
--------------------------------------------------------------------------------
1 | metadata:
2 | name: springconfig
3 | data:
4 | application.properties: |
5 | mongodb://mongo:27017
6 | mongo.database=demo
--------------------------------------------------------------------------------
/vxms-demos/vxms-container-k8s-discovery-demo/vxms-k8s-read/src/main/fabric8/deployment.yml:
--------------------------------------------------------------------------------
1 | metadata:
2 | annotations:
3 | configmap.fabric8.io/update-on-change: springconfig
4 | spec:
5 | replicas: 1
6 | template:
7 | spec:
8 | volumes:
9 | - name: config
10 | configMap:
11 | name: springconfig
12 | items:
13 | - key: application.properties
14 | path: application.properties
15 | containers:
16 | - name: vertx
17 | ports:
18 | - containerPort: 7070
19 | env:
20 | - name: JAVA_ARGS
21 | value: '-Dspring.profiles.active=openshift'
22 | - name: MYENV
23 | value: "openshift"
--------------------------------------------------------------------------------
/vxms-demos/vxms-container-k8s-discovery-demo/vxms-k8s-read/src/main/fabric8/service.yml:
--------------------------------------------------------------------------------
1 | kind: Service
2 | apiVersion: v1
3 | metadata:
4 | labels:
5 | expose: true
6 | name: ${project.artifactId}
7 | version: ${project.parent.version}
8 | spec:
9 | ports:
10 | - port: 80
11 | targetPort: 7070
--------------------------------------------------------------------------------
/vxms-demos/vxms-container-k8s-discovery-demo/vxms-k8s-read/src/main/java/org/jacpfx/vxms/k8sread/ReadApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright [2018] [Andy Moncsek]
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.jacpfx.vxms.k8sread;
18 |
19 |
20 | import org.springframework.context.annotation.ComponentScan;
21 | import org.springframework.context.annotation.Configuration;
22 |
23 |
24 | @Configuration
25 | @ComponentScan
26 | public class ReadApplication {
27 |
28 |
29 |
30 |
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/vxms-demos/vxms-container-k8s-discovery-demo/vxms-k8s-read/src/main/java/org/jacpfx/vxms/k8sread/repository/ReactiveUserRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright [2018] [Andy Moncsek]
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.jacpfx.vxms.k8sread.repository;
18 |
19 |
20 | import org.jacpfx.vxms.k8sread.entity.Users;
21 | import org.springframework.data.repository.reactive.ReactiveCrudRepository;
22 |
23 | /**
24 | * Created by Andy Moncsek on 22.06.17.
25 | */
26 |
27 | public interface ReactiveUserRepository extends ReactiveCrudRepository {
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/vxms-demos/vxms-container-k8s-discovery-demo/vxms-k8s-read/src/main/java/org/jacpfx/vxms/k8sread/service/UserService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright [2018] [Andy Moncsek]
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.jacpfx.vxms.k8sread.service;
18 |
19 | import io.vertx.core.Future;
20 | import io.vertx.core.json.Json;
21 | import org.jacpfx.vxms.k8sread.entity.Users;
22 | import org.jacpfx.vxms.k8sread.repository.ReactiveUserRepository;
23 | import org.springframework.beans.factory.annotation.Autowired;
24 | import org.springframework.stereotype.Component;
25 | import reactor.core.publisher.Flux;
26 |
27 | @Component
28 | public class UserService {
29 | @Autowired
30 | private ReactiveUserRepository repository;
31 |
32 | public void findAllUsers(Future future) {
33 | repository
34 | .findAll()
35 | .collectList()
36 | .doOnSuccess(value -> future.complete(Json.encode(value)))
37 | .doOnError(error -> future.fail(error))
38 | .subscribe();
39 | }
40 |
41 | public void findUser(String id, Future future) {
42 | repository
43 | .findById(id)
44 | .doOnSuccess(value -> future.complete(Json.encode(value)))
45 | .doOnError(error -> future.fail(error))
46 | .subscribe();
47 | }
48 |
49 | public void initData(Future startFuture) {
50 | Flux people =
51 | Flux.just(
52 | new Users("1", "eoc", "Eric", "Foo", "Zh"),
53 | new Users("2", "fgdf", "Raymond", "Bar", "B"),
54 | new Users("3", "bdf", "Paul", "Baz", "x"));
55 | repository.findAll().collectList().doOnSuccess(result -> {
56 | if(result.isEmpty())repository.saveAll(people);
57 | startFuture.complete();
58 | }).subscribe();
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/vxms-demos/vxms-container-k8s-discovery-demo/vxms-k8s-read/src/main/java/org/jacpfx/vxms/k8sread/util/DefaultResponses.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright [2018] [Andy Moncsek]
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.jacpfx.vxms.k8sread.util;
18 |
19 | import io.vertx.core.json.JsonObject;
20 |
21 | /**
22 | * Created by Andy Moncsek on 01.04.16.
23 | */
24 | public class DefaultResponses {
25 |
26 | public static JsonObject defaultErrorResponse() {
27 | JsonObject message = new JsonObject();
28 | message.put("username", "no connection").
29 | put("firstName", "no connection").
30 | put("lastName", "no connection").
31 | put("address", "no connection");
32 | return message;
33 | }
34 |
35 | public static JsonObject defaultErrorResponse(String userMessage) {
36 | JsonObject message = new JsonObject();
37 | message.put("username", userMessage).
38 | put("firstName", userMessage).
39 | put("lastName", userMessage).
40 | put("address", userMessage);
41 | return message;
42 | }
43 |
44 | public static JsonObject mapToUser(JsonObject input, String id) {
45 | return new JsonObject().
46 | put("username", input.getString("username")).
47 | put("firstName", input.getString("firstName")).
48 | put("lastName", input.getString("lastName")).
49 | put("address", input.getString("address")).
50 | put("id", id);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/vxms-demos/vxms-container-k8s-discovery-demo/vxms-k8s-read/src/main/resources/application-TEST.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright [2018] [Andy Moncsek]
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | #
16 |
17 | mongo.database=demo
18 | mongo.database.url=mongodb://localhost:27017
19 |
--------------------------------------------------------------------------------
/vxms-demos/vxms-container-k8s-discovery-demo/vxms-k8s-read/src/main/resources/application-openshift.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright [2018] [Andy Moncsek]
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | #
16 |
17 | mongo.database=demo
18 | mongo.database.url=mongodb://mongo:27017
19 |
--------------------------------------------------------------------------------
/vxms-demos/vxms-container-k8s-discovery-demo/vxms-k8s-read/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright [2018] [Andy Moncsek]
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | #
16 |
17 | mongo.database=demo
18 |
19 |
--------------------------------------------------------------------------------
/vxms-demos/vxms-container-k8s-discovery-demo/vxms-k8s-read/src/main/resources/vertx-default-jul-logging.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright [2018] [Andy Moncsek]
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | #
16 | handlers=java.util.logging.ConsoleHandler,java.util.logging.FileHandler
17 | java.util.logging.SimpleFormatter.format=%5$s %6$s\n
18 | java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
19 | java.util.logging.ConsoleHandler.level=INFO
20 | java.util.logging.FileHandler.level=INFO
21 | java.util.logging.FileHandler.formatter=io.vertx.core.logging.impl.VertxLoggerFormatter
22 |
23 | # Put the log in the system temporary directory
24 | java.util.logging.FileHandler.pattern=%t/vertx.log
25 |
26 | logging.level.*=OFF
27 | io.vertx=INFO
28 | io.netty.buffer=INFO
29 | io.netty.util.internal.PlatformDependent.level=SEVERE
--------------------------------------------------------------------------------
/vxms-demos/vxms-container-k8s-discovery-demo/vxms-k8s-write/src/main/fabric8/service.yml:
--------------------------------------------------------------------------------
1 | kind: Service
2 | apiVersion: v1
3 | metadata:
4 | labels:
5 | expose: true
6 | name: ${project.artifactId}
7 | version: ${project.parent.version}
8 | spec:
9 | ports:
10 | - port: 80
11 | targetPort: 9090
--------------------------------------------------------------------------------
/vxms-demos/vxms-container-k8s-discovery-demo/vxms-k8s-write/src/main/java/module-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright [2018] [Andy Moncsek]
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 |
18 | module vxms.k8s.write.demo {
19 | requires vxms.core;
20 | requires vertx.core;
21 | requires vxms.rest;
22 | requires vertx.web;
23 | requires vertx.mongo.client;
24 | requires java.logging;
25 | requires java.management;
26 | requires java.ws.rs;
27 | requires io.netty.codec.http;
28 |
29 | uses org.jacpfx.vxms.spi.RESThandlerSPI;
30 |
31 | }
--------------------------------------------------------------------------------
/vxms-demos/vxms-container-k8s-discovery-demo/vxms-k8s-write/src/main/java/org/jacpfx/vxms/k8swrite/util/DefaultResponses.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright [2018] [Andy Moncsek]
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.jacpfx.vxms.k8swrite.util;
18 |
19 | import io.vertx.core.json.JsonObject;
20 |
21 | /**
22 | * Created by Andy Moncsek on 01.04.16.
23 | */
24 | public class DefaultResponses {
25 |
26 | public static JsonObject defaultErrorResponse() {
27 | JsonObject message = new JsonObject();
28 | message.put("username", "no connection").
29 | put("firstName", "no connection").
30 | put("lastName", "no connection").
31 | put("address", "no connection");
32 | return message;
33 | }
34 |
35 | public static JsonObject defaultErrorResponse(String userMessage) {
36 | JsonObject message = new JsonObject();
37 | message.put("username", userMessage).
38 | put("firstName", userMessage).
39 | put("lastName", userMessage).
40 | put("address", userMessage);
41 | return message;
42 | }
43 |
44 | public static JsonObject mapToUser(JsonObject input, String id) {
45 | return new JsonObject().
46 | put("username", input.getString("username")).
47 | put("firstName", input.getString("firstName")).
48 | put("lastName", input.getString("lastName")).
49 | put("address", input.getString("address")).
50 | put("id", id);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/vxms-demos/vxms-core-demo/.gitignore:
--------------------------------------------------------------------------------
1 | *.class
2 |
3 | # Mobile Tools for Java (J2ME)
4 | .mtj.tmp/
5 |
6 | # Package Files #
7 | *.jar
8 | *.war
9 | *.ear
10 | .DS_Store
11 | .gradle
12 | .idea
13 | *.iml
14 | build
15 | target
16 | file-uploads
17 | .vertx
18 | docker-compose.yml
19 |
20 |
21 | Backup/*
22 |
23 |
24 | out
25 | mod
26 | etcd-ca
27 | .keystore
28 | vxms-demos/vxms-secure-spa-demo/securityConfPrivate.json
29 |
30 |
31 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
32 | hs_err_pid*
33 |
--------------------------------------------------------------------------------
/vxms-demos/vxms-core-demo/Dockerfile:
--------------------------------------------------------------------------------
1 |
2 | FROM panga/graalvm-ce:latest AS build-aot
3 | WORKDIR /app
4 | ADD . /app
5 | # Build image
6 | RUN native-image \
7 | --no-server \
8 | -Djava.net.preferIPv4Stack=true \
9 | -Dio.netty.noUnsafe=true \
10 | -Dvertx.disableDnsResolver=true \
11 | -H:+ReportUnsupportedElementsAtRuntime \
12 | -H:ReflectionConfigurationFiles=./reflectconfigs/netty.json \
13 | -jar "target/vxms-core-demo-fat.jar"
14 |
15 | # Create new image from alpine
16 | FROM frolvlad/alpine-glibc:alpine-3.8
17 | RUN apk add --no-cache ca-certificates
18 | # Copy generated native executable from build-aot
19 | COPY --from=build-aot /app/vxms-core-demo-fat /vxms-core-demo-fat
20 | # Set the entrypoint
21 | ENTRYPOINT [ "/vxms-core-demo-fat" ]
--------------------------------------------------------------------------------
/vxms-demos/vxms-core-demo/Dockerfile.test1:
--------------------------------------------------------------------------------
1 | # GraalVM docker image used for AoT compilation
2 | FROM maven:3.5.4-jdk-11 AS mavenbuilder
3 | ADD . /app
4 | WORKDIR /app
5 | RUN mvn clean install
6 |
7 |
8 | FROM panga/graalvm-ce:latest AS build-aot
9 | WORKDIR /app
10 | COPY --from=mavenbuilder /app/ /app
11 | # Build image
12 | RUN native-image \
13 | --no-server \
14 | -Djava.net.preferIPv4Stack=true \
15 | -Dio.netty.noUnsafe=true \
16 | -Dvertx.disableDnsResolver=true \
17 | -H:+ReportUnsupportedElementsAtRuntime \
18 | -H:ReflectionConfigurationFiles=./reflectconfigs/netty.json \
19 | -jar "target/vxms-core-demo-fat.jar"
20 |
21 | # Create new image from alpine
22 | FROM frolvlad/alpine-glibc:alpine-3.8
23 | RUN apk add --no-cache ca-certificates
24 | # Copy generated native executable from build-aot
25 | COPY --from=build-aot /app/vxms-core-demo-fat /vxms-core-demo-fat
26 | # Set the entrypoint
27 | ENTRYPOINT [ "/vxms-core-demo-fat" ]
--------------------------------------------------------------------------------
/vxms-demos/vxms-core-demo/README.MD:
--------------------------------------------------------------------------------
1 | # a basic vxms-core example
2 |
3 | This example shows the minimum usage of vxms-core. It defines a HTTP endpoint on port 9090 and two REST (Get) endpoints.
4 | You can start the service using the *main* method or you build the project (*mvn package*) and run the fat jar (*java -jar target/vxms-core-demo-one-fat.jar*).
5 |
6 | ## run as Java 9 module
7 | In this case we simply use the main method declared in the class, instead of using the Vert.x Factory mechanism used by maven shade.
8 |
9 | ```shell
10 | java --module-path target/vxms-core-demo-1.2-SNAPSHOT.jar:target/mod --module vxms.core.demo/org.jacpfx.vxms.verticle.SimpleREST
11 | time java -XX:+UseAppCDS -Xshare:dump -XX:SharedArchiveFile=app-cds.jsa -XX:DumpLoadedClassList=classes.lst --class-path --module-path target/vxms-core-demo-1.2-SNAPSHOT.jar:target/mod --module vxms.core.demo/org.jacpfx.vxms.verticle.SimpleREST
12 | time java -XX:+UnlockCommercialFeatures -XX:+UseAppCDS -Xshare:on -XX:SharedArchiveFile=app-cds.jsa --module-path target/vxms-core-demo-1.2-SNAPSHOT.jar:target/mod --module vxms.core.demo/org.jacpfx.vxms.verticle.SimpleREST -Xlog:class+load
13 |
14 | ```
15 |
16 | ## create a modular runtime image
17 | The Dockerfile in this project is an example, how to build a modular runtime image to run a vxms (Vert.x based) application. To build the application modules, the moditec maven plugin is used(https://github.com/moditect/moditect). Basically the process consists of 3 Steps:
18 | - Step 1: clone the project, switch to Java9 branch and build the project against Java9
19 | - Step 2: the created modules are copied to the next step, the alpine JDK11 will be downloaded an a modular runtime image will be created
20 | - Step 3: the modular image (containing the REST service) will be copied to an alpine image
21 |
22 | ### how to build
23 | ```shell
24 | docker build -t core-demo .
25 | ```
26 | ### how to run
27 | ```shell
28 | docker run -m32M -p 9090:9090 --name core-demo core-demo:latest
29 | ```
30 |
--------------------------------------------------------------------------------
/vxms-demos/vxms-core-demo/app-cds.jsa:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amoAHCP/vxms/06f5a01196f6aca4226ac73a3ddea4a264928b5e/vxms-demos/vxms-core-demo/app-cds.jsa
--------------------------------------------------------------------------------
/vxms-demos/vxms-core-demo/reflectconfigs/netty.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name" : "io.netty.channel.socket.nio.NioSocketChannel",
4 | "methods" : [
5 | { "name" : "", "parameterTypes" : [] }
6 | ]
7 | },
8 | {
9 | "name" : "io.netty.channel.socket.nio.NioServerSocketChannel",
10 | "methods" : [
11 | { "name" : "", "parameterTypes" : [] }
12 | ]
13 | }
14 | ]
--------------------------------------------------------------------------------
/vxms-demos/vxms-core-demo/src/main/java/module-info-graal.java1:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright [2018] [Andy Moncsek]
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 |
18 | open module vxms.core.demo {
19 | requires vxms.core;
20 | requires vertx.core;
21 | requires vertx.web;
22 | requires io.netty.codec;
23 | requires io.netty.codec.http;
24 | requires java.logging;
25 | requires java.management;
26 |
27 | exports org.jacpfx.vxms.verticle to vxms.core,vertx.core;
28 |
29 | }
--------------------------------------------------------------------------------
/vxms-demos/vxms-core-demo/src/main/java/org/jacpfx/vxms/verticle/Runner.java:
--------------------------------------------------------------------------------
1 | package org.jacpfx.vxms.verticle;
2 |
3 | import java.io.File;
4 |
5 | import io.vertx.core.Vertx;
6 | import io.vertx.core.logging.Logger;
7 | import io.vertx.core.logging.LoggerFactory;
8 | import io.vertx.core.logging.SLF4JLogDelegateFactory;
9 | import io.vertx.ext.web.Router;
10 |
11 | public class Runner {
12 |
13 | public static void main(String[] args) {
14 | // Use logback for logging
15 | File logbackFile = new File("config", "logback.xml");
16 | System.setProperty("logback.configurationFile", logbackFile.getAbsolutePath());
17 | System.setProperty(LoggerFactory.LOGGER_DELEGATE_FACTORY_CLASS_NAME, SLF4JLogDelegateFactory.class.getName());
18 | Logger log = LoggerFactory.getLogger(Runner.class);
19 |
20 | // Setup the http server
21 | log.info("Starting server for: http://localhost:8080/hello");
22 | Vertx vertx = Vertx.vertx();
23 | Router router = Router.router(vertx);
24 |
25 | router.route("/hello").handler(rc -> {
26 | log.info("Got hello request");
27 | rc.response().end("World");
28 | });
29 |
30 | vertx.createHttpServer()
31 | .requestHandler(router::accept)
32 | .listen(8080);
33 |
34 | }
35 |
36 | }
--------------------------------------------------------------------------------
/vxms-demos/vxms-core-demo/src/main/java/org/jacpfx/vxms/verticle/SimpleREST.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright [2018] [Andy Moncsek]
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.jacpfx.vxms.verticle;
18 |
19 | import io.vertx.core.DeploymentOptions;
20 | import io.vertx.core.Future;
21 | import io.vertx.core.Handler;
22 | import io.vertx.core.Vertx;
23 | import io.vertx.core.json.JsonObject;
24 | import io.vertx.ext.web.Router;
25 | import io.vertx.ext.web.RoutingContext;
26 | import org.jacpfx.vxms.common.ServiceEndpoint;
27 | import org.jacpfx.vxms.services.VxmsEndpoint;
28 |
29 |
30 | /**
31 | * Created by Andy Moncsek on 25.01.16.
32 | */
33 | @ServiceEndpoint(port = 8080)
34 | public class SimpleREST extends VxmsEndpoint {
35 |
36 | @Override
37 | public void postConstruct(Router router, final Future startFuture) {
38 | router.get("/helloGET").handler(getSimpleResponse());
39 | router.get("/helloGET/:name").handler(getName());
40 | startFuture.complete();
41 | }
42 |
43 | private Handler getName() {
44 | return helloGet -> helloGet.response().end("hello World " + helloGet.request().getParam("name"));
45 | }
46 |
47 | private Handler getSimpleResponse() {
48 | return helloGet -> helloGet.response().end("simple response");
49 | }
50 |
51 | public static void main(String[] args) {
52 | DeploymentOptions options = new DeploymentOptions();
53 | System.out.println("test");
54 | SimpleREST t = new SimpleREST();
55 | Vertx.vertx().deployVerticle(t, options);
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/vxms-demos/vxms-rest-demo/README.MD:
--------------------------------------------------------------------------------
1 | # A (simple) vxms REST endpoint
2 | It defines a HTTP endpoint on port 9090 and two REST (Get) endpoints, using vxms-rest. Start the *main* method in *SimpleREST* class, or build with *mvn clean package* and execute *java -jar target/vxms-demo-verticle-one-XXX.jar*
3 |
--------------------------------------------------------------------------------
/vxms-demos/vxms-rest-demo/src/main/java/module-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright [2018] [Andy Moncsek]
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 |
18 | module vxms.rest.demo {
19 | requires vxms.core;
20 | requires vertx.core;
21 | requires vxms.rest;
22 | requires vertx.web;
23 | requires java.logging;
24 | requires java.management;
25 | requires java.ws.rs;
26 | requires io.netty.codec.http;
27 |
28 | uses org.jacpfx.vxms.spi.RESThandlerSPI;
29 | opens org.jacpfx.vxms.verticle;
30 | exports org.jacpfx.vxms.verticle to vxms.core, vertx.core;
31 |
32 | }
--------------------------------------------------------------------------------
/vxms-demos/vxms-secure-spa-demo/.gitignore:
--------------------------------------------------------------------------------
1 | *.class
2 |
3 | # Mobile Tools for Java (J2ME)
4 | .mtj.tmp/
5 |
6 | # Package Files #
7 | *.jar
8 | *.war
9 | *.ear
10 | .DS_Store
11 | .gradle
12 | .idea
13 | *.iml
14 | build
15 | target
16 | file-uploads
17 | .vertx
18 | vxms-demos/vxms-petshop
19 | out
20 | mod
21 | etcd-ca
22 | .keystore
23 | securityConfPrivate.json
24 |
25 |
26 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
27 | hs_err_pid*
28 |
--------------------------------------------------------------------------------
/vxms-demos/vxms-secure-spa-demo/.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amoAHCP/vxms/06f5a01196f6aca4226ac73a3ddea4a264928b5e/vxms-demos/vxms-secure-spa-demo/.keystore
--------------------------------------------------------------------------------
/vxms-demos/vxms-secure-spa-demo/securityConf.json:
--------------------------------------------------------------------------------
1 | {
2 | "clientID":"0cacb114b5067c843c43",
3 | "clientSecret":"5ad8e3b89a4e00dcdfa94b59cbf642bb63ecf0e3",
4 | "host":"localhost",
5 | "port":8443
6 | }
--------------------------------------------------------------------------------
/vxms-demos/vxms-secure-spa-demo/src/main/java/module-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright [2018] [Andy Moncsek]
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 |
18 | module vxms.spa.demo {
19 | requires vxms.core;
20 | requires vertx.core;
21 | requires vertx.auth.oauth2;
22 | requires vertx.auth.common;
23 | requires spring.context;
24 | requires vxms.rest;
25 | requires vertx.web;
26 | requires java.logging;
27 | requires java.management;
28 | requires java.ws.rs;
29 | requires javax.inject;
30 | requires java.xml.ws.annotation;
31 | requires io.netty.codec.http;
32 | requires jacpfx.vertx.spring;
33 |
34 | uses org.jacpfx.vxms.spi.RESThandlerSPI;
35 |
36 | }
--------------------------------------------------------------------------------
/vxms-demos/vxms-secure-spa-demo/src/main/java/org/jacpfx/vxms/spa/config/CustomHTTPOptions.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright [2018] [Andy Moncsek]
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.jacpfx.vxms.spa.config;
18 |
19 | import io.vertx.core.http.HttpServerOptions;
20 | import io.vertx.core.json.JsonObject;
21 | import io.vertx.core.net.JksOptions;
22 | import org.jacpfx.vxms.common.CustomServerOptions;
23 | import org.jacpfx.vxms.spa.util.KeyUtil;
24 |
25 | import java.io.File;
26 |
27 | /**
28 | * Created by amo on 11.08.16.
29 | */
30 | public class CustomHTTPOptions implements CustomServerOptions {
31 |
32 | public HttpServerOptions getServerOptions(JsonObject config) {
33 | if (!new File(KeyUtil.DEMO_KEYSTTORE).exists()) {
34 | KeyUtil.generateKey(); // only for demo, create keystore
35 | }
36 | return new HttpServerOptions().
37 | setKeyStoreOptions(new JksOptions().setPath(KeyUtil.DEMO_KEYSTTORE).setPassword(KeyUtil.DEMO_PWD)).
38 | setSsl(true);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/vxms-demos/vxms-secure-spa-demo/src/main/java/org/jacpfx/vxms/spa/config/SpringConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright [2018] [Andy Moncsek]
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.jacpfx.vxms.spa.config;
18 |
19 | import org.springframework.context.annotation.ComponentScan;
20 | import org.springframework.context.annotation.Configuration;
21 |
22 | /**
23 | * Created by Andy Moncsek on 28.01.16.
24 | */
25 | @Configuration
26 | @ComponentScan(basePackages = "org.jacpfx.vxms.spa.beans")
27 | public class SpringConfig {
28 | }
29 |
--------------------------------------------------------------------------------
/vxms-demos/vxms-secure-spa-demo/src/main/java/org/jacpfx/vxms/spa/util/DefaultResponses.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright [2018] [Andy Moncsek]
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.jacpfx.vxms.spa.util;
18 |
19 | import io.vertx.core.json.JsonObject;
20 |
21 | /**
22 | * Created by Andy Moncsek on 01.04.16.
23 | */
24 | public class DefaultResponses {
25 |
26 | public static JsonObject defaultErrorResponse() {
27 | JsonObject message = new JsonObject();
28 | message.put("username", "no connection").
29 | put("firstName", "no connection").
30 | put("lastName", "no connection").
31 | put("address", "no connection");
32 | return message;
33 | }
34 |
35 |
36 | public static JsonObject mapToUser(JsonObject input, String id) {
37 | return new JsonObject().
38 | put("username", input.getString("username")).
39 | put("firstName", input.getString("firstName")).
40 | put("lastName", input.getString("lastName")).
41 | put("address", input.getString("address")).
42 | put("_id", id);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/vxms-demos/vxms-secure-spa-demo/src/main/resources/vertx-default-jul-logging.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright [2018] [Andy Moncsek]
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | #
16 | handlers=java.util.logging.ConsoleHandler,java.util.logging.FileHandler
17 | java.util.logging.SimpleFormatter.format=%5$s %6$s\n
18 | java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
19 | java.util.logging.ConsoleHandler.level=INFO
20 | java.util.logging.FileHandler.level=INFO
21 | java.util.logging.FileHandler.formatter=io.vertx.core.logging.impl.VertxLoggerFormatter
22 |
23 | # Put the log in the system temporary directory
24 | java.util.logging.FileHandler.pattern=vertx.log
25 |
26 | .level=INFO
27 | io.vertx.ext.web.level=INFO
28 | io.vertx.level=INFO
29 | com.hazelcast.level=INFO
30 | io.netty.util.internal.PlatformDependent.level=SEVERE
--------------------------------------------------------------------------------
/vxms-demos/vxms-secure-spa-demo/src/main/resources/webroot/index.html:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 | AngularJs
22 |
23 |
24 |
25 |
39 | Add New User
--------------------------------------------------------------------------------
/vxms-demos/vxms-spring-demo/Dockerfile:
--------------------------------------------------------------------------------
1 | # First stage: Copy the project and run mvn clean install in Docker to build the project against Java 9
2 | FROM maven:3.5.4-jdk-11 AS mavenbuilder
3 | MAINTAINER Andy Moncsek
4 | RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
5 | WORKDIR /app
6 | RUN git clone https://github.com/amoAHCP/vxms.git && \
7 | cd vxms && \
8 | git checkout java11 && \
9 | cd vxms-demos/vxms-spring-demo && \
10 | mvn clean install
11 |
12 |
13 | # Second stage: Copies the builded application and creates a custom JRE
14 | FROM alpine:3.8 AS builder
15 | MAINTAINER Andy Moncsek
16 | ENV JAVA_HOME=/opt/jdk \
17 | PATH=${PATH}:/opt/jdk/bin \
18 | LANG=C.UTF-8
19 | RUN set -ex && \
20 | apk add --no-cache bash && \
21 | wget https://download.java.net/java/early_access/alpine/22/binaries/openjdk-11-ea+22_linux-x64-musl_bin.tar.gz -O jdk.tar.gz && \
22 | mkdir -p /opt/jdk && \
23 | tar zxvf jdk.tar.gz -C /opt/jdk --strip-components=1 && \
24 | rm jdk.tar.gz && \
25 | rm /opt/jdk/lib/src.zip
26 | WORKDIR /app
27 | COPY --from=mavenbuilder /app/vxms/vxms-demos/vxms-spring-demo/ ./
28 | RUN jlink --module-path target/vxms-spring-demo-1.2-SNAPSHOT.jar:target/modules:$JAVA_HOME/jmods \
29 | --add-modules vxms.spring.demo \
30 | --limit-modules vxms.spring.demo \
31 | --launcher run=vxms.spring.demo/org.jacpfx.vxms.spring.SimpleSpringRESTStaticInit \
32 | --output dist \
33 | --compress 2 \
34 | --strip-debug \
35 | --no-header-files \
36 | --no-man-pages \
37 | --vm server
38 |
39 |
40 | # Third stage: Copies the custom JRE into our image and runs it
41 | FROM alpine:3.8
42 | MAINTAINER Andy Moncsek
43 | WORKDIR /app
44 | COPY --from=builder /app/dist/ ./
45 | EXPOSE 9090
46 | ENV JVM_OPTS="-XX:MaxRAMFraction=1"
47 | #ENV JVM_OPTS="-Xms16M"
48 | CMD ["bin/java", "--add-opens","java.base/java.lang=spring.core","-m","vxms.spring.demo/org.jacpfx.vxms.spring.SimpleSpringRESTStaticInit"]
49 | # CMD ["bin/java", "-m","vxms.spring.demo/org.jacpfx.vxms.spring.SimpleSpringREST", "--illigal-access=deny","--add-opens ","java.base/java.lang=ALL"]
50 | #CMD ["bin/java -m vxms.spring.demo/org.jacpfx.vxms.spring.SimpleSpringREST --illigal-access=deny --add-opens java.base/java.lang=ALL"]
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/vxms-demos/vxms-spring-demo/README.MD:
--------------------------------------------------------------------------------
1 | # A vxms REST + Spring endpoint
2 | This example demonstrates the usage of the spring-vertx-ext together with vxms.
3 | Start the Endpoint either by using the main method or build the project und start the jar file.
4 |
5 |
6 |
7 | ## run as Java 9 module
8 | In this case we simply use the main method declared in the class, instead of using the Vert.x Factory mechanism used by maven shade.
9 |
10 | ```shell
11 | java --add-opens java.base/java.lang=spring.core --module-path target/vxms-spring-demo-1.2-SNAPSHOT.jar:target/modules:$JAVA_HOME/jmods/ --module vxms.spring.demo/org.jacpfx.vxms.spring.SimpleSpringRESTStaticInit
12 |
13 | ```
14 |
15 | ## create a modular runtime image
16 | The Dockerfile in this project is an example, how to build a modular runtime image to run a vxms (Vert.x based) application. To build the application modules, the moditec maven plugin is used(https://github.com/moditect/moditect). Basically the process consists of 3 Steps:
17 | - Step 1: clone the project, switch to Java9 branch and build the project against Java9
18 | - Step 2: the created modules are copied to the next step, the alpine JDK11 will be downloaded an a modular runtime image will be created
19 | - Step 3: the modular image (containing the REST service) will be copied to an alpine image
20 |
21 | ### how to build
22 | ```shell
23 | docker build -t spring-demo .
24 | ```
25 | ### how to run
26 | ```shell
27 | docker run -m32M -p 9090:9090 --name spring-demo spring-demo:latest
28 | ```
29 |
30 |
31 |
32 | Benchmark plain:
33 |
34 |
35 | STATIC ready
36 |
37 | real 0m3.844s
38 | user 0m0.085s
39 | sys 0m0.019s
40 |
41 |
42 |
--------------------------------------------------------------------------------
/vxms-demos/vxms-spring-demo/jdeps.txt:
--------------------------------------------------------------------------------
1 | jdeps --generate-module-info /Users/amo/Documents/development/vertx/vxms/vxms-demos/vxms-spring-demo/target/moditect --add-modules io.netty.buffer,io.netty.common,reactor.core,org.reactivestreams,io.reactivex.rxjava2,rxjava,rxjava.reactive.streams,jopt.simple,aspectjweaver,kotlin.reflect,kotlin.stdlib,annotations,spring.jcl --module-path /Users/amo/Documents/development/vertx/vxms/vxms-demos/vxms-spring-demo/target/modules/netty-buffer-4.1.19.Final.jar:/Users/amo/Documents/development/vertx/vxms/vxms-demos/vxms-spring-demo/target/modules/netty-common-4.1.19.Final.jar:/Users/amo/.m2/repository/io/projectreactor/reactor-core/3.1.7.RELEASE/reactor-core-3.1.7.RELEASE.jar:/Users/amo/.m2/repository/org/reactivestreams/reactive-streams/1.0.2/reactive-streams-1.0.2.jar:/Users/amo/.m2/repository/io/reactivex/rxjava2/rxjava/2.1.13/rxjava-2.1.13.jar:/Users/amo/.m2/repository/io/reactivex/rxjava/1.3.8/rxjava-1.3.8.jar:/Users/amo/.m2/repository/io/reactivex/rxjava-reactive-streams/1.2.1/rxjava-reactive-streams-1.2.1.jar:/Users/amo/.m2/repository/net/sf/jopt-simple/jopt-simple/5.0.4/jopt-simple-5.0.4.jar:/Users/amo/Documents/development/vertx/vxms/vxms-demos/vxms-spring-demo/target/modules/aspectjweaver-1.8.10.jar:/Users/amo/.m2/repository/org/jetbrains/kotlin/kotlin-reflect/1.2.41/kotlin-reflect-1.2.41.jar:/Users/amo/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib/1.2.41/kotlin-stdlib-1.2.41.jar:/Users/amo/.m2/repository/org/jetbrains/annotations/13.0/annotations-13.0.jar:/Users/amo/Documents/development/vertx/vxms/vxms-demos/vxms-spring-demo/target/modules/spring-jcl-5.0.6.RELEASE.jar /Users/amo/.m2/repository/org/springframework/spring-core/5.0.6.RELEASE/spring-core-5.0.6.RELEASE.jar
2 |
--------------------------------------------------------------------------------
/vxms-demos/vxms-spring-demo/jdeps1.txt:
--------------------------------------------------------------------------------
1 | jdeps --generate-module-info /Documents/development/vertx/vxms/vxms-demos/vxms-spring-demo/target/moditect --add-modules io.netty.buffer,io.netty.common,reactor.core,org.reactivestreams,io.reactivex.rxjava2,rxjava,rxjava.reactive.streams,jopt.simple,aspectjweaver,annotations,spring.jcl --module-path /Documents/development/vertx/vxms/vxms-demos/vxms-spring-demo/target/modules/netty-buffer-4.1.19.Final.jar:/Documents/development/vertx/vxms/vxms-demos/vxms-spring-demo/target/modules/netty-common-4.1.19.Final.jar:/.m2/repository/io/projectreactor/reactor-core/3.1.7.RELEASE/reactor-core-3.1.7.RELEASE.jar:/.m2/repository/org/reactivestreams/reactive-streams/1.0.2/reactive-streams-1.0.2.jar:/.m2/repository/io/reactivex/rxjava2/rxjava/2.1.13/rxjava-2.1.13.jar:/.m2/repository/io/reactivex/rxjava/1.3.8/rxjava-1.3.8.jar:/.m2/repository/io/reactivex/rxjava-reactive-streams/1.2.1/rxjava-reactive-streams-1.2.1.jar:/.m2/repository/net/sf/jopt-simple/jopt-simple/5.0.4/jopt-simple-5.0.4.jar:/Documents/development/vertx/vxms/vxms-demos/vxms-spring-demo/target/modules/aspectjweaver-1.8.10.jar:/.m2/repository/org/jetbrains/kotlin/kotlin-reflect/1.2.41/kotlin-reflect-1.2.41.jar:/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib/1.2.41/kotlin-stdlib-1.2.41.jar:/.m2/repository/org/jetbrains/annotations/13.0/annotations-13.0.jar:/Documents/development/vertx/vxms/vxms-demos/vxms-spring-demo/target/modules/spring-jcl-5.0.6.RELEASE.jar /.m2/repository/org/springframework/spring-core/5.0.6.RELEASE/spring-core-5.0.6.RELEASE.jar
2 |
--------------------------------------------------------------------------------
/vxms-demos/vxms-spring-demo/jdeps2.txt:
--------------------------------------------------------------------------------
1 | jdeps --generate-module-info /Users/amo/Documents/development/vertx/vxms/vxms-demos/vxms-spring-demo/target/moditect --module-path /Users/amo/Documents/development/vertx/vxms/vxms-demos/vxms-spring-demo/target/modules/netty-buffer-4.1.19.Final.jar:/Users/amo/Documents/development/vertx/vxms/vxms-demos/vxms-spring-demo/target/modules/netty-common-4.1.19.Final.jar:/Users/amo/.m2/repository/io/projectreactor/reactor-core/3.1.7.RELEASE/reactor-core-3.1.7.RELEASE.jar:/Users/amo/.m2/repository/org/reactivestreams/reactive-streams/1.0.2/reactive-streams-1.0.2.jar:/Users/amo/.m2/repository/io/reactivex/rxjava2/rxjava/2.1.13/rxjava-2.1.13.jar:/Users/amo/.m2/repository/io/reactivex/rxjava/1.3.8/rxjava-1.3.8.jar:/Users/amo/.m2/repository/io/reactivex/rxjava-reactive-streams/1.2.1/rxjava-reactive-streams-1.2.1.jar:/Users/amo/.m2/repository/net/sf/jopt-simple/jopt-simple/5.0.4/jopt-simple-5.0.4.jar:/Users/amo/Documents/development/vertx/vxms/vxms-demos/vxms-spring-demo/target/modules/aspectjweaver-1.8.10.jar:/Users/amo/.m2/repository/org/jetbrains/kotlin/kotlin-reflect/1.2.41/kotlin-reflect-1.2.41.jar:/Users/amo/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib/1.2.41/kotlin-stdlib-1.2.41.jar:/Users/amo/.m2/repository/org/jetbrains/annotations/13.0/annotations-13.0.jar:/Users/amo/Documents/development/vertx/vxms/vxms-demos/vxms-spring-demo/target/modules/spring-jcl-5.0.6.RELEASE.jar /Users/amo/.m2/repository/org/springframework/spring-core/5.0.6.RELEASE/spring-core-5.0.6.RELEASE.jar
2 |
--------------------------------------------------------------------------------
/vxms-demos/vxms-spring-demo/jdepstmp.txt:
--------------------------------------------------------------------------------
1 | jdeps --generate-module-info /Users/amo/Documents/development/vertx/vxms/vxms-demos/vxms-spring-demo/target/moditect --add-modules io.netty.buffer,io.netty.common,reactor.core,org.reactivestreams,jopt.simple,aspectjweaver,kotlin.reflect,kotlin.stdlib,annotations,spring.jcl --module-path /Users/amo/Documents/development/vertx/vxms/vxms-demos/vxms-spring-demo/target/modules/netty-buffer-4.1.19.Final.jar:/Users/amo/Documents/development/vertx/vxms/vxms-demos/vxms-spring-demo/target/modules/netty-common-4.1.19.Final.jar:/Users/amo/.m2/repository/io/projectreactor/reactor-core/3.1.7.RELEASE/reactor-core-3.1.7.RELEASE.jar:/Users/amo/.m2/repository/org/reactivestreams/reactive-streams/1.0.2/reactive-streams-1.0.2.jar:/Users/amo/.m2/repository/io/reactivex/rxjava2/rxjava/2.1.13/rxjava-2.1.13.jar:/Users/amo/.m2/repository/io/reactivex/rxjava/1.3.8/rxjava-1.3.8.jar:/Users/amo/.m2/repository/io/reactivex/rxjava-reactive-streams/1.2.1/rxjava-reactive-streams-1.2.1.jar:/Users/amo/.m2/repository/net/sf/jopt-simple/jopt-simple/5.0.4/jopt-simple-5.0.4.jar:/Users/amo/Documents/development/vertx/vxms/vxms-demos/vxms-spring-demo/target/modules/aspectjweaver-1.8.10.jar:/Users/amo/.m2/repository/org/jetbrains/kotlin/kotlin-reflect/1.2.41/kotlin-reflect-1.2.41.jar:/Users/amo/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib/1.2.41/kotlin-stdlib-1.2.41.jar:/Users/amo/.m2/repository/org/jetbrains/annotations/13.0/annotations-13.0.jar:/Users/amo/Documents/development/vertx/vxms/vxms-demos/vxms-spring-demo/target/modules/spring-jcl-5.0.6.RELEASE.jar /Users/amo/.m2/repository/org/springframework/spring-core/5.0.6.RELEASE/spring-core-5.0.6.RELEASE.jar
2 |
--------------------------------------------------------------------------------
/vxms-demos/vxms-spring-demo/src/main/java/module-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright [2018] [Andy Moncsek]
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 |
18 | open module vxms.spring.demo {
19 | requires vxms.core;
20 | requires vertx.core;
21 | requires spring.context;
22 | requires spring.core;
23 | requires jacpfx.vertx.spring;
24 | requires vxms.rest;
25 | requires vertx.web;
26 | requires java.logging;
27 | requires java.management;
28 | requires java.ws.rs;
29 | requires javax.inject;
30 | requires io.netty.codec.http;
31 |
32 |
33 | uses org.jacpfx.vxms.spi.RESThandlerSPI;
34 | exports org.jacpfx.vxms.spring;
35 |
36 |
37 |
38 | }
--------------------------------------------------------------------------------
/vxms-demos/vxms-spring-demo/src/main/java/org/jacpfx/vxms/spring/beans/HelloWorldBean.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright [2018] [Andy Moncsek]
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.jacpfx.vxms.spring.beans;
18 |
19 | import org.springframework.stereotype.Component;
20 |
21 | /**
22 | * Created by Andy Moncsek on 28.01.16.
23 | */
24 | @Component
25 | public class HelloWorldBean {
26 | public String sayHallo(){
27 | return "hello world";
28 | }
29 |
30 | public String sayHallo(String name){
31 | // System.out.println("got name: "+name);
32 | return "hello world "+name;
33 | }
34 |
35 | public String seyHelloWithException() {
36 | throw new NullPointerException("stupid exception");
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/vxms-demos/vxms-spring-demo/src/main/java/org/jacpfx/vxms/spring/configuration/SpringConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright [2018] [Andy Moncsek]
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.jacpfx.vxms.spring.configuration;
18 |
19 | import org.jacpfx.vxms.spring.beans.HelloWorldBean;
20 | import org.springframework.context.annotation.Bean;
21 | import org.springframework.context.annotation.ComponentScan;
22 | import org.springframework.context.annotation.Configuration;
23 | import org.springframework.stereotype.Component;
24 |
25 | /**
26 | * Created by Andy Moncsek on 28.01.16.
27 | */
28 | @Configuration
29 | //@ComponentScan(basePackages = "org.jacpfx.vxms.spring.beans")
30 | public class SpringConfig {
31 | @Bean
32 | public HelloWorldBean getHelloWorldBean() {
33 | return new HelloWorldBean();
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/vxms-demos/vxms-spring-demo/temp.txt:
--------------------------------------------------------------------------------
1 | target/moditect --add-modules io.netty.buffer,io.netty.common,reactor.core,org.reactivestreams,io.reactivex.rxjava2,rxjava,rxjava.reactive.streams,jopt.simple,aspectjweaver,kotlin.reflect,kotlin.stdlib,annotations,spring.jcl --module-path netty-buffer-4.1.19.Final.jar:netty-common-4.1.19.Final.jar:.m2/repository/io/projectreactor/reactor-core/3.1.7.RELEASE/reactor-core-3.1.7.RELEASE.jar:.m2/repository/org/reactivestreams/reactive-streams/1.0.2/reactive-streams-1.0.2.jar:.m2/repository/io/reactivex/rxjava2/rxjava/2.1.13/rxjava-2.1.13.jar:.m2/repository/io/reactivex/rxjava/1.3.8/rxjava-1.3.8.jar:.m2/repository/io/reactivex/rxjava-reactive-streams/1.2.1/rxjava-reactive-streams-1.2.1.jar:.m2/repository/net/sf/jopt-simple/jopt-simple/5.0.4/jopt-simple-5.0.4.jar:aspectjweaver-1.8.10.jar:.m2/repository/org/jetbrains/kotlin/kotlin-reflect/1.2.41/kotlin-reflect-1.2.41.jar:.m2/repository/org/jetbrains/kotlin/kotlin-stdlib/1.2.41/kotlin-stdlib-1.2.41.jar:.m2/repository/org/jetbrains/annotations/13.0/annotations-13.0.jar:spring-jcl-5.0.6.RELEASE.jar .m2/repository/org/springframework/spring-core/5.0.6.RELEASE/spring-core-5.0.6.RELEASE.jar
--------------------------------------------------------------------------------
/vxms-event/pom.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
20 | 4.0.0
21 |
22 |
23 | org.jacpfx
24 | vxms
25 | 1.2-SNAPSHOT
26 | ../
27 |
28 |
29 | vxms-event
30 | jar
31 |
32 | vxms-event
33 | http://maven.apache.org
34 |
35 |
36 | UTF-8
37 |
38 |
39 |
40 |
41 | org.jacpfx
42 | vxms-core
43 | ${parent.version}
44 |
45 |
46 | javax.ws.rs
47 | javax.ws.rs-api
48 | 2.0.1
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/vxms-event/src/main/java/module-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright [2018] [Andy Moncsek]
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 |
18 | module vxms.event {
19 | requires vxms.core;
20 | requires vertx.core;
21 | requires vertx.web;
22 | requires io.netty.codec;
23 | requires io.netty.codec.http;
24 | requires java.logging;
25 | requires java.management;
26 |
27 | exports org.jacpfx.vxms.event.annotation;
28 |
29 | provides org.jacpfx.vxms.spi.EventhandlerSPI with org.jacpfx.vxms.event.Eventhandler;
30 |
31 |
32 | }
--------------------------------------------------------------------------------
/vxms-event/src/main/java/org/jacpfx/vxms/event/Eventhandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright [2018] [Andy Moncsek]
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.jacpfx.vxms.event;
18 |
19 | import io.vertx.core.AbstractVerticle;
20 | import org.jacpfx.vxms.common.VxmsShared;
21 | import org.jacpfx.vxms.spi.EventhandlerSPI;
22 |
23 | /** Created by amo on 05.08.16. */
24 | public class Eventhandler implements EventhandlerSPI {
25 |
26 | @Override
27 | public void initEventHandler(VxmsShared vxmsShared, AbstractVerticle service) {
28 | EventInitializer.initEventbusHandling(vxmsShared, service);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/vxms-event/src/main/java/org/jacpfx/vxms/event/annotation/Consume.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright [2018] [Andy Moncsek]
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.jacpfx.vxms.event.annotation;
18 |
19 | import java.lang.annotation.Documented;
20 | import java.lang.annotation.ElementType;
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.RetentionPolicy;
23 | import java.lang.annotation.Target;
24 |
25 | @Target({ElementType.TYPE, ElementType.METHOD})
26 | @Retention(RetentionPolicy.RUNTIME)
27 | @Documented
28 | /**
29 | * Defines an eventbus consumer id
30 | */
31 | public @interface Consume {
32 |
33 | /**
34 | * The consumer ID
35 | *
36 | * @return the ID
37 | */
38 | String value();
39 | }
40 |
--------------------------------------------------------------------------------
/vxms-event/src/main/java/org/jacpfx/vxms/event/annotation/OnEventError.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright [2018] [Andy Moncsek]
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.jacpfx.vxms.event.annotation;
18 |
19 | import java.lang.annotation.Documented;
20 | import java.lang.annotation.ElementType;
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.RetentionPolicy;
23 | import java.lang.annotation.Target;
24 |
25 | @Target({ElementType.TYPE, ElementType.METHOD})
26 | @Retention(RetentionPolicy.RUNTIME)
27 | @Documented
28 | /** marks fallback methods to be executed wenn an exception in method occurred and not handled **/
29 | public @interface OnEventError {
30 |
31 | /**
32 | * the path name
33 | *
34 | * @return the name of the Consumes path
35 | */
36 | String value();
37 | }
38 |
--------------------------------------------------------------------------------
/vxms-event/src/main/java/org/jacpfx/vxms/event/response/EventbusRequest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright [2018] [Andy Moncsek]
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.jacpfx.vxms.event.response;
18 |
19 | import io.vertx.core.eventbus.Message;
20 |
21 | /**
22 | * Created by Andy Moncsek on 12.01.16. his class allows easy access to event-bus message to get the
23 | * body and the reply address
24 | */
25 | public class EventbusRequest {
26 |
27 | private final Message