You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gn...@apache.org on 2010/05/28 09:52:36 UTC

svn commit: r949127 [5/5] - in /camel/trunk: components/ components/camel-blueprint/ components/camel-blueprint/src/main/java/org/apache/camel/blueprint/ components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/ components/camel-blue...

Added: camel/trunk/components/camel-osgi/src/test/java/org/apache/camel/core/osgi/ServiceRegistryTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-osgi/src/test/java/org/apache/camel/core/osgi/ServiceRegistryTest.java?rev=949127&view=auto
==============================================================================
--- camel/trunk/components/camel-osgi/src/test/java/org/apache/camel/core/osgi/ServiceRegistryTest.java (added)
+++ camel/trunk/components/camel-osgi/src/test/java/org/apache/camel/core/osgi/ServiceRegistryTest.java Fri May 28 07:52:33 2010
@@ -0,0 +1,66 @@
+/**
+ * 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.core.osgi;
+
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.osgi.CamelContextFactory;
+import org.apache.camel.osgi.CamelContextFactoryBean;
+import org.apache.camel.osgi.test.MyService;
+import org.junit.Test;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class ServiceRegistryTest extends CamelOsgiTestSupport {
+
+    @Test
+    public void camelContextFactoryServiceRegistryTest() throws Exception {
+        CamelContextFactory factory = new CamelContextFactory();
+        factory.setBundleContext(getBundleContext());
+        DefaultCamelContext context = factory.createContext();
+        context.start();
+        MyService myService = context.getRegistry().lookup(MyService.class.getName(), MyService.class);
+        assertNotNull("MyService should not be null", myService);
+        
+        Object service = context.getRegistry().lookup(MyService.class.getName());
+        assertNotNull("MyService should not be null", service);
+        
+        service = context.getRegistry().lookupByType(MyService.class);
+        assertNotNull("MyService should not be null", service);
+        context.stop();
+    }
+    
+    @Test
+    public void camelContextFactoryBeanServiceRegistryTest() throws Exception {
+        CamelContextFactoryBean factoryBean = new CamelContextFactoryBean();
+        factoryBean.setBundleContext(getBundleContext());
+        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/osgi/camelContext.xml");
+        factoryBean.setApplicationContext(applicationContext);
+        DefaultCamelContext context = factoryBean.getContext();
+        context.start();
+        MyService myService = context.getRegistry().lookup(MyService.class.getName(), MyService.class);
+        assertNotNull("MyService should not be null", myService);
+        
+        Object service = context.getRegistry().lookup(MyService.class.getName());
+        assertNotNull("MyService should not be null", service);
+        
+        service = context.getRegistry().lookupByType(MyService.class);
+        assertNotNull("MyService should not be null", service);
+        
+        context.stop();
+    }
+
+}

Modified: camel/trunk/components/camel-spring-osgi/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring-osgi/pom.xml?rev=949127&r1=949126&r2=949127&view=diff
==============================================================================
--- camel/trunk/components/camel-spring-osgi/pom.xml (original)
+++ camel/trunk/components/camel-spring-osgi/pom.xml Fri May 28 07:52:33 2010
@@ -20,7 +20,7 @@
         !org.apache.camel.component.event,
         !org.apache.camel.component.validator,
         !org.apache.camel.component.xslt,
-        !org.aapche.camel.osgi.*,
+        !org.apache.camel.osgi.*,
         org.apache.camel.*;${camel.osgi.import.strict.version},
         org.osgi.framework;version="[1.3,2)",
         org.springframework.osgi.*;version="[1.2,2)",
@@ -37,7 +37,7 @@
         org.apache.camel.component.xslt;${camel.osgi.split.pkg};${camel.osgi.version}
       </camel.osgi.export>
       <camel.osgi.activator>
-        org.apache.camel.osgi.Activator
+        org.apache.camel.core.osgi.Activator
       </camel.osgi.activator>
   </properties>
 
@@ -50,6 +50,15 @@
       <groupId>org.apache.camel</groupId>
       <artifactId>camel-osgi</artifactId>
     </dependency> 
+    <dependency>
+      <groupId>org.apache.felix</groupId>
+      <artifactId>org.osgi.core</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.osgi</groupId>
+      <artifactId>spring-osgi-core</artifactId>
+    </dependency>
   </dependencies>
   <build>
     <resources>

Modified: camel/trunk/components/camel-spring/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/pom.xml?rev=949127&r1=949126&r2=949127&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/pom.xml (original)
+++ camel/trunk/components/camel-spring/pom.xml Fri May 28 07:52:33 2010
@@ -42,6 +42,7 @@
         *
       </camel.osgi.import>
       <camel.osgi.export>
+        org.apache.camel.xml.*;${camel.osgi.version},
         org.apache.camel.spring.*;${camel.osgi.version},
         org.apache.camel.component;${camel.osgi.split.pkg};${camel.osgi.version},
         org.apache.camel.component.event;${camel.osgi.split.pkg};${camel.osgi.version},
@@ -61,6 +62,10 @@
       <artifactId>camel-core</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core-xml</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-context</artifactId>
     </dependency>
@@ -351,6 +356,9 @@
 			                      <include name="org/apache/camel/spring/ErrorHandler*.java" />
 				                  <include name="org/apache/camel/spring/package-info.java" />
                                 </fileset>
+                                <fileset dir="${basedir}/../camel-core-xml/src/main/java">
+                                  <include name="org/apache/camel/core/xml/*.java" />
+                                </fileset>
                                 <fileset dir="${basedir}/../../camel-core/src/main/java">
                                   <include name="org/apache/camel/model/**/*.java" />
                                   <include name="org/apache/camel/ExchangePattern.java" />

Modified: camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java?rev=949127&r1=949126&r2=949127&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java (original)
+++ camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java Fri May 28 07:52:33 2010
@@ -32,6 +32,7 @@ import org.apache.camel.Endpoint;
 import org.apache.camel.EndpointInject;
 import org.apache.camel.Produce;
 import org.apache.camel.Service;
+import org.apache.camel.core.xml.CamelJMXAgentDefinition;
 import org.apache.camel.impl.CamelPostProcessorHelper;
 import org.apache.camel.impl.DefaultEndpoint;
 import org.apache.camel.spring.util.ReflectionUtils;

Modified: camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelConsumerTemplateFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelConsumerTemplateFactoryBean.java?rev=949127&r1=949126&r2=949127&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelConsumerTemplateFactoryBean.java (original)
+++ camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelConsumerTemplateFactoryBean.java Fri May 28 07:52:33 2010
@@ -18,17 +18,12 @@ package org.apache.camel.spring;
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
 
 import org.apache.camel.CamelContext;
-import org.apache.camel.CamelContextAware;
-import org.apache.camel.ConsumerTemplate;
-import org.apache.camel.impl.DefaultConsumerTemplate;
-import org.apache.camel.model.IdentifiedType;
+import org.apache.camel.core.xml.AbstractCamelConsumerTemplateFactoryBean;
 import org.apache.camel.spring.util.CamelContextResolverHelper;
-import org.apache.camel.util.ServiceHelper;
 import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.DisposableBean;
 import org.springframework.beans.factory.FactoryBean;
@@ -44,76 +39,18 @@ import org.springframework.context.Appli
  */
 @XmlRootElement(name = "consumerTemplate")
 @XmlAccessorType(XmlAccessType.FIELD)
