You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by jb...@apache.org on 2016/10/24 19:09:50 UTC
[1/3] activemq-artemis git commit: ARTEMIS-756 Moving Client CDI as a
main module
Repository: activemq-artemis
Updated Branches:
refs/heads/master 35759725f -> bcc90d3f3
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/examples/features/sub-modules/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIExample.java
----------------------------------------------------------------------
diff --git a/examples/features/sub-modules/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIExample.java b/examples/features/sub-modules/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIExample.java
deleted file mode 100644
index bbbf49c..0000000
--- a/examples/features/sub-modules/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIExample.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.activemq.artemis.core.example;
-
-import org.apache.deltaspike.cdise.api.CdiContainer;
-import org.apache.deltaspike.cdise.api.CdiContainerLoader;
-
-/**
- * A simple example using DeltaSpike CDI Control to connect to an external broker
- */
-public class CDIExample {
-
- public static void main(final String[] args) throws Exception {
- CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
- cdiContainer.boot();
-
- cdiContainer.shutdown();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/examples/features/sub-modules/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIMessagingIntegrator.java
----------------------------------------------------------------------
diff --git a/examples/features/sub-modules/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIMessagingIntegrator.java b/examples/features/sub-modules/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIMessagingIntegrator.java
deleted file mode 100644
index a3b530c..0000000
--- a/examples/features/sub-modules/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIMessagingIntegrator.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.activemq.artemis.core.example;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.context.Initialized;
-import javax.enterprise.event.Observes;
-import javax.inject.Inject;
-import javax.jms.JMSContext;
-import javax.jms.Queue;
-
-@ApplicationScoped
-public class CDIMessagingIntegrator {
- @Inject
- private JMSContext context;
- public void init(@Observes @Initialized(ApplicationScoped.class) Object obj) {
- String body = "This is a test";
- Queue queue = context.createQueue("test");
- context.createProducer().send(queue, body);
- String receivedBody = context.createConsumer(queue).receiveBody(String.class, 5000);
- System.out.println("Received a message " + receivedBody);
- }
-}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/examples/features/sub-modules/cdi/src/main/resources/META-INF/apache-deltaspike.properties
----------------------------------------------------------------------
diff --git a/examples/features/sub-modules/cdi/src/main/resources/META-INF/apache-deltaspike.properties b/examples/features/sub-modules/cdi/src/main/resources/META-INF/apache-deltaspike.properties
deleted file mode 100644
index eb75483..0000000
--- a/examples/features/sub-modules/cdi/src/main/resources/META-INF/apache-deltaspike.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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.
-#
-
-username=guest
-password=guest
-url=tcp://localhost:61616
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/examples/features/sub-modules/cdi/src/main/resources/META-INF/beans.xml
----------------------------------------------------------------------
diff --git a/examples/features/sub-modules/cdi/src/main/resources/META-INF/beans.xml b/examples/features/sub-modules/cdi/src/main/resources/META-INF/beans.xml
deleted file mode 100644
index b6f51f1..0000000
--- a/examples/features/sub-modules/cdi/src/main/resources/META-INF/beans.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you 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://xmlns.jcp.org/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
- http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
- bean-discovery-mode="annotated">
-</beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/examples/features/sub-modules/pom.xml
----------------------------------------------------------------------
diff --git a/examples/features/sub-modules/pom.xml b/examples/features/sub-modules/pom.xml
index 79fc7d7..5dfc9cd 100644
--- a/examples/features/sub-modules/pom.xml
+++ b/examples/features/sub-modules/pom.xml
@@ -52,7 +52,6 @@ under the License.
<module>aerogear</module>
<module>artemis-ra-rar</module>
<module>vertx</module>
- <module>cdi</module>
</modules>
</profile>
</profiles>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/integration/artemis-cdi-integration/pom.xml
----------------------------------------------------------------------
diff --git a/integration/artemis-cdi-integration/pom.xml b/integration/artemis-cdi-integration/pom.xml
deleted file mode 100644
index c04ab0c..0000000
--- a/integration/artemis-cdi-integration/pom.xml
+++ /dev/null
@@ -1,121 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you 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.
- -->
-
-<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/xsd/maven-4.0.0.xsd">
- <parent>
- <artifactId>artemis-pom</artifactId>
- <groupId>org.apache.activemq</groupId>
- <version>1.5.0-SNAPSHOT</version>
- <relativePath>../..</relativePath>
- </parent>
- <modelVersion>4.0.0</modelVersion>
-
- <properties>
- <activemq.basedir>${project.basedir}/../../</activemq.basedir>
- </properties>
-
- <artifactId>artemis-cdi-client</artifactId>
- <name>ActiveMQ Artemis CDI Integration</name>
-
- <dependencies>
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-processor</artifactId>
- <scope>provided</scope>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-jms-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-jms-server</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>javax.enterprise</groupId>
- <artifactId>cdi-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.logmanager</groupId>
- <artifactId>jboss-logmanager</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.arquillian.junit</groupId>
- <artifactId>arquillian-junit-container</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- </dependencies>
- <profiles>
- <profile>
- <id>Weld</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <dependencies>
- <dependency>
- <groupId>org.jboss.weld.se</groupId>
- <artifactId>weld-se</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.arquillian.container</groupId>
- <artifactId>arquillian-weld-embedded</artifactId>
- </dependency>
- </dependencies>
- </profile>
- <profile>
- <id>OWB</id>
- <dependencies>
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-impl</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-spi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-resource</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.openwebbeans.arquillian</groupId>
- <artifactId>owb-arquillian-standalone</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-annotation_1.2_spec</artifactId>
- </dependency>
- </dependencies>
- </profile>
- </profiles>
-</project>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/configuration/ArtemisClientConfiguration.java
----------------------------------------------------------------------
diff --git a/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/configuration/ArtemisClientConfiguration.java b/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/configuration/ArtemisClientConfiguration.java
deleted file mode 100644
index 4bd816c..0000000
--- a/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/configuration/ArtemisClientConfiguration.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.artemis.client.cdi.configuration;
-
-import org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory;
-import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory;
-
-public interface ArtemisClientConfiguration {
-
- String IN_VM_CONNECTOR = InVMConnectorFactory.class.getName();
- String REMOTE_CONNECTOR = NettyConnectorFactory.class.getName();
-
- /**
- * @return if present, sends a username for the connection
- */
- String getUsername();
-
- /**
- * @return the password for the connection. If username is set, password must be set
- */
- String getPassword();
-
- /**
- * Either url should be set, or host, port, connector factory should be set.
- *
- * @return if set, will be used in the server locator to look up the server instead of the hostname/port combination
- */
- String getUrl();
-
- /**
- * @return The hostname to connect to
- */
- String getHost();
-
- /**
- * @return the port number to connect to
- */
- Integer getPort();
-
- /**
- * @return the connector factory to use for connections.
- */
- String getConnectorFactory();
-
- /**
- * @return Whether or not to start the embedded broker
- */
- boolean startEmbeddedBroker();
-
- /**
- * @return whether or not this is an HA connection
- */
- boolean isHa();
-
- /**
- * @return whether or not the authentication parameters should be used
- */
- boolean hasAuthentication();
-}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/configuration/DefaultArtemisClientConfigurationImpl.java
----------------------------------------------------------------------
diff --git a/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/configuration/DefaultArtemisClientConfigurationImpl.java b/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/configuration/DefaultArtemisClientConfigurationImpl.java
deleted file mode 100644
index 272e1bf..0000000
--- a/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/configuration/DefaultArtemisClientConfigurationImpl.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.artemis.client.cdi.configuration;
-
-import javax.enterprise.inject.Vetoed;
-import java.util.Map;
-
-@Vetoed
-public class DefaultArtemisClientConfigurationImpl implements ArtemisClientConfiguration {
-
- private String host;
- private Integer port;
- private String url;
- private String username;
- private String password;
- private boolean ha;
-
- public DefaultArtemisClientConfigurationImpl() {
- }
-
- public DefaultArtemisClientConfigurationImpl(Map<String, Object> params) {
- host = (String) params.get("host");
- port = (Integer) params.get("port");
- url = (String) params.get("url");
- username = (String) params.get("username");
- password = (String) params.get("password");
- Boolean isHa = (Boolean) params.get("ha");
- if (isHa == null) {
- isHa = false;
- }
- ha = isHa;
- }
-
- @Override
- public String getHost() {
- return host;
- }
-
- @Override
- public Integer getPort() {
- return port;
- }
-
- @Override
- public String getUsername() {
- return username;
- }
-
- @Override
- public String getPassword() {
- return password;
- }
-
- @Override
- public String getUrl() {
- return url;
- }
-
- @Override
- public String getConnectorFactory() {
- return startEmbeddedBroker() ? IN_VM_CONNECTOR : REMOTE_CONNECTOR;
- }
-
- @Override
- public boolean startEmbeddedBroker() {
- return host == null && url == null;
- }
-
- @Override
- public boolean isHa() {
- return ha;
- }
-
- @Override
- public boolean hasAuthentication() {
- return getUsername() != null && getUsername().length() > 0;
- }
-}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/extension/AnyLiteral.java
----------------------------------------------------------------------
diff --git a/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/extension/AnyLiteral.java b/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/extension/AnyLiteral.java
deleted file mode 100644
index 6d0ccaf..0000000
--- a/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/extension/AnyLiteral.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.artemis.client.cdi.extension;
-
-import javax.enterprise.inject.Any;
-import javax.enterprise.util.AnnotationLiteral;
-
-class AnyLiteral extends AnnotationLiteral<Any> implements Any {
-
- static final Any INSTANCE = new AnyLiteral();
-}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/extension/ArtemisClientConfigBean.java
----------------------------------------------------------------------
diff --git a/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/extension/ArtemisClientConfigBean.java b/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/extension/ArtemisClientConfigBean.java
deleted file mode 100644
index 54f5a7f..0000000
--- a/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/extension/ArtemisClientConfigBean.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.artemis.client.cdi.extension;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.InjectionPoint;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.artemis.client.cdi.configuration.ArtemisClientConfiguration;
-import org.apache.artemis.client.cdi.configuration.DefaultArtemisClientConfigurationImpl;
-
-import static java.util.Collections.emptySet;
-
-class ArtemisClientConfigBean implements Bean<ArtemisClientConfiguration> {
-
- @Override
- public Class<?> getBeanClass() {
- return DefaultArtemisClientConfigurationImpl.class;
- }
-
- @Override
- public Set<InjectionPoint> getInjectionPoints() {
- return emptySet();
- }
-
- @Override
- public boolean isNullable() {
- return false;
- }
-
- @Override
- public ArtemisClientConfiguration create(CreationalContext<ArtemisClientConfiguration> creationalContext) {
- return new DefaultArtemisClientConfigurationImpl();
- }
-
- @Override
- public void destroy(ArtemisClientConfiguration configuration,
- CreationalContext<ArtemisClientConfiguration> creationalContext) {
- }
-
- @Override
- public Set<Type> getTypes() {
- Set<Type> types = new HashSet<>();
- types.add(DefaultArtemisClientConfigurationImpl.class);
- types.add(ArtemisClientConfiguration.class);
- return types;
- }
-
- @Override
- public Set<Annotation> getQualifiers() {
- Set<Annotation> qualifiers = new HashSet<>();
- qualifiers.add(AnyLiteral.INSTANCE);
- qualifiers.add(DefaultLiteral.INSTANCE);
- return qualifiers;
-
- }
-
- @Override
- public Class<? extends Annotation> getScope() {
- return ApplicationScoped.class;
- }
-
- @Override
- public String getName() {
- return null;
- }
-
- @Override
- public Set<Class<? extends Annotation>> getStereotypes() {
- return emptySet();
- }
-
- @Override
- public boolean isAlternative() {
- return false;
- }
-}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/extension/ArtemisEmbeddedServerConfigBean.java
----------------------------------------------------------------------
diff --git a/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/extension/ArtemisEmbeddedServerConfigBean.java b/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/extension/ArtemisEmbeddedServerConfigBean.java
deleted file mode 100644
index 5f38240..0000000
--- a/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/extension/ArtemisEmbeddedServerConfigBean.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.artemis.client.cdi.extension;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.InjectionPoint;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.activemq.artemis.api.core.TransportConfiguration;
-import org.apache.activemq.artemis.core.config.Configuration;
-import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl;
-import org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory;
-
-import static java.util.Collections.emptySet;
-
-public class ArtemisEmbeddedServerConfigBean implements Bean<Configuration> {
-
- @Override
- public Class<?> getBeanClass() {
- return ConfigurationImpl.class;
- }
-
- @Override
- public Set<InjectionPoint> getInjectionPoints() {
- return emptySet();
- }
-
- @Override
- public boolean isNullable() {
- return false;
- }
-
- @Override
- public Configuration create(CreationalContext<Configuration> creationalContext) {
- Map<String, Object> params = new HashMap<>();
- params.put(org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, "1");
- return new ConfigurationImpl().setSecurityEnabled(false).setPersistenceEnabled(false).setJMXManagementEnabled(false).addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getName(), params));
- }
-
- @Override
- public void destroy(Configuration configuration, CreationalContext<Configuration> creationalContext) {
- }
-
- @Override
- public Set<Type> getTypes() {
- Set<Type> types = new HashSet<>();
- types.add(ConfigurationImpl.class);
- types.add(Configuration.class);
- return types;
- }
-
- @Override
- public Set<Annotation> getQualifiers() {
- Set<Annotation> qualifiers = new HashSet<>();
- qualifiers.add(AnyLiteral.INSTANCE);
- qualifiers.add(DefaultLiteral.INSTANCE);
- return qualifiers;
-
- }
-
- @Override
- public Class<? extends Annotation> getScope() {
- return ApplicationScoped.class;
- }
-
- @Override
- public String getName() {
- return null;
- }
-
- @Override
- public Set<Class<? extends Annotation>> getStereotypes() {
- return emptySet();
- }
-
- @Override
- public boolean isAlternative() {
- return false;
- }
-}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/extension/ArtemisExtension.java
----------------------------------------------------------------------
diff --git a/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/extension/ArtemisExtension.java b/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/extension/ArtemisExtension.java
deleted file mode 100644
index d9a0d54..0000000
--- a/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/extension/ArtemisExtension.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.artemis.client.cdi.extension;
-
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.spi.AfterBeanDiscovery;
-import javax.enterprise.inject.spi.Extension;
-import javax.enterprise.inject.spi.ProcessAnnotatedType;
-
-import org.apache.activemq.artemis.core.config.Configuration;
-import org.apache.artemis.client.cdi.configuration.ArtemisClientConfiguration;
-import org.apache.artemis.client.cdi.logger.ActiveMQCDILogger;
-
-public class ArtemisExtension implements Extension {
-
- private boolean foundEmbeddedConfig = false;
- private boolean foundConfiguration = false;
-
- <T extends ArtemisClientConfiguration> void foundClientConfig(@Observes ProcessAnnotatedType<T> pat) {
- ActiveMQCDILogger.LOGGER.discoveredConfiguration(pat);
- foundConfiguration = true;
- }
-
- <T extends Configuration> void foundEmbeddedConfig(@Observes ProcessAnnotatedType<T> pat) {
- ActiveMQCDILogger.LOGGER.discoveredClientConfiguration(pat);
- foundEmbeddedConfig = true;
- }
-
- void afterBeanDiscovery(@Observes AfterBeanDiscovery afterBeanDiscovery) {
- if (!foundConfiguration) {
- afterBeanDiscovery.addBean(new ArtemisClientConfigBean());
- } else {
- ActiveMQCDILogger.LOGGER.notUsingDefaultConfiguration();
- }
- if (!foundEmbeddedConfig) {
- afterBeanDiscovery.addBean(new ArtemisEmbeddedServerConfigBean());
- } else {
- ActiveMQCDILogger.LOGGER.notUsingDefaultClientConfiguration();
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/extension/DefaultLiteral.java
----------------------------------------------------------------------
diff --git a/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/extension/DefaultLiteral.java b/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/extension/DefaultLiteral.java
deleted file mode 100644
index 2280535..0000000
--- a/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/extension/DefaultLiteral.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.artemis.client.cdi.extension;
-
-import javax.enterprise.inject.Default;
-import javax.enterprise.util.AnnotationLiteral;
-
-class DefaultLiteral extends AnnotationLiteral<Default> implements Default {
-
- static final Default INSTANCE = new DefaultLiteral();
-}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/factory/ConnectionFactoryProvider.java
----------------------------------------------------------------------
diff --git a/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/factory/ConnectionFactoryProvider.java b/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/factory/ConnectionFactoryProvider.java
deleted file mode 100644
index b249474..0000000
--- a/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/factory/ConnectionFactoryProvider.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.artemis.client.cdi.factory;
-
-import javax.annotation.PostConstruct;
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.inject.Produces;
-import javax.inject.Inject;
-import javax.jms.JMSContext;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.activemq.artemis.api.core.TransportConfiguration;
-import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
-import org.apache.activemq.artemis.api.jms.JMSFactoryType;
-import org.apache.activemq.artemis.core.config.Configuration;
-import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
-import org.apache.activemq.artemis.core.server.ActiveMQServer;
-import org.apache.activemq.artemis.core.server.ActiveMQServers;
-import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
-import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl;
-import org.apache.artemis.client.cdi.configuration.ArtemisClientConfiguration;
-
-@ApplicationScoped
-public class ConnectionFactoryProvider {
-
- @Produces
- @ApplicationScoped
- private ActiveMQConnectionFactory activeMQConnectionFactory;
-
- @Inject
- private ArtemisClientConfiguration configuration;
-
- @Inject
- private Configuration embeddedConfiguration;
-
- @PostConstruct
- public void setupConnection() {
- if (configuration.startEmbeddedBroker()) {
- try {
- ActiveMQServer activeMQServer = ActiveMQServers.newActiveMQServer(embeddedConfiguration, false);
- JMSServerManagerImpl jmsServerManager = new JMSServerManagerImpl(activeMQServer);
- jmsServerManager.start();
- } catch (Exception e) {
- throw new RuntimeException("Unable to start embedded JMS", e);
- }
- }
-
- try {
- this.activeMQConnectionFactory = createConnectionFactory();
- } catch (Exception e) {
- throw new RuntimeException("Unable to connect to remote server", e);
- }
- }
-
- @Produces
- @ApplicationScoped
- public JMSContext createJMSContext() {
- return this.activeMQConnectionFactory.createContext();
- }
-
- private ActiveMQConnectionFactory createConnectionFactory() throws Exception {
- Map<String, Object> params = new HashMap<>();
- params.put(org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, "1");
- final ActiveMQConnectionFactory activeMQConnectionFactory;
- if (configuration.getUrl() != null) {
- activeMQConnectionFactory = ActiveMQJMSClient.createConnectionFactory(configuration.getUrl(), null);
- } else {
- if (configuration.getHost() != null) {
- params.put(TransportConstants.HOST_PROP_NAME, configuration.getHost());
- params.put(TransportConstants.PORT_PROP_NAME, configuration.getPort());
- }
- if (configuration.isHa()) {
- activeMQConnectionFactory = ActiveMQJMSClient.createConnectionFactoryWithHA(JMSFactoryType.CF, new TransportConfiguration(configuration.getConnectorFactory(), params));
- } else {
- activeMQConnectionFactory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, new TransportConfiguration(configuration.getConnectorFactory(), params));
- }
- }
- if (configuration.hasAuthentication()) {
- activeMQConnectionFactory.setUser(configuration.getUsername());
- activeMQConnectionFactory.setPassword(configuration.getPassword());
- }
- // The CF will probably be GCed since it was injected, so we disable the finalize check
- return activeMQConnectionFactory.disableFinalizeChecks();
- }
-}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/logger/ActiveMQCDILogger.java
----------------------------------------------------------------------
diff --git a/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/logger/ActiveMQCDILogger.java b/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/logger/ActiveMQCDILogger.java
deleted file mode 100644
index fd2f7e7..0000000
--- a/integration/artemis-cdi-integration/src/main/java/org/apache/artemis/client/cdi/logger/ActiveMQCDILogger.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.artemis.client.cdi.logger;
-
-import javax.enterprise.inject.spi.ProcessAnnotatedType;
-
-import org.jboss.logging.BasicLogger;
-import org.jboss.logging.Logger;
-import org.jboss.logging.annotations.LogMessage;
-import org.jboss.logging.annotations.Message;
-import org.jboss.logging.annotations.MessageLogger;
-
-/**
- * Logger code 57
- *
- * each message id must be 6 digits long starting with 57, the 3rd digit donates the level so
- *
- * INF0 1
- * WARN 2
- * DEBUG 3
- * ERROR 4
- * TRACE 5
- * FATAL 6
- *
- * so an INFO message would be 571000 to 571999
- */
-@MessageLogger(projectCode = "AMQ")
-public interface ActiveMQCDILogger extends BasicLogger {
-
- ActiveMQCDILogger LOGGER = Logger.getMessageLogger(ActiveMQCDILogger.class, ActiveMQCDILogger.class.getPackage().getName());
-
- @LogMessage
- @Message(id = 571000, value = "Discovered configuration class {0}", format = Message.Format.MESSAGE_FORMAT)
- void discoveredConfiguration(ProcessAnnotatedType<?> pat);
-
- @LogMessage
- @Message(id = 571001, value = "Discovered client configuration class {0}", format = Message.Format.MESSAGE_FORMAT)
- void discoveredClientConfiguration(ProcessAnnotatedType<?> pat);
-
- @LogMessage(level = Logger.Level.DEBUG)
- @Message(id = 573000, value = "Configuration found, not using built in configuration")
- void notUsingDefaultConfiguration();
-
- @LogMessage(level = Logger.Level.DEBUG)
- @Message(id = 573001, value = "Configuration found, not using built in configuration")
- void notUsingDefaultClientConfiguration();
-}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/integration/artemis-cdi-integration/src/main/resources/META-INF/beans.xml
----------------------------------------------------------------------
diff --git a/integration/artemis-cdi-integration/src/main/resources/META-INF/beans.xml b/integration/artemis-cdi-integration/src/main/resources/META-INF/beans.xml
deleted file mode 100644
index b6f51f1..0000000
--- a/integration/artemis-cdi-integration/src/main/resources/META-INF/beans.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you 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://xmlns.jcp.org/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
- http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
- bean-discovery-mode="annotated">
-</beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/integration/artemis-cdi-integration/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
----------------------------------------------------------------------
diff --git a/integration/artemis-cdi-integration/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension b/integration/artemis-cdi-integration/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
deleted file mode 100644
index 81282d4..0000000
--- a/integration/artemis-cdi-integration/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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.artemis.client.cdi.extension.ArtemisExtension
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/integration/artemis-cdi-integration/src/test/java/org/apache/activemq/artemis/cdi/bootstrap/CDIBootstrapTest.java
----------------------------------------------------------------------
diff --git a/integration/artemis-cdi-integration/src/test/java/org/apache/activemq/artemis/cdi/bootstrap/CDIBootstrapTest.java b/integration/artemis-cdi-integration/src/test/java/org/apache/activemq/artemis/cdi/bootstrap/CDIBootstrapTest.java
deleted file mode 100644
index 84afda7..0000000
--- a/integration/artemis-cdi-integration/src/test/java/org/apache/activemq/artemis/cdi/bootstrap/CDIBootstrapTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.activemq.artemis.cdi.bootstrap;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.inject.spi.Extension;
-import javax.inject.Inject;
-import javax.jms.JMSContext;
-import javax.jms.Queue;
-
-import org.apache.artemis.client.cdi.configuration.ArtemisClientConfiguration;
-import org.apache.artemis.client.cdi.configuration.DefaultArtemisClientConfigurationImpl;
-import org.apache.artemis.client.cdi.extension.ArtemisExtension;
-import org.apache.artemis.client.cdi.factory.ConnectionFactoryProvider;
-import org.jboss.arquillian.container.test.api.Deployment;
-import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.ShrinkWrap;
-import org.jboss.shrinkwrap.api.asset.EmptyAsset;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static org.junit.Assert.assertEquals;
-
-@RunWith(Arquillian.class)
-public class CDIBootstrapTest {
-
- @Deployment
- public static Archive<?> createArchive() {
- return ShrinkWrap.create(JavaArchive.class).addAsServiceProviderAndClasses(Extension.class, ArtemisExtension.class).addClasses(NativeConfig.class, ConnectionFactoryProvider.class).addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
- }
-
- @Inject
- private JMSContext jmsContext;
-
- @Test
- public void shouldStartJMS() throws Exception {
- String body = "This is a test";
- Queue queue = jmsContext.createQueue("test");
- jmsContext.createProducer().send(queue, body);
- String receivedBody = jmsContext.createConsumer(queue).receiveBody(String.class, 5000);
- Assert.assertNotNull(receivedBody);
- assertEquals(body, receivedBody);
- }
-
- @ApplicationScoped
- public static class NativeConfig extends DefaultArtemisClientConfigurationImpl {
-
- @Override
- public String getConnectorFactory() {
- return ArtemisClientConfiguration.IN_VM_CONNECTOR;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index d040375..4978f98 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,6 +32,7 @@
<modules>
<module>artemis-protocols</module>
<module>artemis-dto</module>
+ <module>artemis-cdi-client</module>
<module>artemis-boot</module>
<module>artemis-web</module>
<module>artemis-website</module>
@@ -54,7 +55,6 @@
<module>integration/activemq-spring-integration</module>
<module>integration/activemq-aerogear-integration</module>
<module>integration/activemq-vertx-integration</module>
- <module>integration/artemis-cdi-integration</module>
<module>artemis-distribution</module>
<module>tests</module>
<module>artemis-features</module>
[3/3] activemq-artemis git commit: This closes #861
Posted by jb...@apache.org.
This closes #861
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/bcc90d3f
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/bcc90d3f
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/bcc90d3f
Branch: refs/heads/master
Commit: bcc90d3f3c7288d3ec3e4a4f39033bbadd7f8c73
Parents: 3575972 b23207c
Author: jbertram <jb...@apache.com>
Authored: Mon Oct 24 14:01:09 2016 -0500
Committer: jbertram <jb...@apache.com>
Committed: Mon Oct 24 14:01:09 2016 -0500
----------------------------------------------------------------------
artemis-cdi-client/pom.xml | 121 +++++++++
.../ArtemisClientConfiguration.java | 76 ++++++
.../DefaultArtemisClientConfigurationImpl.java | 95 +++++++
.../client/cdi/extension/AnyLiteral.java | 28 +++
.../cdi/extension/ArtemisClientConfigBean.java | 99 ++++++++
.../ArtemisEmbeddedServerConfigBean.java | 104 ++++++++
.../client/cdi/extension/ArtemisExtension.java | 60 +++++
.../client/cdi/extension/DefaultLiteral.java | 28 +++
.../cdi/factory/ConnectionFactoryProvider.java | 103 ++++++++
.../client/cdi/logger/ActiveMQCDILogger.java | 64 +++++
.../src/main/resources/META-INF/beans.xml | 25 ++
.../javax.enterprise.inject.spi.Extension | 20 ++
.../artemis/cdi/bootstrap/CDIBootstrapTest.java | 73 ++++++
examples/features/standard/cdi/pom.xml | 252 +++++++++++++++++++
examples/features/standard/cdi/readme.md | 86 +++++++
.../artemis/core/example/CDIClientConfig.java | 87 +++++++
.../artemis/core/example/CDIExample.java | 36 +++
.../core/example/CDIMessagingIntegrator.java | 40 +++
.../META-INF/apache-deltaspike.properties | 22 ++
.../cdi/src/main/resources/META-INF/beans.xml | 25 ++
examples/features/standard/pom.xml | 2 +
examples/features/sub-modules/cdi/pom.xml | 252 -------------------
examples/features/sub-modules/cdi/readme.md | 86 -------
.../artemis/core/example/CDIClientConfig.java | 87 -------
.../artemis/core/example/CDIExample.java | 36 ---
.../core/example/CDIMessagingIntegrator.java | 40 ---
.../META-INF/apache-deltaspike.properties | 22 --
.../cdi/src/main/resources/META-INF/beans.xml | 25 --
examples/features/sub-modules/pom.xml | 1 -
integration/artemis-cdi-integration/pom.xml | 121 ---------
.../ArtemisClientConfiguration.java | 76 ------
.../DefaultArtemisClientConfigurationImpl.java | 95 -------
.../client/cdi/extension/AnyLiteral.java | 28 ---
.../cdi/extension/ArtemisClientConfigBean.java | 99 --------
.../ArtemisEmbeddedServerConfigBean.java | 104 --------
.../client/cdi/extension/ArtemisExtension.java | 60 -----
.../client/cdi/extension/DefaultLiteral.java | 28 ---
.../cdi/factory/ConnectionFactoryProvider.java | 103 --------
.../client/cdi/logger/ActiveMQCDILogger.java | 64 -----
.../src/main/resources/META-INF/beans.xml | 25 --
.../javax.enterprise.inject.spi.Extension | 20 --
.../artemis/cdi/bootstrap/CDIBootstrapTest.java | 73 ------
pom.xml | 2 +-
43 files changed, 1447 insertions(+), 1446 deletions(-)
----------------------------------------------------------------------
[2/3] activemq-artemis git commit: ARTEMIS-756 Moving Client CDI as a
main module
Posted by jb...@apache.org.
ARTEMIS-756 Moving Client CDI as a main module
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/b23207c0
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/b23207c0
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/b23207c0
Branch: refs/heads/master
Commit: b23207c019ea807791bfde2531c75bd5fa18f952
Parents: 3575972
Author: Clebert Suconic <cl...@apache.org>
Authored: Mon Oct 24 11:26:32 2016 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon Oct 24 12:12:18 2016 -0400
----------------------------------------------------------------------
artemis-cdi-client/pom.xml | 121 +++++++++
.../ArtemisClientConfiguration.java | 76 ++++++
.../DefaultArtemisClientConfigurationImpl.java | 95 +++++++
.../client/cdi/extension/AnyLiteral.java | 28 +++
.../cdi/extension/ArtemisClientConfigBean.java | 99 ++++++++
.../ArtemisEmbeddedServerConfigBean.java | 104 ++++++++
.../client/cdi/extension/ArtemisExtension.java | 60 +++++
.../client/cdi/extension/DefaultLiteral.java | 28 +++
.../cdi/factory/ConnectionFactoryProvider.java | 103 ++++++++
.../client/cdi/logger/ActiveMQCDILogger.java | 64 +++++
.../src/main/resources/META-INF/beans.xml | 25 ++
.../javax.enterprise.inject.spi.Extension | 20 ++
.../artemis/cdi/bootstrap/CDIBootstrapTest.java | 73 ++++++
examples/features/standard/cdi/pom.xml | 252 +++++++++++++++++++
examples/features/standard/cdi/readme.md | 86 +++++++
.../artemis/core/example/CDIClientConfig.java | 87 +++++++
.../artemis/core/example/CDIExample.java | 36 +++
.../core/example/CDIMessagingIntegrator.java | 40 +++
.../META-INF/apache-deltaspike.properties | 22 ++
.../cdi/src/main/resources/META-INF/beans.xml | 25 ++
examples/features/standard/pom.xml | 2 +
examples/features/sub-modules/cdi/pom.xml | 252 -------------------
examples/features/sub-modules/cdi/readme.md | 86 -------
.../artemis/core/example/CDIClientConfig.java | 87 -------
.../artemis/core/example/CDIExample.java | 36 ---
.../core/example/CDIMessagingIntegrator.java | 40 ---
.../META-INF/apache-deltaspike.properties | 22 --
.../cdi/src/main/resources/META-INF/beans.xml | 25 --
examples/features/sub-modules/pom.xml | 1 -
integration/artemis-cdi-integration/pom.xml | 121 ---------
.../ArtemisClientConfiguration.java | 76 ------
.../DefaultArtemisClientConfigurationImpl.java | 95 -------
.../client/cdi/extension/AnyLiteral.java | 28 ---
.../cdi/extension/ArtemisClientConfigBean.java | 99 --------
.../ArtemisEmbeddedServerConfigBean.java | 104 --------
.../client/cdi/extension/ArtemisExtension.java | 60 -----
.../client/cdi/extension/DefaultLiteral.java | 28 ---
.../cdi/factory/ConnectionFactoryProvider.java | 103 --------
.../client/cdi/logger/ActiveMQCDILogger.java | 64 -----
.../src/main/resources/META-INF/beans.xml | 25 --
.../javax.enterprise.inject.spi.Extension | 20 --
.../artemis/cdi/bootstrap/CDIBootstrapTest.java | 73 ------
pom.xml | 2 +-
43 files changed, 1447 insertions(+), 1446 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/artemis-cdi-client/pom.xml
----------------------------------------------------------------------
diff --git a/artemis-cdi-client/pom.xml b/artemis-cdi-client/pom.xml
new file mode 100644
index 0000000..0d9f887
--- /dev/null
+++ b/artemis-cdi-client/pom.xml
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you 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.
+ -->
+
+<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/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>artemis-pom</artifactId>
+ <groupId>org.apache.activemq</groupId>
+ <version>1.5.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <properties>
+ <activemq.basedir>${project.basedir}/..</activemq.basedir>
+ </properties>
+
+ <artifactId>artemis-cdi-client</artifactId>
+ <name>ActiveMQ Artemis CDI Integration</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-processor</artifactId>
+ <scope>provided</scope>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-jms-client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-jms-server</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.logmanager</groupId>
+ <artifactId>jboss-logmanager</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.junit</groupId>
+ <artifactId>arquillian-junit-container</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+ <profiles>
+ <profile>
+ <id>Weld</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.weld.se</groupId>
+ <artifactId>weld-se</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-weld-embedded</artifactId>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>OWB</id>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-resource</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans.arquillian</groupId>
+ <artifactId>owb-arquillian-standalone</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-annotation_1.2_spec</artifactId>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+</project>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/configuration/ArtemisClientConfiguration.java
----------------------------------------------------------------------
diff --git a/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/configuration/ArtemisClientConfiguration.java b/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/configuration/ArtemisClientConfiguration.java
new file mode 100644
index 0000000..4bd816c
--- /dev/null
+++ b/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/configuration/ArtemisClientConfiguration.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.artemis.client.cdi.configuration;
+
+import org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory;
+import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory;
+
+public interface ArtemisClientConfiguration {
+
+ String IN_VM_CONNECTOR = InVMConnectorFactory.class.getName();
+ String REMOTE_CONNECTOR = NettyConnectorFactory.class.getName();
+
+ /**
+ * @return if present, sends a username for the connection
+ */
+ String getUsername();
+
+ /**
+ * @return the password for the connection. If username is set, password must be set
+ */
+ String getPassword();
+
+ /**
+ * Either url should be set, or host, port, connector factory should be set.
+ *
+ * @return if set, will be used in the server locator to look up the server instead of the hostname/port combination
+ */
+ String getUrl();
+
+ /**
+ * @return The hostname to connect to
+ */
+ String getHost();
+
+ /**
+ * @return the port number to connect to
+ */
+ Integer getPort();
+
+ /**
+ * @return the connector factory to use for connections.
+ */
+ String getConnectorFactory();
+
+ /**
+ * @return Whether or not to start the embedded broker
+ */
+ boolean startEmbeddedBroker();
+
+ /**
+ * @return whether or not this is an HA connection
+ */
+ boolean isHa();
+
+ /**
+ * @return whether or not the authentication parameters should be used
+ */
+ boolean hasAuthentication();
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/configuration/DefaultArtemisClientConfigurationImpl.java
----------------------------------------------------------------------
diff --git a/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/configuration/DefaultArtemisClientConfigurationImpl.java b/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/configuration/DefaultArtemisClientConfigurationImpl.java
new file mode 100644
index 0000000..272e1bf
--- /dev/null
+++ b/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/configuration/DefaultArtemisClientConfigurationImpl.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.artemis.client.cdi.configuration;
+
+import javax.enterprise.inject.Vetoed;
+import java.util.Map;
+
+@Vetoed
+public class DefaultArtemisClientConfigurationImpl implements ArtemisClientConfiguration {
+
+ private String host;
+ private Integer port;
+ private String url;
+ private String username;
+ private String password;
+ private boolean ha;
+
+ public DefaultArtemisClientConfigurationImpl() {
+ }
+
+ public DefaultArtemisClientConfigurationImpl(Map<String, Object> params) {
+ host = (String) params.get("host");
+ port = (Integer) params.get("port");
+ url = (String) params.get("url");
+ username = (String) params.get("username");
+ password = (String) params.get("password");
+ Boolean isHa = (Boolean) params.get("ha");
+ if (isHa == null) {
+ isHa = false;
+ }
+ ha = isHa;
+ }
+
+ @Override
+ public String getHost() {
+ return host;
+ }
+
+ @Override
+ public Integer getPort() {
+ return port;
+ }
+
+ @Override
+ public String getUsername() {
+ return username;
+ }
+
+ @Override
+ public String getPassword() {
+ return password;
+ }
+
+ @Override
+ public String getUrl() {
+ return url;
+ }
+
+ @Override
+ public String getConnectorFactory() {
+ return startEmbeddedBroker() ? IN_VM_CONNECTOR : REMOTE_CONNECTOR;
+ }
+
+ @Override
+ public boolean startEmbeddedBroker() {
+ return host == null && url == null;
+ }
+
+ @Override
+ public boolean isHa() {
+ return ha;
+ }
+
+ @Override
+ public boolean hasAuthentication() {
+ return getUsername() != null && getUsername().length() > 0;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/extension/AnyLiteral.java
----------------------------------------------------------------------
diff --git a/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/extension/AnyLiteral.java b/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/extension/AnyLiteral.java
new file mode 100644
index 0000000..6d0ccaf
--- /dev/null
+++ b/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/extension/AnyLiteral.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.artemis.client.cdi.extension;
+
+import javax.enterprise.inject.Any;
+import javax.enterprise.util.AnnotationLiteral;
+
+class AnyLiteral extends AnnotationLiteral<Any> implements Any {
+
+ static final Any INSTANCE = new AnyLiteral();
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/extension/ArtemisClientConfigBean.java
----------------------------------------------------------------------
diff --git a/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/extension/ArtemisClientConfigBean.java b/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/extension/ArtemisClientConfigBean.java
new file mode 100644
index 0000000..54f5a7f
--- /dev/null
+++ b/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/extension/ArtemisClientConfigBean.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.artemis.client.cdi.extension;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.artemis.client.cdi.configuration.ArtemisClientConfiguration;
+import org.apache.artemis.client.cdi.configuration.DefaultArtemisClientConfigurationImpl;
+
+import static java.util.Collections.emptySet;
+
+class ArtemisClientConfigBean implements Bean<ArtemisClientConfiguration> {
+
+ @Override
+ public Class<?> getBeanClass() {
+ return DefaultArtemisClientConfigurationImpl.class;
+ }
+
+ @Override
+ public Set<InjectionPoint> getInjectionPoints() {
+ return emptySet();
+ }
+
+ @Override
+ public boolean isNullable() {
+ return false;
+ }
+
+ @Override
+ public ArtemisClientConfiguration create(CreationalContext<ArtemisClientConfiguration> creationalContext) {
+ return new DefaultArtemisClientConfigurationImpl();
+ }
+
+ @Override
+ public void destroy(ArtemisClientConfiguration configuration,
+ CreationalContext<ArtemisClientConfiguration> creationalContext) {
+ }
+
+ @Override
+ public Set<Type> getTypes() {
+ Set<Type> types = new HashSet<>();
+ types.add(DefaultArtemisClientConfigurationImpl.class);
+ types.add(ArtemisClientConfiguration.class);
+ return types;
+ }
+
+ @Override
+ public Set<Annotation> getQualifiers() {
+ Set<Annotation> qualifiers = new HashSet<>();
+ qualifiers.add(AnyLiteral.INSTANCE);
+ qualifiers.add(DefaultLiteral.INSTANCE);
+ return qualifiers;
+
+ }
+
+ @Override
+ public Class<? extends Annotation> getScope() {
+ return ApplicationScoped.class;
+ }
+
+ @Override
+ public String getName() {
+ return null;
+ }
+
+ @Override
+ public Set<Class<? extends Annotation>> getStereotypes() {
+ return emptySet();
+ }
+
+ @Override
+ public boolean isAlternative() {
+ return false;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/extension/ArtemisEmbeddedServerConfigBean.java
----------------------------------------------------------------------
diff --git a/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/extension/ArtemisEmbeddedServerConfigBean.java b/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/extension/ArtemisEmbeddedServerConfigBean.java
new file mode 100644
index 0000000..5f38240
--- /dev/null
+++ b/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/extension/ArtemisEmbeddedServerConfigBean.java
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.artemis.client.cdi.extension;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.activemq.artemis.api.core.TransportConfiguration;
+import org.apache.activemq.artemis.core.config.Configuration;
+import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl;
+import org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory;
+
+import static java.util.Collections.emptySet;
+
+public class ArtemisEmbeddedServerConfigBean implements Bean<Configuration> {
+
+ @Override
+ public Class<?> getBeanClass() {
+ return ConfigurationImpl.class;
+ }
+
+ @Override
+ public Set<InjectionPoint> getInjectionPoints() {
+ return emptySet();
+ }
+
+ @Override
+ public boolean isNullable() {
+ return false;
+ }
+
+ @Override
+ public Configuration create(CreationalContext<Configuration> creationalContext) {
+ Map<String, Object> params = new HashMap<>();
+ params.put(org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, "1");
+ return new ConfigurationImpl().setSecurityEnabled(false).setPersistenceEnabled(false).setJMXManagementEnabled(false).addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getName(), params));
+ }
+
+ @Override
+ public void destroy(Configuration configuration, CreationalContext<Configuration> creationalContext) {
+ }
+
+ @Override
+ public Set<Type> getTypes() {
+ Set<Type> types = new HashSet<>();
+ types.add(ConfigurationImpl.class);
+ types.add(Configuration.class);
+ return types;
+ }
+
+ @Override
+ public Set<Annotation> getQualifiers() {
+ Set<Annotation> qualifiers = new HashSet<>();
+ qualifiers.add(AnyLiteral.INSTANCE);
+ qualifiers.add(DefaultLiteral.INSTANCE);
+ return qualifiers;
+
+ }
+
+ @Override
+ public Class<? extends Annotation> getScope() {
+ return ApplicationScoped.class;
+ }
+
+ @Override
+ public String getName() {
+ return null;
+ }
+
+ @Override
+ public Set<Class<? extends Annotation>> getStereotypes() {
+ return emptySet();
+ }
+
+ @Override
+ public boolean isAlternative() {
+ return false;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/extension/ArtemisExtension.java
----------------------------------------------------------------------
diff --git a/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/extension/ArtemisExtension.java b/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/extension/ArtemisExtension.java
new file mode 100644
index 0000000..d9a0d54
--- /dev/null
+++ b/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/extension/ArtemisExtension.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.artemis.client.cdi.extension;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+
+import org.apache.activemq.artemis.core.config.Configuration;
+import org.apache.artemis.client.cdi.configuration.ArtemisClientConfiguration;
+import org.apache.artemis.client.cdi.logger.ActiveMQCDILogger;
+
+public class ArtemisExtension implements Extension {
+
+ private boolean foundEmbeddedConfig = false;
+ private boolean foundConfiguration = false;
+
+ <T extends ArtemisClientConfiguration> void foundClientConfig(@Observes ProcessAnnotatedType<T> pat) {
+ ActiveMQCDILogger.LOGGER.discoveredConfiguration(pat);
+ foundConfiguration = true;
+ }
+
+ <T extends Configuration> void foundEmbeddedConfig(@Observes ProcessAnnotatedType<T> pat) {
+ ActiveMQCDILogger.LOGGER.discoveredClientConfiguration(pat);
+ foundEmbeddedConfig = true;
+ }
+
+ void afterBeanDiscovery(@Observes AfterBeanDiscovery afterBeanDiscovery) {
+ if (!foundConfiguration) {
+ afterBeanDiscovery.addBean(new ArtemisClientConfigBean());
+ } else {
+ ActiveMQCDILogger.LOGGER.notUsingDefaultConfiguration();
+ }
+ if (!foundEmbeddedConfig) {
+ afterBeanDiscovery.addBean(new ArtemisEmbeddedServerConfigBean());
+ } else {
+ ActiveMQCDILogger.LOGGER.notUsingDefaultClientConfiguration();
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/extension/DefaultLiteral.java
----------------------------------------------------------------------
diff --git a/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/extension/DefaultLiteral.java b/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/extension/DefaultLiteral.java
new file mode 100644
index 0000000..2280535
--- /dev/null
+++ b/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/extension/DefaultLiteral.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.artemis.client.cdi.extension;
+
+import javax.enterprise.inject.Default;
+import javax.enterprise.util.AnnotationLiteral;
+
+class DefaultLiteral extends AnnotationLiteral<Default> implements Default {
+
+ static final Default INSTANCE = new DefaultLiteral();
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/factory/ConnectionFactoryProvider.java
----------------------------------------------------------------------
diff --git a/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/factory/ConnectionFactoryProvider.java b/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/factory/ConnectionFactoryProvider.java
new file mode 100644
index 0000000..b249474
--- /dev/null
+++ b/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/factory/ConnectionFactoryProvider.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.artemis.client.cdi.factory;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+import javax.jms.JMSContext;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.activemq.artemis.api.core.TransportConfiguration;
+import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
+import org.apache.activemq.artemis.api.jms.JMSFactoryType;
+import org.apache.activemq.artemis.core.config.Configuration;
+import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
+import org.apache.activemq.artemis.core.server.ActiveMQServer;
+import org.apache.activemq.artemis.core.server.ActiveMQServers;
+import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
+import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl;
+import org.apache.artemis.client.cdi.configuration.ArtemisClientConfiguration;
+
+@ApplicationScoped
+public class ConnectionFactoryProvider {
+
+ @Produces
+ @ApplicationScoped
+ private ActiveMQConnectionFactory activeMQConnectionFactory;
+
+ @Inject
+ private ArtemisClientConfiguration configuration;
+
+ @Inject
+ private Configuration embeddedConfiguration;
+
+ @PostConstruct
+ public void setupConnection() {
+ if (configuration.startEmbeddedBroker()) {
+ try {
+ ActiveMQServer activeMQServer = ActiveMQServers.newActiveMQServer(embeddedConfiguration, false);
+ JMSServerManagerImpl jmsServerManager = new JMSServerManagerImpl(activeMQServer);
+ jmsServerManager.start();
+ } catch (Exception e) {
+ throw new RuntimeException("Unable to start embedded JMS", e);
+ }
+ }
+
+ try {
+ this.activeMQConnectionFactory = createConnectionFactory();
+ } catch (Exception e) {
+ throw new RuntimeException("Unable to connect to remote server", e);
+ }
+ }
+
+ @Produces
+ @ApplicationScoped
+ public JMSContext createJMSContext() {
+ return this.activeMQConnectionFactory.createContext();
+ }
+
+ private ActiveMQConnectionFactory createConnectionFactory() throws Exception {
+ Map<String, Object> params = new HashMap<>();
+ params.put(org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, "1");
+ final ActiveMQConnectionFactory activeMQConnectionFactory;
+ if (configuration.getUrl() != null) {
+ activeMQConnectionFactory = ActiveMQJMSClient.createConnectionFactory(configuration.getUrl(), null);
+ } else {
+ if (configuration.getHost() != null) {
+ params.put(TransportConstants.HOST_PROP_NAME, configuration.getHost());
+ params.put(TransportConstants.PORT_PROP_NAME, configuration.getPort());
+ }
+ if (configuration.isHa()) {
+ activeMQConnectionFactory = ActiveMQJMSClient.createConnectionFactoryWithHA(JMSFactoryType.CF, new TransportConfiguration(configuration.getConnectorFactory(), params));
+ } else {
+ activeMQConnectionFactory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, new TransportConfiguration(configuration.getConnectorFactory(), params));
+ }
+ }
+ if (configuration.hasAuthentication()) {
+ activeMQConnectionFactory.setUser(configuration.getUsername());
+ activeMQConnectionFactory.setPassword(configuration.getPassword());
+ }
+ // The CF will probably be GCed since it was injected, so we disable the finalize check
+ return activeMQConnectionFactory.disableFinalizeChecks();
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/logger/ActiveMQCDILogger.java
----------------------------------------------------------------------
diff --git a/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/logger/ActiveMQCDILogger.java b/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/logger/ActiveMQCDILogger.java
new file mode 100644
index 0000000..fd2f7e7
--- /dev/null
+++ b/artemis-cdi-client/src/main/java/org/apache/artemis/client/cdi/logger/ActiveMQCDILogger.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.artemis.client.cdi.logger;
+
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+
+import org.jboss.logging.BasicLogger;
+import org.jboss.logging.Logger;
+import org.jboss.logging.annotations.LogMessage;
+import org.jboss.logging.annotations.Message;
+import org.jboss.logging.annotations.MessageLogger;
+
+/**
+ * Logger code 57
+ *
+ * each message id must be 6 digits long starting with 57, the 3rd digit donates the level so
+ *
+ * INF0 1
+ * WARN 2
+ * DEBUG 3
+ * ERROR 4
+ * TRACE 5
+ * FATAL 6
+ *
+ * so an INFO message would be 571000 to 571999
+ */
+@MessageLogger(projectCode = "AMQ")
+public interface ActiveMQCDILogger extends BasicLogger {
+
+ ActiveMQCDILogger LOGGER = Logger.getMessageLogger(ActiveMQCDILogger.class, ActiveMQCDILogger.class.getPackage().getName());
+
+ @LogMessage
+ @Message(id = 571000, value = "Discovered configuration class {0}", format = Message.Format.MESSAGE_FORMAT)
+ void discoveredConfiguration(ProcessAnnotatedType<?> pat);
+
+ @LogMessage
+ @Message(id = 571001, value = "Discovered client configuration class {0}", format = Message.Format.MESSAGE_FORMAT)
+ void discoveredClientConfiguration(ProcessAnnotatedType<?> pat);
+
+ @LogMessage(level = Logger.Level.DEBUG)
+ @Message(id = 573000, value = "Configuration found, not using built in configuration")
+ void notUsingDefaultConfiguration();
+
+ @LogMessage(level = Logger.Level.DEBUG)
+ @Message(id = 573001, value = "Configuration found, not using built in configuration")
+ void notUsingDefaultClientConfiguration();
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/artemis-cdi-client/src/main/resources/META-INF/beans.xml
----------------------------------------------------------------------
diff --git a/artemis-cdi-client/src/main/resources/META-INF/beans.xml b/artemis-cdi-client/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000..b6f51f1
--- /dev/null
+++ b/artemis-cdi-client/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,25 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you 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://xmlns.jcp.org/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
+ http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
+ bean-discovery-mode="annotated">
+</beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/artemis-cdi-client/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
----------------------------------------------------------------------
diff --git a/artemis-cdi-client/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension b/artemis-cdi-client/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
new file mode 100644
index 0000000..81282d4
--- /dev/null
+++ b/artemis-cdi-client/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
@@ -0,0 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.artemis.client.cdi.extension.ArtemisExtension
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/artemis-cdi-client/src/test/java/org/apache/activemq/artemis/cdi/bootstrap/CDIBootstrapTest.java
----------------------------------------------------------------------
diff --git a/artemis-cdi-client/src/test/java/org/apache/activemq/artemis/cdi/bootstrap/CDIBootstrapTest.java b/artemis-cdi-client/src/test/java/org/apache/activemq/artemis/cdi/bootstrap/CDIBootstrapTest.java
new file mode 100644
index 0000000..84afda7
--- /dev/null
+++ b/artemis-cdi-client/src/test/java/org/apache/activemq/artemis/cdi/bootstrap/CDIBootstrapTest.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.activemq.artemis.cdi.bootstrap;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.spi.Extension;
+import javax.inject.Inject;
+import javax.jms.JMSContext;
+import javax.jms.Queue;
+
+import org.apache.artemis.client.cdi.configuration.ArtemisClientConfiguration;
+import org.apache.artemis.client.cdi.configuration.DefaultArtemisClientConfigurationImpl;
+import org.apache.artemis.client.cdi.extension.ArtemisExtension;
+import org.apache.artemis.client.cdi.factory.ConnectionFactoryProvider;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.assertEquals;
+
+@RunWith(Arquillian.class)
+public class CDIBootstrapTest {
+
+ @Deployment
+ public static Archive<?> createArchive() {
+ return ShrinkWrap.create(JavaArchive.class).addAsServiceProviderAndClasses(Extension.class, ArtemisExtension.class).addClasses(NativeConfig.class, ConnectionFactoryProvider.class).addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+ }
+
+ @Inject
+ private JMSContext jmsContext;
+
+ @Test
+ public void shouldStartJMS() throws Exception {
+ String body = "This is a test";
+ Queue queue = jmsContext.createQueue("test");
+ jmsContext.createProducer().send(queue, body);
+ String receivedBody = jmsContext.createConsumer(queue).receiveBody(String.class, 5000);
+ Assert.assertNotNull(receivedBody);
+ assertEquals(body, receivedBody);
+ }
+
+ @ApplicationScoped
+ public static class NativeConfig extends DefaultArtemisClientConfigurationImpl {
+
+ @Override
+ public String getConnectorFactory() {
+ return ArtemisClientConfiguration.IN_VM_CONNECTOR;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/examples/features/standard/cdi/pom.xml
----------------------------------------------------------------------
diff --git a/examples/features/standard/cdi/pom.xml b/examples/features/standard/cdi/pom.xml
new file mode 100644
index 0000000..567bef4
--- /dev/null
+++ b/examples/features/standard/cdi/pom.xml
@@ -0,0 +1,252 @@
+<?xml version='1.0'?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you 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.
+ -->
+
+<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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.activemq.examples.broker</groupId>
+ <artifactId>jms-examples</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>artemis-cdi-example</artifactId>
+ <packaging>jar</packaging>
+ <name>ActiveMQ Artemis CDI Example</name>
+
+ <properties>
+ <activemq.basedir>${project.basedir}/../../../..</activemq.basedir>
+ <deltaspike.version>1.7.1</deltaspike.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-server</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-core-client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-commons</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-all</artifactId>
+ <version>${netty.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_2.0_spec</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-cdi-client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.deltaspike.cdictrl</groupId>
+ <artifactId>deltaspike-cdictrl-api</artifactId>
+ <version>${deltaspike.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.deltaspike.core</groupId>
+ <artifactId>deltaspike-core-api</artifactId>
+ <version>${deltaspike.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.deltaspike.core</groupId>
+ <artifactId>deltaspike-core-impl</artifactId>
+ <version>${deltaspike.version}</version>
+ </dependency>
+ </dependencies>
+ <profiles>
+ <profile>
+ <id>Weld</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>create0</id>
+ <goals>
+ <goal>create</goal>
+ </goals>
+ <configuration>
+ <libListWithDeps>
+ <arg>org.apache.activemq.examples.broker:artemis-cdi-example:${project.version}</arg>
+ </libListWithDeps>
+
+ <instance>${basedir}/target/server0</instance>
+ <configuration>${basedir}/target/classes/activemq/server0</configuration>
+ </configuration>
+ </execution>
+ <execution>
+ <id>start0</id>
+ <goals>
+ <goal>cli</goal>
+ </goals>
+ <configuration>
+ <ignore>${noServer}</ignore>
+ <spawn>true</spawn>
+ <location>${basedir}/target/server0</location>
+ <testURI>tcp://localhost:61616</testURI>
+ <args>
+ <param>run</param>
+ </args>
+ <name>server0</name>
+ </configuration>
+ </execution>
+ <execution>
+ <id>runClient</id>
+ <goals>
+ <goal>runClient</goal>
+ </goals>
+ <configuration>
+ <clientClass>org.apache.activemq.artemis.core.example.CDIExample</clientClass>
+ </configuration>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.activemq.examples.broker</groupId>
+ <artifactId>artemis-cdi-example</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.weld.se</groupId>
+ <artifactId>weld-se</artifactId>
+ <version>${weld.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.deltaspike.cdictrl</groupId>
+ <artifactId>deltaspike-cdictrl-weld</artifactId>
+ <version>${deltaspike.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>OWB</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>create0</id>
+ <goals>
+ <goal>create</goal>
+ </goals>
+ <configuration>
+ <libListWithDeps>
+ <arg>org.apache.activemq.examples.broker:artemis-cdi-example:${project.version}</arg>
+ </libListWithDeps>
+
+ <instance>${basedir}/target/server0</instance>
+ <configuration>${basedir}/target/classes/activemq/server0</configuration>
+ </configuration>
+ </execution>
+ <execution>
+ <id>start0</id>
+ <goals>
+ <goal>cli</goal>
+ </goals>
+ <configuration>
+ <ignore>${noServer}</ignore>
+ <spawn>true</spawn>
+ <location>${basedir}/target/server0</location>
+ <testURI>tcp://localhost:61616</testURI>
+ <args>
+ <param>run</param>
+ </args>
+ <name>server0</name>
+ </configuration>
+ </execution>
+ <execution>
+ <id>runClient</id>
+ <goals>
+ <goal>runClient</goal>
+ </goals>
+ <configuration>
+ <clientClass>org.apache.activemq.artemis.core.example.CDIExample</clientClass>
+ </configuration>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.activemq.examples.broker</groupId>
+ <artifactId>artemis-cdi-example</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
+ <version>${cdi-api.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ <version>${owb.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <version>${owb.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-resource</artifactId>
+ <version>${owb.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-annotation_1.2_spec</artifactId>
+ <version>${geronimo-annotation_1.2_spec.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.deltaspike.cdictrl</groupId>
+ <artifactId>deltaspike-cdictrl-owb</artifactId>
+ <version>${deltaspike.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/examples/features/standard/cdi/readme.md
----------------------------------------------------------------------
diff --git a/examples/features/standard/cdi/readme.md b/examples/features/standard/cdi/readme.md
new file mode 100644
index 0000000..7e981ca
--- /dev/null
+++ b/examples/features/standard/cdi/readme.md
@@ -0,0 +1,86 @@
+<!--
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+#
+-->
+# ActiveMQ Artemis CDI Integration Example
+
+This is a simple example that demonstrates how to use CDI to integrate with ActiveMQ Artemis on the client side. It is designed mainly for connecting to a remote broker rather than embedding within your application.
+
+## Configuring the connection
+
+While the integration provides an out of the box solution for configuration with some sensible defaults, the values should be configurable. This example leverages [Apache DeltaSpike](https://deltaspike.apache.org) to configure the connectivity. It overrides the username, password and URL for the broker. The configuration hard codes the connector class. This configuration class is a standard CDI bean.
+
+```
+@ApplicationScoped
+public class CDIClientConfig implements ArtemisClientConfiguration {
+ @Inject
+ @ConfigProperty(name = "username")
+ private String username;
+
+ @Inject
+ @ConfigProperty(name = "password")
+ private String password;
+
+ @Inject
+ @ConfigProperty(name = "url")
+ private String url;
+
+ @Override
+ public String getUsername() {
+ return username;
+ }
+
+ @Override
+ public String getPassword() {
+ return password;
+ }
+
+ @Override
+ public String getUrl() {
+ return url;
+ }
+
+ @Override
+ public String getConnectorFactory() {
+ return "org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory";
+ }
+}
+```
+
+## Setup and Tear Down
+
+For the example, we leverage DeltaSpike's Container Control to start and stop the container. It is implemented within the main method, and is done in a way to make this work for both Weld and OpenWebBeans.
+
+## Sending and Receiving Messages
+
+The key to how the CDI integration works is the built in beans. It provides two out of the box - a `ConnectionFactory` and a `JMSContext`. Most operations should be performed against the JMS 2.0 simplified API using `JMSContext`. The example does this via an observer method, but can be done anywhere.
+
+```
+@ApplicationScoped
+public class CDIMessagingIntegrator {
+ @Inject
+ private JMSContext context;
+ public void init(@Observes @Initialized(ApplicationScoped.class) Object obj) {
+ String body = "This is a test";
+ Queue queue = context.createQueue("test");
+ context.createProducer().send(queue, body);
+ String receivedBody = context.createConsumer(queue).receiveBody(String.class, 5000);
+ System.out.println("Received a message "+receivedBody);
+ }
+}
+```
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/examples/features/standard/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIClientConfig.java
----------------------------------------------------------------------
diff --git a/examples/features/standard/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIClientConfig.java b/examples/features/standard/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIClientConfig.java
new file mode 100644
index 0000000..93037ca
--- /dev/null
+++ b/examples/features/standard/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIClientConfig.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.activemq.artemis.core.example;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+
+import org.apache.artemis.client.cdi.configuration.ArtemisClientConfiguration;
+import org.apache.deltaspike.core.api.config.ConfigProperty;
+
+@ApplicationScoped
+public class CDIClientConfig implements ArtemisClientConfiguration {
+ @Inject
+ @ConfigProperty(name = "username")
+ private String username;
+
+ @Inject
+ @ConfigProperty(name = "password")
+ private String password;
+
+ @Inject
+ @ConfigProperty(name = "url")
+ private String url;
+
+
+ @Override
+ public String getUsername() {
+ return username;
+ }
+
+ @Override
+ public String getPassword() {
+ return password;
+ }
+
+ @Override
+ public String getUrl() {
+ return url;
+ }
+
+ @Override
+ public String getHost() {
+ return null;
+ }
+
+ @Override
+ public Integer getPort() {
+ return null;
+ }
+
+ @Override
+ public String getConnectorFactory() {
+ return "org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory";
+ }
+
+ @Override
+ public boolean startEmbeddedBroker() {
+ return false;
+ }
+
+ @Override
+ public boolean isHa() {
+ return false;
+ }
+
+ @Override
+ public boolean hasAuthentication() {
+ return false;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/examples/features/standard/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIExample.java
----------------------------------------------------------------------
diff --git a/examples/features/standard/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIExample.java b/examples/features/standard/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIExample.java
new file mode 100644
index 0000000..bbbf49c
--- /dev/null
+++ b/examples/features/standard/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIExample.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.activemq.artemis.core.example;
+
+import org.apache.deltaspike.cdise.api.CdiContainer;
+import org.apache.deltaspike.cdise.api.CdiContainerLoader;
+
+/**
+ * A simple example using DeltaSpike CDI Control to connect to an external broker
+ */
+public class CDIExample {
+
+ public static void main(final String[] args) throws Exception {
+ CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
+ cdiContainer.boot();
+
+ cdiContainer.shutdown();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/examples/features/standard/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIMessagingIntegrator.java
----------------------------------------------------------------------
diff --git a/examples/features/standard/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIMessagingIntegrator.java b/examples/features/standard/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIMessagingIntegrator.java
new file mode 100644
index 0000000..a3b530c
--- /dev/null
+++ b/examples/features/standard/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIMessagingIntegrator.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.activemq.artemis.core.example;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.Initialized;
+import javax.enterprise.event.Observes;
+import javax.inject.Inject;
+import javax.jms.JMSContext;
+import javax.jms.Queue;
+
+@ApplicationScoped
+public class CDIMessagingIntegrator {
+ @Inject
+ private JMSContext context;
+ public void init(@Observes @Initialized(ApplicationScoped.class) Object obj) {
+ String body = "This is a test";
+ Queue queue = context.createQueue("test");
+ context.createProducer().send(queue, body);
+ String receivedBody = context.createConsumer(queue).receiveBody(String.class, 5000);
+ System.out.println("Received a message " + receivedBody);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/examples/features/standard/cdi/src/main/resources/META-INF/apache-deltaspike.properties
----------------------------------------------------------------------
diff --git a/examples/features/standard/cdi/src/main/resources/META-INF/apache-deltaspike.properties b/examples/features/standard/cdi/src/main/resources/META-INF/apache-deltaspike.properties
new file mode 100644
index 0000000..eb75483
--- /dev/null
+++ b/examples/features/standard/cdi/src/main/resources/META-INF/apache-deltaspike.properties
@@ -0,0 +1,22 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+#
+
+username=guest
+password=guest
+url=tcp://localhost:61616
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/examples/features/standard/cdi/src/main/resources/META-INF/beans.xml
----------------------------------------------------------------------
diff --git a/examples/features/standard/cdi/src/main/resources/META-INF/beans.xml b/examples/features/standard/cdi/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000..b6f51f1
--- /dev/null
+++ b/examples/features/standard/cdi/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,25 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you 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://xmlns.jcp.org/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
+ http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
+ bean-discovery-mode="annotated">
+</beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/examples/features/standard/pom.xml
----------------------------------------------------------------------
diff --git a/examples/features/standard/pom.xml b/examples/features/standard/pom.xml
index 610b289..84c4197 100644
--- a/examples/features/standard/pom.xml
+++ b/examples/features/standard/pom.xml
@@ -43,6 +43,7 @@ under the License.
<modules>
<module>bridge</module>
<module>browser</module>
+ <module>cdi</module>
<module>client-kickoff</module>
<module>consumer-rate-limit</module>
<module>dead-letter</module>
@@ -104,6 +105,7 @@ under the License.
<modules>
<module>bridge</module>
<module>browser</module>
+ <module>cdi</module>
<module>client-kickoff</module>
<module>consumer-rate-limit</module>
<module>dead-letter</module>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/examples/features/sub-modules/cdi/pom.xml
----------------------------------------------------------------------
diff --git a/examples/features/sub-modules/cdi/pom.xml b/examples/features/sub-modules/cdi/pom.xml
deleted file mode 100644
index 30580d5..0000000
--- a/examples/features/sub-modules/cdi/pom.xml
+++ /dev/null
@@ -1,252 +0,0 @@
-<?xml version='1.0'?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you 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.
- -->
-
-<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">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.activemq.examples.modules</groupId>
- <artifactId>broker-modules</artifactId>
- <version>1.5.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>artemis-cdi-example</artifactId>
- <packaging>jar</packaging>
- <name>ActiveMQ Artemis CDI Example</name>
-
- <properties>
- <activemq.basedir>${project.basedir}/../../../..</activemq.basedir>
- <deltaspike.version>1.7.1</deltaspike.version>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-server</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-core-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-commons</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-all</artifactId>
- <version>${netty.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_2.0_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-cdi-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.deltaspike.cdictrl</groupId>
- <artifactId>deltaspike-cdictrl-api</artifactId>
- <version>${deltaspike.version}</version>
- </dependency>
- <dependency>
- <groupId>javax.enterprise</groupId>
- <artifactId>cdi-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.deltaspike.core</groupId>
- <artifactId>deltaspike-core-api</artifactId>
- <version>${deltaspike.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.deltaspike.core</groupId>
- <artifactId>deltaspike-core-impl</artifactId>
- <version>${deltaspike.version}</version>
- </dependency>
- </dependencies>
- <profiles>
- <profile>
- <id>Weld</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>create0</id>
- <goals>
- <goal>create</goal>
- </goals>
- <configuration>
- <libListWithDeps>
- <arg>org.apache.activemq.examples.modules:artemis-cdi-example:${project.version}</arg>
- </libListWithDeps>
-
- <instance>${basedir}/target/server0</instance>
- <configuration>${basedir}/target/classes/activemq/server0</configuration>
- </configuration>
- </execution>
- <execution>
- <id>start0</id>
- <goals>
- <goal>cli</goal>
- </goals>
- <configuration>
- <ignore>${noServer}</ignore>
- <spawn>true</spawn>
- <location>${basedir}/target/server0</location>
- <testURI>tcp://localhost:61616</testURI>
- <args>
- <param>run</param>
- </args>
- <name>server0</name>
- </configuration>
- </execution>
- <execution>
- <id>runClient</id>
- <goals>
- <goal>runClient</goal>
- </goals>
- <configuration>
- <clientClass>org.apache.activemq.artemis.core.example.CDIExample</clientClass>
- </configuration>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.apache.activemq.examples.modules</groupId>
- <artifactId>artemis-cdi-example</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.weld.se</groupId>
- <artifactId>weld-se</artifactId>
- <version>${weld.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.deltaspike.cdictrl</groupId>
- <artifactId>deltaspike-cdictrl-weld</artifactId>
- <version>${deltaspike.version}</version>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>OWB</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>create0</id>
- <goals>
- <goal>create</goal>
- </goals>
- <configuration>
- <libListWithDeps>
- <arg>org.apache.activemq.examples.modules:artemis-cdi-example:${project.version}</arg>
- </libListWithDeps>
-
- <instance>${basedir}/target/server0</instance>
- <configuration>${basedir}/target/classes/activemq/server0</configuration>
- </configuration>
- </execution>
- <execution>
- <id>start0</id>
- <goals>
- <goal>cli</goal>
- </goals>
- <configuration>
- <ignore>${noServer}</ignore>
- <spawn>true</spawn>
- <location>${basedir}/target/server0</location>
- <testURI>tcp://localhost:61616</testURI>
- <args>
- <param>run</param>
- </args>
- <name>server0</name>
- </configuration>
- </execution>
- <execution>
- <id>runClient</id>
- <goals>
- <goal>runClient</goal>
- </goals>
- <configuration>
- <clientClass>org.apache.activemq.artemis.core.example.CDIExample</clientClass>
- </configuration>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.apache.activemq.examples.modules</groupId>
- <artifactId>artemis-cdi-example</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>javax.enterprise</groupId>
- <artifactId>cdi-api</artifactId>
- <version>${cdi-api.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-impl</artifactId>
- <version>${owb.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-spi</artifactId>
- <version>${owb.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-resource</artifactId>
- <version>${owb.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-annotation_1.2_spec</artifactId>
- <version>${geronimo-annotation_1.2_spec.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.deltaspike.cdictrl</groupId>
- <artifactId>deltaspike-cdictrl-owb</artifactId>
- <version>${deltaspike.version}</version>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-</project>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/examples/features/sub-modules/cdi/readme.md
----------------------------------------------------------------------
diff --git a/examples/features/sub-modules/cdi/readme.md b/examples/features/sub-modules/cdi/readme.md
deleted file mode 100644
index 7e981ca..0000000
--- a/examples/features/sub-modules/cdi/readme.md
+++ /dev/null
@@ -1,86 +0,0 @@
-<!--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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.
-#
--->
-# ActiveMQ Artemis CDI Integration Example
-
-This is a simple example that demonstrates how to use CDI to integrate with ActiveMQ Artemis on the client side. It is designed mainly for connecting to a remote broker rather than embedding within your application.
-
-## Configuring the connection
-
-While the integration provides an out of the box solution for configuration with some sensible defaults, the values should be configurable. This example leverages [Apache DeltaSpike](https://deltaspike.apache.org) to configure the connectivity. It overrides the username, password and URL for the broker. The configuration hard codes the connector class. This configuration class is a standard CDI bean.
-
-```
-@ApplicationScoped
-public class CDIClientConfig implements ArtemisClientConfiguration {
- @Inject
- @ConfigProperty(name = "username")
- private String username;
-
- @Inject
- @ConfigProperty(name = "password")
- private String password;
-
- @Inject
- @ConfigProperty(name = "url")
- private String url;
-
- @Override
- public String getUsername() {
- return username;
- }
-
- @Override
- public String getPassword() {
- return password;
- }
-
- @Override
- public String getUrl() {
- return url;
- }
-
- @Override
- public String getConnectorFactory() {
- return "org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory";
- }
-}
-```
-
-## Setup and Tear Down
-
-For the example, we leverage DeltaSpike's Container Control to start and stop the container. It is implemented within the main method, and is done in a way to make this work for both Weld and OpenWebBeans.
-
-## Sending and Receiving Messages
-
-The key to how the CDI integration works is the built in beans. It provides two out of the box - a `ConnectionFactory` and a `JMSContext`. Most operations should be performed against the JMS 2.0 simplified API using `JMSContext`. The example does this via an observer method, but can be done anywhere.
-
-```
-@ApplicationScoped
-public class CDIMessagingIntegrator {
- @Inject
- private JMSContext context;
- public void init(@Observes @Initialized(ApplicationScoped.class) Object obj) {
- String body = "This is a test";
- Queue queue = context.createQueue("test");
- context.createProducer().send(queue, body);
- String receivedBody = context.createConsumer(queue).receiveBody(String.class, 5000);
- System.out.println("Received a message "+receivedBody);
- }
-}
-```
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b23207c0/examples/features/sub-modules/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIClientConfig.java
----------------------------------------------------------------------
diff --git a/examples/features/sub-modules/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIClientConfig.java b/examples/features/sub-modules/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIClientConfig.java
deleted file mode 100644
index 93037ca..0000000
--- a/examples/features/sub-modules/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIClientConfig.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.activemq.artemis.core.example;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Inject;
-
-import org.apache.artemis.client.cdi.configuration.ArtemisClientConfiguration;
-import org.apache.deltaspike.core.api.config.ConfigProperty;
-
-@ApplicationScoped
-public class CDIClientConfig implements ArtemisClientConfiguration {
- @Inject
- @ConfigProperty(name = "username")
- private String username;
-
- @Inject
- @ConfigProperty(name = "password")
- private String password;
-
- @Inject
- @ConfigProperty(name = "url")
- private String url;
-
-
- @Override
- public String getUsername() {
- return username;
- }
-
- @Override
- public String getPassword() {
- return password;
- }
-
- @Override
- public String getUrl() {
- return url;
- }
-
- @Override
- public String getHost() {
- return null;
- }
-
- @Override
- public Integer getPort() {
- return null;
- }
-
- @Override
- public String getConnectorFactory() {
- return "org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory";
- }
-
- @Override
- public boolean startEmbeddedBroker() {
- return false;
- }
-
- @Override
- public boolean isHa() {
- return false;
- }
-
- @Override
- public boolean hasAuthentication() {
- return false;
- }
-}