Author: gnodet
Date: Tue Dec 7 14:44:49 2010
New Revision: 1043069
URL: http://svn.apache.org/viewvc?rev=1043069&view=rev
Log:
[CAMEL-3295][CAMEL-3398] Fix injection in camel-blueprint
Added:
camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/ContextScanRouteBuilderFinder.java
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/TestInterceptStrategy.java
- copied, changed from r1043063,
camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintContainerRegistry.java
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-6.xml
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-7.xml
Modified:
camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintComponentResolver.java
camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintContainerRegistry.java
camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/OSGiBlueprintTestSupport.java
Modified:
camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintComponentResolver.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintComponentResolver.java?rev=1043069&r1=1043068&r2=1043069&view=diff
==============================================================================
---
camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintComponentResolver.java
(original)
+++
camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintComponentResolver.java
Tue Dec 7 14:44:49 2010
@@ -35,6 +35,17 @@ public class BlueprintComponentResolver
@Override
public Component resolveComponent(String name, CamelContext context)
throws Exception {
try {
+ Object bean = context.getRegistry().lookup(name);
+ if (bean instanceof Component) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Found component: " + name + " in registry: " +
bean);
+ }
+ return (Component) bean;
+ }
+ } catch (Exception e) {
+ LOG.debug("Ignored error looking up bean: " + name + ". Error: " +
e);
+ }
+ try {
Object bean =
context.getRegistry().lookup(".camelBlueprint.componentResolver." + name);
if (bean instanceof ComponentResolver) {
if (LOG.isDebugEnabled()) {
@@ -45,7 +56,7 @@ public class BlueprintComponentResolver
} catch (Exception e) {
LOG.debug("Ignored error looking up bean: " + name + ". Error: " +
e);
}
- return super.resolveComponent(name, context);
+ return getComponent(name, context);
}
}
Modified:
camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintContainerRegistry.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintContainerRegistry.java?rev=1043069&r1=1043068&r2=1043069&view=diff
==============================================================================
---
camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintContainerRegistry.java
(original)
+++
camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintContainerRegistry.java
Tue Dec 7 14:44:49 2010
@@ -16,11 +16,14 @@
*/
package org.apache.camel.blueprint;
-import java.util.Collections;
-import java.util.Map;
-
import org.apache.camel.spi.Registry;
import org.osgi.service.blueprint.container.BlueprintContainer;
+import org.osgi.service.blueprint.reflect.BeanMetadata;
+import org.osgi.service.blueprint.reflect.ComponentMetadata;
+import org.osgi.service.blueprint.reflect.ReferenceMetadata;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
public class BlueprintContainerRegistry implements Registry {
@@ -35,11 +38,28 @@ public class BlueprintContainerRegistry
}
public <T> T lookup(String name, Class<T> type) {
- return null;
+ return type.cast(blueprintContainer.getComponentInstance(name));
}
public <T> Map<String, T> lookupByType(Class<T> type) {
- return Collections.emptyMap();
+ return lookupByType(blueprintContainer, type);
+ }
+
+ public static <T> Map<String, T> lookupByType(BlueprintContainer
blueprintContainer, Class<T> type) {
+ Map<String, T> objects = new LinkedHashMap<String, T>();
+ for (ComponentMetadata metadata :
blueprintContainer.getMetadata(ComponentMetadata.class)) {
+ boolean isSingleton = metadata instanceof BeanMetadata
+ &&
(BeanMetadata.SCOPE_SINGLETON.equals(((BeanMetadata) metadata).getScope())
+ || ((BeanMetadata) metadata).getScope() == null);
+ boolean isReference = metadata instanceof ReferenceMetadata;
+ if (isSingleton || isReference) {
+ Object o = blueprintContainer.getComponentInstance(
metadata.getId() );
+ if (type.isInstance( o )) {
+ objects.put( metadata.getId(), type.cast(o) );
+ }
+ }
+ }
+ return objects;
}
}
Modified:
camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java?rev=1043069&r1=1043068&r2=1043069&view=diff
==============================================================================
---
camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
(original)
+++
camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
Tue Dec 7 14:44:49 2010
@@ -16,8 +16,13 @@
*/
package org.apache.camel.blueprint;
+import java.text.Collator;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
@@ -54,10 +59,14 @@ import org.apache.camel.model.ThreadPool
import org.apache.camel.model.config.PropertiesDefinition;
import org.apache.camel.model.dataformat.DataFormatsDefinition;
import org.apache.camel.spi.PackageScanFilter;
+import org.apache.camel.spi.Registry;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.osgi.framework.BundleContext;
import org.osgi.service.blueprint.container.BlueprintContainer;
+import org.osgi.service.blueprint.reflect.BeanMetadata;
+import org.osgi.service.blueprint.reflect.ComponentMetadata;
+import org.osgi.service.blueprint.reflect.ReferenceMetadata;
/**
* A bean to create and initialize a {...@link BlueprintCamelContext}
@@ -182,10 +191,19 @@ public class CamelContextFactoryBean ext
@Override
protected void initCustomRegistry(BlueprintCamelContext context) {
+ Registry registry = getBeanForType(Registry.class);
+ if (registry != null) {
+ LOG.info("Using custom Registry: " + registry);
+ context.setRegistry(registry);
+ }
}
@Override
protected <S> S getBeanForType(Class<S> clazz) {
+ Collection<S> objects =
BlueprintContainerRegistry.lookupByType(blueprintContainer, clazz).values();
+ if (objects.size() == 1) {
+ return objects.iterator().next();
+ }
return null;
}
@@ -212,6 +230,8 @@ public class CamelContextFactoryBean ext
@Override
protected void findRouteBuildersByContextScan(PackageScanFilter filter,
List<RoutesBuilder> builders) throws Exception {
+ ContextScanRouteBuilderFinder finder = new
ContextScanRouteBuilderFinder(getContext(), filter);
+ finder.appendBuilders(builders);
}
@Override
Added:
camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/ContextScanRouteBuilderFinder.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/ContextScanRouteBuilderFinder.java?rev=1043069&view=auto
==============================================================================
---
camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/ContextScanRouteBuilderFinder.java
(added)
+++
camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/ContextScanRouteBuilderFinder.java
Tue Dec 7 14:44:49 2010
@@ -0,0 +1,91 @@
+/**
+ * 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.blueprint;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.spi.PackageScanFilter;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.osgi.service.blueprint.container.BlueprintContainer;
+
+/**
+ * A helper class which will find all {...@link
org.apache.camel.builder.RouteBuilder} instances in the
+ * {...@link org.osgi.service.blueprint.container.BlueprintContainer}.
+ *
+ * @version $Revision$
+ */
+public class ContextScanRouteBuilderFinder {
+ private static final transient Log LOG =
LogFactory.getLog(ContextScanRouteBuilderFinder.class);
+ private final BlueprintContainer blueprintContainer;
+ private final PackageScanFilter filter;
+
+ public ContextScanRouteBuilderFinder(BlueprintCamelContext camelContext,
PackageScanFilter filter) {
+ this.blueprintContainer = camelContext.getBlueprintContainer();
+ this.filter = filter;
+ }
+
+ /**
+ * Appends all the {...@link org.apache.camel.builder.RouteBuilder}
instances that can be found in the context
+ */
+ public void appendBuilders(List<RoutesBuilder> list) {
+ Map<String, RoutesBuilder> beans =
BlueprintContainerRegistry.lookupByType(blueprintContainer,
RoutesBuilder.class);
+
+ for (Object key : beans.keySet()) {
+ Object bean = beans.get(key);
+
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Found RouteBuilder with id: " + key + " -> " +
bean);
+ }
+
+ // certain beans should be ignored
+ if (shouldIgnoreBean(bean)) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Ignoring RouteBuilder id: " + key);
+ }
+ continue;
+ }
+
+ if (!isFilteredClass(bean)) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Ignoring filtered RouteBuilder id: " + key + "
as class: " + bean.getClass());
+ }
+ continue;
+ }
+
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Adding instantiated RouteBuilder id: " + key + " as
class: " + bean.getClass());
+ }
+ list.add((RoutesBuilder) bean);
+ }
+ }
+
+ protected boolean shouldIgnoreBean(Object bean) {
+ return false;
+ }
+
+ protected boolean isFilteredClass(Object bean) {
+ if (filter != null) {
+ return filter.matches(bean.getClass());
+ } else {
+ return false;
+ }
+ }
+
+}
\ No newline at end of file
Modified:
camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java?rev=1043069&r1=1043068&r2=1043069&view=diff
==============================================================================
---
camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java
(original)
+++
camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java
Tue Dec 7 14:44:49 2010
@@ -28,6 +28,8 @@ import javax.xml.bind.Binder;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
+import org.apache.aries.blueprint.ComponentDefinitionRegistry;
+import org.apache.aries.blueprint.ComponentDefinitionRegistryProcessor;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -144,7 +146,127 @@ public class CamelNamespaceHandler imple
ptm = (PassThroughMetadata)
context.getComponentDefinitionRegistry().getComponentDefinition("blueprintBundleContext");
ccfb.setBundleContext((BundleContext) ptm.getObject());
ccfb.setImplicitId(implicitId);
+ } catch (Exception e) {
+ throw new ComponentDefinitionException("Unable to initialize
camel context factory", e);
+ }
+
+ //
+ // gnodet: the initialization of the CamelContextFactoryBean is
now done at the end of the blueprint
+ // container creation through the use of a
ComponentDefinitionRegistryProcessor (those are called
+ // after all the beans have been initialized. That's why the
calls to #afterPropertiesSet and
+ // #init are commented.
+ // This mechanism is now required because the
#afterPropertiesSet method on the CamelContext
+ // will search through the blueprint beans for beans
implementing known interfaces such as
+ // LifeCycle strategies, etc... so that they are automatically
wired to the CamelContext.
+ // However, Blueprint does not support real factories, so in
order to do so, we need to actually
+ // access the beans which lead to a circular exception while
looking for the CamelContext itself.
+ //
+
+ MutablePassThroughMetadata factory =
context.createMetadata(MutablePassThroughMetadata.class);
+ factory.setId(".camelBlueprint.passThrough." + contextId);
+ factory.setObject(new PassThroughCallable<Object>(value));
+
+ MutableBeanMetadata factory2 =
context.createMetadata(MutableBeanMetadata.class);
+ factory2.setId(".camelBlueprint.factory." + contextId);
+ factory2.setFactoryComponent(factory);
+ factory2.setFactoryMethod("call");
+// factory2.setInitMethod("afterPropertiesSet");
+ factory2.setDestroyMethod("destroy");
+
+ MutableBeanMetadata ctx =
context.createMetadata(MutableBeanMetadata.class);
+ ctx.setId(contextId);
+ ctx.setFactoryComponent(factory2);
+ ctx.setFactoryMethod("getContext");
+// ctx.setInitMethod("init");
+ ctx.setDestroyMethod("destroy");
+
+ MutablePassThroughMetadata processorFactory =
context.createMetadata(MutablePassThroughMetadata.class);
+ processorFactory.setId(".camelBlueprint.processor.passThrough." +
contextId);
+ processorFactory.setObject(new PassThroughCallable<Object>(new
CamelDependenciesFinder(ccfb, context)));
+
+ MutableBeanMetadata processor =
context.createMetadata(MutableBeanMetadata.class);
+ processor.setId(".camelBlueprint.processor." + contextId);
+
processor.setRuntimeClass(ComponentDefinitionRegistryProcessor.class);
+ processor.setFactoryComponent(processorFactory);
+ processor.setFactoryMethod("call");
+ processor.setProcessor(true);
+
context.getComponentDefinitionRegistry().registerComponentDefinition( processor
);
+
+ return ctx;
+ }
+ return null;
+ }
+
+ public ComponentMetadata decorate(Node node, ComponentMetadata component,
ParserContext context) {
+ return null;
+ }
+
+ protected Object parseUsingJaxb(Element element, ParserContext
parserContext, Binder<Node> binder) {
+ try {
+ return binder.unmarshal(element);
+ } catch (JAXBException e) {
+ throw new ComponentDefinitionException("Failed to parse JAXB
element: " + e, e);
+ }
+ }
+
+ public JAXBContext getJaxbContext() throws JAXBException {
+ if (jaxbContext == null) {
+ jaxbContext = createJaxbContext();
+ }
+ return jaxbContext;
+ }
+
+ protected JAXBContext createJaxbContext() throws JAXBException {
+ StringBuilder packages = new StringBuilder();
+ for (Class cl : getJaxbPackages()) {
+ if (packages.length() > 0) {
+ packages.append(":");
+ }
+ packages.append(cl.getName().substring(0,
cl.getName().lastIndexOf('.')));
+ }
+ return JAXBContext.newInstance(packages.toString(),
getClass().getClassLoader());
+ }
+
+ protected Set<Class> getJaxbPackages() {
+ Set<Class> classes = new HashSet<Class>();
+ classes.add(CamelContextFactoryBean.class);
+ classes.add(AbstractCamelContextFactoryBean.class);
+ classes.add(org.apache.camel.ExchangePattern.class);
+ classes.add(org.apache.camel.model.RouteDefinition.class);
+
classes.add(org.apache.camel.model.config.StreamResequencerConfig.class);
+
classes.add(org.apache.camel.model.dataformat.DataFormatsDefinition.class);
+
classes.add(org.apache.camel.model.language.ExpressionDefinition.class);
+
classes.add(org.apache.camel.model.loadbalancer.RoundRobinLoadBalancerDefinition.class);
+ return classes;
+ }
+
+ public static class PassThroughCallable<T> implements Callable<T> {
+
+ private T value;
+
+ public PassThroughCallable(T value) {
+ this.value = value;
+ }
+
+ public T call() throws Exception {
+ return value;
+ }
+ }
+
+ public static class CamelDependenciesFinder implements
ComponentDefinitionRegistryProcessor {
+
+ private final CamelContextFactoryBean ccfb;
+ private final ParserContext context;
+
+ public CamelDependenciesFinder(CamelContextFactoryBean ccfb,
ParserContext context) {
+ this.ccfb = ccfb;
+ this.context = context;
+ }
+
+ public void process(ComponentDefinitionRegistry
componentDefinitionRegistry) {
+ try {
ccfb.afterPropertiesSet();
+ ccfb.getContext().init();
} catch (Exception e) {
throw new ComponentDefinitionException("Unable to initialize
camel context factory", e);
}
@@ -159,9 +281,9 @@ public class CamelNamespaceHandler imple
}
try {
for (String component : components) {
- ComponentMetadata cm =
context.getComponentDefinitionRegistry().getComponentDefinition(".camelBlueprint.componentResolver."
+ component);
+ ComponentMetadata cm =
componentDefinitionRegistry.getComponentDefinition(".camelBlueprint.componentResolver."
+ component);
if (cm == null) {
- MutableReferenceMetadata svc =
context.createMetadata(MutableReferenceMetadata.class);
+ MutableReferenceMetadata svc =
createMetadata(MutableReferenceMetadata.class);
svc.setId(".camelBlueprint.componentResolver." +
component);
svc.setFilter("(component=" + component + ")");
try {
@@ -170,7 +292,7 @@ public class CamelNamespaceHandler imple
} catch (Throwable t) {
// Check if the bundle can see the class
try {
- PassThroughMetadata ptm =
(PassThroughMetadata)
context.getComponentDefinitionRegistry().getComponentDefinition("blueprintBundle");
+ PassThroughMetadata ptm =
(PassThroughMetadata)
componentDefinitionRegistry.getComponentDefinition("blueprintBundle");
Bundle b = (Bundle) ptm.getObject();
if
(b.loadClass(ComponentResolver.class.getName()) != ComponentResolver.class) {
throw new UnsupportedOperationException();
@@ -180,14 +302,14 @@ public class CamelNamespaceHandler imple
throw new UnsupportedOperationException();
}
}
-
context.getComponentDefinitionRegistry().registerComponentDefinition(svc);
+
componentDefinitionRegistry.registerComponentDefinition(svc);
dependsOn.add(svc.getId());
}
}
for (String language : languages) {
- ComponentMetadata cm =
context.getComponentDefinitionRegistry().getComponentDefinition(".camelBlueprint.languageResolver."
+ language);
+ ComponentMetadata cm =
componentDefinitionRegistry.getComponentDefinition(".camelBlueprint.languageResolver."
+ language);
if (cm == null) {
- MutableReferenceMetadata svc =
context.createMetadata(MutableReferenceMetadata.class);
+ MutableReferenceMetadata svc =
createMetadata(MutableReferenceMetadata.class);
svc.setId(".camelBlueprint.languageResolver." +
language);
svc.setFilter("(language=" + language + ")");
try {
@@ -196,7 +318,7 @@ public class CamelNamespaceHandler imple
} catch (Throwable t) {
// Check if the bundle can see the class
try {
- PassThroughMetadata ptm =
(PassThroughMetadata)
context.getComponentDefinitionRegistry().getComponentDefinition("blueprintBundle");
+ PassThroughMetadata ptm =
(PassThroughMetadata)
componentDefinitionRegistry.getComponentDefinition("blueprintBundle");
Bundle b = (Bundle) ptm.getObject();
if
(b.loadClass(LanguageResolver.class.getName()) != LanguageResolver.class) {
throw new UnsupportedOperationException();
@@ -206,14 +328,14 @@ public class CamelNamespaceHandler imple
throw new UnsupportedOperationException();
}
}
-
context.getComponentDefinitionRegistry().registerComponentDefinition(svc);
+
componentDefinitionRegistry.registerComponentDefinition(svc);
dependsOn.add(svc.getId());
}
}
for (String dataformat : dataformats) {
- ComponentMetadata cm =
context.getComponentDefinitionRegistry().getComponentDefinition(".camelBlueprint.dataformatResolver."
+ dataformat);
+ ComponentMetadata cm =
componentDefinitionRegistry.getComponentDefinition(".camelBlueprint.dataformatResolver."
+ dataformat);
if (cm == null) {
- MutableReferenceMetadata svc =
context.createMetadata(MutableReferenceMetadata.class);
+ MutableReferenceMetadata svc =
createMetadata(MutableReferenceMetadata.class);
svc.setId(".camelBlueprint.dataformatResolver." +
dataformat);
svc.setFilter("(dataformat=" + dataformat + ")");
try {
@@ -222,7 +344,7 @@ public class CamelNamespaceHandler imple
} catch (Throwable t) {
// Check if the bundle can see the class
try {
- PassThroughMetadata ptm =
(PassThroughMetadata)
context.getComponentDefinitionRegistry().getComponentDefinition("blueprintBundle");
+ PassThroughMetadata ptm =
(PassThroughMetadata)
componentDefinitionRegistry.getComponentDefinition("blueprintBundle");
Bundle b = (Bundle) ptm.getObject();
if
(b.loadClass(DataFormatResolver.class.getName()) != DataFormatResolver.class) {
throw new UnsupportedOperationException();
@@ -232,7 +354,7 @@ public class CamelNamespaceHandler imple
throw new UnsupportedOperationException();
}
}
-
context.getComponentDefinitionRegistry().registerComponentDefinition(svc);
+
componentDefinitionRegistry.registerComponentDefinition(svc);
dependsOn.add(svc.getId());
}
}
@@ -243,176 +365,104 @@ public class CamelNamespaceHandler imple
languages.clear();
dataformats.clear();
}
-
- MutablePassThroughMetadata factory =
context.createMetadata(MutablePassThroughMetadata.class);
- factory.setId(".camelBlueprint.passThrough." + contextId);
- factory.setObject(new PassThroughCallable<Object>(value));
- factory.setDependsOn(new ArrayList<String>(components));
-
- MutableBeanMetadata factory2 =
context.createMetadata(MutableBeanMetadata.class);
- factory2.setId(".camelBlueprint.factory." + contextId);
- factory2.setFactoryComponent(factory);
- factory2.setFactoryMethod("call");
- factory2.setDestroyMethod("destroy");
-
- MutableBeanMetadata ctx =
context.createMetadata(MutableBeanMetadata.class);
- ctx.setId(contextId);
- ctx.setFactoryComponent(factory2);
- ctx.setFactoryMethod("getContext");
- ctx.setInitMethod("init");
- ctx.setDestroyMethod("destroy");
-
- return ctx;
}
- return null;
- }
- private void findInputComponents(List<FromDefinition> defs, Set<String>
components, Set<String> languages, Set<String> dataformats) {
- if (defs != null) {
- for (FromDefinition def : defs) {
- findUriComponent(def.getUri(), components);
- }
+ public <T extends org.osgi.service.blueprint.reflect.Metadata> T
createMetadata(java.lang.Class<T> tClass) {
+ return context.createMetadata(tClass);
}
- }
- @SuppressWarnings("unchecked")
- private void findOutputComponents(List<ProcessorDefinition> defs,
Set<String> components, Set<String> languages, Set<String> dataformats) {
- if (defs != null) {
- for (ProcessorDefinition def : defs) {
- if (def instanceof SendDefinition) {
- findUriComponent(((SendDefinition) def).getUri(),
components);
- }
- if (def instanceof MarshalDefinition) {
- findDataFormat(((MarshalDefinition)
def).getDataFormatType(), dataformats);
- }
- if (def instanceof UnmarshalDefinition) {
- findDataFormat(((UnmarshalDefinition)
def).getDataFormatType(), dataformats);
- }
- if (def instanceof ExpressionNode) {
- findLanguage(((ExpressionNode) def).getExpression(),
languages);
- }
- if (def instanceof ResequenceDefinition) {
- findLanguage(((ResequenceDefinition)
def).getExpressions(), languages);
- }
- if (def instanceof AggregateDefinition) {
- findLanguage(((AggregateDefinition) def).getExpression(),
languages);
- findLanguage(((AggregateDefinition)
def).getCorrelationExpression(), languages);
- findLanguage(((AggregateDefinition)
def).getCompletionPredicate(), languages);
- findLanguage(((AggregateDefinition)
def).getCompletionTimeoutExpression(), languages);
- findLanguage(((AggregateDefinition)
def).getCompletionSizeExpression(), languages);
+ private void findInputComponents(List<FromDefinition> defs,
Set<String> components, Set<String> languages, Set<String> dataformats) {
+ if (defs != null) {
+ for (FromDefinition def : defs) {
+ findUriComponent(def.getUri(), components);
}
- if (def instanceof CatchDefinition) {
- findLanguage(((CatchDefinition) def).getHandled(),
languages);
- }
- if (def instanceof OnExceptionDefinition) {
- findLanguage(((OnExceptionDefinition)
def).getRetryWhile(), languages);
- findLanguage(((OnExceptionDefinition) def).getHandled(),
languages);
- findLanguage(((OnExceptionDefinition) def).getContinued(),
languages);
- }
- if (def instanceof SortDefinition) {
- findLanguage(((SortDefinition) def).getExpression(),
languages);
- }
- if (def instanceof WireTapDefinition) {
- findLanguage(((WireTapDefinition)
def).getNewExchangeExpression(), languages);
- }
- findOutputComponents(def.getOutputs(), components, languages,
dataformats);
}
}
- }
- private void findLanguage(ExpressionDefinition expression, Set<String>
languages) {
- if (expression != null) {
- String lang = expression.getLanguage();
- if (lang != null && lang.length() > 0) {
- languages.add(lang);
+ @SuppressWarnings("unchecked")
+ private void findOutputComponents(List<ProcessorDefinition> defs,
Set<String> components, Set<String> languages, Set<String> dataformats) {
+ if (defs != null) {
+ for (ProcessorDefinition def : defs) {
+ if (def instanceof SendDefinition) {
+ findUriComponent(((SendDefinition) def).getUri(),
components);
+ }
+ if (def instanceof MarshalDefinition) {
+ findDataFormat(((MarshalDefinition)
def).getDataFormatType(), dataformats);
+ }
+ if (def instanceof UnmarshalDefinition) {
+ findDataFormat(((UnmarshalDefinition)
def).getDataFormatType(), dataformats);
+ }
+ if (def instanceof ExpressionNode) {
+ findLanguage(((ExpressionNode) def).getExpression(),
languages);
+ }
+ if (def instanceof ResequenceDefinition) {
+ findLanguage(((ResequenceDefinition)
def).getExpressions(), languages);
+ }
+ if (def instanceof AggregateDefinition) {
+ findLanguage(((AggregateDefinition)
def).getExpression(), languages);
+ findLanguage(((AggregateDefinition)
def).getCorrelationExpression(), languages);
+ findLanguage(((AggregateDefinition)
def).getCompletionPredicate(), languages);
+ findLanguage(((AggregateDefinition)
def).getCompletionTimeoutExpression(), languages);
+ findLanguage(((AggregateDefinition)
def).getCompletionSizeExpression(), languages);
+ }
+ if (def instanceof CatchDefinition) {
+ findLanguage(((CatchDefinition) def).getHandled(),
languages);
+ }
+ if (def instanceof OnExceptionDefinition) {
+ findLanguage(((OnExceptionDefinition)
def).getRetryWhile(), languages);
+ findLanguage(((OnExceptionDefinition)
def).getHandled(), languages);
+ findLanguage(((OnExceptionDefinition)
def).getContinued(), languages);
+ }
+ if (def instanceof SortDefinition) {
+ findLanguage(((SortDefinition) def).getExpression(),
languages);
+ }
+ if (def instanceof WireTapDefinition) {
+ findLanguage(((WireTapDefinition)
def).getNewExchangeExpression(), languages);
+ }
+ findOutputComponents(def.getOutputs(), components,
languages, dataformats);
+ }
}
}
- }
- private void findLanguage(List<ExpressionDefinition> expressions,
Set<String> languages) {
- if (expressions != null) {
- for (ExpressionDefinition e : expressions) {
- findLanguage(e, languages);
+ private void findLanguage(ExpressionDefinition expression, Set<String>
languages) {
+ if (expression != null) {
+ String lang = expression.getLanguage();
+ if (lang != null && lang.length() > 0) {
+ languages.add(lang);
+ }
}
}
- }
-
- private void findLanguage(ExpressionSubElementDefinition expression,
Set<String> languages) {
- if (expression != null) {
- findLanguage(expression.getExpressionType(), languages);
- }
- }
-
- private void findDataFormat(DataFormatDefinition dfd, Set<String>
dataformats) {
- if (dfd != null && dfd.getDataFormatName() != null) {
- dataformats.add(dfd.getDataFormatName());
- }
- }
- private void findUriComponent(String uri, Set<String> components) {
- if (uri != null) {
- String splitURI[] = ObjectHelper.splitOnCharacter(uri, ":", 2);
- if (splitURI[1] != null) {
- String scheme = splitURI[0];
- components.add(scheme);
+ private void findLanguage(List<ExpressionDefinition> expressions,
Set<String> languages) {
+ if (expressions != null) {
+ for (ExpressionDefinition e : expressions) {
+ findLanguage(e, languages);
+ }
}
}
- }
- public ComponentMetadata decorate(Node node, ComponentMetadata component,
ParserContext context) {
- return null;
- }
-
- protected Object parseUsingJaxb(Element element, ParserContext
parserContext, Binder<Node> binder) {
- try {
- return binder.unmarshal(element);
- } catch (JAXBException e) {
- throw new ComponentDefinitionException("Failed to parse JAXB
element: " + e, e);
- }
- }
-
- public JAXBContext getJaxbContext() throws JAXBException {
- if (jaxbContext == null) {
- jaxbContext = createJaxbContext();
+ private void findLanguage(ExpressionSubElementDefinition expression,
Set<String> languages) {
+ if (expression != null) {
+ findLanguage(expression.getExpressionType(), languages);
+ }
}
- return jaxbContext;
- }
- protected JAXBContext createJaxbContext() throws JAXBException {
- StringBuilder packages = new StringBuilder();
- for (Class cl : getJaxbPackages()) {
- if (packages.length() > 0) {
- packages.append(":");
+ private void findDataFormat(DataFormatDefinition dfd, Set<String>
dataformats) {
+ if (dfd != null && dfd.getDataFormatName() != null) {
+ dataformats.add(dfd.getDataFormatName());
}
- packages.append(cl.getName().substring(0,
cl.getName().lastIndexOf('.')));
}
- return JAXBContext.newInstance(packages.toString(),
getClass().getClassLoader());
- }
- protected Set<Class> getJaxbPackages() {
- Set<Class> classes = new HashSet<Class>();
- classes.add(CamelContextFactoryBean.class);
- classes.add(AbstractCamelContextFactoryBean.class);
- classes.add(org.apache.camel.ExchangePattern.class);
- classes.add(org.apache.camel.model.RouteDefinition.class);
-
classes.add(org.apache.camel.model.config.StreamResequencerConfig.class);
-
classes.add(org.apache.camel.model.dataformat.DataFormatsDefinition.class);
-
classes.add(org.apache.camel.model.language.ExpressionDefinition.class);
-
classes.add(org.apache.camel.model.loadbalancer.RoundRobinLoadBalancerDefinition.class);
- return classes;
- }
-
- public static class PassThroughCallable<T> implements Callable<T> {
-
- private T value;
-
- public PassThroughCallable(T value) {
- this.value = value;
+ private void findUriComponent(String uri, Set<String> components) {
+ if (uri != null) {
+ String splitURI[] = ObjectHelper.splitOnCharacter(uri, ":", 2);
+ if (splitURI[1] != null) {
+ String scheme = splitURI[0];
+ components.add(scheme);
+ }
+ }
}
- public T call() throws Exception {
- return value;
- }
}
}
Modified:
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/OSGiBlueprintTestSupport.java
URL:
http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/OSGiBlueprintTestSupport.java?rev=1043069&r1=1043068&r2=1043069&view=diff
==============================================================================
---
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/OSGiBlueprintTestSupport.java
(original)
+++
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/OSGiBlueprintTestSupport.java
Tue Dec 7 14:44:49 2010
@@ -22,6 +22,8 @@ import java.io.InputStream;
import java.io.OutputStream;
import org.apache.camel.CamelContext;
+import org.apache.camel.component.seda.SedaComponent;
+import org.apache.camel.processor.interceptor.Tracer;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -112,6 +114,25 @@ public class OSGiBlueprintTestSupport ex
assertEquals(1, ctx.getRoutes().size());
}
+ @Test
+ public void testRouteWithComponentFromBlueprint() throws Exception {
+ getInstalledBundle("CamelBlueprintTestBundle6").start();
+ BlueprintContainer ctn = getOsgiService(BlueprintContainer.class,
"(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle6)", 5000);
+ CamelContext ctx = getOsgiService(CamelContext.class,
"(camel.context.symbolicname=CamelBlueprintTestBundle6)", 5000);
+ assertEquals(1, ctx.getRoutes().size());
+ assertSame(ctn.getComponentInstance("seda"), ctx.getComponent("seda"));
+ }
+
+ @Test
+ public void testRouteWithInterceptStrategy() throws Exception {
+ getInstalledBundle("CamelBlueprintTestBundle7").start();
+ BlueprintContainer ctn = getOsgiService(BlueprintContainer.class,
"(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle7)", 5000);
+ CamelContext ctx = getOsgiService(CamelContext.class,
"(camel.context.symbolicname=CamelBlueprintTestBundle7)", 5000);
+ assertEquals(1, ctx.getRoutes().size());
+ assertEquals(1, ctx.getInterceptStrategies().size());
+ assertEquals(TestInterceptStrategy.class.getName(),
ctx.getInterceptStrategies().get(0).getClass().getName());
+ }
+
@Before
public void setUp() throws Exception {
}
@@ -125,55 +146,68 @@ public class OSGiBlueprintTestSupport ex
Option[] options = options(
- bundle(newBundle()
- .add("OSGI-INF/blueprint/test.xml",
OSGiBlueprintTestSupport.class.getResource("blueprint-1.xml"))
- .set(Constants.BUNDLE_SYMBOLICNAME,
"CamelBlueprintTestBundle1")
- .build()).noStart(),
-
- bundle(newBundle()
- .add("OSGI-INF/blueprint/test.xml",
OSGiBlueprintTestSupport.class.getResource("blueprint-2.xml"))
- .set(Constants.BUNDLE_SYMBOLICNAME,
"CamelBlueprintTestBundle2")
- .build()).noStart(),
-
- bundle(newBundle()
- .add("OSGI-INF/blueprint/test.xml",
OSGiBlueprintTestSupport.class.getResource("blueprint-3.xml"))
- .set(Constants.BUNDLE_SYMBOLICNAME,
"CamelBlueprintTestBundle3")
- .build()).noStart(),
-
- bundle(newBundle()
- .add("OSGI-INF/blueprint/test.xml",
OSGiBlueprintTestSupport.class.getResource("blueprint-4.xml"))
- .add(TestRouteBuilder.class)
- .set(Constants.BUNDLE_SYMBOLICNAME,
"CamelBlueprintTestBundle4")
- .build(withBnd())).noStart(),
-
- bundle(newBundle()
- .add("OSGI-INF/blueprint/test.xml",
OSGiBlueprintTestSupport.class.getResource("blueprint-5.xml"))
- .add(TestRouteBuilder.class)
- .set(Constants.BUNDLE_SYMBOLICNAME,
"CamelBlueprintTestBundle5")
- .build(withBnd())).noStart(),
-
- // install the spring dm profile
- profile("spring.dm").version("1.2.0"),
- // this is how you set the default log level when using pax
logging (logProfile)
-
org.ops4j.pax.exam.CoreOptions.systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("TRACE"),
-
- // install blueprint requirements
- mavenBundle("org.apache.felix", "org.apache.felix.configadmin"),
- // install tiny bundles
- mavenBundle("org.ops4j.base", "ops4j-base-store"),
- wrappedBundle(mavenBundle("org.ops4j.pax.swissbox",
"pax-swissbox-bnd")),
- mavenBundle("org.ops4j.pax.swissbox", "pax-swissbox-tinybundles"),
-
- // using the features to install the camel components
- scanFeatures(getCamelKarafFeatureUrl(),
- "camel-core", "camel-blueprint", "camel-test",
"camel-mail", "camel-jaxb"),
+ bundle(newBundle()
+ .add("OSGI-INF/blueprint/test.xml",
OSGiBlueprintTestSupport.class.getResource("blueprint-1.xml"))
+ .set(Constants.BUNDLE_SYMBOLICNAME,
"CamelBlueprintTestBundle1")
+ .build()).noStart(),
+
+ bundle(newBundle()
+ .add("OSGI-INF/blueprint/test.xml",
OSGiBlueprintTestSupport.class.getResource("blueprint-2.xml"))
+ .set(Constants.BUNDLE_SYMBOLICNAME,
"CamelBlueprintTestBundle2")
+ .build()).noStart(),
+
+ bundle(newBundle()
+ .add("OSGI-INF/blueprint/test.xml",
OSGiBlueprintTestSupport.class.getResource("blueprint-3.xml"))
+ .set(Constants.BUNDLE_SYMBOLICNAME,
"CamelBlueprintTestBundle3")
+ .build()).noStart(),
+
+ bundle(newBundle()
+ .add("OSGI-INF/blueprint/test.xml",
OSGiBlueprintTestSupport.class.getResource("blueprint-4.xml"))
+ .add(TestRouteBuilder.class)
+ .set(Constants.BUNDLE_SYMBOLICNAME,
"CamelBlueprintTestBundle4")
+ .build(withBnd())).noStart(),
+
+ bundle(newBundle()
+ .add("OSGI-INF/blueprint/test.xml",
OSGiBlueprintTestSupport.class.getResource("blueprint-5.xml"))
+ .add(TestRouteBuilder.class)
+ .set(Constants.BUNDLE_SYMBOLICNAME,
"CamelBlueprintTestBundle5")
+ .build(withBnd())).noStart(),
+
+ bundle(newBundle()
+ .add("OSGI-INF/blueprint/test.xml",
OSGiBlueprintTestSupport.class.getResource("blueprint-6.xml"))
+ .set(Constants.DYNAMICIMPORT_PACKAGE, "*")
+ .set(Constants.BUNDLE_SYMBOLICNAME,
"CamelBlueprintTestBundle6")
+ .build(withBnd())).noStart(),
+
+ bundle(newBundle()
+ .add("OSGI-INF/blueprint/test.xml",
OSGiBlueprintTestSupport.class.getResource("blueprint-7.xml"))
+ .add(TestInterceptStrategy.class)
+ .set(Constants.DYNAMICIMPORT_PACKAGE, "*")
+ .set(Constants.BUNDLE_SYMBOLICNAME,
"CamelBlueprintTestBundle7")
+ .build()).noStart(),
+
+ // install the spring dm profile
+ profile("spring.dm").version("1.2.0"),
+ // this is how you set the default log level when using pax
logging (logProfile)
+
org.ops4j.pax.exam.CoreOptions.systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("TRACE"),
+
+ // install blueprint requirements
+ mavenBundle("org.apache.felix",
"org.apache.felix.configadmin"),
+ // install tiny bundles
+ mavenBundle("org.ops4j.base", "ops4j-base-store"),
+ wrappedBundle(mavenBundle("org.ops4j.pax.swissbox",
"pax-swissbox-bnd")),
+ mavenBundle("org.ops4j.pax.swissbox",
"pax-swissbox-tinybundles"),
+
+ // using the features to install the camel components
+ scanFeatures(getCamelKarafFeatureUrl(),
+ "camel-core", "camel-blueprint", "camel-test",
"camel-mail", "camel-jaxb", "camel-jms"),
- workingDirectory("target/paxrunner/"),
+ workingDirectory("target/paxrunner/"),
- //vmOption("-Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"),
+// vmOption("-Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"),
- //felix(),
- equinox());
+ //felix(),
+ equinox());
return options;
}
Copied:
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/TestInterceptStrategy.java
(from r1043063,
camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintContainerRegistry.java)
URL:
http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/TestInterceptStrategy.java?p2=camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/TestInterceptStrategy.java&p1=camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintContainerRegistry.java&r1=1043063&r2=1043069&rev=1043069&view=diff
==============================================================================
---
camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintContainerRegistry.java
(original)
+++
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/TestInterceptStrategy.java
Tue Dec 7 14:44:49 2010
@@ -14,32 +14,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.blueprint;
+package org.apache.camel.itest.osgi.blueprint;
-import java.util.Collections;
-import java.util.Map;
+import org.apache.camel.CamelContext;
+import org.apache.camel.Processor;
+import org.apache.camel.model.ProcessorDefinition;
+import org.apache.camel.spi.InterceptStrategy;
-import org.apache.camel.spi.Registry;
-import org.osgi.service.blueprint.container.BlueprintContainer;
+public class TestInterceptStrategy implements InterceptStrategy {
-public class BlueprintContainerRegistry implements Registry {
-
- private final BlueprintContainer blueprintContainer;
-
- public BlueprintContainerRegistry(BlueprintContainer blueprintContainer) {
- this.blueprintContainer = blueprintContainer;
+ public Processor wrapProcessorInInterceptors(CamelContext context,
ProcessorDefinition<?> definition, Processor target, Processor nextTarget)
throws Exception {
+ return null; //To change body of implemented methods use File |
Settings | File Templates.
}
-
- public Object lookup(String name) {
- return blueprintContainer.getComponentInstance(name);
- }
-
- public <T> T lookup(String name, Class<T> type) {
- return null;
- }
-
- public <T> Map<String, T> lookupByType(Class<T> type) {
- return Collections.emptyMap();
- }
-
}
Added:
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-6.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-6.xml?rev=1043069&view=auto
==============================================================================
---
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-6.xml
(added)
+++
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-6.xml
Tue Dec 7 14:44:49 2010
@@ -0,0 +1,29 @@
+<?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.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+ <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+ <route>
+ <from uri="seda:queue"/>
+ <to uri="mock:result"/>
+ </route>
+ </camelContext>
+
+ <bean id="seda" class="org.apache.camel.component.seda.SedaComponent"/>
+
+</blueprint>
Added:
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-7.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-7.xml?rev=1043069&view=auto
==============================================================================
---
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-7.xml
(added)
+++
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-7.xml
Tue Dec 7 14:44:49 2010
@@ -0,0 +1,29 @@
+<?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.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+ <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+ <route>
+ <from uri="seda:queue"/>
+ <to uri="mock:result"/>
+ </route>
+ </camelContext>
+
+ <bean id="intercept"
class="org.apache.camel.itest.osgi.blueprint.TestInterceptStrategy"/>
+
+</blueprint>