-public class CamelConsumerTemplateFactoryBean extends IdentifiedType implements FactoryBean, InitializingBean, DisposableBean, CamelContextAware, ApplicationContextAware {
-    @XmlTransient
-    private ConsumerTemplate template;
-    @XmlAttribute
-    private String camelContextId;
-    @XmlTransient
-    private CamelContext camelContext;
+public class CamelConsumerTemplateFactoryBean extends AbstractCamelConsumerTemplateFactoryBean implements FactoryBean, InitializingBean, DisposableBean, ApplicationContextAware {
+
     @XmlTransient
     private ApplicationContext applicationContext;
-    @XmlAttribute
-    private Integer maximumCacheSize;
-
-    public void afterPropertiesSet() throws Exception {
-        if (camelContext == null && camelContextId != null) {
-            camelContext = CamelContextResolverHelper.getCamelContextWithId(applicationContext, camelContextId);
-        }
-        if (camelContext == null) {
-            throw new IllegalArgumentException("A CamelContext or a CamelContextId must be injected!");
-        }
-    }
-
-    public Object getObject() throws Exception {
-        template = new DefaultConsumerTemplate(camelContext);
-
-        // set custom cache size if provided
-        if (maximumCacheSize != null) {
-            template.setMaximumCacheSize(maximumCacheSize);
-        }
-
-        // must start it so its ready to use
-        ServiceHelper.startService(template);
-        return template;
-    }
-
-    public Class getObjectType() {
-        return DefaultConsumerTemplate.class;
-    }
-
-    public boolean isSingleton() {
-        return true;
-    }
-
-    public void destroy() throws Exception {
-        ServiceHelper.stopService(template);
-    }
-
-    // Properties
-    // -------------------------------------------------------------------------
-
-    public CamelContext getCamelContext() {
-        return camelContext;
-    }
 
-    public void setCamelContext(CamelContext camelContext) {
-        this.camelContext = camelContext;
+    @Override
+    protected CamelContext getCamelContextWithId(String camelContextId) {
+        return CamelContextResolverHelper.getCamelContextWithId(applicationContext, camelContextId);
     }
 
     public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
         this.applicationContext = applicationContext;
     }
 
-    public void setCamelContextId(String camelContextId) {
-        this.camelContextId = camelContextId;
-    }
-
-    public Integer getMaximumCacheSize() {
-        return maximumCacheSize;
-    }
-
-    public void setMaximumCacheSize(Integer maximumCacheSize) {
-        this.maximumCacheSize = maximumCacheSize;
-    }
 }
\ No newline at end of file

Modified: camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java?rev=949127&r1=949126&r2=949127&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java (original)
+++ camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java Fri May 28 07:52:33 2010
@@ -17,10 +17,7 @@
 package org.apache.camel.spring;
 
 import java.util.ArrayList;
-import java.util.HashSet;
 import java.util.List;
-import java.util.Map;
-import java.util.Set;
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
@@ -31,57 +28,28 @@ import javax.xml.bind.annotation.XmlRoot
 import javax.xml.bind.annotation.XmlTransient;
 
 import org.apache.camel.CamelContext;
-import org.apache.camel.CamelException;
 import org.apache.camel.RoutesBuilder;
 import org.apache.camel.ShutdownRoute;
 import org.apache.camel.ShutdownRunningTask;
-import org.apache.camel.builder.ErrorHandlerBuilderRef;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.properties.PropertiesComponent;
-import org.apache.camel.component.properties.PropertiesResolver;
-import org.apache.camel.management.DefaultManagementAgent;
-import org.apache.camel.management.DefaultManagementLifecycleStrategy;
-import org.apache.camel.management.DefaultManagementStrategy;
-import org.apache.camel.management.ManagedManagementStrategy;
-import org.apache.camel.model.FromDefinition;
-import org.apache.camel.model.IdentifiedType;
+import org.apache.camel.core.xml.AbstractCamelContextFactoryBean;
+import org.apache.camel.core.xml.CamelJMXAgentDefinition;
+import org.apache.camel.core.xml.CamelPropertyPlaceholderDefinition;
+import org.apache.camel.core.xml.CamelServiceExporterDefinition;
 import org.apache.camel.model.InterceptDefinition;
 import org.apache.camel.model.InterceptFromDefinition;
 import org.apache.camel.model.InterceptSendToEndpointDefinition;
 import org.apache.camel.model.OnCompletionDefinition;
 import org.apache.camel.model.OnExceptionDefinition;
 import org.apache.camel.model.PackageScanDefinition;
-import org.apache.camel.model.ProcessorDefinition;
 import org.apache.camel.model.RouteBuilderDefinition;
-import org.apache.camel.model.RouteContainer;
 import org.apache.camel.model.RouteContextRefDefinition;
 import org.apache.camel.model.RouteDefinition;
 import org.apache.camel.model.ThreadPoolProfileDefinition;
-import org.apache.camel.model.ToDefinition;
-import org.apache.camel.model.TransactedDefinition;
 import org.apache.camel.model.config.PropertiesDefinition;
 import org.apache.camel.model.dataformat.DataFormatsDefinition;
-import org.apache.camel.processor.interceptor.Delayer;
-import org.apache.camel.processor.interceptor.HandleFault;
-import org.apache.camel.processor.interceptor.TraceFormatter;
-import org.apache.camel.processor.interceptor.Tracer;
-import org.apache.camel.spi.ClassResolver;
-import org.apache.camel.spi.EventFactory;
-import org.apache.camel.spi.EventNotifier;
-import org.apache.camel.spi.ExecutorServiceStrategy;
-import org.apache.camel.spi.FactoryFinderResolver;
-import org.apache.camel.spi.InflightRepository;
-import org.apache.camel.spi.InterceptStrategy;
-import org.apache.camel.spi.LifecycleStrategy;
-import org.apache.camel.spi.ManagementStrategy;
-import org.apache.camel.spi.PackageScanClassResolver;
 import org.apache.camel.spi.Registry;
-import org.apache.camel.spi.RouteContext;
-import org.apache.camel.spi.ShutdownStrategy;
-import org.apache.camel.spi.ThreadPoolProfile;
-import org.apache.camel.util.CamelContextHelper;
-import org.apache.camel.util.EndpointHelper;
-import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.core.xml.CamelProxyFactoryDefinition;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.springframework.beans.factory.DisposableBean;
@@ -107,7 +75,7 @@ import static org.apache.camel.util.Obje
 @XmlRootElement(name = "camelContext")
 @XmlAccessorType(XmlAccessType.FIELD)
 @SuppressWarnings("unused")
-public class CamelContextFactoryBean extends IdentifiedType implements RouteContainer, FactoryBean, InitializingBean, DisposableBean, ApplicationContextAware, ApplicationListener {
+public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<SpringCamelContext> implements FactoryBean, InitializingBean, DisposableBean, ApplicationContextAware, ApplicationListener {
     private static final Log LOG = LogFactory.getLog(CamelContextFactoryBean.class);
 
     @XmlAttribute(name = "depends-on", required = false)
@@ -137,7 +105,7 @@ public class CamelContextFactoryBean ext
     @XmlElement(name = "packageScan", type = PackageScanDefinition.class, required = false)
     private PackageScanDefinition packageScan;
     @XmlElement(name = "jmxAgent", type = CamelJMXAgentDefinition.class, required = false)
-    private CamelJMXAgentDefinition camelJMXAgent;    
+    private CamelJMXAgentDefinition camelJMXAgent;
     @XmlElements({
         @XmlElement(name = "beanPostProcessor", type = CamelBeanPostProcessor.class, required = false),
         @XmlElement(name = "template", type = CamelProducerTemplateFactoryBean.class, required = false),
@@ -145,7 +113,7 @@ public class CamelContextFactoryBean ext
         @XmlElement(name = "proxy", type = CamelProxyFactoryDefinition.class, required = false),
         @XmlElement(name = "export", type = CamelServiceExporterDefinition.class, required = false),
         @XmlElement(name = "errorHandler", type = ErrorHandlerDefinition.class, required = false)})
-    private List beans;    
+    private List beans;
     @XmlElement(name = "routeBuilder", required = false)
     private List<RouteBuilderDefinition> builderRefs = new ArrayList<RouteBuilderDefinition>();
     @XmlElement(name = "routeContextRef", required = false)
@@ -169,173 +137,46 @@ public class CamelContextFactoryBean ext
     @XmlElement(name = "interceptSendToEndpoint", required = false)
     private List<InterceptSendToEndpointDefinition> interceptSendToEndpoints = new ArrayList<InterceptSendToEndpointDefinition>();
     @XmlElement(name = "route", required = false)
-    private List<RouteDefinition> routes = new ArrayList<RouteDefinition>();    
+    private List<RouteDefinition> routes = new ArrayList<RouteDefinition>();
     @XmlTransient
     private SpringCamelContext context;
     @XmlTransient
-    private List<RoutesBuilder> builders = new ArrayList<RoutesBuilder>();
+    private ClassLoader contextClassLoaderOnStart;
     @XmlTransient
     private ApplicationContext applicationContext;
     @XmlTransient
-    private ClassLoader contextClassLoaderOnStart;
-    @XmlTransient
     private BeanPostProcessor beanPostProcessor;
 
-    public CamelContextFactoryBean() {
-        // Lets keep track of the class loader for when we actually do start things up
-        contextClassLoaderOnStart = Thread.currentThread().getContextClassLoader();
-    }
-
-    public Object getObject() throws Exception {
-        return getContext();
-    }
-
+    @Override
     public Class getObjectType() {
         return SpringCamelContext.class;
     }
 
-    public boolean isSingleton() {
-        return true;
-    }
-    
-    public ClassLoader getContextClassLoaderOnStart() {
-        return contextClassLoaderOnStart;
-    }
-
-    public void afterPropertiesSet() throws Exception {
-        if (ObjectHelper.isEmpty(getId())) {
-            throw new IllegalArgumentException("Id must be set");
-        }
-
-        if (properties != null) {
-            getContext().setProperties(properties.asMap());
-        }
-
-        // set the resolvers first
-        PackageScanClassResolver packageResolver = getBeanForType(PackageScanClassResolver.class);
-        if (packageResolver != null) {
-            LOG.info("Using custom PackageScanClassResolver: " + packageResolver);
-            getContext().setPackageScanClassResolver(packageResolver);
-        }
-        ClassResolver classResolver = getBeanForType(ClassResolver.class);
-        if (classResolver != null) {
-            LOG.info("Using custom ClassResolver: " + classResolver);
-            getContext().setClassResolver(classResolver);
-        }
-        FactoryFinderResolver factoryFinderResolver = getBeanForType(FactoryFinderResolver.class);
-        if (factoryFinderResolver != null) {
-            LOG.info("Using custom FactoryFinderResolver: " + factoryFinderResolver);
-            getContext().setFactoryFinderResolver(factoryFinderResolver);
-        }
-        ExecutorServiceStrategy executorServiceStrategy = getBeanForType(ExecutorServiceStrategy.class);
-        if (executorServiceStrategy != null) {
-            LOG.info("Using custom ExecutorServiceStrategy: " + executorServiceStrategy);
-            getContext().setExecutorServiceStrategy(executorServiceStrategy);
-        }
-
-        // set the custom registry if defined
-        Registry registry = getBeanForType(Registry.class);
-        if (registry != null) {
-            LOG.info("Using custom Registry: " + registry);
-            getContext().setRegistry(registry);
-        }
-
-        // setup property placeholder so we got it as early as possible
-        initPropertyPlaceholder();
-
-        // setup JMX agent at first
-        initJMXAgent();
-
-        Tracer tracer = getBeanForType(Tracer.class);
-        if (tracer != null) {
-            // use formatter if there is a TraceFormatter bean defined
-            TraceFormatter formatter = getBeanForType(TraceFormatter.class);
-            if (formatter != null) {
-                tracer.setFormatter(formatter);
-            }
-            LOG.info("Using custom Tracer: " + tracer);
-            getContext().addInterceptStrategy(tracer);
-        }
-
-        HandleFault handleFault = getBeanForType(HandleFault.class);
-        if (handleFault != null) {
-            LOG.info("Using custom HandleFault: " + handleFault);
-            getContext().addInterceptStrategy(handleFault);
-        }
-
-        Delayer delayer = getBeanForType(Delayer.class);
-        if (delayer != null) {
-            LOG.info("Using custom Delayer: " + delayer);
-            getContext().addInterceptStrategy(delayer);
-        }
-
-        InflightRepository inflightRepository = getBeanForType(InflightRepository.class);
-        if (delayer != null) {
-            LOG.info("Using custom InflightRepository: " + inflightRepository);
-            getContext().setInflightRepository(inflightRepository);
-        }
-
-        ManagementStrategy managementStrategy = getBeanForType(ManagementStrategy.class);
-        if (managementStrategy != null) {
-            LOG.info("Using custom ManagementStrategy: " + managementStrategy);
-            getContext().setManagementStrategy(managementStrategy);
-        }
-
-        EventFactory eventFactory = getBeanForType(EventFactory.class);
-        if (eventFactory != null) {
-            LOG.info("Using custom EventFactory: " + eventFactory);
-            getContext().getManagementStrategy().setEventFactory(eventFactory);
-        }
-
-        // set the event notifier strategies if defined
-        Map<String, EventNotifier> eventNotifiers = getContext().getRegistry().lookupByType(EventNotifier.class);
-        if (eventNotifiers != null && !eventNotifiers.isEmpty()) {
-            for (String id : eventNotifiers.keySet()) {
-                EventNotifier notifier = eventNotifiers.get(id);
-                // do not add if already added, for instance a tracer that is also an InterceptStrategy class
-                if (!getContext().getManagementStrategy().getEventNotifiers().contains(notifier)) {
-                    LOG.info("Using custom EventNotifier with id: " + id + " and implementation: " + notifier);
-                    getContext().getManagementStrategy().addEventNotifier(notifier);
-                }
-            }
-        }
-
-        ShutdownStrategy shutdownStrategy = getBeanForType(ShutdownStrategy.class);
-        if (shutdownStrategy != null) {
-            LOG.info("Using custom ShutdownStrategy: " + shutdownStrategy);
-            getContext().setShutdownStrategy(shutdownStrategy);
-        }
-
-        // add global interceptors
-        Map<String, InterceptStrategy> interceptStrategies = getContext().getRegistry().lookupByType(InterceptStrategy.class);
-        if (interceptStrategies != null && !interceptStrategies.isEmpty()) {
-            for (String id : interceptStrategies.keySet()) {
-                InterceptStrategy strategy = interceptStrategies.get(id);
-                // do not add if already added, for instance a tracer that is also an InterceptStrategy class
-                if (!getContext().getInterceptStrategies().contains(strategy)) {
-                    LOG.info("Using custom InterceptStrategy with id: " + id + " and implementation: " + strategy);
-                    getContext().addInterceptStrategy(strategy);
-                }
-            }
+    protected <S> S getBeanForType(Class<S> clazz) {
+        S bean = null;
+        String[] names = getApplicationContext().getBeanNamesForType(clazz, true, true);
+        if (names.length == 1) {
+            bean = (S) getApplicationContext().getBean(names[0], clazz);
         }
-
-        // set the lifecycle strategy if defined
-        Map<String, LifecycleStrategy> lifecycleStrategies = getContext().getRegistry().lookupByType(LifecycleStrategy.class);
-        if (lifecycleStrategies != null && !lifecycleStrategies.isEmpty()) {
-            for (String id : lifecycleStrategies.keySet()) {
-                LifecycleStrategy strategy = lifecycleStrategies.get(id);
-                // do not add if already added, for instance a tracer that is also an InterceptStrategy class
-                if (!getContext().getLifecycleStrategies().contains(strategy)) {
-                    LOG.info("Using custom LifecycleStrategy with id: " + id + " and implementation: " + strategy);
-                    getContext().addLifecycleStrategy(strategy);
+        if (bean == null) {
+            ApplicationContext parentContext = getApplicationContext().getParent();
+            if (parentContext != null) {
+                names = parentContext.getBeanNamesForType(clazz, true, true);
+                if (names.length == 1) {
+                    bean = (S) parentContext.getBean(names[0], clazz);
                 }
             }
         }
+        return bean;
+    }
 
-        // set the default thread pool profile if defined
-        initThreadPoolProfiles(getContext());
+    protected void findRouteBuilders(String[] normalized, List<RoutesBuilder> builders) throws Exception {
+        RouteBuilderFinder finder = new RouteBuilderFinder(getContext(), normalized, getContextClassLoaderOnStart(),
+                getBeanPostProcessor(), getContext().getPackageScanClassResolver());
+        finder.appendBuilders(builders);
+    }
 
-        // Set the application context and camelContext for the beanPostProcessor
+    protected void initBeanPostProcessor(SpringCamelContext context) {
         if (beanPostProcessor != null) {
             if (beanPostProcessor instanceof ApplicationContextAware) {
                 ((ApplicationContextAware)beanPostProcessor).setApplicationContext(applicationContext);
@@ -344,322 +185,29 @@ public class CamelContextFactoryBean ext
                 ((CamelBeanPostProcessor)beanPostProcessor).setCamelContext(getContext());
             }
         }
-
-        initSpringCamelContext(getContext());
-
-        // must init route refs before we prepare the routes below
-        initRouteRefs();
-
-        // do special preparation for some concepts such as interceptors and policies
-        // this is needed as JAXB does not build exactly the same model definition as Spring DSL would do
-        // using route builders. So we have here a little custom code to fix the JAXB gaps
-        for (RouteDefinition route : routes) {
-
-            // abstracts is the cross cutting concerns
-            List<ProcessorDefinition> abstracts = new ArrayList<ProcessorDefinition>();
-
-            // upper is the cross cutting concerns such as interceptors, error handlers etc
-            List<ProcessorDefinition> upper = new ArrayList<ProcessorDefinition>();
-
-            // lower is the regular route
-            List<ProcessorDefinition> lower = new ArrayList<ProcessorDefinition>();
-
-            prepareRouteForInit(route, abstracts, lower);
-
-            // toAsync should fix up itself at first
-            initToAsync(lower);
-
-            // interceptors should be first for the cross cutting concerns
-            initInterceptors(route, upper);
-            // then on completion
-            initOnCompletions(abstracts, upper);
-            // then transactions
-            initTransacted(abstracts, lower);
-            // then on exception
-            initOnExceptions(abstracts, upper);
-
-            // rebuild route as upper + lower
-            route.clearOutput();
-            route.getOutputs().addAll(upper);
-            route.getOutputs().addAll(lower);
-
-            // configure parents
-            initParent(route);
-        }
-
-        if (dataFormats != null) {
-            getContext().setDataFormats(dataFormats.asMap());
-        }
-
-        // lets force any lazy creation
-        getContext().addRouteDefinitions(routes);
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Found JAXB created routes: " + getRoutes());
-        }
-        findRouteBuilders();
-        installRoutes();
-    }
-
-    private void prepareRouteForInit(RouteDefinition route, List<ProcessorDefinition> abstracts,
-                                     List<ProcessorDefinition> lower) {
-        // filter the route into abstracts and lower
-        for (ProcessorDefinition output : route.getOutputs()) {
-            if (output.isAbstract()) {
-                abstracts.add(output);
-            } else {
-                lower.add(output);
-            }
-        }
-    }
-
-    private void initParent(RouteDefinition route) {
-        for (ProcessorDefinition output : route.getOutputs()) {
-            output.setParent(route);
-            if (output.getOutputs() != null) {
-                // recursive the outputs
-                initParent(output);
-            }
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    private void initParent(ProcessorDefinition parent) {
-        List<ProcessorDefinition> children = parent.getOutputs();
-        for (ProcessorDefinition child : children) {
-            child.setParent(parent);
-            if (child.getOutputs() != null) {
-                // recursive the children
-                initParent(child);
-            }
-        }
-    }
-
-    private void initToAsync(List<ProcessorDefinition> lower) {
-        List<ProcessorDefinition> outputs = new ArrayList<ProcessorDefinition>();
-        ToDefinition toAsync = null;
-
-        for (ProcessorDefinition output : lower) {
-            if (toAsync != null) {
-                // add this output on toAsync
-                toAsync.getOutputs().add(output);
-            } else {
-                // regular outputs
-                outputs.add(output);
-            }
-
-            if (output instanceof ToDefinition) {
-                ToDefinition to = (ToDefinition) output;
-                if (to.isAsync() != null && to.isAsync()) {
-                    // new current to async
-                    toAsync = to;
-                }
-            }
-        }
-
-        // rebuild outputs
-        lower.clear();
-        lower.addAll(outputs);
-    }
-
-    private void initOnExceptions(List<ProcessorDefinition> abstracts, List<ProcessorDefinition> upper) {
-        // add global on exceptions if any
-        if (onExceptions != null && !onExceptions.isEmpty()) {
-            abstracts.addAll(onExceptions);
-        }
-
-        // now add onExceptions to the route
-        for (ProcessorDefinition output : abstracts) {
-            if (output instanceof OnExceptionDefinition) {
-                // on exceptions must be added at top, so the route flow is correct as
-                // on exceptions should be the first outputs
-                upper.add(0, output);
-            }
-        }
-    }
-
-    private void initInterceptors(RouteDefinition route, List<ProcessorDefinition> upper) {
-        // configure intercept
-        for (InterceptDefinition intercept : getIntercepts()) {
-            intercept.afterPropertiesSet();
-            // add as first output so intercept is handled before the actual route and that gives
-            // us the needed head start to init and be able to intercept all the remaining processing steps
-            upper.add(0, intercept);
-        }
-
-        // configure intercept from
-        for (InterceptFromDefinition intercept : getInterceptFroms()) {
-
-            // should we only apply interceptor for a given endpoint uri
-            boolean match = true;
-            if (intercept.getUri() != null) {
-                match = false;
-                for (FromDefinition input : route.getInputs()) {
-                    if (EndpointHelper.matchEndpoint(input.getUri(), intercept.getUri())) {
-                        match = true;
-                        break;
-                    }
-                }
-            }
-
-            if (match) {
-                intercept.afterPropertiesSet();
-                // add as first output so intercept is handled before the actual route and that gives
-                // us the needed head start to init and be able to intercept all the remaining processing steps
-                upper.add(0, intercept);
-            }
-        }
-
-        // configure intercept send to endpoint
-        for (InterceptSendToEndpointDefinition intercept : getInterceptSendToEndpoints()) {
-            intercept.afterPropertiesSet();
-            // add as first output so intercept is handled before the actual route and that gives
-            // us the needed head start to init and be able to intercept all the remaining processing steps
-            upper.add(0, intercept);
-        }
     }
 
-    private void initOnCompletions(List<ProcessorDefinition> abstracts, List<ProcessorDefinition> upper) {
-        List<OnCompletionDefinition> completions = new ArrayList<OnCompletionDefinition>();
-
-        // find the route scoped onCompletions
-        for (ProcessorDefinition out : abstracts) {
-            if (out instanceof OnCompletionDefinition) {
-                completions.add((OnCompletionDefinition) out);
-            }
-        }
-
-        // only add global onCompletion if there are no route already
-        if (completions.isEmpty()) {
-            completions = getOnCompletions();
-        }
-
-        // are there any completions to init at all?
-        if (completions.isEmpty()) {
-            return;
-        }
-
-        upper.addAll(completions);
-    }
-
-    private void initTransacted(List<ProcessorDefinition> abstracts, List<ProcessorDefinition> lower) {
-        TransactedDefinition transacted = null;
-
-        // add to correct type
-        for (ProcessorDefinition type : abstracts) {
-            if (type instanceof TransactedDefinition) {
-                if (transacted == null) {
-                    transacted = (TransactedDefinition) type;
-                } else {
-                    throw new IllegalArgumentException("The route can only have one transacted defined");
-                }
-            }
-        }
-
-        if (transacted != null) {
-            // the outputs should be moved to the transacted policy
-            transacted.getOutputs().addAll(lower);
-            // and add it as the single output
-            lower.clear();
-            lower.add(transacted);
-        } 
-    }
-
-    private void initJMXAgent() throws Exception {
-        if (camelJMXAgent != null && camelJMXAgent.isAgentDisabled()) {
-            LOG.info("JMXAgent disabled");
-            // clear the existing lifecycle strategies define by the DefaultCamelContext constructor
-            getContext().getLifecycleStrategies().clear();
-            // no need to add a lifecycle strategy as we do not need one as JMX is disabled
-            getContext().setManagementStrategy(new DefaultManagementStrategy());
-        } else if (camelJMXAgent != null) {
-            LOG.info("JMXAgent enabled: " + camelJMXAgent);
-            DefaultManagementAgent agent = new DefaultManagementAgent(getContext());
-            agent.setConnectorPort(parseInteger(camelJMXAgent.getConnectorPort()));
-            agent.setCreateConnector(parseBoolean(camelJMXAgent.getCreateConnector()));
-            agent.setMBeanObjectDomainName(parseText(camelJMXAgent.getMbeanObjectDomainName()));
-            agent.setMBeanServerDefaultDomain(parseText(camelJMXAgent.getMbeanServerDefaultDomain()));
-            agent.setRegistryPort(parseInteger(camelJMXAgent.getRegistryPort()));
-            agent.setServiceUrlPath(parseText(camelJMXAgent.getServiceUrlPath()));
-            agent.setUsePlatformMBeanServer(parseBoolean(camelJMXAgent.getUsePlatformMBeanServer()));
-            agent.setOnlyRegisterProcessorWithCustomId(parseBoolean(camelJMXAgent.getOnlyRegisterProcessorWithCustomId()));
-
-            ManagementStrategy managementStrategy = new ManagedManagementStrategy(agent);
-            getContext().setManagementStrategy(managementStrategy);
-
-            // clear the existing lifecycle strategies define by the DefaultCamelContext constructor
-            getContext().getLifecycleStrategies().clear();
-            getContext().addLifecycleStrategy(new DefaultManagementLifecycleStrategy(getContext()));
-            // set additional configuration from camelJMXAgent
-            boolean onlyId = agent.getOnlyRegisterProcessorWithCustomId() != null && agent.getOnlyRegisterProcessorWithCustomId();
-            getContext().getManagementStrategy().onlyManageProcessorWithCustomId(onlyId);
-            getContext().getManagementStrategy().setStatisticsLevel(camelJMXAgent.getStatisticsLevel());
-        }
-    }
-
-    private void initPropertyPlaceholder() throws Exception {
-        if (getCamelPropertyPlaceholder() != null) {
-            CamelPropertyPlaceholderDefinition def = getCamelPropertyPlaceholder();
-
-            PropertiesComponent pc = new PropertiesComponent();
-            pc.setLocation(def.getLocation());
-
-            // if using a custom resolver
-            if (ObjectHelper.isNotEmpty(def.getPropertiesResolverRef())) {
-                PropertiesResolver resolver = CamelContextHelper.mandatoryLookup(getContext(), def.getPropertiesResolverRef(),
-                                                                                 PropertiesResolver.class);
-                pc.setPropertiesResolver(resolver);
-            }
-
-            // register the properties component
-            getContext().addComponent("properties", pc);
-        }
-    }
-
-    private void initRouteRefs() throws Exception {
-        // add route refs to existing routes
-        if (routeRefs != null) {
-            for (RouteContextRefDefinition ref : routeRefs) {
-                List<RouteDefinition> defs = ref.lookupRoutes(getContext());
-                for (RouteDefinition def : defs) {
-                    if (LOG.isDebugEnabled()) {
-                        LOG.debug("Adding route from " + ref + " -> " + def);
-                    }
-                    // add in top as they are most likely to be common/shared
-                    // which you may want to start first
-                    routes.add(0, def);
-                }
-            }
+    protected void postProcessBeforeInit(RouteBuilder builder) {
+        if (beanPostProcessor != null) {
+            // Inject the annotated resource
+            beanPostProcessor.postProcessBeforeInitialization(builder, builder.toString());
         }
     }
 
-    private <T> T getBeanForType(Class<T> clazz) {
-        T bean = null;
-        String[] names = getApplicationContext().getBeanNamesForType(clazz, true, true);
-        if (names.length == 1) {
-            bean = (T) getApplicationContext().getBean(names[0], clazz);
-        }
-        if (bean == null) {
-            ApplicationContext parentContext = getApplicationContext().getParent();
-            if (parentContext != null) {
-                names = parentContext.getBeanNamesForType(clazz, true, true);
-                if (names.length == 1) {
-                    bean = (T) parentContext.getBean(names[0], clazz);
-                }
-            }
+    protected void initCustomRegistry(SpringCamelContext context) {
+        Registry registry = getBeanForType(Registry.class);
+        if (registry != null) {
+            LOG.info("Using custom Registry: " + registry);
+            context.setRegistry(registry);
         }
-        return bean;
-    }
-
-    public void destroy() throws Exception {
-        getContext().stop();
     }
 
     public void onApplicationEvent(ApplicationEvent event) {
         // From Spring 3.0.1, The BeanFactory applicationEventListener 
         // and Bean's applicationEventListener will be called,
         // So we just delegate the onApplicationEvent call here.
-        
+
+        SpringCamelContext context = getContext(false);
         if (context != null) {
             // let the spring camel context handle the events
             context.onApplicationEvent(event);
@@ -681,67 +229,45 @@ public class CamelContextFactoryBean ext
         }
     }
 
-    private String parseText(String text) throws Exception {
-        // ensure we support property placeholders
-        return getContext().resolvePropertyPlaceholders(text);
-    }
-
-    private Integer parseInteger(String text) throws Exception {
-        // ensure we support property placeholders
-        String s = getContext().resolvePropertyPlaceholders(text);
-        if (s != null) {
-            try {
-                return new Integer(s);
-            } catch (NumberFormatException e) {
-                if (s.equals(text)) {
-                    throw new IllegalArgumentException("Error parsing [" + s + "] as an Integer.", e);
-                } else {
-                    throw new IllegalArgumentException("Error parsing [" + s + "] from property " + text + " as an Integer.", e);
-                }
-            }
+    // Properties
+    // -------------------------------------------------------------------------
+    public ApplicationContext getApplicationContext() {
+        if (applicationContext == null) {
+            throw new IllegalArgumentException("No applicationContext has been injected!");
         }
-        return null;
+        return applicationContext;
     }
 
-    private Long parseLong(String text) throws Exception {
-        // ensure we support property placeholders
-        String s = getContext().resolvePropertyPlaceholders(text);
-        if (s != null) {
-            try {
-                return new Long(s);
-            } catch (NumberFormatException e) {
-                if (s.equals(text)) {
-                    throw new IllegalArgumentException("Error parsing [" + s + "] as a Long.", e);
-                } else {
-                    throw new IllegalArgumentException("Error parsing [" + s + "] from property " + text + " as a Long.", e);
-                }
-            }
-        }
-        return null;
+    public void setApplicationContext(ApplicationContext applicationContext) {
+        this.applicationContext = applicationContext;
+    }
+    
+    public void setBeanPostProcessor(BeanPostProcessor postProcessor) {
+        this.beanPostProcessor = postProcessor;
     }
 
-    private Boolean parseBoolean(String text) throws Exception {
-        // ensure we support property placeholders
-        String s = getContext().resolvePropertyPlaceholders(text);
-        if (s != null) {
-            s = s.trim().toLowerCase();
-            if (s.equals("true") || s.equals("false")) {
-                return new Boolean(s);
-            } else {
-                if (s.equals(text)) {
-                    throw new IllegalArgumentException("Error parsing [" + s + "] as a Boolean.");
-                } else {
-                    throw new IllegalArgumentException("Error parsing [" + s + "] from property " + text + " as a Boolean.");
-                }
-            }
-        }
-        return null;
+    public BeanPostProcessor getBeanPostProcessor() {
+        return beanPostProcessor;
     }
 
-    // Properties
+    // Implementation methods
     // -------------------------------------------------------------------------
-    public SpringCamelContext getContext() throws Exception {
-        if (context == null) {
+
+    /**
+     * Create the context
+     */
+    protected SpringCamelContext createContext() {
+        SpringCamelContext ctx = newCamelContext();
+        ctx.setName(getId());
+        return ctx;
+    }
+
+    protected SpringCamelContext newCamelContext() {
+        return new SpringCamelContext(getApplicationContext());
+    }
+
+    public SpringCamelContext getContext(boolean create) {
+        if (context == null && create) {
             context = createContext();
         }
         return context;
@@ -783,22 +309,11 @@ public class CamelContextFactoryBean ext
         this.interceptSendToEndpoints = interceptSendToEndpoints;
     }
 
-    public ApplicationContext getApplicationContext() {
-        if (applicationContext == null) {
-            throw new IllegalArgumentException("No applicationContext has been injected!");
-        }
-        return applicationContext;
-    }
-
-    public void setApplicationContext(ApplicationContext applicationContext) {
-        this.applicationContext = applicationContext;
-    }
-    
     public PropertiesDefinition getProperties() {
         return properties;
     }
-    
-    public void setProperties(PropertiesDefinition properties) {        
+
+    public void setProperties(PropertiesDefinition properties) {
         this.properties = properties;
     }
 
@@ -808,12 +323,12 @@ public class CamelContextFactoryBean ext
 
     /**
      * Sets the package names to be recursively searched for Java classes which
-     * extend {@link RouteBuilder} to be auto-wired up to the
-     * {@link SpringCamelContext} as a route. Note that classes are excluded if
+     * extend {@link org.apache.camel.builder.RouteBuilder} to be auto-wired up to the
+     * {@link CamelContext} as a route. Note that classes are excluded if
      * they are specifically configured in the spring.xml
      * <p/>
      * A more advanced configuration can be done using {@link #setPackageScan(org.apache.camel.model.PackageScanDefinition)}
-     * 
+     *
      * @param packages the package names which are recursively searched
      * @see #setPackageScan(org.apache.camel.model.PackageScanDefinition)
      */
@@ -828,8 +343,8 @@ public class CamelContextFactoryBean ext
     /**
      * Sets the package scanning information. Package scanning allows for the
      * automatic discovery of certain camel classes at runtime for inclusion
-     * e.g. {@link RouteBuilder} implementations
-     * 
+     * e.g. {@link org.apache.camel.builder.RouteBuilder} implementations
+     *
      * @param packageScan the package scan
      */
     public void setPackageScan(PackageScanDefinition packageScan) {
@@ -844,14 +359,6 @@ public class CamelContextFactoryBean ext
         this.camelPropertyPlaceholder = camelPropertyPlaceholder;
     }
 
-    public void setBeanPostProcessor(BeanPostProcessor postProcessor) {
-        this.beanPostProcessor = postProcessor;
-    }
-
-    public BeanPostProcessor getBeanPostProcessor() {
-        return beanPostProcessor;
-    }
-
     public void setCamelJMXAgent(CamelJMXAgentDefinition agent) {
         camelJMXAgent = agent;
     }
@@ -985,191 +492,4 @@ public class CamelContextFactoryBean ext
         this.dependsOn = dependsOn;
     }
 
-    // Implementation methods
-    // -------------------------------------------------------------------------
-
-    /**
-     * Create the context
-     */
-    protected SpringCamelContext createContext() {
-        SpringCamelContext ctx = newCamelContext();
-        ctx.setName(getId());
-        return ctx;
-    }
-
-    /**
-     * Initializes the context
-     * 
-     * @param ctx the context
-     * @throws Exception is thrown if error occurred
-     */
-    protected void initSpringCamelContext(SpringCamelContext ctx) throws Exception {
-        if (streamCache != null) {
-            ctx.setStreamCaching(parseBoolean(getStreamCache()));
-        }
-        if (trace != null) {
-            ctx.setTracing(parseBoolean(getTrace()));
-        }
-        if (delayer != null) {
-            ctx.setDelayer(parseLong(getDelayer()));
-        }
-        if (handleFault != null) {
-            ctx.setHandleFault(parseBoolean(getHandleFault()));
-        }
-        if (errorHandlerRef != null) {
-            ctx.setErrorHandlerBuilder(new ErrorHandlerBuilderRef(getErrorHandlerRef()));
-        }
-        if (autoStartup != null) {
-            ctx.setAutoStartup(parseBoolean(getAutoStartup()));
-        }
-        if (shutdownRoute != null) {
-            ctx.setShutdownRoute(getShutdownRoute());
-        }
-        if (shutdownRunningTask != null) {
-            ctx.setShutdownRunningTask(getShutdownRunningTask());
-        }
-    }
-    
-    protected SpringCamelContext newCamelContext() {
-        return new SpringCamelContext(getApplicationContext());
-    }
-
-    private void initThreadPoolProfiles(CamelContext context) {
-        Set<String> defaultIds = new HashSet<String>();
-
-        // lookup and use custom profiles from the registry
-        Map<String, ThreadPoolProfile> profiles = context.getRegistry().lookupByType(ThreadPoolProfile.class);
-        if (profiles != null && !profiles.isEmpty()) {
-            for (String id : profiles.keySet()) {
-                ThreadPoolProfile profile = profiles.get(id);
-                // do not add if already added, for instance a tracer that is also an InterceptStrategy class
-                if (profile.isDefaultProfile()) {
-                    LOG.info("Using custom default ThreadPoolProfile with id: " + id + " and implementation: " + profile);
-                    context.getExecutorServiceStrategy().setDefaultThreadPoolProfile(profile);
-                    defaultIds.add(id);
-                } else {
-                    context.getExecutorServiceStrategy().registerThreadPoolProfile(profile);
-                }
-            }
-        }
-
-        // use custom profiles defined in the CamelContext
-        if (threadPoolProfiles != null && !threadPoolProfiles.isEmpty()) {
-            for (ThreadPoolProfileDefinition profile : threadPoolProfiles) {
-                if (profile.isDefaultProfile()) {
-                    LOG.info("Using custom default ThreadPoolProfile with id: " + profile.getId() + " and implementation: " + profile);
-                    context.getExecutorServiceStrategy().setDefaultThreadPoolProfile(profile);
-                    defaultIds.add(profile.getId());
-                } else {
-                    context.getExecutorServiceStrategy().registerThreadPoolProfile(profile);
-                }
-            }
-        }
-
-        // validate at most one is defined
-        if (defaultIds.size() > 1) {
-            throw new IllegalArgumentException("Only exactly one default ThreadPoolProfile is allowed, was " + defaultIds.size() + " ids: " + defaultIds);
-        }
-    }
-
-    /**
-     * Strategy to install all available routes into the context
-     */
-    protected void installRoutes() throws Exception {
-        List<RouteBuilder> builders = new ArrayList<RouteBuilder>();
-
-        // lets add route builders added from references
-        if (builderRefs != null) {
-            for (RouteBuilderDefinition builderRef : builderRefs) {
-                RouteBuilder builder = builderRef.createRouteBuilder(getContext());
-                if (builder != null) {
-                    builders.add(builder);
-                } else {
-                    // support to get the route here
-                    RoutesBuilder routes = builderRef.createRoutes(getContext());
-                    if (routes != null) {
-                        this.builders.add(routes);
-                    } else {
-                        // Throw the exception that we can't find any build here
-                        throw new CamelException("Cannot find any routes with this RouteBuilder reference: " + builderRef);
-                    }
-                }
-            }
-        }
-
-        // install already configured routes
-        for (RoutesBuilder routeBuilder : this.builders) {
-            getContext().addRoutes(routeBuilder);
-        }
-
-        // install builders
-        for (RouteBuilder builder : builders) {
-            if (beanPostProcessor != null) {
-                // Inject the annotated resource
-                beanPostProcessor.postProcessBeforeInitialization(builder, builder.toString());
-            }
-            getContext().addRoutes(builder);
-        }
-    }
-
-    /**
-     * Strategy method to try find {@link RouteBuilder} instances on the classpath
-     */
-    protected void findRouteBuilders() throws Exception {
-        PackageScanClassResolver resolver = getContext().getPackageScanClassResolver();
-        addPackageElementContentsToScanDefinition();
-
-        PackageScanDefinition packageScanDef = getPackageScan();
-        if (packageScanDef != null && packageScanDef.getPackages().size() > 0) {
-            // use package scan filter
-            PatternBasedPackageScanFilter filter = new PatternBasedPackageScanFilter();
-            // support property placeholders in include and exclude
-            for (String include : packageScanDef.getIncludes()) {
-                include = getContext().resolvePropertyPlaceholders(include);
-                filter.addIncludePattern(include);
-            }
-            for (String exclude : packageScanDef.getExcludes()) {
-                exclude = getContext().resolvePropertyPlaceholders(exclude);
-                filter.addExcludePattern(exclude);
-            }
-            resolver.addFilter(filter);
-
-            String[] normalized = normalizePackages(getContext(), packageScanDef.getPackages());
-            RouteBuilderFinder finder = new RouteBuilderFinder(getContext(), normalized, getContextClassLoaderOnStart(),
-                    getBeanPostProcessor(), getContext().getPackageScanClassResolver());
-            finder.appendBuilders(builders);
-        }
-    }
-
-    private void addPackageElementContentsToScanDefinition() {
-        PackageScanDefinition packageScanDef = getPackageScan();
-
-        if (getPackages() != null && getPackages().length > 0) {
-            if (packageScanDef == null) {
-                packageScanDef = new PackageScanDefinition();
-                setPackageScan(packageScanDef);
-            }
-
-            for (String pkg : getPackages()) {
-                packageScanDef.getPackages().add(pkg);
-            }
-        }
-    }
-
-    private String[] normalizePackages(CamelContext context, List<String> unnormalized) throws Exception {
-        List<String> packages = new ArrayList<String>();
-        for (String name : unnormalized) {
-            // it may use property placeholders
-            name = context.resolvePropertyPlaceholders(name);
-            name = ObjectHelper.normalizeClassName(name);
-            if (ObjectHelper.isNotEmpty(name)) {
-                if (LOG.isTraceEnabled()) {
-                    LOG.trace("Using package: " + name + " to scan for RouteBuilder classes");
-                }
-                packages.add(name);
-            }
-        }
-        return packages.toArray(new String[packages.size()]);
-    }
-
 }

Modified: camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelEndpointFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelEndpointFactoryBean.java?rev=949127&r1=949126&r2=949127&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelEndpointFactoryBean.java (original)
+++ camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelEndpointFactoryBean.java Fri May 28 07:52:33 2010
@@ -18,13 +18,12 @@ package org.apache.camel.spring;
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
 
 import org.apache.camel.CamelContext;
-import org.apache.camel.CamelContextAware;
 import org.apache.camel.Endpoint;
+import org.apache.camel.core.xml.AbstractCamelEndpointFactoryBean;
 import org.apache.camel.NoSuchEndpointException;
 import org.apache.camel.model.IdentifiedType;
 import org.apache.camel.spring.util.CamelContextResolverHelper;
@@ -33,8 +32,6 @@ import org.springframework.beans.factory
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
 
-import static org.apache.camel.util.ObjectHelper.notNull;
-
 /**
  * A {@link FactoryBean} which instantiates {@link Endpoint} objects
  *
@@ -42,80 +39,17 @@ import static org.apache.camel.util.Obje
  */
 @XmlRootElement(name = "endpoint")
 @XmlAccessorType(XmlAccessType.FIELD)
-public class CamelEndpointFactoryBean extends IdentifiedType implements FactoryBean, CamelContextAware, ApplicationContextAware {
-    @XmlAttribute
-    private String uri;
-    @XmlAttribute
-    private String camelContextId;
-    @XmlTransient
-    private CamelContext context;    
-    @XmlTransient
-    private Endpoint endpoint;
+public class CamelEndpointFactoryBean extends AbstractCamelEndpointFactoryBean implements FactoryBean, ApplicationContextAware {
     @XmlTransient
     private ApplicationContext applicationContext;
 
-    public Object getObject() throws Exception {
-        if (endpoint == null) {
-            endpoint = createEndpoint();
-        }
-        return endpoint;
-    }
-
-    public Class getObjectType() {
-        return Endpoint.class;
-    }
-    
-    public boolean isSingleton() {
-        return true;
-    }
-    
-    public CamelContext getCamelContext() {
-        return context;
-    }
-    
-
-    /**
-     * Sets the context to use to resolve endpoints
-     *
-     * @param context the context used to resolve endpoints
-     */
-    public void setCamelContext(CamelContext context) {
-        this.context = context;
-    }
-
-    public String getUri() {
-        return uri;
-    }
-
-    /**
-     * Sets the URI to use to resolve the endpoint
-     *
-     * @param uri the URI used to set the endpoint
-     */
-    public void setUri(String uri) {
-        this.uri = uri;
-    }
-
-    protected Endpoint createEndpoint() {
-        if (context == null && camelContextId != null) {
-            context = CamelContextResolverHelper.getCamelContextWithId(applicationContext, camelContextId);
-        }
-        notNull(context, "context");
-        notNull(uri, "uri");
-        
-        Endpoint endpoint = context.getEndpoint(uri);
-        if (endpoint == null) {
-            throw new NoSuchEndpointException(uri);
-        }
-        return endpoint;
+    @Override
+    protected CamelContext getCamelContextWithId(String camelContextId) {
+        return CamelContextResolverHelper.getCamelContextWithId(applicationContext, camelContextId);
     }
 
     public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
         this.applicationContext = applicationContext;
     }
 
-    public void setCamelContextId(String camelContextId) {
-        this.camelContextId = camelContextId;
-    }
-   
 }

Modified: camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelProducerTemplateFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelProducerTemplateFactoryBean.java?rev=949127&r1=949126&r2=949127&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelProducerTemplateFactoryBean.java (original)
+++ camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelProducerTemplateFactoryBean.java Fri May 28 07:52:33 2010
@@ -18,18 +18,12 @@ package org.apache.camel.spring;
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
 
 import org.apache.camel.CamelContext;
-import org.apache.camel.CamelContextAware;
-import org.apache.camel.Endpoint;
-import org.apache.camel.ProducerTemplate;
-import org.apache.camel.impl.DefaultProducerTemplate;
-import org.apache.camel.model.IdentifiedType;
 import org.apache.camel.spring.util.CamelContextResolverHelper;
-import org.apache.camel.util.ServiceHelper;
+import org.apache.camel.core.xml.AbstractCamelProducerTemplateFactoryBean;
 import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.DisposableBean;
 import org.springframework.beans.factory.FactoryBean;
@@ -45,95 +39,18 @@ import org.springframework.context.Appli
  */
 @XmlRootElement(name = "template")
 @XmlAccessorType(XmlAccessType.FIELD)
-public class CamelProducerTemplateFactoryBean extends IdentifiedType implements FactoryBean, InitializingBean, DisposableBean, CamelContextAware, ApplicationContextAware {
-    @XmlTransient
-    private ProducerTemplate template;
-    @XmlAttribute(required = false)
-    private String defaultEndpoint;
-    @XmlAttribute
-    private String camelContextId;
-    @XmlTransient
-    private CamelContext camelContext;
+public class CamelProducerTemplateFactoryBean extends AbstractCamelProducerTemplateFactoryBean implements FactoryBean, InitializingBean, DisposableBean, ApplicationContextAware {
+
     @XmlTransient
     private ApplicationContext applicationContext;
-    @XmlAttribute
-    private Integer maximumCacheSize;
-
-    public void afterPropertiesSet() throws Exception {
-        if (camelContext == null && camelContextId != null) {
-            camelContext = CamelContextResolverHelper.getCamelContextWithId(applicationContext, camelContextId);
-        }
-        if (camelContext == null) {
-            throw new IllegalArgumentException("A CamelContext or a CamelContextId must be injected!");
-        }
-    }
-
-    public Object getObject() throws Exception {
-        CamelContext context = getCamelContext();
-        if (defaultEndpoint != null) {
-            Endpoint endpoint = context.getEndpoint(defaultEndpoint);
-            if (endpoint == null) {
-                throw new IllegalArgumentException("No endpoint found for URI: " + defaultEndpoint);
-            } else {
-                template = new DefaultProducerTemplate(context, endpoint);
-            }
-        } else {
-            template = new DefaultProducerTemplate(context);
-        }
-
-        // set custom cache size if provided
-        if (maximumCacheSize != null) {
-            template.setMaximumCacheSize(maximumCacheSize);
-        }
-
-        // must start it so its ready to use
-        ServiceHelper.startService(template);
-        return template;
-    }
-
-    public Class getObjectType() {
-        return DefaultProducerTemplate.class;
-    }
 
-    public boolean isSingleton() {
-        return true;
-    }
-
-    public void destroy() throws Exception {
-        ServiceHelper.stopService(template);
-    }
-
-    // Properties
-    // -------------------------------------------------------------------------
-    public CamelContext getCamelContext() {
-        return camelContext;
-    }
-
-    public void setCamelContext(CamelContext camelContext) {
-        this.camelContext = camelContext;
-    }
-
-    /**
-     * Sets the default endpoint URI used by default for sending message exchanges
-     */
-    public void setDefaultEndpoint(String defaultEndpoint) {
-        this.defaultEndpoint = defaultEndpoint;
-    }
-
-    public void setCamelContextId(String camelContextId) {
-        this.camelContextId = camelContextId;
+    @Override
+    protected CamelContext getCamelContextWithId(String camelContextId) {
+        return CamelContextResolverHelper.getCamelContextWithId(applicationContext, camelContextId);
     }
 
     public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
         this.applicationContext = applicationContext;
     }
 
-    public Integer getMaximumCacheSize() {
-        return maximumCacheSize;
-    }
-
-    public void setMaximumCacheSize(Integer maximumCacheSize) {
-        this.maximumCacheSize = maximumCacheSize;
-    }
-
 }

Modified: camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelThreadPoolFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelThreadPoolFactoryBean.java?rev=949127&r1=949126&r2=949127&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelThreadPoolFactoryBean.java (original)
+++ camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelThreadPoolFactoryBean.java Fri May 28 07:52:33 2010
@@ -16,21 +16,13 @@
  */
 package org.apache.camel.spring;
 
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.RejectedExecutionHandler;
-import java.util.concurrent.TimeUnit;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 
 import org.apache.camel.CamelContext;
-import org.apache.camel.CamelContextAware;
-import org.apache.camel.ThreadPoolRejectedPolicy;
-import org.apache.camel.builder.xml.TimeUnitAdapter;
-import org.apache.camel.model.IdentifiedType;
+import org.apache.camel.core.xml.AbstractCamelThreadPoolFactoryBean;
 import org.apache.camel.spring.util.CamelContextResolverHelper;
 import org.springframework.beans.factory.FactoryBean;
 import org.springframework.context.ApplicationContext;
@@ -45,143 +37,14 @@ import static org.apache.camel.util.Obje
  */
 @XmlRootElement(name = "threadPool")
 @XmlAccessorType(XmlAccessType.FIELD)
-public class CamelThreadPoolFactoryBean extends IdentifiedType implements FactoryBean, CamelContextAware, ApplicationContextAware {
+public class CamelThreadPoolFactoryBean extends AbstractCamelThreadPoolFactoryBean implements FactoryBean, ApplicationContextAware {
 
-    @XmlAttribute(required = true)
-    private Integer poolSize;
-    @XmlAttribute
-    private Integer maxPoolSize;
-    @XmlAttribute
-    private Long keepAliveTime = 60L;
-    @XmlAttribute
-    @XmlJavaTypeAdapter(TimeUnitAdapter.class)
-    private TimeUnit timeUnit = TimeUnit.SECONDS;
-    @XmlAttribute
-    private Integer maxQueueSize = -1;
-    @XmlAttribute
-    private ThreadPoolRejectedPolicy rejectedPolicy = ThreadPoolRejectedPolicy.CallerRuns;
-    @XmlAttribute(required = true)
-    private String threadName;
-    @XmlAttribute
-    private Boolean daemon = Boolean.TRUE;
-    @XmlAttribute
-    private String camelContextId;
-    @XmlTransient
-    private CamelContext camelContext;
     @XmlTransient
     private ApplicationContext applicationContext;
 
-    public Object getObject() throws Exception {
-        if (camelContext == null && camelContextId != null) {
-            camelContext = CamelContextResolverHelper.getCamelContextWithId(applicationContext, camelContextId);
-        }
-
-        notNull(camelContext, "camelContext");
-        if (poolSize == null || poolSize <= 0) {
-            throw new IllegalArgumentException("PoolSize must be a positive number");
-        }
-
-        int max = getMaxPoolSize() != null ? getMaxPoolSize() : getPoolSize();
-        RejectedExecutionHandler rejected = null;
-        if (rejectedPolicy != null) {
-            rejected = rejectedPolicy.asRejectedExecutionHandler();
-        }
-
-        ExecutorService answer = camelContext.getExecutorServiceStrategy().newThreadPool(getId(), getThreadName(), getPoolSize(), max,
-                    getKeepAliveTime(), getTimeUnit(), getMaxQueueSize(), rejected, isDaemon());
-        return answer;
-    }
-
-    public Class getObjectType() {
-        return ExecutorService.class;
-    }
-
-    public boolean isSingleton() {
-        return true;
-    }
-
-    public Integer getPoolSize() {
-        return poolSize;
-    }
-
-    public void setPoolSize(Integer poolSize) {
-        this.poolSize = poolSize;
-    }
-
-    public Integer getMaxPoolSize() {
-        return maxPoolSize;
-    }
-
-    public void setMaxPoolSize(Integer maxPoolSize) {
-        this.maxPoolSize = maxPoolSize;
-    }
-
-    public Long getKeepAliveTime() {
-        return keepAliveTime;
-    }
-
-    public void setKeepAliveTime(Long keepAliveTime) {
-        this.keepAliveTime = keepAliveTime;
-    }
-
-    public TimeUnit getTimeUnit() {
-        return timeUnit;
-    }
-
-    public void setTimeUnit(TimeUnit timeUnit) {
-        this.timeUnit = timeUnit;
-    }
-
-    public Integer getMaxQueueSize() {
-        return maxQueueSize;
-    }
-
-    public void setMaxQueueSize(Integer maxQueueSize) {
-        this.maxQueueSize = maxQueueSize;
-    }
-
-    public ThreadPoolRejectedPolicy getRejectedPolicy() {
-        return rejectedPolicy;
-    }
-
-    public void setRejectedPolicy(ThreadPoolRejectedPolicy rejectedPolicy) {
-        this.rejectedPolicy = rejectedPolicy;
-    }
-
-    public String getThreadName() {
-        return threadName;
-    }
-
-    public void setThreadName(String threadName) {
-        this.threadName = threadName;
-    }
-
-    public Boolean isDaemon() {
-        return daemon;
-    }
-
-    public void setDaemon(Boolean daemon) {
-        this.daemon = daemon;
-    }
-
-    public String getCamelContextId() {
-        return camelContextId;
-    }
-
-    public void setCamelContextId(String camelContextId) {
-        this.camelContextId = camelContextId;
-    }
-
-    public CamelContext getCamelContext() {
-        return camelContext;
-    }
-
-    public void setCamelContext(CamelContext camelContext) {
-        this.camelContext = camelContext;
-    }
-
-    public ApplicationContext getApplicationContext() {
-        return applicationContext;
+    @Override
+    protected CamelContext getCamelContextWithId(String camelContextId) {
+        return CamelContextResolverHelper.getCamelContextWithId(applicationContext, camelContextId);
     }
 
     public void setApplicationContext(ApplicationContext applicationContext) {

Modified: camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java?rev=949127&r1=949126&r2=949127&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java (original)
+++ camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java Fri May 28 07:52:33 2010
@@ -26,6 +26,8 @@ import javax.xml.bind.Binder;
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
 
+import org.apache.camel.core.xml.CamelJMXAgentDefinition;
+import org.apache.camel.core.xml.CamelPropertyPlaceholderDefinition;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -39,9 +41,7 @@ import org.apache.camel.spring.CamelBean
 import org.apache.camel.spring.CamelConsumerTemplateFactoryBean;
 import org.apache.camel.spring.CamelContextFactoryBean;
 import org.apache.camel.spring.CamelEndpointFactoryBean;
-import org.apache.camel.spring.CamelJMXAgentDefinition;
 import org.apache.camel.spring.CamelProducerTemplateFactoryBean;
-import org.apache.camel.spring.CamelPropertyPlaceholderDefinition;
 import org.apache.camel.spring.CamelRouteContextFactoryBean;
 import org.apache.camel.spring.CamelThreadPoolFactoryBean;
 import org.apache.camel.spring.remoting.CamelProxyFactoryBean;
@@ -183,6 +183,7 @@ public class CamelNamespaceHandler exten
     protected Set<Class> getJaxbPackages() {
         Set<Class> classes = new HashSet<Class>();
         classes.add(org.apache.camel.spring.CamelContextFactoryBean.class);
+        classes.add(CamelJMXAgentDefinition.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);

Modified: camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/handler/ErrorHandlerDefinitionParser.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/handler/ErrorHandlerDefinitionParser.java?rev=949127&r1=949126&r2=949127&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/handler/ErrorHandlerDefinitionParser.java (original)
+++ camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/handler/ErrorHandlerDefinitionParser.java Fri May 28 07:52:33 2010
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.spring.handler;
 
+import org.apache.camel.spring.ErrorHandlerType;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Element;
 import org.w3c.dom.NamedNodeMap;
@@ -23,7 +24,6 @@ import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
 import org.apache.camel.processor.RedeliveryPolicy;
-import org.apache.camel.spring.ErrorHandlerType;
 import org.apache.camel.util.ObjectHelper;
 
 import org.springframework.beans.factory.config.BeanDefinition;

Modified: camel/trunk/components/camel-spring/src/main/resources/org/apache/camel/spring/jaxb.index
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/main/resources/org/apache/camel/spring/jaxb.index?rev=949127&r1=949126&r2=949127&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/main/resources/org/apache/camel/spring/jaxb.index (original)
+++ camel/trunk/components/camel-spring/src/main/resources/org/apache/camel/spring/jaxb.index Fri May 28 07:52:33 2010
@@ -18,10 +18,6 @@ CamelBeanPostProcessor
 CamelConsumerTemplateFactoryBean
 CamelContextFactoryBean
 CamelEndpointFactoryBean
-CamelJMXAgentDefinition
 CamelProducerTemplateFactoryBean
-CamelPropertyPlaceholderDefinition
-CamelProxyFactoryDefinition
 CamelRouteContextFactoryBean
-CamelServiceExporterDefinition
 CamelThreadPoolFactoryBean

Modified: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/scan/PatternBasedPackageScanFilterTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/scan/PatternBasedPackageScanFilterTest.java?rev=949127&r1=949126&r2=949127&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/scan/PatternBasedPackageScanFilterTest.java (original)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/scan/PatternBasedPackageScanFilterTest.java Fri May 28 07:52:33 2010
@@ -26,7 +26,7 @@ import java.util.List;
 import java.util.Set;
 import java.util.jar.JarFile;
 
-import org.apache.camel.spring.PatternBasedPackageScanFilter;
+import org.apache.camel.core.xml.scan.PatternBasedPackageScanFilter;
 import org.apache.camel.util.CollectionHelper;
 
 public class PatternBasedPackageScanFilterTest extends org.apache.camel.spring.scan.ScanTestSupport {

Modified: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/scan/ScanTestSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/scan/ScanTestSupport.java?rev=949127&r1=949126&r2=949127&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/scan/ScanTestSupport.java (original)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/scan/ScanTestSupport.java Fri May 28 07:52:33 2010
@@ -20,7 +20,7 @@ import java.util.HashSet;
 import java.util.Set;
 
 import junit.framework.TestCase;
-import org.apache.camel.spring.PatternBasedPackageScanFilter;
+import org.apache.camel.core.xml.scan.PatternBasedPackageScanFilter;
 
 public abstract class ScanTestSupport extends TestCase {
 

Modified: camel/trunk/components/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/pom.xml?rev=949127&r1=949126&r2=949127&view=diff
==============================================================================
--- camel/trunk/components/pom.xml (original)
+++ camel/trunk/components/pom.xml Fri May 28 07:52:33 2010
@@ -35,12 +35,12 @@
     <module>camel-bam</module>
     <module>camel-bean-validator</module>
     <module>camel-bindy</module>
-<!-- blueprint is under active development
     <module>camel-blueprint</module>
--->
     <module>camel-cometd</module>
     <module>camel-cache</module>
     <module>camel-castor</module>
+    <module>camel-core-osgi</module>
+    <module>camel-core-xml</module>
     <module>camel-crypto</module>
     <module>camel-csv</module>
     <module>camel-cxf</module>

Modified: camel/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/parent/pom.xml?rev=949127&r1=949126&r2=949127&view=diff
==============================================================================
--- camel/trunk/parent/pom.xml (original)
+++ camel/trunk/parent/pom.xml Fri May 28 07:52:33 2010
@@ -250,6 +250,16 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-core-xml</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-core-osgi</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-crypto</artifactId>
         <version>${project.version}</version>
       </dependency>
@@ -1283,6 +1293,13 @@
         <artifactId>ftplet-api</artifactId>
         <version>${ftpserver-version}</version>
       </dependency>
+
+      <!-- blueprint -->
+      <dependency>
+        <groupId>org.apache.aries.blueprint</groupId>
+        <artifactId>org.apache.aries.blueprint</artifactId>
+        <version>0.1-incubating</version>
+      </dependency>
     </dependencies>
   </dependencyManagement>