2 Replies Latest reply on Sep 13, 2010 10:39 AM by Peter Chandler

    OSGi and Spring ApplicationContext

    Peter Chandler Master

      Question:

       

      I have Spring ApplicationContext (i.e., camelContext) that I want to execute both inside and outside (standalone) of OSGi/ServiceMix.

       

      From inside OSGi I should be doing a:

      OsgiBundleXmlApplicationContext applicationContext = new OsgiBundleXmlApplicationContext(new String[]{"org/apache/camel/itest/osgi/CamelContext.xml"})
         applicationContext.setBundleContext(bundleContext);
         applicationContext.refresh();
      

       

      From  outside (standalone) of OSGi I do a:

      ApplicationContext result = new FileSystemXmlApplicationContext(resource);
      

       

      Without having separate implementation classes is there a way to include both of these in the same java class? Is there a way, at run-time, to test for the existences/presents of the  OSGi Container/Framework?

       

      Peter.