Willem, did you forget to add AbstractCamelBeanPostProcessor.java? Hadrian On Nov 4, 2010, at 10:26 PM, [email protected] wrote:
> Author: ningjiang > Date: Fri Nov 5 02:26:49 2010 > New Revision: 1031406 > > URL: http://svn.apache.org/viewvc?rev=1031406&view=rev > Log: > CAMEL-3308 Updated the cxf version rang > > Modified: > > camel/trunk/camel-core/src/main/java/org/apache/camel/impl/CamelPostProcessorHelper.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/components/camel-hawtdb/src/test/java/org/apache/camel/component/hawtdb/HawtDBAggregateDiscardOnTimeoutTest.java > camel/trunk/components/camel-jms/pom.xml > > camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/AbstractJpaMethodTest.java > > camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaUseMergeTest.java > > camel/trunk/components/camel-ldap/src/test/java/org/apache/camel/component/ldap/LdapRouteTest.java > camel/trunk/components/camel-spring-javaconfig/pom.xml > > camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java > > camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/CamelContextResource.java > > camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppConsumer.java > > camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppGroupChatProducer.java > > camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppPrivateChatProducer.java > camel/trunk/parent/pom.xml > > camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/OSGiBlueprintTestSupport.java > > camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/CxfProxyExampleTest.java > > camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/spring/xslt/XsltRouteTest.java > > Modified: > camel/trunk/camel-core/src/main/java/org/apache/camel/impl/CamelPostProcessorHelper.java > URL: > http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/CamelPostProcessorHelper.java?rev=1031406&r1=1031405&r2=1031406&view=diff > ============================================================================== > --- > camel/trunk/camel-core/src/main/java/org/apache/camel/impl/CamelPostProcessorHelper.java > (original) > +++ > camel/trunk/camel-core/src/main/java/org/apache/camel/impl/CamelPostProcessorHelper.java > Fri Nov 5 02:26:49 2010 > @@ -44,8 +44,9 @@ import org.apache.commons.logging.LogFac > > /** > * A helper class for Camel based injector or post processing hooks which can > be reused by > - * both the <a href="http://camel.apache.org/spring.html">Spring</a> > - * and <a href="http://camel.apache.org/guice.html">Guice</a> support. > + * both the <a href="http://camel.apache.org/spring.html">Spring</a>, > + * <a href="http://camel.apache.org/guice.html">Guice</a> and > + * <a href="http://camel.apache.org/blueprint.html">Blueprint</a>support. > * > * @version $Revision$ > */ > > 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=1031406&r1=1031405&r2=1031406&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 > Fri Nov 5 02:26:49 2010 > @@ -98,7 +98,7 @@ public class CamelContextFactoryBean ext > @XmlElement(name = "jmxAgent", type = CamelJMXAgentDefinition.class, > required = false) > private CamelJMXAgentDefinition camelJMXAgent; > @XmlElements({ > -// @XmlElement(name = "beanPostProcessor", type = > CamelBeanPostProcessor.class, required = false), > + @XmlElement(name = "beanPostProcessor", type = > CamelBeanPostProcessor.class, required = false), > @XmlElement(name = "template", type = > CamelProducerTemplateFactoryBean.class, required = false), > @XmlElement(name = "consumerTemplate", type = > CamelConsumerTemplateFactoryBean.class, required = false), > @XmlElement(name = "proxy", type = CamelProxyFactoryDefinition.class, > required = false), > @@ -178,6 +178,7 @@ public class CamelContextFactoryBean ext > } > > @Override > + // TODO this method is need for looking up the customer configure > component > protected <S> S getBeanForType(Class<S> clazz) { > return null; > } > > 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=1031406&r1=1031405&r2=1031406&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 > Fri Nov 5 02:26:49 2010 > @@ -40,6 +40,7 @@ import org.apache.aries.blueprint.mutabl > import org.apache.aries.blueprint.mutable.MutablePassThroughMetadata; > import org.apache.aries.blueprint.mutable.MutableReferenceMetadata; > import org.apache.camel.blueprint.BlueprintCamelContext; > +import org.apache.camel.blueprint.CamelBeanPostProcessor; > import org.apache.camel.blueprint.CamelContextFactoryBean; > import org.apache.camel.core.xml.AbstractCamelContextFactoryBean; > import org.apache.camel.impl.DefaultCamelContextNameStrategy; > @@ -141,6 +142,8 @@ public class CamelNamespaceHandler imple > ptm = (PassThroughMetadata) > context.getComponentDefinitionRegistry().getComponentDefinition("blueprintBundleContext"); > ccfb.setBundleContext((BundleContext) ptm.getObject()); > ccfb.setImplicitId(implicitId); > + // setup the BeanPostProcessor > + createBeansReference(context, contextId, ccfb.getBeans()); > ccfb.afterPropertiesSet(); > } catch (Exception e) { > throw new ComponentDefinitionException("Unable to initialize > camel context factory", e); > @@ -264,6 +267,16 @@ public class CamelNamespaceHandler imple > return null; > } > > + private void createBeansReference(ParserContext context, String > contextId, List beans) { > + // need to check the beanPostProcessor first > + MutableBeanMetadata metadata = > context.createMetadata(MutableBeanMetadata.class); > + metadata.setProcessor(true); > + metadata.setId(contextId + ".beanPostProcessor"); > + metadata.setRuntimeClass(CamelBeanPostProcessor.class); > + LOG.info("**** create the beanPostProcessor"); > + > context.getComponentDefinitionRegistry().registerComponentDefinition(metadata); > + } > + > private void findInputComponents(List<FromDefinition> defs, Set<String> > components, Set<String> languages, Set<String> dataformats) { > if (defs != null) { > for (FromDefinition def : defs) { > > Modified: > camel/trunk/components/camel-hawtdb/src/test/java/org/apache/camel/component/hawtdb/HawtDBAggregateDiscardOnTimeoutTest.java > URL: > http://svn.apache.org/viewvc/camel/trunk/components/camel-hawtdb/src/test/java/org/apache/camel/component/hawtdb/HawtDBAggregateDiscardOnTimeoutTest.java?rev=1031406&r1=1031405&r2=1031406&view=diff > ============================================================================== > --- > camel/trunk/components/camel-hawtdb/src/test/java/org/apache/camel/component/hawtdb/HawtDBAggregateDiscardOnTimeoutTest.java > (original) > +++ > camel/trunk/components/camel-hawtdb/src/test/java/org/apache/camel/component/hawtdb/HawtDBAggregateDiscardOnTimeoutTest.java > Fri Nov 5 02:26:49 2010 > @@ -17,7 +17,6 @@ > package org.apache.camel.component.hawtdb; > > import java.util.concurrent.TimeUnit; > -import java.util.concurrent.atomic.AtomicInteger; > > import org.apache.camel.Exchange; > import org.apache.camel.builder.RouteBuilder; > @@ -27,8 +26,7 @@ import org.apache.camel.test.junit4.Came > import org.junit.Test; > > public class HawtDBAggregateDiscardOnTimeoutTest extends CamelTestSupport { > - > - private static AtomicInteger counter = new AtomicInteger(0); > + > private HawtDBAggregationRepository repo; > > @Override > > Modified: camel/trunk/components/camel-jms/pom.xml > URL: > http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/pom.xml?rev=1031406&r1=1031405&r2=1031406&view=diff > ============================================================================== > --- camel/trunk/components/camel-jms/pom.xml (original) > +++ camel/trunk/components/camel-jms/pom.xml Fri Nov 5 02:26:49 2010 > @@ -42,6 +42,11 @@ > </dependency> > <dependency> > <groupId>org.apache.camel</groupId> > + <artifactId>camel-core-xml</artifactId> > + <scope>provided</scope> > + </dependency> > + <dependency> > + <groupId>org.apache.camel</groupId> > <artifactId>camel-spring</artifactId> > </dependency> > <dependency> > > Modified: > camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/AbstractJpaMethodTest.java > URL: > http://svn.apache.org/viewvc/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/AbstractJpaMethodTest.java?rev=1031406&r1=1031405&r2=1031406&view=diff > ============================================================================== > --- > camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/AbstractJpaMethodTest.java > (original) > +++ > camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/AbstractJpaMethodTest.java > Fri Nov 5 02:26:49 2010 > @@ -62,7 +62,6 @@ public abstract class AbstractJpaMethodT > stopServices(consumer, template, camelContext); > } > > - @SuppressWarnings("unchecked") > @Test > public void produceNewEntity() throws Exception { > setUp("jpa://" + Customer.class.getName() + "?usePersist=" + > (usePersist() ? "true" : "false")); > @@ -89,7 +88,6 @@ public abstract class AbstractJpaMethodT > assertEquals(receivedCustomer.getAddress().getId(), > persistedCustomer.getAddress().getId()); > } > > - @SuppressWarnings("unchecked") > @Test > public void produceNewEntitiesFromList() throws Exception { > setUp("jpa://" + List.class.getName() + "?usePersist=" + > (usePersist() ? "true" : "false")); > @@ -160,7 +158,6 @@ public abstract class AbstractJpaMethodT > assertEntitiesInDatabase(0, Address.class.getName()); > } > > - @SuppressWarnings("unchecked") > protected void setUp(String endpointUri) throws Exception { > template = camelContext.createProducerTemplate(); > startServices(template, camelContext); > @@ -181,7 +178,6 @@ public abstract class AbstractJpaMethodT > assertEntitiesInDatabase(0, Address.class.getName()); > } > > - @SuppressWarnings("unchecked") > protected void save(final Customer customer) { > transactionStrategy.execute(new JpaCallback() { > public Object doInJpa(EntityManager entityManager) throws > PersistenceException { > @@ -195,7 +191,6 @@ public abstract class AbstractJpaMethodT > assertEntitiesInDatabase(1, Address.class.getName()); > } > > - @SuppressWarnings("unchecked") > protected void assertEntitiesInDatabase(int count, String entity) { > List results = jpaTemplate.find("select o from " + entity + " o"); > assertEquals(count, results.size()); > > Modified: > camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaUseMergeTest.java > URL: > http://svn.apache.org/viewvc/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaUseMergeTest.java?rev=1031406&r1=1031405&r2=1031406&view=diff > ============================================================================== > --- > camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaUseMergeTest.java > (original) > +++ > camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaUseMergeTest.java > Fri Nov 5 02:26:49 2010 > @@ -37,7 +37,6 @@ public class JpaUseMergeTest extends Abs > return false; > } > > - @SuppressWarnings("unchecked") > @Test > public void produceExistingEntity() throws Exception { > setUp("jpa://" + Customer.class.getName() + "?usePersist=false"); > > Modified: > camel/trunk/components/camel-ldap/src/test/java/org/apache/camel/component/ldap/LdapRouteTest.java > URL: > http://svn.apache.org/viewvc/camel/trunk/components/camel-ldap/src/test/java/org/apache/camel/component/ldap/LdapRouteTest.java?rev=1031406&r1=1031405&r2=1031406&view=diff > ============================================================================== > --- > camel/trunk/components/camel-ldap/src/test/java/org/apache/camel/component/ldap/LdapRouteTest.java > (original) > +++ > camel/trunk/components/camel-ldap/src/test/java/org/apache/camel/component/ldap/LdapRouteTest.java > Fri Nov 5 02:26:49 2010 > @@ -49,6 +49,7 @@ public class LdapRouteTest extends Abstr > private ProducerTemplate template; > private int port; > > + @SuppressWarnings("unchecked") > @ApplyLdifFiles("org/apache/camel/component/ldap/LdapRouteTest.ldif") > @Test > public void testLdapRoute() throws Exception { > > Modified: camel/trunk/components/camel-spring-javaconfig/pom.xml > URL: > http://svn.apache.org/viewvc/camel/trunk/components/camel-spring-javaconfig/pom.xml?rev=1031406&r1=1031405&r2=1031406&view=diff > ============================================================================== > --- camel/trunk/components/camel-spring-javaconfig/pom.xml (original) > +++ camel/trunk/components/camel-spring-javaconfig/pom.xml Fri Nov 5 > 02:26:49 2010 > @@ -58,6 +58,11 @@ > </dependency> > <dependency> > <groupId>org.apache.camel</groupId> > + <artifactId>camel-core-xml</artifactId> > + <scope>provided</scope> > + </dependency> > + <dependency> > + <groupId>org.apache.camel</groupId> > <artifactId>camel-spring</artifactId> > <exclusions> > <exclusion> > > 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=1031406&r1=1031405&r2=1031406&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 Nov 5 02:26:49 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.AbstractCamelBeanPostProcessor; > import org.apache.camel.core.xml.CamelJMXAgentDefinition; > import org.apache.camel.impl.CamelPostProcessorHelper; > import org.apache.camel.impl.DefaultEndpoint; > @@ -65,19 +66,13 @@ import org.springframework.context.Appli > */ > @XmlRootElement(name = "beanPostProcessor") > @XmlAccessorType(XmlAccessType.FIELD) > -public class CamelBeanPostProcessor implements BeanPostProcessor, > ApplicationContextAware { > +public class CamelBeanPostProcessor extends AbstractCamelBeanPostProcessor > implements BeanPostProcessor, ApplicationContextAware { > private static final transient Log LOG = > LogFactory.getLog(CamelBeanPostProcessor.class); > @XmlTransient > Set<String> prototypeBeans = new LinkedHashSet<String>(); > @XmlTransient > - private CamelContext camelContext; > - @XmlTransient > private ApplicationContext applicationContext; > - @XmlTransient > - private CamelPostProcessorHelper postProcessor; > - @XmlTransient > - private String camelId; > - > + > public CamelBeanPostProcessor() { > } > > @@ -91,8 +86,8 @@ public class CamelBeanPostProcessor impl > return bean; > } > > - if (camelContext == null && > applicationContext.containsBean(camelId)) { > - setCamelContext((CamelContext) > applicationContext.getBean(camelId)); > + if (getCamelContext() == null && > applicationContext.containsBean(getCamelId())) { > + setCamelContext((CamelContext) > applicationContext.getBean(getCamelId())); > } > > injectFields(bean, beanName); > @@ -100,10 +95,10 @@ public class CamelBeanPostProcessor impl > > if (bean instanceof CamelContextAware && canSetCamelContext(bean, > beanName)) { > CamelContextAware contextAware = (CamelContextAware)bean; > - if (camelContext == null) { > + if (getCamelContext() == null) { > LOG.warn("No CamelContext defined yet so cannot inject into: > " + bean); > } else { > - contextAware.setCamelContext(camelContext); > + contextAware.setCamelContext(getCamelContext()); > } > } > > @@ -134,92 +129,11 @@ public class CamelBeanPostProcessor impl > public void setApplicationContext(ApplicationContext applicationContext) > throws BeansException { > this.applicationContext = applicationContext; > } > - > - public CamelContext getCamelContext() { > - return camelContext; > - } > - > - public void setCamelContext(CamelContext camelContext) { > - this.camelContext = camelContext; > - postProcessor = new CamelPostProcessorHelper(camelContext) { > - @Override > - protected RuntimeException > createProxyInstantiationRuntimeException(Class<?> type, Endpoint endpoint, > Exception e) { > - return new BeanInstantiationException(type, "Could not > instantiate proxy of type " + type.getName() + " on endpoint " + endpoint, e); > - } > - > - protected boolean isSingleton(Object bean, String beanName) { > - // no application context has been injected which means the > bean > - // has not been enlisted in Spring application context > - if (applicationContext == null || beanName == null) { > - return super.isSingleton(bean, beanName); > - } else { > - return applicationContext.isSingleton(beanName); > - } > - } > - > - protected void startService(Service service, Object bean, String > beanName) throws Exception { > - if (isSingleton(bean, beanName)) { > - getCamelContext().addService(service); > - } else { > - // only start service and do not add it to CamelContext > - ServiceHelper.startService(service); > - if (prototypeBeans.add(beanName)) { > - // do not spam the log with WARN so do this only > once per bean name > - LOG.warn("The bean with id [" + beanName + "] is > prototype scoped and cannot stop the injected service when bean is destroyed: > " > - + service + ". You may want to stop the > service manually from the bean."); > - } > - } > - } > - }; > - } > - > - public String getCamelId() { > - return camelId; > - } > - > - public void setCamelId(String camelId) { > - this.camelId = camelId; > - } > - > + > // Implementation methods > // > ------------------------------------------------------------------------- > > - /** > - * Can we post process the given bean? > - * > - * @param bean the bean > - * @param beanName the bean name > - * @return true to process it > - */ > - protected boolean canPostProcessBean(Object bean, String beanName) { > - // the JMXAgent is a bit strange and causes Spring issues if we let > it being > - // post processed by this one. It does not need it anyway so we are > good to go. > - if (bean instanceof CamelJMXAgentDefinition) { > - return false; > - } > - > - // all other beans can of course be processed > - return true; > - } > - > - > - protected boolean canSetCamelContext(Object bean, String beanName) { > - boolean answer = true; > - if (bean instanceof CamelContextAware) { > - CamelContextAware camelContextAware = (CamelContextAware) bean; > - CamelContext context = camelContextAware.getCamelContext(); > - if (context != null) { > - if (LOG.isTraceEnabled()) { > - LOG.trace("The camel context of " + beanName + " is set, > so we skip inject the camel context of it."); > - } > - answer = false; > - } > - } else { > - answer = false; > - } > - return answer; > - } > - > + > /** > * A strategy method to allow implementations to perform some custom JBI > * based injection of the POJO > @@ -230,12 +144,12 @@ public class CamelBeanPostProcessor impl > ReflectionUtils.doWithFields(bean.getClass(), new > ReflectionUtils.FieldCallback() { > public void doWith(Field field) throws IllegalArgumentException, > IllegalAccessException { > EndpointInject endpointInject = > field.getAnnotation(EndpointInject.class); > - if (endpointInject != null && > postProcessor.matchContext(endpointInject.context())) { > + if (endpointInject != null && > getPostProcessor().matchContext(endpointInject.context())) { > injectField(field, endpointInject.uri(), > endpointInject.ref(), bean, beanName); > } > > Produce produce = field.getAnnotation(Produce.class); > - if (produce != null && > postProcessor.matchContext(produce.context())) { > + if (produce != null && > getPostProcessor().matchContext(produce.context())) { > injectField(field, produce.uri(), produce.ref(), bean, > beanName); > } > } > @@ -257,12 +171,12 @@ public class CamelBeanPostProcessor impl > > protected void setterInjection(Method method, Object bean, String > beanName) { > EndpointInject endpointInject = > method.getAnnotation(EndpointInject.class); > - if (endpointInject != null && > postProcessor.matchContext(endpointInject.context())) { > + if (endpointInject != null && > getPostProcessor().matchContext(endpointInject.context())) { > setterInjection(method, bean, beanName, endpointInject.uri(), > endpointInject.ref()); > } > > Produce produce = method.getAnnotation(Produce.class); > - if (produce != null && > postProcessor.matchContext(produce.context())) { > + if (produce != null && > getPostProcessor().matchContext(produce.context())) { > setterInjection(method, bean, beanName, produce.uri(), > produce.ref()); > } > } > @@ -280,9 +194,40 @@ public class CamelBeanPostProcessor impl > } > } > > - public CamelPostProcessorHelper getPostProcessor() { > - ObjectHelper.notNull(postProcessor, "postProcessor"); > - return postProcessor; > + @Override > + public CamelPostProcessorHelper > createCamelPostProcessorHelper(CamelContext camelContext) { > + return new CamelPostProcessorHelper(camelContext) { > + @Override > + protected RuntimeException > createProxyInstantiationRuntimeException(Class<?> type, Endpoint endpoint, > Exception e) { > + return new BeanInstantiationException(type, "Could not > instantiate proxy of type " + type.getName() + " on endpoint " + endpoint, e); > + } > + > + protected boolean isSingleton(Object bean, String beanName) { > + // no application context has been injected which means the > bean > + // has not been enlisted in Spring application context > + if (applicationContext == null || beanName == null) { > + return super.isSingleton(bean, beanName); > + } else { > + return applicationContext.isSingleton(beanName); > + } > + } > + > + protected void startService(Service service, Object bean, String > beanName) throws Exception { > + if (isSingleton(bean, beanName)) { > + getCamelContext().addService(service); > + } else { > + // only start service and do not add it to CamelContext > + ServiceHelper.startService(service); > + if (prototypeBeans.add(beanName)) { > + // do not spam the log with WARN so do this only > once per bean name > + LOG.warn("The bean with id [" + beanName + "] is > prototype scoped and cannot stop the injected service when bean is destroyed: > " > + + service + ". You may want to stop the > service manually from the bean."); > + } > + } > + } > + }; > } > + > + > > } > > Modified: > camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/CamelContextResource.java > URL: > http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/CamelContextResource.java?rev=1031406&r1=1031405&r2=1031406&view=diff > ============================================================================== > --- > camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/CamelContextResource.java > (original) > +++ > camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/CamelContextResource.java > Fri Nov 5 02:26:49 2010 > @@ -24,8 +24,8 @@ import javax.ws.rs.Path; > import javax.ws.rs.Produces; > import javax.ws.rs.core.MediaType; > > +import com.sun.jersey.api.core.InjectParam; > import com.sun.jersey.api.view.ImplicitProduces; > -import com.sun.jersey.spi.inject.Inject; > import com.sun.jersey.spi.resource.Singleton; > import org.apache.camel.CamelContext; > import org.apache.camel.ProducerTemplate; > @@ -46,7 +46,7 @@ public class CamelContextResource { > private CamelContext camelContext; > private ProducerTemplate template; > > - public CamelContextResource(@Inject CamelContext camelContext) throws > Exception { > + public CamelContextResource(@InjectParam CamelContext camelContext) > throws Exception { > this.camelContext = camelContext; > this.template = camelContext.createProducerTemplate(); > template.start(); > > Modified: > camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppConsumer.java > URL: > http://svn.apache.org/viewvc/camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppConsumer.java?rev=1031406&r1=1031405&r2=1031406&view=diff > ============================================================================== > --- > camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppConsumer.java > (original) > +++ > camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppConsumer.java > Fri Nov 5 02:26:49 2010 > @@ -103,7 +103,9 @@ public class XmppConsumer extends Defaul > muc.leave(); > muc = null; > } > - //the endpoint will clean up the connection > + if (connection != null && connection.isConnected()) { > + connection.disconnect(); > + } > } > > public void chatCreated(Chat chat, boolean createdLocally) { > > Modified: > camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppGroupChatProducer.java > URL: > http://svn.apache.org/viewvc/camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppGroupChatProducer.java?rev=1031406&r1=1031405&r2=1031406&view=diff > ============================================================================== > --- > camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppGroupChatProducer.java > (original) > +++ > camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppGroupChatProducer.java > Fri Nov 5 02:26:49 2010 > @@ -99,6 +99,9 @@ public class XmppGroupChatProducer exten > chat.leave(); > chat = null; > } > + if (connection != null && connection.isConnected()) { > + connection.disconnect(); > + } > super.doStop(); > } > > > Modified: > camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppPrivateChatProducer.java > URL: > http://svn.apache.org/viewvc/camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppPrivateChatProducer.java?rev=1031406&r1=1031405&r2=1031406&view=diff > ============================================================================== > --- > camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppPrivateChatProducer.java > (original) > +++ > camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppPrivateChatProducer.java > Fri Nov 5 02:26:49 2010 > @@ -51,10 +51,6 @@ public class XmppPrivateChatProducer ext > > public void process(Exchange exchange) { > try { > - if (connection == null) { > - connection = endpoint.createConnection(); > - } > - > // make sure we are connected > if (!connection.isConnected()) { > if (LOG.isDebugEnabled()) { > @@ -108,6 +104,22 @@ public class XmppPrivateChatProducer ext > + " to: " + > XmppEndpoint.getConnectionMessage(connection), exchange, e); > } > } > + > + @Override > + protected void doStart() throws Exception { > + if (connection == null) { > + connection = endpoint.createConnection(); > + } > + super.doStart(); > + } > + > + @Override > + protected void doStop() throws Exception { > + if (connection != null && connection.isConnected()) { > + connection.disconnect(); > + } > + super.doStop(); > + } > > // Properties > // > ------------------------------------------------------------------------- > > Modified: camel/trunk/parent/pom.xml > URL: > http://svn.apache.org/viewvc/camel/trunk/parent/pom.xml?rev=1031406&r1=1031405&r2=1031406&view=diff > ============================================================================== > --- camel/trunk/parent/pom.xml (original) > +++ camel/trunk/parent/pom.xml Fri Nov 5 02:26:49 2010 > @@ -150,7 +150,7 @@ > <camel.osgi.import.defaults> > org.springframework.*;version="[2.5,4)", > org.apache.commons.logging.*;version="[1.1,2)", > - org.apache.cxf.*;version="[2.3.0,2.4)", > + org.apache.cxf.*;version="[2.2.11,2.4)", > org.apache.qpid.*;version="[0.5,0.6)", > org.apache.abdera.*;version="[0.4,0.5)", > org.apache.commons.httpclient.*;version="[3.1,4.0)", > > 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=1031406&r1=1031405&r2=1031406&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 > Fri Nov 5 02:26:49 2010 > @@ -125,7 +125,7 @@ public class OSGiBlueprintTestSupport ex > // 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"), > + > org.ops4j.pax.exam.CoreOptions.systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"), > > // install blueprint requirements > mavenBundle("org.apache.felix", "org.apache.felix.configadmin"), > > Modified: > camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/CxfProxyExampleTest.java > URL: > http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/CxfProxyExampleTest.java?rev=1031406&r1=1031405&r2=1031406&view=diff > ============================================================================== > --- > camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/CxfProxyExampleTest.java > (original) > +++ > camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/CxfProxyExampleTest.java > Fri Nov 5 02:26:49 2010 > @@ -36,7 +36,6 @@ import static org.ops4j.pax.exam.contain > import static > org.ops4j.pax.exam.container.def.PaxRunnerOptions.workingDirectory; > > @RunWith(JUnit4TestRunner.class) > -...@ignore > public class CxfProxyExampleTest extends OSGiIntegrationSpringTestSupport { > > protected static ReportIncidentEndpoint createCXFClient() { > @@ -73,9 +72,6 @@ public class CxfProxyExampleTest extends > return new OsgiBundleXmlApplicationContext(new > String[]{"org/apache/camel/itest/osgi/cxf/camel-config.xml"}); > } > > - // TODO: CxfConsumer should use OSGi http service (no embedded Jetty) > - // TODO: Make this test work with OSGi > - > @Configuration > public static Option[] configure() { > Option[] options = options( > > Modified: > camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/spring/xslt/XsltRouteTest.java > URL: > http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/spring/xslt/XsltRouteTest.java?rev=1031406&r1=1031405&r2=1031406&view=diff > ============================================================================== > --- > camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/spring/xslt/XsltRouteTest.java > (original) > +++ > camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/spring/xslt/XsltRouteTest.java > Fri Nov 5 02:26:49 2010 > @@ -19,13 +19,13 @@ package org.apache.camel.itest.osgi.spri > import org.apache.camel.builder.RouteBuilder; > import org.apache.camel.component.mock.MockEndpoint; > import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport; > -import org.junit.Ignore; > import org.junit.Test; > import org.junit.runner.RunWith; > +import org.ops4j.pax.exam.Option; > +import org.ops4j.pax.exam.junit.Configuration; > import org.ops4j.pax.exam.junit.JUnit4TestRunner; > > @RunWith(JUnit4TestRunner.class) > -...@ignore("TODO: fix me") > public class XsltRouteTest extends OSGiIntegrationTestSupport { > > @Test > @@ -51,5 +51,26 @@ public class XsltRouteTest extends OSGiI > } > }; > } > + > + @Configuration > + public static Option[] configure() throws Exception { > + Option[] options = options( > + // 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("INFO"), > + > + > + // using the features to install the camel components > > + scanFeatures(getCamelKarafFeatureUrl(), > + "camel-core", "camel-spring", "camel-test"), > + > + workingDirectory("target/paxrunner/"), > + > + equinox(), > + felix()); > + > + return options; > + } > > } > >
