- * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - *
- * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - *
- * You should have received a copy of the GNU Lesser General Public License along with this library. If not, see
- * http://www.gnu.org/licenses/.
- */
-package org.fuin.cqrs4j.example.javasecdi.shared.app;
-
-import com.eventstore.dbclient.EventStoreDBClient;
-import com.eventstore.dbclient.EventStoreDBClientSettings;
-import jakarta.enterprise.context.ApplicationScoped;
-import jakarta.enterprise.inject.Disposes;
-import jakarta.enterprise.inject.Produces;
-import org.fuin.esc.esgrpc.ESGrpcEventStore;
-import org.fuin.esc.esgrpc.IESGrpcEventStore;
-import org.fuin.esc.spi.EnhancedMimeType;
-import org.fuin.esc.spi.SerDeserializerRegistry;
-
-import java.nio.charset.StandardCharsets;
-
-/**
- * CDI factory that creates an event store connection.
- */
-@ApplicationScoped
-public class SharedEventStoreFactory {
-
- /**
- * Creates an GRPC based event store.
- *
- * CAUTION: The returned event store instance is NOT thread safe.
- *
- * @param config
- * Configuration to use.
- * @param registry
- * Serialization registry.
- *
- * @return Application scope event store.
- */
- @Produces
- @ApplicationScoped
- public IESGrpcEventStore createEventStore(final SharedConfig config, final SerDeserializerRegistry registry) {
-
- final EventStoreDBClientSettings setts = EventStoreDBClientSettings.builder()
- .addHost(config.getEventStoreHost(), config.getEventStoreHttpPort())
- .defaultCredentials(config.getEventStoreUser(), config.getEventStorePassword())
- .tls(false)
- .buildConnectionSettings();
-
- final EventStoreDBClient client = EventStoreDBClient.create(setts);
- final IESGrpcEventStore eventstore = new ESGrpcEventStore.Builder().eventStore(client).serDesRegistry(registry)
- .targetContentType(EnhancedMimeType.create("application", "json", StandardCharsets.UTF_8))
- .build();
-
- eventstore.open();
- return eventstore;
-
- }
-
- /**
- * Closes the GRPC based event store when the context is disposed.
- *
- * @param es
- * Event store to close.
- */
- public void closeEventStore(@Disposes final IESGrpcEventStore es) {
- es.close();
- }
-
-}
diff --git a/java-se-cdi/src/main/java/org/fuin/cqrs4j/example/javasecdi/shared/app/SharedExecutorServiceFactory.java b/java-se-cdi/src/main/java/org/fuin/cqrs4j/example/javasecdi/shared/app/SharedExecutorServiceFactory.java
deleted file mode 100644
index 2498621..0000000
--- a/java-se-cdi/src/main/java/org/fuin/cqrs4j/example/javasecdi/shared/app/SharedExecutorServiceFactory.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * Copyright (C) 2015 Michael Schnell. All rights reserved. http://www.fuin.org/
- *
- * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License along with this library. If not, see
- * http://www.gnu.org/licenses/.
- */
-package org.fuin.cqrs4j.example.javasecdi.shared.app;
-
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-import jakarta.enterprise.context.ApplicationScoped;
-import jakarta.enterprise.inject.Produces;
-
-/**
- * Creates an executor service.
- */
-@ApplicationScoped
-public class SharedExecutorServiceFactory {
-
- @ApplicationScoped
- @Produces
- public ExecutorService createExecutorService() {
- return Executors.newFixedThreadPool(10);
- }
-
-}
diff --git a/java-se-cdi/src/main/java/org/fuin/cqrs4j/example/javasecdi/shared/app/SharedSerDeserializerRegistryFactory.java b/java-se-cdi/src/main/java/org/fuin/cqrs4j/example/javasecdi/shared/app/SharedSerDeserializerRegistryFactory.java
deleted file mode 100644
index bf41865..0000000
--- a/java-se-cdi/src/main/java/org/fuin/cqrs4j/example/javasecdi/shared/app/SharedSerDeserializerRegistryFactory.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.fuin.cqrs4j.example.javasecdi.shared.app;
-
-import jakarta.enterprise.context.ApplicationScoped;
-import jakarta.enterprise.inject.Produces;
-
-import org.fuin.esc.spi.JsonbDeSerializer;
-import org.fuin.esc.spi.SerDeserializerRegistry;
-import org.fuin.esc.spi.SerializedDataTypeRegistry;
-
-/**
- * CDI bean that creates a {@link SerDeserializerRegistry}.
- */
-@ApplicationScoped
-public class SharedSerDeserializerRegistryFactory {
-
- @Produces
- @ApplicationScoped
- public SerDeserializerRegistry createRegistry() {
-
- // Knows about all types for usage with JSON-B
- final SerializedDataTypeRegistry typeRegistry = SharedUtils.createTypeRegistry();
-
- // Does the actual marshalling/unmarshalling
- final JsonbDeSerializer jsonbDeSer = SharedUtils.createJsonbDeSerializer();
-
- // Registry connects the type with the appropriate serializer and de-serializer
- final SerDeserializerRegistry serDeserRegistry = SharedUtils.createSerDeserializerRegistry(typeRegistry, jsonbDeSer);
-
- return serDeserRegistry;
-
- }
-
-}
\ No newline at end of file
diff --git a/java-se-cdi/src/main/java/org/fuin/cqrs4j/example/javasecdi/shared/app/SharedUtils.java b/java-se-cdi/src/main/java/org/fuin/cqrs4j/example/javasecdi/shared/app/SharedUtils.java
deleted file mode 100644
index 0a9f593..0000000
--- a/java-se-cdi/src/main/java/org/fuin/cqrs4j/example/javasecdi/shared/app/SharedUtils.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/**
- * Copyright (C) 2015 Michael Schnell. All rights reserved.
- * http://www.fuin.org/
- *
- * This library is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation; either version 3 of the License, or (at your option) any
- * later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library. If not, see http://www.gnu.org/licenses/.
- */
-package org.fuin.cqrs4j.example.javasecdi.shared.app;
-
-import java.nio.charset.Charset;
-
-import jakarta.json.bind.adapter.JsonbAdapter;
-
-import org.eclipse.yasson.FieldAccessStrategy;
-import org.fuin.cqrs4j.example.shared.PersonCreatedEvent;
-import org.fuin.cqrs4j.example.shared.PersonId;
-import org.fuin.cqrs4j.example.shared.PersonName;
-import org.fuin.ddd4j.ddd.EntityIdPathConverter;
-import org.fuin.ddd4j.ddd.EventIdConverter;
-import org.fuin.esc.spi.Base64Data;
-import org.fuin.esc.spi.EscEvent;
-import org.fuin.esc.spi.EscEvents;
-import org.fuin.esc.spi.EscMeta;
-import org.fuin.esc.spi.EscSpiUtils;
-import org.fuin.esc.spi.JsonbDeSerializer;
-import org.fuin.esc.spi.SerDeserializerRegistry;
-import org.fuin.esc.spi.SerializedDataType;
-import org.fuin.esc.spi.SerializedDataTypeRegistry;
-import org.fuin.esc.spi.SimpleSerializedDataTypeRegistry;
-import org.fuin.esc.spi.SimpleSerializerDeserializerRegistry;
-
-/**
- * Utility code shared between command (write) and query (read) module.
- */
-public final class SharedUtils {
-
- /** All types that will be written into and read from the event store. */
- private static TypeClass[] USER_DEFINED_TYPES = new TypeClass[] {
- new TypeClass(PersonCreatedEvent.SER_TYPE, PersonCreatedEvent.class) };
-
- /** All JSON-B adapters from this module. */
- public static JsonbAdapter, ?>[] JSONB_ADAPTERS = new JsonbAdapter, ?>[] { new EventIdConverter(),
- new EntityIdPathConverter(new SharedEntityIdFactory()), new PersonId.Converter(), new PersonName.Converter() };
-
- private SharedUtils() {
- throw new UnsupportedOperationException("It is not allowed to create an instance of a utiliy class");
- }
-
- /**
- * Create a registry that allows finding types (classes) based on their unique type name.
- *
- * @return New instance.
- */
- public static SerializedDataTypeRegistry createTypeRegistry() {
-
- // Contains all types for usage with JSON-B
- final SimpleSerializedDataTypeRegistry typeRegistry = new SimpleSerializedDataTypeRegistry();
-
- // Base types always needed
- typeRegistry.add(EscEvent.SER_TYPE, EscEvent.class);
- typeRegistry.add(EscEvents.SER_TYPE, EscEvents.class);
- typeRegistry.add(EscMeta.SER_TYPE, EscMeta.class);
- typeRegistry.add(Base64Data.SER_TYPE, Base64Data.class);
-
- // User defined types
- for (final TypeClass tc : USER_DEFINED_TYPES) {
- typeRegistry.add(tc.getType(), tc.getClasz());
- }
- return typeRegistry;
-
- }
-
- /**
- * Creates a registry that connects the type with the appropriate serializer and de-serializer.
- *
- * @param typeRegistry
- * Type registry (Mapping from type name to class).
- * @param jsonbDeSer
- * JSON-B serializer/deserializer to use.
- *
- * @return New instance.
- */
- public static SerDeserializerRegistry createSerDeserializerRegistry(final SerializedDataTypeRegistry typeRegistry,
- final JsonbDeSerializer jsonbDeSer) {
-
- final SimpleSerializerDeserializerRegistry registry = new SimpleSerializerDeserializerRegistry();
-
- // Base types always needed
- registry.add(EscEvents.SER_TYPE, "application/json", jsonbDeSer);
- registry.add(EscEvent.SER_TYPE, "application/json", jsonbDeSer);
- registry.add(EscMeta.SER_TYPE, "application/json", jsonbDeSer);
- registry.add(Base64Data.SER_TYPE, "application/json", jsonbDeSer);
-
- // User defined types
- for (final TypeClass tc : USER_DEFINED_TYPES) {
- registry.add(tc.getType(), "application/json", jsonbDeSer);
- }
- jsonbDeSer.init(typeRegistry, registry, registry);
-
- return registry;
- }
-
- /**
- * Creates an instance of the JSON-B serializer/deserializer.
- *
- * @return New instance that is fully initialized with al necessary settings.
- */
- public static JsonbDeSerializer createJsonbDeSerializer() {
-
- return JsonbDeSerializer.builder().withSerializers(EscSpiUtils.createEscJsonbSerializers())
- .withDeserializers(EscSpiUtils.createEscJsonbDeserializers()).withAdapters(JSONB_ADAPTERS)
- .withPropertyVisibilityStrategy(new FieldAccessStrategy()).withEncoding(Charset.forName("utf-8")).build();
-
- }
-
- /**
- * Helper class for type/class combination.
- */
- private static final class TypeClass {
-
- private final SerializedDataType type;
-
- private final Class> clasz;
-
- /**
- * Constructor with all data.
- *
- * @param type
- * Type.
- * @param clasz
- * Class.
- */
- public TypeClass(final SerializedDataType type, final Class> clasz) {
- super();
- this.type = type;
- this.clasz = clasz;
- }
-
- /**
- * Returns the type.
- *
- * @return Type.
- */
- public SerializedDataType getType() {
- return type;
- }
-
- /**
- * Returns the class.
- *
- * @return Class.
- */
- public Class> getClasz() {
- return clasz;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/java-se-cdi/src/main/java/org/fuin/cqrs4j/example/javasecdi/shared/app/package-info.java b/java-se-cdi/src/main/java/org/fuin/cqrs4j/example/javasecdi/shared/app/package-info.java
deleted file mode 100644
index 018ea17..0000000
--- a/java-se-cdi/src/main/java/org/fuin/cqrs4j/example/javasecdi/shared/app/package-info.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- * Copyright (C) 2015 Michael Schnell. All rights reserved. http://www.fuin.org/
- *
- * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License along with this library. If not, see
- * http://www.gnu.org/licenses/.
- */
-package org.fuin.cqrs4j.example.javasecdi.shared.app;
-
-/**
- * Application specific code to be shared between all modules.
- */
diff --git a/java-se-cdi/src/main/java/org/fuin/cqrs4j/example/javasecdi/shared/package-info.java b/java-se-cdi/src/main/java/org/fuin/cqrs4j/example/javasecdi/shared/package-info.java
deleted file mode 100644
index 448ca1a..0000000
--- a/java-se-cdi/src/main/java/org/fuin/cqrs4j/example/javasecdi/shared/package-info.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- * Copyright (C) 2015 Michael Schnell. All rights reserved. http://www.fuin.org/
- *
- * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License along with this library. If not, see
- * http://www.gnu.org/licenses/.
- */
-package org.fuin.cqrs4j.example.javasecdi.shared;
-
-/**
- * Code shared between command (write) and query (read) modules.
- */
diff --git a/java-se-cdi/src/main/resources/META-INF/beans.xml b/java-se-cdi/src/main/resources/META-INF/beans.xml
deleted file mode 100644
index dba3375..0000000
--- a/java-se-cdi/src/main/resources/META-INF/beans.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
This page is served by Quarkus. The source is in src/main/resources/META-INF/resources/index.html
.