This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit 3d72d77345322cb3e685a82ac40a4b462f6754da Author: Andrea Cosentino <[email protected]> AuthorDate: Wed Jul 31 12:03:18 2019 +0200 CAMEL-13806: Removed camel-ejb --- apache-camel/pom.xml | 5 - apache-camel/src/main/descriptors/common-bin.xml | 1 - bom/camel-bom/pom.xml | 5 - .../catalog/maven/MavenVersionManagerTest.java | 4 - .../catalog/karaf/KarafRuntimeProviderTest.java | 2 - .../springboot/SpringBootRuntimeProviderTest.java | 2 - components/camel-ejb/pom.xml | 117 ----------- .../camel-ejb/src/main/docs/ejb-component.adoc | 225 --------------------- .../apache/camel/component/ejb/EjbComponent.java | 88 -------- .../apache/camel/component/ejb/EjbEndpoint.java | 32 --- .../camel/component/ejb/EjbRegistryBean.java | 45 ----- .../camel/component/ejb/GreaterCamelBeanTest.java | 60 ------ .../ejb/GreaterCamelEjbPropertiesTest.java | 68 ------- .../camel/component/ejb/GreaterCamelEjbTest.java | 78 ------- .../apache/camel/component/ejb/GreaterImpl.java | 34 ---- .../apache/camel/component/ejb/GreaterLocal.java | 27 --- .../apache/camel/component/ejb/GreaterTest.java | 50 ----- .../component/ejb/SpringGreaterCamelEjbTest.java | 46 ----- .../src/test/resources/META-INF/ejb-jar.xml | 20 -- .../camel-ejb/src/test/resources/log4j2.properties | 32 --- .../component/ejb/SpringGreaterCamelEjbTest.xml | 52 ----- components/pom.xml | 1 - .../endpoint/dsl/EjbEndpointBuilderFactory.java | 187 ----------------- .../modules/ROOT/pages/ejb-component.adoc | 225 --------------------- parent/pom.xml | 5 - .../spring-boot/components-starter/README.adoc | 1 - .../camel-spring-boot-dependencies/pom.xml | 5 - .../maven/packaging/SpringBootStarterMojo.java | 2 +- 28 files changed, 1 insertion(+), 1418 deletions(-) diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml index 4602f94..a176f70 100644 --- a/apache-camel/pom.xml +++ b/apache-camel/pom.xml @@ -509,11 +509,6 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-ejb</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> <artifactId>camel-elasticsearch-rest</artifactId> <version>${project.version}</version> </dependency> diff --git a/apache-camel/src/main/descriptors/common-bin.xml b/apache-camel/src/main/descriptors/common-bin.xml index 65ff6c2..e7c1720 100644 --- a/apache-camel/src/main/descriptors/common-bin.xml +++ b/apache-camel/src/main/descriptors/common-bin.xml @@ -122,7 +122,6 @@ <include>org.apache.camel:camel-drill</include> <include>org.apache.camel:camel-dropbox</include> <include>org.apache.camel:camel-ehcache</include> - <include>org.apache.camel:camel-ejb</include> <include>org.apache.camel:camel-elasticsearch-rest</include> <include>org.apache.camel:camel-elsql</include> <include>org.apache.camel:camel-etcd</include> diff --git a/bom/camel-bom/pom.xml b/bom/camel-bom/pom.xml index 3b06a18..b8ca5bc 100644 --- a/bom/camel-bom/pom.xml +++ b/bom/camel-bom/pom.xml @@ -904,11 +904,6 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-ejb</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> <artifactId>camel-elasticsearch-rest</artifactId> <version>${project.version}</version> </dependency> diff --git a/catalog/camel-catalog-maven/src/test/java/org/apache/camel/catalog/maven/MavenVersionManagerTest.java b/catalog/camel-catalog-maven/src/test/java/org/apache/camel/catalog/maven/MavenVersionManagerTest.java index 584c100..2aa84db 100644 --- a/catalog/camel-catalog-maven/src/test/java/org/apache/camel/catalog/maven/MavenVersionManagerTest.java +++ b/catalog/camel-catalog-maven/src/test/java/org/apache/camel/catalog/maven/MavenVersionManagerTest.java @@ -105,8 +105,6 @@ public class MavenVersionManagerTest extends Assert { assertTrue(names.contains("file")); assertTrue(names.contains("ftp")); assertTrue(names.contains("jms")); - // camel-ejb does not work in spring-boot - assertFalse(names.contains("ejb")); // camel-pax-logging does not work in spring-boot assertFalse(names.contains("paxlogging")); } @@ -133,8 +131,6 @@ public class MavenVersionManagerTest extends Assert { assertTrue(names.contains("file")); assertTrue(names.contains("ftp")); assertTrue(names.contains("jms")); - // camel-ejb does not work in spring-boot - assertFalse(names.contains("ejb")); // camel-pax-logging does not work in spring-boot assertFalse(names.contains("paxlogging")); } diff --git a/catalog/camel-catalog-provider-karaf/src/test/java/org/apache/camel/catalog/karaf/KarafRuntimeProviderTest.java b/catalog/camel-catalog-provider-karaf/src/test/java/org/apache/camel/catalog/karaf/KarafRuntimeProviderTest.java index 2f24904..5e1d148 100644 --- a/catalog/camel-catalog-provider-karaf/src/test/java/org/apache/camel/catalog/karaf/KarafRuntimeProviderTest.java +++ b/catalog/camel-catalog-provider-karaf/src/test/java/org/apache/camel/catalog/karaf/KarafRuntimeProviderTest.java @@ -62,8 +62,6 @@ public class KarafRuntimeProviderTest { assertTrue(names.contains("ftp")); assertTrue(names.contains("paxlogging")); - // camel-ejb does not work in Karaf - assertFalse(names.contains("ejb")); } @Test diff --git a/catalog/camel-catalog-provider-springboot/src/test/java/org/apache/camel/catalog/springboot/SpringBootRuntimeProviderTest.java b/catalog/camel-catalog-provider-springboot/src/test/java/org/apache/camel/catalog/springboot/SpringBootRuntimeProviderTest.java index a588360..5afd845 100644 --- a/catalog/camel-catalog-provider-springboot/src/test/java/org/apache/camel/catalog/springboot/SpringBootRuntimeProviderTest.java +++ b/catalog/camel-catalog-provider-springboot/src/test/java/org/apache/camel/catalog/springboot/SpringBootRuntimeProviderTest.java @@ -62,8 +62,6 @@ public class SpringBootRuntimeProviderTest { assertTrue(names.contains("file")); assertTrue(names.contains("ftp")); assertTrue(names.contains("jms")); - // camel-ejb does not work in spring-boot - assertFalse(names.contains("ejb")); // camel-pac-logging does not work in spring-boot assertFalse(names.contains("paxlogging")); } diff --git a/components/camel-ejb/pom.xml b/components/camel-ejb/pom.xml deleted file mode 100644 index b5c12f2..0000000 --- a/components/camel-ejb/pom.xml +++ /dev/null @@ -1,117 +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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - 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.camel</groupId> - <artifactId>components</artifactId> - <version>3.0.0-SNAPSHOT</version> - </parent> - - <artifactId>camel-ejb</artifactId> - <packaging>jar</packaging> - <name>Camel :: EJB</name> - <description>Camel EJB support</description> - - <dependencies> - - <!-- requires camel-core JndiRegistry --> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-core</artifactId> - </dependency> - <!-- this is an extension to the bean component --> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-bean</artifactId> - </dependency> - - <!-- testing --> - <dependency> - <groupId>org.apache.openejb</groupId> - <artifactId>openejb-core</artifactId> - <version>${openejb-version}</version> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-jdk14</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-test-spring</artifactId> - <scope>test</scope> - </dependency> - <!-- relying on the xbean-asm5-shaded version (currently 4.2) transitively through --> - <!-- the 'org.apache.openejb:openejb-core' dependency would cause the tests to fail --> - <dependency> - <groupId>org.apache.xbean</groupId> - <artifactId>xbean-asm5-shaded</artifactId> - <version>${xbean-asm5-shaded-version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-api</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-slf4j-impl</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - </dependencies> - - <profiles> - <profile> - <id>jdk9+-build</id> - <activation> - <jdk>[9,)</jdk> - </activation> - <build> - <plugins> - <plugin> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <excludes> - <!--TODO: See https://issues.apache.org/jira/browse/TOMEE-2038 for more details--> - <exclude>**/**.java</exclude> - </excludes> - </configuration> - </plugin> - </plugins> - </build> - </profile> - </profiles> -</project> diff --git a/components/camel-ejb/src/main/docs/ejb-component.adoc b/components/camel-ejb/src/main/docs/ejb-component.adoc deleted file mode 100644 index 0b81640..0000000 --- a/components/camel-ejb/src/main/docs/ejb-component.adoc +++ /dev/null @@ -1,225 +0,0 @@ -[[ejb-component]] -= EJB Component - -*Available as of Camel version 2.4* - -The EJB component binds EJBs to Camel message exchanges. - -Maven users will need to add the following dependency to their `pom.xml` -for this component: - -[source,xml] ------------------------------------------------------------- -<dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-ejb</artifactId> - <version>x.x.x</version> - <!-- use the same version as your Camel core version --> -</dependency> ------------------------------------------------------------- - -== URI format - -[source,java] ---------------------- -ejb:ejbName[?options] ---------------------- - -Where *ejbName* can be any string which is used to look up the EJB in -the Application Server JNDI Registry - -== Options - - - -// component options: START -The EJB component supports 5 options, which are listed below. - - - -[width="100%",cols="2,5,^1,2",options="header"] -|=== -| Name | Description | Default | Type -| *context* (producer) | The Context to use for looking up the EJBs | | Context -| *properties* (producer) | Properties for creating javax.naming.Context if a context has not been configured. | | Properties -| *cache* (advanced) | If enabled, Camel will cache the result of the first Registry look-up. Cache can be enabled if the bean in the Registry is defined as a singleton scope. | | Boolean -| *resolveProperty Placeholders* (advanced) | Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders. | true | boolean -| *basicPropertyBinding* (advanced) | Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean -|=== -// component options: END - - - - -// endpoint options: START -The EJB endpoint is configured using URI syntax: - ----- -ejb:beanName ----- - -with the following path and query parameters: - -=== Path Parameters (1 parameters): - - -[width="100%",cols="2,5,^1,2",options="header"] -|=== -| Name | Description | Default | Type -| *beanName* | *Required* Sets the name of the bean to invoke | | String -|=== - - -=== Query Parameters (6 parameters): - - -[width="100%",cols="2,5,^1,2",options="header"] -|=== -| Name | Description | Default | Type -| *cache* (common) | If enabled, Camel will cache the result of the first Registry look-up. Cache can be enabled if the bean in the Registry is defined as a singleton scope. | | Boolean -| *method* (common) | Sets the name of the method to invoke on the bean | | String -| *parameters* (common) | Used for configuring additional properties on the bean | | Map -| *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] -| *basicPropertyBinding* (advanced) | Whether the endpoint should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean -| *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean -|=== -// endpoint options: END - - -== Bean Binding - -How bean methods to be invoked are chosen (if they are not specified -explicitly through the *method* parameter) and how parameter values are -constructed from the Message are all defined by the -Bean Binding mechanism which is used throughout -all of the various Bean Integration -mechanisms in Camel. - -== Examples - -In the following examples we use the Greater EJB which is defined as -follows: - -*GreaterLocal.java* - -[source,java] -------------------------------------------------------------------------------------------------------------------------------------------------------------- -public interface GreaterLocal { - - String hello(String name); - - String bye(String name); - -} -------------------------------------------------------------------------------------------------------------------------------------------------------------- - -And the implementation - -*GreaterImpl.java* - -[source,java] -------------------------------------------------------------------------------------------------------------------------------------------------------------- -@Stateless -public class GreaterImpl implements GreaterLocal { - - public String hello(String name) { - return "Hello " + name; - } - - public String bye(String name) { - return "Bye " + name; - } - -} -------------------------------------------------------------------------------------------------------------------------------------------------------------- - -=== Using Java DSL - -In this example we want to invoke the `hello` method on the EJB. Since -this example is based on an unit test using Apache OpenEJB we have to -set a `JndiContext` on the xref:ejb-component.adoc[EJB] component with the OpenEJB -settings. - -[source,java] -------------------------------------------------------------------------------------------------------------------------------------------------------------- -@Override -protected CamelContext createCamelContext() throws Exception { - CamelContext answer = new DefaultCamelContext(); - - // enlist EJB component using the JndiContext - EjbComponent ejb = answer.getComponent("ejb", EjbComponent.class); - ejb.setContext(createEjbContext()); - - return answer; -} - -private static Context createEjbContext() throws NamingException { - // here we need to define our context factory to use OpenEJB for our testing - Properties properties = new Properties(); - properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory"); - - return new InitialContext(properties); -} -------------------------------------------------------------------------------------------------------------------------------------------------------------- - -Then we are ready to use the EJB in the Camel route: - -[source,java] -------------------------------------------------------------------------------------------------------------------------------------------------------------- -from("direct:start") - // invoke the greeter EJB using the local interface and invoke the hello method - .to("ejb:GreaterImplLocal?method=hello") - .to("mock:result"); -------------------------------------------------------------------------------------------------------------------------------------------------------------- - -*In a real application server* - -In a real application server you most likely do not have to setup a -`JndiContext` on the xref:ejb-component.adoc[EJB] component as it will create a -default `JndiContext` on the same JVM as the application server, which -usually allows it to access the JNDI registry and lookup the -xref:ejb-component.adoc[EJB]s. However if you need to access a application server on a remote JVM or -the likes, you have to prepare the properties beforehand. - -=== Using Spring XML - -And this is the same example using Spring XML instead: - -Again since this is based on an unit test we need to setup the -xref:ejb-component.adoc[EJB] component: - -[source,XML] -------------------------------------------------------------------------------------------------------------------------------------------------------------- -<!-- setup Camel EJB component --> -<bean id="ejb" class="org.apache.camel.component.ejb.EjbComponent"> - <property name="properties" ref="jndiProperties"/> -</bean> - -<!-- use OpenEJB context factory --> -<p:properties id="jndiProperties"> - <prop key="java.naming.factory.initial">org.apache.openejb.client.LocalInitialContextFactory</prop> -</p:properties> -------------------------------------------------------------------------------------------------------------------------------------------------------------- - -Before we are ready to use xref:ejb-component.adoc[EJB] in the Camel routes: - -[source,XML] -------------------------------------------------------------------------------------------------------------------------------------------------------------- -<camelContext xmlns="http://camel.apache.org/schema/spring"> - <route> - <from uri="direct:start"/> - <to uri="ejb:GreaterImplLocal?method=hello"/> - <to uri="mock:result"/> - </route> -</camelContext> -------------------------------------------------------------------------------------------------------------------------------------------------------------- - -== See Also - -* Configuring Camel -* Component -* Endpoint -* Getting Started -* xref:bean-component.adoc[Bean] -* Bean Binding -* Bean Integration diff --git a/components/camel-ejb/src/main/java/org/apache/camel/component/ejb/EjbComponent.java b/components/camel-ejb/src/main/java/org/apache/camel/component/ejb/EjbComponent.java deleted file mode 100644 index e69e328..0000000 --- a/components/camel-ejb/src/main/java/org/apache/camel/component/ejb/EjbComponent.java +++ /dev/null @@ -1,88 +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.camel.component.ejb; - -import java.util.Map; -import java.util.Properties; - -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; - -import org.apache.camel.Endpoint; -import org.apache.camel.component.bean.BeanComponent; -import org.apache.camel.component.bean.BeanHolder; -import org.apache.camel.spi.annotations.Component; -import org.apache.camel.support.jndi.JndiBeanRepository; - -/** - * EJB component to invoke EJBs like the {@link org.apache.camel.component.bean.BeanComponent}. - */ -@Component("ejb") -public class EjbComponent extends BeanComponent { - - private Context context; - private Properties properties; - - public EjbComponent() { - } - - @Override - protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { - EjbEndpoint answer = new EjbEndpoint(uri, this); - answer.setBeanName(remaining); - - // plugin registry to lookup in jndi for the EJBs - JndiBeanRepository registry = new JndiBeanRepository(getContext()); - // and register the bean as a holder on the endpoint - BeanHolder holder = new EjbRegistryBean(registry, getCamelContext(), answer.getBeanName()); - answer.setBeanHolder(holder); - - return answer; - } - - public Context getContext() throws NamingException { - return context; - } - - /** - * The Context to use for looking up the EJBs - */ - public void setContext(Context context) { - this.context = context; - } - - public Properties getProperties() { - return properties; - } - - /** - * Properties for creating javax.naming.Context if a context has not been configured. - */ - public void setProperties(Properties properties) { - this.properties = properties; - } - - @Override - protected void doStart() throws Exception { - super.doStart(); - - if (context == null && properties != null) { - context = new InitialContext(getProperties()); - } - } -} diff --git a/components/camel-ejb/src/main/java/org/apache/camel/component/ejb/EjbEndpoint.java b/components/camel-ejb/src/main/java/org/apache/camel/component/ejb/EjbEndpoint.java deleted file mode 100644 index 6542e92..0000000 --- a/components/camel-ejb/src/main/java/org/apache/camel/component/ejb/EjbEndpoint.java +++ /dev/null @@ -1,32 +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.camel.component.ejb; - -import org.apache.camel.Component; -import org.apache.camel.component.bean.BeanEndpoint; -import org.apache.camel.spi.UriEndpoint; - -/** - * The ejb component is for invoking EJB Java beans from Camel. - */ -@UriEndpoint(firstVersion = "2.4.0", scheme = "ejb", title = "EJB", syntax = "ejb:beanName", producerOnly = true, label = "endpoint,java") -public class EjbEndpoint extends BeanEndpoint { - - public EjbEndpoint(String endpointUri, Component component) { - super(endpointUri, component); - } -} diff --git a/components/camel-ejb/src/main/java/org/apache/camel/component/ejb/EjbRegistryBean.java b/components/camel-ejb/src/main/java/org/apache/camel/component/ejb/EjbRegistryBean.java deleted file mode 100644 index 1a97998..0000000 --- a/components/camel-ejb/src/main/java/org/apache/camel/component/ejb/EjbRegistryBean.java +++ /dev/null @@ -1,45 +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.camel.component.ejb; - -import org.apache.camel.CamelContext; -import org.apache.camel.component.bean.RegistryBean; -import org.apache.camel.support.jndi.JndiBeanRepository; - -/** - * An implementation of a {@link org.apache.camel.component.bean.BeanHolder} which will look up - * an EJB bean from the JNDI {@link javax.naming.Context} - */ -public class EjbRegistryBean extends RegistryBean { - - private JndiBeanRepository registry; - - public EjbRegistryBean(JndiBeanRepository registry, CamelContext context, String name) { - super(context, name); - this.registry = registry; - } - - @Override - public String toString() { - return "ejb: " + getName(); - } - - protected Object lookupBean() { - return registry.lookupByName(getName()); - } - -} diff --git a/components/camel-ejb/src/test/java/org/apache/camel/component/ejb/GreaterCamelBeanTest.java b/components/camel-ejb/src/test/java/org/apache/camel/component/ejb/GreaterCamelBeanTest.java deleted file mode 100644 index a5371f1..0000000 --- a/components/camel-ejb/src/test/java/org/apache/camel/component/ejb/GreaterCamelBeanTest.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.camel.component.ejb; - -import java.util.Properties; - -import javax.naming.Context; -import javax.naming.InitialContext; - -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.impl.JndiRegistry; -import org.apache.camel.test.junit4.CamelTestSupport; -import org.junit.Test; - -public class GreaterCamelBeanTest extends CamelTestSupport { - - @Override - protected JndiRegistry createRegistry() throws Exception { - Properties properties = new Properties(); - properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory"); - - InitialContext initialContext = new InitialContext(properties); - return new JndiRegistry(initialContext); - } - - @Test - public void testGreaterViaCamelBean() throws Exception { - getMockEndpoint("mock:result").expectedBodiesReceived("Hello World"); - - template.sendBody("direct:start", "World"); - - assertMockEndpointsSatisfied(); - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - @Override - public void configure() throws Exception { - from("direct:start") - .bean("GreaterImplLocal", "hello") - .to("mock:result"); - } - }; - } -} \ No newline at end of file diff --git a/components/camel-ejb/src/test/java/org/apache/camel/component/ejb/GreaterCamelEjbPropertiesTest.java b/components/camel-ejb/src/test/java/org/apache/camel/component/ejb/GreaterCamelEjbPropertiesTest.java deleted file mode 100644 index 59a2156f..0000000 --- a/components/camel-ejb/src/test/java/org/apache/camel/component/ejb/GreaterCamelEjbPropertiesTest.java +++ /dev/null @@ -1,68 +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.camel.component.ejb; - -import java.util.Properties; - -import javax.naming.Context; - -import org.apache.camel.CamelContext; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.impl.DefaultCamelContext; -import org.apache.camel.support.SimpleRegistry; -import org.apache.camel.test.junit4.CamelTestSupport; -import org.junit.Test; - -public class GreaterCamelEjbPropertiesTest extends CamelTestSupport { - - @Override - protected CamelContext createCamelContext() throws Exception { - // use simple registry to not conflict with jndi used by EJB - CamelContext answer = new DefaultCamelContext(new SimpleRegistry()); - - // enlist EJB component using JndiContext - Properties properties = new Properties(); - properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory"); - - EjbComponent ejb = answer.getComponent("ejb", EjbComponent.class); - ejb.setProperties(properties); - - return answer; - } - - @Test - public void testGreaterViaCamelEjb() throws Exception { - getMockEndpoint("mock:result").expectedBodiesReceived("Hello World"); - - template.sendBody("direct:start", "World"); - - assertMockEndpointsSatisfied(); - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - @Override - public void configure() throws Exception { - from("direct:start") - .to("ejb:GreaterImplLocal?method=hello") - .to("mock:result"); - } - }; - } - -} \ No newline at end of file diff --git a/components/camel-ejb/src/test/java/org/apache/camel/component/ejb/GreaterCamelEjbTest.java b/components/camel-ejb/src/test/java/org/apache/camel/component/ejb/GreaterCamelEjbTest.java deleted file mode 100644 index 0c847d1..0000000 --- a/components/camel-ejb/src/test/java/org/apache/camel/component/ejb/GreaterCamelEjbTest.java +++ /dev/null @@ -1,78 +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.camel.component.ejb; - -import java.util.Properties; - -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; - -import org.apache.camel.CamelContext; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.impl.DefaultCamelContext; -import org.apache.camel.test.junit4.CamelTestSupport; -import org.junit.Test; - -public class GreaterCamelEjbTest extends CamelTestSupport { - - // START SNIPPET: e1 - @Override - protected CamelContext createCamelContext() throws Exception { - CamelContext answer = new DefaultCamelContext(); - - // enlist EJB component using the JndiContext - EjbComponent ejb = answer.getComponent("ejb", EjbComponent.class); - ejb.setContext(createEjbContext()); - - return answer; - } - - private static Context createEjbContext() throws NamingException { - // here we need to define our context factory to use OpenEJB for our testing - Properties properties = new Properties(); - properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory"); - - return new InitialContext(properties); - } - // END SNIPPET: e1 - - @Test - public void testGreaterViaCamelEjb() throws Exception { - getMockEndpoint("mock:result").expectedBodiesReceived("Hello World"); - - template.sendBody("direct:start", "World"); - - assertMockEndpointsSatisfied(); - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - @Override - public void configure() throws Exception { - // START SNIPPET: e2 - from("direct:start") - // invoke the greeter EJB using the local interface and invoke the hello method - .to("ejb:GreaterImplLocal?method=hello") - .to("mock:result"); - // END SNIPPET: e2 - } - }; - } - -} \ No newline at end of file diff --git a/components/camel-ejb/src/test/java/org/apache/camel/component/ejb/GreaterImpl.java b/components/camel-ejb/src/test/java/org/apache/camel/component/ejb/GreaterImpl.java deleted file mode 100644 index 2f71463..0000000 --- a/components/camel-ejb/src/test/java/org/apache/camel/component/ejb/GreaterImpl.java +++ /dev/null @@ -1,34 +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.camel.component.ejb; - -import javax.ejb.Stateless; - -// START SNIPPET: e1 -@Stateless -public class GreaterImpl implements GreaterLocal { - - public String hello(String name) { - return "Hello " + name; - } - - public String bye(String name) { - return "Bye " + name; - } - -} -// END SNIPPET: e1 diff --git a/components/camel-ejb/src/test/java/org/apache/camel/component/ejb/GreaterLocal.java b/components/camel-ejb/src/test/java/org/apache/camel/component/ejb/GreaterLocal.java deleted file mode 100644 index b3f04bb..0000000 --- a/components/camel-ejb/src/test/java/org/apache/camel/component/ejb/GreaterLocal.java +++ /dev/null @@ -1,27 +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.camel.component.ejb; - -// START SNIPPET: e1 -public interface GreaterLocal { - - String hello(String name); - - String bye(String name); - -} -// END SNIPPET: e1 diff --git a/components/camel-ejb/src/test/java/org/apache/camel/component/ejb/GreaterTest.java b/components/camel-ejb/src/test/java/org/apache/camel/component/ejb/GreaterTest.java deleted file mode 100644 index 77742d8..0000000 --- a/components/camel-ejb/src/test/java/org/apache/camel/component/ejb/GreaterTest.java +++ /dev/null @@ -1,50 +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.camel.component.ejb; -import java.util.Properties; - -import javax.naming.Context; -import javax.naming.InitialContext; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -public class GreaterTest extends Assert { - - private InitialContext initialContext; - - @Before - public void setUp() throws Exception { - Properties properties = new Properties(); - properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory"); - - initialContext = new InitialContext(properties); - } - - @Test - public void testGreaterViaLocalInterface() throws Exception { - Object object = initialContext.lookup("GreaterImplLocal"); - - assertNotNull(object); - assertTrue(object instanceof GreaterLocal); - GreaterLocal greater = (GreaterLocal) object; - - assertEquals("Hello World", greater.hello("World")); - } - -} diff --git a/components/camel-ejb/src/test/java/org/apache/camel/component/ejb/SpringGreaterCamelEjbTest.java b/components/camel-ejb/src/test/java/org/apache/camel/component/ejb/SpringGreaterCamelEjbTest.java deleted file mode 100644 index 30bcddb..0000000 --- a/components/camel-ejb/src/test/java/org/apache/camel/component/ejb/SpringGreaterCamelEjbTest.java +++ /dev/null @@ -1,46 +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.camel.component.ejb; - -import org.apache.camel.test.spring.CamelSpringTestSupport; -import org.junit.Test; -import org.springframework.context.support.AbstractXmlApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -public class SpringGreaterCamelEjbTest extends CamelSpringTestSupport { - - @Override - protected AbstractXmlApplicationContext createApplicationContext() { - return new ClassPathXmlApplicationContext("org/apache/camel/component/ejb/SpringGreaterCamelEjbTest.xml"); - } - - @Test - public void testGreaterViaCamelEjb() throws Exception { - getMockEndpoint("mock:result").expectedBodiesReceived("Hello World"); - - template.sendBody("direct:start", "World"); - - assertMockEndpointsSatisfied(); - } - - @Test - public void testLocateOtherBeans() throws Exception { - GreaterLocal mySpringBean = context().getRegistry().lookupByNameAndType("mySpringBean", GreaterLocal.class); - assertNotNull("We should get the instance of spring bean", mySpringBean); - } - -} \ No newline at end of file diff --git a/components/camel-ejb/src/test/resources/META-INF/ejb-jar.xml b/components/camel-ejb/src/test/resources/META-INF/ejb-jar.xml deleted file mode 100644 index bd00a54..0000000 --- a/components/camel-ejb/src/test/resources/META-INF/ejb-jar.xml +++ /dev/null @@ -1,20 +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. - ---> -<ejb-jar/> diff --git a/components/camel-ejb/src/test/resources/log4j2.properties b/components/camel-ejb/src/test/resources/log4j2.properties deleted file mode 100644 index ecfca90..0000000 --- a/components/camel-ejb/src/test/resources/log4j2.properties +++ /dev/null @@ -1,32 +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. -## --------------------------------------------------------------------------- - -appender.out.type = File -appender.out.name = out -appender.out.fileName = target/camel-ejb-test.log -appender.out.layout.type = PatternLayout -appender.out.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n -appender.stdout.type = Console -appender.stdout.name = stdout -appender.stdout.layout.type = PatternLayout -appender.stdout.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n -logger.spring.name = org.apache.activemq.spring -logger.spring.level = WARN -logger.velocity.name = org.apache.camel.component.velocity -logger.velocity.level = DEBUG -rootLogger.level = INFO -rootLogger.appenderRef.out.ref = out diff --git a/components/camel-ejb/src/test/resources/org/apache/camel/component/ejb/SpringGreaterCamelEjbTest.xml b/components/camel-ejb/src/test/resources/org/apache/camel/component/ejb/SpringGreaterCamelEjbTest.xml deleted file mode 100644 index 450055c..0000000 --- a/components/camel-ejb/src/test/resources/org/apache/camel/component/ejb/SpringGreaterCamelEjbTest.xml +++ /dev/null @@ -1,52 +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. - ---> -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:p="http://www.springframework.org/schema/util" - xsi:schemaLocation=" - http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd - http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd - http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> - <!-- add other spring for testing --> - <bean id="mySpringBean" class="org.apache.camel.component.ejb.GreaterImpl" /> - - <!-- START SNIPPET: e2 --> - <camelContext xmlns="http://camel.apache.org/schema/spring"> - <route> - <from uri="direct:start"/> - <to uri="ejb:GreaterImplLocal?method=hello"/> - <to uri="mock:result"/> - </route> - </camelContext> - <!-- END SNIPPET: e2 --> - - <!-- START SNIPPET: e1 --> - <!-- setup Camel EJB component --> - <bean id="ejb" class="org.apache.camel.component.ejb.EjbComponent"> - <property name="properties" ref="jndiProperties"/> - </bean> - - <!-- use OpenEJB context factory --> - <p:properties id="jndiProperties"> - <prop key="java.naming.factory.initial">org.apache.openejb.client.LocalInitialContextFactory</prop> - </p:properties> - <!-- END SNIPPET: e1 --> - -</beans> diff --git a/components/pom.xml b/components/pom.xml index 1437ac9..bdc4f72 100644 --- a/components/pom.xml +++ b/components/pom.xml @@ -154,7 +154,6 @@ <module>camel-drill</module> <module>camel-dropbox</module> <module>camel-ehcache</module> - <module>camel-ejb</module> <module>camel-elasticsearch-rest</module> <module>camel-elsql</module> <module>camel-etcd</module> diff --git a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/EjbEndpointBuilderFactory.java b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/EjbEndpointBuilderFactory.java deleted file mode 100644 index e6adf23..0000000 --- a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/EjbEndpointBuilderFactory.java +++ /dev/null @@ -1,187 +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.camel.builder.endpoint.dsl; - -import java.util.Map; -import javax.annotation.Generated; -import org.apache.camel.builder.EndpointConsumerBuilder; -import org.apache.camel.builder.EndpointProducerBuilder; -import org.apache.camel.builder.endpoint.AbstractEndpointBuilder; - -/** - * The ejb component is for invoking EJB Java beans from Camel. - * - * Generated by camel-package-maven-plugin - do not edit this file! - */ -@Generated("org.apache.camel.maven.packaging.EndpointDslMojo") -public interface EjbEndpointBuilderFactory { - - - /** - * Builder for endpoint for the EJB component. - */ - public interface EjbEndpointBuilder extends EndpointProducerBuilder { - default AdvancedEjbEndpointBuilder advanced() { - return (AdvancedEjbEndpointBuilder) this; - } - /** - * If enabled, Camel will cache the result of the first Registry - * look-up. Cache can be enabled if the bean in the Registry is defined - * as a singleton scope. - * - * The option is a: <code>java.lang.Boolean</code> type. - * - * Group: common - */ - default EjbEndpointBuilder cache(Boolean cache) { - setProperty("cache", cache); - return this; - } - /** - * If enabled, Camel will cache the result of the first Registry - * look-up. Cache can be enabled if the bean in the Registry is defined - * as a singleton scope. - * - * The option will be converted to a <code>java.lang.Boolean</code> - * type. - * - * Group: common - */ - default EjbEndpointBuilder cache(String cache) { - setProperty("cache", cache); - return this; - } - /** - * Sets the name of the method to invoke on the bean. - * - * The option is a: <code>java.lang.String</code> type. - * - * Group: common - */ - default EjbEndpointBuilder method(String method) { - setProperty("method", method); - return this; - } - /** - * Used for configuring additional properties on the bean. - * - * The option is a: <code>java.util.Map<java.lang.String, - * java.lang.Object></code> type. - * - * Group: common - */ - default EjbEndpointBuilder parameters(Map<String, Object> parameters) { - setProperty("parameters", parameters); - return this; - } - /** - * Used for configuring additional properties on the bean. - * - * The option will be converted to a - * <code>java.util.Map<java.lang.String, java.lang.Object></code> - * type. - * - * Group: common - */ - default EjbEndpointBuilder parameters(String parameters) { - setProperty("parameters", parameters); - return this; - } - } - - /** - * Advanced builder for endpoint for the EJB component. - */ - public interface AdvancedEjbEndpointBuilder - extends - EndpointProducerBuilder { - default EjbEndpointBuilder basic() { - return (EjbEndpointBuilder) this; - } - /** - * Whether the endpoint should use basic property binding (Camel 2.x) or - * the newer property binding with additional capabilities. - * - * The option is a: <code>boolean</code> type. - * - * Group: advanced - */ - default AdvancedEjbEndpointBuilder basicPropertyBinding( - boolean basicPropertyBinding) { - setProperty("basicPropertyBinding", basicPropertyBinding); - return this; - } - /** - * Whether the endpoint should use basic property binding (Camel 2.x) or - * the newer property binding with additional capabilities. - * - * The option will be converted to a <code>boolean</code> type. - * - * Group: advanced - */ - default AdvancedEjbEndpointBuilder basicPropertyBinding( - String basicPropertyBinding) { - setProperty("basicPropertyBinding", basicPropertyBinding); - return this; - } - /** - * Sets whether synchronous processing should be strictly used, or Camel - * is allowed to use asynchronous processing (if supported). - * - * The option is a: <code>boolean</code> type. - * - * Group: advanced - */ - default AdvancedEjbEndpointBuilder synchronous(boolean synchronous) { - setProperty("synchronous", synchronous); - return this; - } - /** - * Sets whether synchronous processing should be strictly used, or Camel - * is allowed to use asynchronous processing (if supported). - * - * The option will be converted to a <code>boolean</code> type. - * - * Group: advanced - */ - default AdvancedEjbEndpointBuilder synchronous(String synchronous) { - setProperty("synchronous", synchronous); - return this; - } - } - /** - * EJB (camel-ejb) - * The ejb component is for invoking EJB Java beans from Camel. - * - * Category: endpoint,java - * Available as of version: 2.4 - * Maven coordinates: org.apache.camel:camel-ejb - * - * Syntax: <code>ejb:beanName</code> - * - * Path parameter: beanName (required) - * Sets the name of the bean to invoke - */ - default EjbEndpointBuilder ejb(String path) { - class EjbEndpointBuilderImpl extends AbstractEndpointBuilder implements EjbEndpointBuilder, AdvancedEjbEndpointBuilder { - public EjbEndpointBuilderImpl(String path) { - super("ejb", path); - } - } - return new EjbEndpointBuilderImpl(path); - } -} \ No newline at end of file diff --git a/docs/components/modules/ROOT/pages/ejb-component.adoc b/docs/components/modules/ROOT/pages/ejb-component.adoc deleted file mode 100644 index 0b81640..0000000 --- a/docs/components/modules/ROOT/pages/ejb-component.adoc +++ /dev/null @@ -1,225 +0,0 @@ -[[ejb-component]] -= EJB Component - -*Available as of Camel version 2.4* - -The EJB component binds EJBs to Camel message exchanges. - -Maven users will need to add the following dependency to their `pom.xml` -for this component: - -[source,xml] ------------------------------------------------------------- -<dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-ejb</artifactId> - <version>x.x.x</version> - <!-- use the same version as your Camel core version --> -</dependency> ------------------------------------------------------------- - -== URI format - -[source,java] ---------------------- -ejb:ejbName[?options] ---------------------- - -Where *ejbName* can be any string which is used to look up the EJB in -the Application Server JNDI Registry - -== Options - - - -// component options: START -The EJB component supports 5 options, which are listed below. - - - -[width="100%",cols="2,5,^1,2",options="header"] -|=== -| Name | Description | Default | Type -| *context* (producer) | The Context to use for looking up the EJBs | | Context -| *properties* (producer) | Properties for creating javax.naming.Context if a context has not been configured. | | Properties -| *cache* (advanced) | If enabled, Camel will cache the result of the first Registry look-up. Cache can be enabled if the bean in the Registry is defined as a singleton scope. | | Boolean -| *resolveProperty Placeholders* (advanced) | Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders. | true | boolean -| *basicPropertyBinding* (advanced) | Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean -|=== -// component options: END - - - - -// endpoint options: START -The EJB endpoint is configured using URI syntax: - ----- -ejb:beanName ----- - -with the following path and query parameters: - -=== Path Parameters (1 parameters): - - -[width="100%",cols="2,5,^1,2",options="header"] -|=== -| Name | Description | Default | Type -| *beanName* | *Required* Sets the name of the bean to invoke | | String -|=== - - -=== Query Parameters (6 parameters): - - -[width="100%",cols="2,5,^1,2",options="header"] -|=== -| Name | Description | Default | Type -| *cache* (common) | If enabled, Camel will cache the result of the first Registry look-up. Cache can be enabled if the bean in the Registry is defined as a singleton scope. | | Boolean -| *method* (common) | Sets the name of the method to invoke on the bean | | String -| *parameters* (common) | Used for configuring additional properties on the bean | | Map -| *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] -| *basicPropertyBinding* (advanced) | Whether the endpoint should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean -| *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean -|=== -// endpoint options: END - - -== Bean Binding - -How bean methods to be invoked are chosen (if they are not specified -explicitly through the *method* parameter) and how parameter values are -constructed from the Message are all defined by the -Bean Binding mechanism which is used throughout -all of the various Bean Integration -mechanisms in Camel. - -== Examples - -In the following examples we use the Greater EJB which is defined as -follows: - -*GreaterLocal.java* - -[source,java] -------------------------------------------------------------------------------------------------------------------------------------------------------------- -public interface GreaterLocal { - - String hello(String name); - - String bye(String name); - -} -------------------------------------------------------------------------------------------------------------------------------------------------------------- - -And the implementation - -*GreaterImpl.java* - -[source,java] -------------------------------------------------------------------------------------------------------------------------------------------------------------- -@Stateless -public class GreaterImpl implements GreaterLocal { - - public String hello(String name) { - return "Hello " + name; - } - - public String bye(String name) { - return "Bye " + name; - } - -} -------------------------------------------------------------------------------------------------------------------------------------------------------------- - -=== Using Java DSL - -In this example we want to invoke the `hello` method on the EJB. Since -this example is based on an unit test using Apache OpenEJB we have to -set a `JndiContext` on the xref:ejb-component.adoc[EJB] component with the OpenEJB -settings. - -[source,java] -------------------------------------------------------------------------------------------------------------------------------------------------------------- -@Override -protected CamelContext createCamelContext() throws Exception { - CamelContext answer = new DefaultCamelContext(); - - // enlist EJB component using the JndiContext - EjbComponent ejb = answer.getComponent("ejb", EjbComponent.class); - ejb.setContext(createEjbContext()); - - return answer; -} - -private static Context createEjbContext() throws NamingException { - // here we need to define our context factory to use OpenEJB for our testing - Properties properties = new Properties(); - properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory"); - - return new InitialContext(properties); -} -------------------------------------------------------------------------------------------------------------------------------------------------------------- - -Then we are ready to use the EJB in the Camel route: - -[source,java] -------------------------------------------------------------------------------------------------------------------------------------------------------------- -from("direct:start") - // invoke the greeter EJB using the local interface and invoke the hello method - .to("ejb:GreaterImplLocal?method=hello") - .to("mock:result"); -------------------------------------------------------------------------------------------------------------------------------------------------------------- - -*In a real application server* - -In a real application server you most likely do not have to setup a -`JndiContext` on the xref:ejb-component.adoc[EJB] component as it will create a -default `JndiContext` on the same JVM as the application server, which -usually allows it to access the JNDI registry and lookup the -xref:ejb-component.adoc[EJB]s. However if you need to access a application server on a remote JVM or -the likes, you have to prepare the properties beforehand. - -=== Using Spring XML - -And this is the same example using Spring XML instead: - -Again since this is based on an unit test we need to setup the -xref:ejb-component.adoc[EJB] component: - -[source,XML] -------------------------------------------------------------------------------------------------------------------------------------------------------------- -<!-- setup Camel EJB component --> -<bean id="ejb" class="org.apache.camel.component.ejb.EjbComponent"> - <property name="properties" ref="jndiProperties"/> -</bean> - -<!-- use OpenEJB context factory --> -<p:properties id="jndiProperties"> - <prop key="java.naming.factory.initial">org.apache.openejb.client.LocalInitialContextFactory</prop> -</p:properties> -------------------------------------------------------------------------------------------------------------------------------------------------------------- - -Before we are ready to use xref:ejb-component.adoc[EJB] in the Camel routes: - -[source,XML] -------------------------------------------------------------------------------------------------------------------------------------------------------------- -<camelContext xmlns="http://camel.apache.org/schema/spring"> - <route> - <from uri="direct:start"/> - <to uri="ejb:GreaterImplLocal?method=hello"/> - <to uri="mock:result"/> - </route> -</camelContext> -------------------------------------------------------------------------------------------------------------------------------------------------------------- - -== See Also - -* Configuring Camel -* Component -* Endpoint -* Getting Started -* xref:bean-component.adoc[Bean] -* Bean Binding -* Bean Integration diff --git a/parent/pom.xml b/parent/pom.xml index f084a2a..440e0bf 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -1215,11 +1215,6 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-ejb</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> <artifactId>camel-elasticsearch-rest</artifactId> <version>${project.version}</version> </dependency> diff --git a/platforms/spring-boot/components-starter/README.adoc b/platforms/spring-boot/components-starter/README.adoc index fb06d1b..fe5a480 100644 --- a/platforms/spring-boot/components-starter/README.adoc +++ b/platforms/spring-boot/components-starter/README.adoc @@ -17,7 +17,6 @@ The following components do not have a starter because of compatibility issues: * **camel-cdi** (intended for CDI only) * **camel-core-osgi** (intended for OSGi only) * **camel-core-xml** -* **camel-ejb** (intended for JEE only) * **camel-eventadmin** (intended for OSGi only) * **camel-ibatis** (`camel-mybatis-starter` is included) * **camel-mina** (`camel-mina2-starter` is included) diff --git a/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml b/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml index cdb502f..ed6658d 100644 --- a/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml +++ b/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml @@ -1129,11 +1129,6 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-ejb</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> <artifactId>camel-elasticsearch-rest</artifactId> <version>${project.version}</version> </dependency> diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java index a7bbf36..925a48a 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java +++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java @@ -76,7 +76,7 @@ public class SpringBootStarterMojo extends AbstractMojo { private static final String[] IGNORE_MODULES = { /* OSGi -> */ "camel-blueprint", "camel-core-osgi", "camel-eventadmin", "camel-paxlogging", /* extended core */ "camel-attachments", - /* Java EE -> */ "camel-cdi", "camel-ejb", + /* Java EE -> */ "camel-cdi", /* Microprofile -> */ "camel-microprofile-config", /* deprecated (and not working perfectly) -> */ "camel-swagger", "camel-mina", "camel-ibatis", /* currently incompatible */ "camel-spark-rest",
