You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2016/04/28 11:46:16 UTC
camel git commit: CAMEL-9882: Add Javadoc
Repository: camel
Updated Branches:
refs/heads/master 3b977a265 -> 285550797
CAMEL-9882: Add Javadoc
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/28555079
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/28555079
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/28555079
Branch: refs/heads/master
Commit: 285550797b68275bda37f19ae7a0be6835a2d9b5
Parents: 3b977a2
Author: Antonin Stefanutti <an...@stefanutti.fr>
Authored: Thu Apr 28 11:46:07 2016 +0200
Committer: Antonin Stefanutti <an...@stefanutti.fr>
Committed: Thu Apr 28 11:46:07 2016 +0200
----------------------------------------------------------------------
.../org/apache/camel/cdi/ImportResource.java | 67 ++++++++++++++++++++
1 file changed, 67 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/28555079/components/camel-cdi/src/main/java/org/apache/camel/cdi/ImportResource.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/main/java/org/apache/camel/cdi/ImportResource.java b/components/camel-cdi/src/main/java/org/apache/camel/cdi/ImportResource.java
index b21c757..01cc041 100644
--- a/components/camel-cdi/src/main/java/org/apache/camel/cdi/ImportResource.java
+++ b/components/camel-cdi/src/main/java/org/apache/camel/cdi/ImportResource.java
@@ -21,9 +21,76 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+/**
+ * Indicates one or more resources representing <a href="http://camel.apache.org/http://camel.apache.org/xml-configuration.html">Camel XML configuration</a>
+ * to import. Resources are currently loaded from the classpath.<p>
+ *
+ * {@code CamelContext} elements and other Camel primitives are automatically
+ * deployed as CDI beans during the container bootstrap so that they become
+ * available for injection at runtime. If such an element has an explicit
+ * {@code id} attribute set, the corresponding CDI bean is qualified with the
+ * {@code @Named} qualifier, e.g., given the following Camel XML configuration:
+ *
+ * <pre>{@code
+ * <camelContext id="foo">
+ * <endpoint id="bar" uri="seda:inbound">
+ * <property key="queue" value="#queue"/>
+ * <property key="concurrentConsumers" value="10"/>
+ * </endpoint>
+ * <camelContext/>
+ * }</pre>
+ *
+ * Corresponding CDI beans are automatically deployed and can be injected, e.g.:
+ *
+ * <pre><code>
+ * {@literal @}Inject
+ * {@literal @}ContextName("foo")
+ * CamelContext context;
+ * </code></pre>
+ *
+ * <pre><code>
+ * {@literal @}Inject
+ * {@literal @}Named("bar")
+ * Endpoint endpoint;
+ * </code></pre>
+ *
+ * Note that {@code CamelContext} beans are automatically qualified with both
+ * the {@code Named} and {@code ContextName} qualifiers. If the imported
+ * {@code CamelContext} element doesn't have an {@code id} attribute, the
+ * corresponding bean is deployed with the built-in {@code Default} qualifier.<p>
+ *
+ * Conversely, CDI beans deployed in the application can be referred to from
+ * the Camel XML configuration, usually using the {@code ref} attribute, e.g.,
+ * given the following bean declared:
+ *
+ * <pre><code>
+ * {@literal @}Produces
+ * {@literal @}Named("baz")
+ * Processor processor = exchange{@literal ->} exchange.getIn().setHeader("qux", "quux");
+ * </code></pre>
+ *
+ * A reference to that bean can be declared in the imported Camel XML configuration,
+ * e.g.:
+ *
+ * <pre>{@code
+ * <camelContext id="foo">
+ * <route>
+ * <from uri="..."/>
+ * <process ref="baz"/>
+ * </route>
+ * <camelContext/>
+ * }</pre>
+ *
+ * @since 2.18.0
+ */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
public @interface ImportResource {
+ /**
+ * Resource locations from which to import Camel XML configuration.
+ *
+ * @return the locations of the resources to import
+ */
String[] value() default {};
}