Sounds like a good idea - assuming that the bundle activator kicks in before Spring DM processes the XML?
2009/3/26 Gert Vanthienen <gert.vanthie...@gmail.com>: > Willem, > > Would adding a Bundle-Activator to our jars help? The activator would > only be called upon in an OSGi environment so it could take of putting > in place everything that's necessary for OSGi without the need for > anyone to change the configuration in the XML files. > > Regards, > > Gert Vanthienen > ------------------------ > Open Source SOA: http://fusesource.com > Blog: http://gertvanthienen.blogspot.com/ > > > > 2009/3/26 Willem Jiang <willem.ji...@gmail.com>: >> Hi, >> >> Yes, in servicemix-camel component, we can use the Spring namespace for >> OSGi and non-OSGi environment. That is because ServiceMix take charge of >> the Camel Spring handler itself, and the Spring handler of camel-spring >> will detect the CamelContextFactoryBean of OSGi (in the camel-osgi >> bundle) by using Class.forName() and replace the CamelContextFactoryBean >> of Spring with the OSGi one. >> >> But if we deploy a camel context spring configure file into ServiceMix >> directly, the Spring handler will be inited by Spring DM first, and the >> Class.forName() detection will not work for camel-spring bundle anymore, >> since the camel-osgi bundle is not be installed at that time. >> >> Maybe we need to find some other way to accomplish this kind of auto >> replacing work. >> >> BTW, I don't if we can achieve this by using Spring java config ? >> >> Willem >> >> >> James Strachan wrote: >>> BTW I remember having a chat with Guillaume a while back and I don't >>> think the OSGi namespace in the XML is required any more; I think he >>> figured out how to wire in the OSGi injection without having to change >>> the XML namespace. Though I've not tested it to be sure though - want >>> to give it a try? >>> >>> Then in OSGi you add camel-osgi but when not using OSGi you can omit >>> this dependency? >>> >>> 2009/3/25 Willem Jiang <willem.ji...@gmail.com>: >>>> Hi Aaron >>>> >>>> The CamelContextFactoryBean of OSGi version extends the >>>> CamelContextFactoryBean of Spring version. It only add the handle of >>>> bundle context injection. For non-OSGi container it will not inject the >>>> bundle context into the OSGi CamelContextFactoryBean, so the OSGi >>>> CamelContextFactoryBean will act as Spring CamelContextFactoryBean. >>>> >>>> The only side effect is you need to add the camel-osgi dependented third >>>> party jars into the class path. >>>> >>>> Willem >>>> >>>> Aaron Crickenberger wrote: >>>>> I have the following XML I'd like to deploy both in an OSGi container, >>>>> and a >>>>> non-OSGi container. To deploy in the OSGi container, I have to use the >>>>> "osgi" schema so that the "quartz" component is resolved to the >>>>> camel-quartz >>>>> bundle. >>>>> >>>>> To deploy in a non-OSGi container, I had to add spring-osgi-core-1.1.2.jar >>>>> and org.osg.core-1.2.0.jar to the classpath. It appears to be working, >>>>> but >>>>> I wanted to double-check with the experts. Can you think of any >>>>> side-effects I might see from deploying this way vs. deploying w/ the " >>>>> http://activemq.apache.org/camel/schema/spring" schema? >>>>> >>>>> <beans xmlns="http://www.springframework.org/schema/beans" >>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >>>>> xmlns:camel="http://activemq.apache.org/camel/schema/spring" >>>>> xsi:schemaLocation=" >>>>> http://www.springframework.org/schema/beans >>>>> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd >>>>> http://activemq.apache.org/camel/schema/spring >>>>> http://activemq.apache.org/camel/schema/spring/camel-spring.xsd >>>>> http://activemq.apache.org/camel/schema/osgi >>>>> http://activemq.apache.org/camel/schema/osgi/camel-osgi.xsd"> >>>>> >>>>> <camelContext xmlns="http://activemq.apache.org/camel/schema/osgi"> >>>>> <camel:route> >>>>> <camel:from uri="quartz://groupName/timerName/0,15,30,45/*/*/*/*/$" >>>>> /> >>>>> <camel:to uri="log:ExampleRouter"/> >>>>> </camel:route> >>>>> </camelContext> >>>>> >>>>> </beans> >>>>> >>>>> - aaron >>>>> >>>> >>> >>> >>> >> >> > -- James ------- http://macstrac.blogspot.com/ Open Source Integration http://fusesource.com/