Repository: camel Updated Branches: refs/heads/master f8d290765 -> 678006152
CAMEL-7999: More components include documentation Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/67800615 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/67800615 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/67800615 Branch: refs/heads/master Commit: 67800615273031c45772b394d018b03662cee488 Parents: f8d2907 Author: Claus Ibsen <davscl...@apache.org> Authored: Sun Jan 4 11:31:53 2015 +0100 Committer: Claus Ibsen <davscl...@apache.org> Committed: Sun Jan 4 11:31:53 2015 +0100 ---------------------------------------------------------------------- .../camel/component/ejb/EjbComponent.java | 21 ++++++++++---- .../apache/camel/component/ejb/EjbEndpoint.java | 29 ++++++++++++++++++++ 2 files changed, 44 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/67800615/components/camel-ejb/src/main/java/org/apache/camel/component/ejb/EjbComponent.java ---------------------------------------------------------------------- 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 index f2ee72a..d7375f5 100644 --- 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 @@ -25,7 +25,6 @@ import javax.naming.NamingException; import org.apache.camel.Endpoint; import org.apache.camel.Processor; import org.apache.camel.component.bean.BeanComponent; -import org.apache.camel.component.bean.BeanEndpoint; import org.apache.camel.impl.JndiRegistry; import org.apache.camel.spi.Registry; @@ -39,9 +38,13 @@ public class EjbComponent extends BeanComponent { private Context context; private Properties properties; + public EjbComponent() { + super(EjbEndpoint.class); + } + @Override protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { - BeanEndpoint answer = new BeanEndpoint(uri, this); + EjbEndpoint answer = new EjbEndpoint(uri, this); answer.setBeanName(remaining); // plugin registry to lookup in jndi for the EJBs @@ -53,10 +56,7 @@ public class EjbComponent extends BeanComponent { return answer; } - public synchronized Context getContext() throws NamingException { - if (context == null && properties != null) { - context = new InitialContext(getProperties()); - } + public Context getContext() throws NamingException { return context; } @@ -71,4 +71,13 @@ public class EjbComponent extends BeanComponent { 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()); + } + } } http://git-wip-us.apache.org/repos/asf/camel/blob/67800615/components/camel-ejb/src/main/java/org/apache/camel/component/ejb/EjbEndpoint.java ---------------------------------------------------------------------- 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 new file mode 100644 index 0000000..b54fc7f --- /dev/null +++ b/components/camel-ejb/src/main/java/org/apache/camel/component/ejb/EjbEndpoint.java @@ -0,0 +1,29 @@ +/** + * 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; + +@UriEndpoint(scheme = "ejb", label = "endpoint,java") +public class EjbEndpoint extends BeanEndpoint { + + public EjbEndpoint(String endpointUri, Component component) { + super(endpointUri, component); + } +}