[jira] [Created] (FELIX-4443) Using iPOJO API shows different behavior (Only works when adding a service)
Zaid created FELIX-4443: Summary: Using iPOJO API shows different behavior (Only works when adding a service) Key: FELIX-4443 URL: https://issues.apache.org/jira/browse/FELIX-4443 Project: Felix Issue Type: Bug Components: iPOJO Affects Versions: ipojo-runtime-1.11.1 Environment: Windows 64 Operating System, eclipse, java Reporter: Zaid I am trying to use ipojo API to create a component type. I am embedding Felix framework and I load my component bundle to the framework. In my bundle I have the following class: public class PlainHelloImpl implements PlainHello{ @Override public void sayHello() { System.out.println("Plainly Hello :D"); } public PlainHelloImpl() { System.out.println("in contructor"); } public void start() { System.out.println("Hello, this is the plain hello component start method"); } public void stop() { System.out.println("Bye, this is the plain hello component stop method"); } } and below is my activator where the error occurs: public class Activator implements BundleActivator { public static BundleContext bundleContext; public void start(BundleContext context) throws Exception { System.out.println("Plain Hello iPOJO Bundle Started!"); bundleContext=context; PrimitiveComponentType x= new PrimitiveComponentType() .setBundleContext(context) .setClassName(PlainHelloImpl.class.getName()) .setValidateMethod("start") .setInvalidateMethod("stop") .addService(new Service()) ; x.start(); ComponentInstance i = x.createInstance(); //ERROR HERE i.start(); System.out.println("and we are done!"); } public void stop(BundleContext context) throws Exception { context = null; System.out.println("Plain Hello iPOJO Bundle Stopped!"); } } In my java application, I have the following code: Map config= new HashMap(); // Create a configuration property map. //Map config = new HashMap(); config.put(Constants.FRAMEWORK_STORAGE_CLEAN, Constants.FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT); // Create host activator; m_activator = new HostActivator(); List list = new ArrayList(); list.add(m_activator); config.put(FelixConstants.SYSTEMBUNDLE_ACTIVATORS_PROP, list); try { // Now create an instance of the framework with // our configuration properties. m_felix = new Felix(config); // Now start Felix instance. m_felix.start(); } catch (Exception ex) { System.err.println("Could not create framework: " + ex); ex.printStackTrace(); } // Register the application's context as an OSGi service! BundleContext bundleContext1 = m_felix.getBundleContext(); //starting ipojo required bundles Bundle coreBundle = bundleContext1.installBundle("file:C:\\Users\\zaid.almahmoud\\Dropbox\\EBTIC\\ADERE\\feasibility-codes\\ipojo\\ipojo-distribution-1.11.0\\bundle\\org.apache.felix.ipojo-1.11.0.jar"); coreBundle.start(); if(coreBundle.getState()== Bundle.ACTIVE) System.out.println("Core Bundle is Active!"); Bundle compositeBundle = bundleContext1.installBundle("file:C:\\Users\\zaid.almahmoud\\Dropbox\\EBTIC\\ADERE\\feasibility-codes\\ipojo\\ipojo-distribution-1.11.0\\bundle\\org.apache.felix.ipojo.composite-1.6.0.jar"); compositeBundle.start(); if(compositeBundle.getState()== Bundle.ACTIVE) System.out.println("Composite Bundle is Active!"); Bundle apiBundle = bundleContext1.installBundle("file:C:\\Users\\zaid.almahmoud\\Dropbox\\EBTIC\\ADERE\\feasibility-codes\\ipojo\\ipojo-distribution-1.11.0\\bundle\\org.apache.felix.ipojo.api-1.6.0.jar"); apiBundle.start(); if(apiBundle.getState()== Bundle.ACTIVE) System.out.println("API Bundle is Active!");
[jira] [Updated] (FELIX-4443) Using iPOJO API shows different behavior (Only works when adding a service only)
[ https://issues.apache.org/jira/browse/FELIX-4443?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Zaid updated FELIX-4443: - Description: I am trying to use ipojo API to create a component type. I am embedding Felix framework and I load my component bundle to the framework. In my bundle I have the following class: public class PlainHelloImpl implements PlainHello{ @Override public void sayHello() { System.out.println("Plainly Hello :D"); } public PlainHelloImpl() { System.out.println("in contructor"); } public void start() { System.out.println("Hello, this is the plain hello component start method"); } public void stop() { System.out.println("Bye, this is the plain hello component stop method"); } } and below is my activator where the error occurs: public class Activator implements BundleActivator { public static BundleContext bundleContext; public void start(BundleContext context) throws Exception { System.out.println("Plain Hello iPOJO Bundle Started!"); bundleContext=context; PrimitiveComponentType x= new PrimitiveComponentType() .setBundleContext(context) .setClassName(PlainHelloImpl.class.getName()) .setValidateMethod("start") .setInvalidateMethod("stop") .addService(new Service()) ; x.start(); ComponentInstance i = x.createInstance(); //ERROR HERE i.start(); System.out.println("and we are done!"); } public void stop(BundleContext context) throws Exception { context = null; System.out.println("Plain Hello iPOJO Bundle Stopped!"); } } In my java application, I have the following code: Map config= new HashMap(); // Create a configuration property map. //Map config = new HashMap(); config.put(Constants.FRAMEWORK_STORAGE_CLEAN, Constants.FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT); // Create host activator; m_activator = new HostActivator(); List list = new ArrayList(); list.add(m_activator); config.put(FelixConstants.SYSTEMBUNDLE_ACTIVATORS_PROP, list); try { // Now create an instance of the framework with // our configuration properties. m_felix = new Felix(config); // Now start Felix instance. m_felix.start(); } catch (Exception ex) { System.err.println("Could not create framework: " + ex); ex.printStackTrace(); } // Register the application's context as an OSGi service! BundleContext bundleContext1 = m_felix.getBundleContext(); //starting ipojo required bundles Bundle coreBundle = bundleContext1.installBundle("file:C:\\Users\\zaid.almahmoud\\Dropbox\\feasibility-codes\\ipojo\\ipojo-distribution-1.11.0\\bundle\\org.apache.felix.ipojo-1.11.0.jar"); coreBundle.start(); if(coreBundle.getState()== Bundle.ACTIVE) System.out.println("Core Bundle is Active!"); Bundle compositeBundle = bundleContext1.installBundle("file:C:\\Users\\zaid.almahmoud\\Dropbox\\feasibility-codes\\ipojo\\ipojo-distribution-1.11.0\\bundle\\org.apache.felix.ipojo.composite-1.6.0.jar"); compositeBundle.start(); if(compositeBundle.getState()== Bundle.ACTIVE) System.out.println("Composite Bundle is Active!"); Bundle apiBundle = bundleContext1.installBundle("file:C:\\Users\\zaid.almahmoud\\Dropbox\\feasibility-codes\\ipojo\\ipojo-distribution-1.11.0\\bundle\\org.apache.felix.ipojo.api-1.6.0.jar"); apiBundle.start(); if(apiBundle.getState()== Bundle.ACTIVE) System.out.println("API Bundle is Active!"); //HERE I start my bundle Bundle plainIPOJOBundle = bundleContext1.installBundle("file:C:\\Users\\zaid.almahmoud\\Desktop\\plugins\\Manipulated_PlainHelloiPOJO.jar"); plainIPOJOBundle.start(); As you see, at the very end, I start my bundle. This
[jira] [Updated] (FELIX-4443) Using iPOJO API shows different behavior (works when adding a service only)
[ https://issues.apache.org/jira/browse/FELIX-4443?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Zaid updated FELIX-4443: - Description: I am trying to use ipojo API to create a component type. I am embedding Felix framework and I load my component bundle to the framework. In my bundle I have the following class: public class PlainHelloImpl implements PlainHello{ @Override public void sayHello() { System.out.println("Plainly Hello :D"); } public PlainHelloImpl() { System.out.println("in contructor"); } public void start() { System.out.println("Hello, this is the plain hello component start method"); } public void stop() { System.out.println("Bye, this is the plain hello component stop method"); } } and below is my activator where the error occurs: public class Activator implements BundleActivator { public static BundleContext bundleContext; public void start(BundleContext context) throws Exception { System.out.println("Plain Hello iPOJO Bundle Started!"); bundleContext=context; PrimitiveComponentType x= new PrimitiveComponentType() .setBundleContext(context) .setClassName(PlainHelloImpl.class.getName()) .setValidateMethod("start") .setInvalidateMethod("stop") .addService(new Service()) ; x.start(); ComponentInstance i = x.createInstance(); //ERROR HERE i.start(); System.out.println("and we are done!"); } public void stop(BundleContext context) throws Exception { context = null; System.out.println("Plain Hello iPOJO Bundle Stopped!"); } } In my java application, I have the following code: Map config= new HashMap(); // Create a configuration property map. //Map config = new HashMap(); config.put(Constants.FRAMEWORK_STORAGE_CLEAN, Constants.FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT); // Create host activator; m_activator = new HostActivator(); List list = new ArrayList(); list.add(m_activator); config.put(FelixConstants.SYSTEMBUNDLE_ACTIVATORS_PROP, list); try { // Now create an instance of the framework with // our configuration properties. m_felix = new Felix(config); // Now start Felix instance. m_felix.start(); } catch (Exception ex) { System.err.println("Could not create framework: " + ex); ex.printStackTrace(); } // Register the application's context as an OSGi service! BundleContext bundleContext1 = m_felix.getBundleContext(); //starting ipojo required bundles Bundle coreBundle = bundleContext1.installBundle("file:C:\\Users\\zaid.almahmoud\\Dropbox\\feasibility-codes\\ipojo\\ipojo-distribution-1.11.0\\bundle\\org.apache.felix.ipojo-1.11.0.jar"); coreBundle.start(); if(coreBundle.getState()== Bundle.ACTIVE) System.out.println("Core Bundle is Active!"); Bundle compositeBundle = bundleContext1.installBundle("file:C:\\Users\\zaid.almahmoud\\Dropbox\\feasibility-codes\\ipojo\\ipojo-distribution-1.11.0\\bundle\\org.apache.felix.ipojo.composite-1.6.0.jar"); compositeBundle.start(); if(compositeBundle.getState()== Bundle.ACTIVE) System.out.println("Composite Bundle is Active!"); Bundle apiBundle = bundleContext1.installBundle("file:C:\\Users\\zaid.almahmoud\\Dropbox\\feasibility-codes\\ipojo\\ipojo-distribution-1.11.0\\bundle\\org.apache.felix.ipojo.api-1.6.0.jar"); apiBundle.start(); if(apiBundle.getState()== Bundle.ACTIVE) System.out.println("API Bundle is Active!"); //HERE I start my bundle Bundle plainIPOJOBundle = bundleContext1.installBundle("file:C:\\Users\\zaid.almahmoud\\Desktop\\plugins\\Manipulated_PlainHelloiPOJO.jar"); plainIPOJOBundle.start(); As you see, at the very end, I start my bundle. This
Fragment Bundle supplying a Require-Capability seems to not work
Just a heads-up, According to the specs, it should be possible for a Fragment to add a Require-Capability to a Host. I tried this with Log4J to have it wait for an Apache FileInstall exploded bundle to supply the Capability, but it didn't seem to take. If I get the time, I'll try to gather the work and submit a case. If anyone is familiar with the code, I'd appreciate a quick pointer to the responsible class. I'd like to submit a patch along with the case. Thanks, Nick Baker
Re: Fragment Bundle supplying a Require-Capability seems to not work
Hello Nick, From your description I cannot determine if you first installed, resolved and started the host and then installed the fragment or if the fragment was already installed at the point where the host resolved. I’m asking because that’s a common pitfall when dealing with fragments: if you install them after the host has already been resolved, “nothing happens”. Greetings, Marcel On 03 Mar 2014, at 5:42 , Nick Baker wrote: > Just a heads-up, > > According to the specs, it should be possible for a Fragment to add a > Require-Capability to a Host. I tried this with Log4J to have it wait for > an Apache FileInstall exploded bundle to supply the Capability, but it > didn't seem to take. If I get the time, I'll try to gather the work and > submit a case. > > If anyone is familiar with the code, I'd appreciate a quick pointer to the > responsible class. I'd like to submit a patch along with the case. > > Thanks, > Nick Baker
[jira] [Assigned] (FELIX-4443) Using iPOJO API shows different behavior (works when adding a service only)
[ https://issues.apache.org/jira/browse/FELIX-4443?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Clement Escoffier reassigned FELIX-4443: Assignee: Clement Escoffier > Using iPOJO API shows different behavior (works when adding a service only) > --- > > Key: FELIX-4443 > URL: https://issues.apache.org/jira/browse/FELIX-4443 > Project: Felix > Issue Type: Bug > Components: iPOJO >Affects Versions: ipojo-runtime-1.11.1 > Environment: Windows 64 Operating System, eclipse, java >Reporter: Zaid >Assignee: Clement Escoffier > Labels: ipojo > > I am trying to use ipojo API to create a component type. I am embedding Felix > framework and I load my component bundle to the framework. > In my bundle I have the following class: > public class PlainHelloImpl implements PlainHello{ > @Override > public void sayHello() { > System.out.println("Plainly Hello :D"); > > } > > public PlainHelloImpl() > { > System.out.println("in contructor"); > } > > public void start() > { > > System.out.println("Hello, this is the plain hello component > start method"); > } > public void stop() > { > System.out.println("Bye, this is the plain hello component stop > method"); > } > } > and below is my activator where the error occurs: > public class Activator implements BundleActivator { > > public static BundleContext bundleContext; > public void start(BundleContext context) throws Exception { > > > System.out.println("Plain Hello iPOJO Bundle Started!"); > bundleContext=context; > > > PrimitiveComponentType x= new PrimitiveComponentType() > .setBundleContext(context) > .setClassName(PlainHelloImpl.class.getName()) > .setValidateMethod("start") > .setInvalidateMethod("stop") > .addService(new Service()) ; > > x.start(); > > ComponentInstance i = x.createInstance(); //ERROR HERE > i.start(); > > > System.out.println("and we are done!"); > > } > public void stop(BundleContext context) throws Exception { > >context = null; >System.out.println("Plain Hello iPOJO Bundle Stopped!"); > > > } > > } > In my java application, I have the following code: > Map config= new HashMap(); > > // Create a configuration property map. > //Map config = new HashMap(); > config.put(Constants.FRAMEWORK_STORAGE_CLEAN, > Constants.FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT); > // Create host activator; > m_activator = new HostActivator(); > List list = new ArrayList(); > list.add(m_activator); > config.put(FelixConstants.SYSTEMBUNDLE_ACTIVATORS_PROP, list); > > try > { > // Now create an instance of the framework with > // our configuration properties. > m_felix = new Felix(config); > // Now start Felix instance. > m_felix.start(); > } > catch (Exception ex) > { > System.err.println("Could not create framework: " + ex); > ex.printStackTrace(); > } > // Register the application's context as an OSGi service! > BundleContext bundleContext1 = m_felix.getBundleContext(); > > //starting ipojo required bundles > Bundle coreBundle = > bundleContext1.installBundle("file:C:\\Users\\zaid.almahmoud\\Dropbox\\feasibility-codes\\ipojo\\ipojo-distribution-1.11.0\\bundle\\org.apache.felix.ipojo-1.11.0.jar"); > coreBundle.start(); > if(coreBundle.getState()== Bundle.ACTIVE) > System.out.println("Core Bundle is Active!"); > > Bundle compositeBundle = > bundleContext1.installBundle("file:C:\\Users\\zaid.almahmoud\\Dropbox\\feasibility-codes\\ipojo\\ipojo-distribution-1.11.0\\bundle\\org.apache.felix.ipojo.composite-1.6.0.jar"); > compositeBundle.start(); > if(compositeBundle.getState()== Bundle.ACTIVE) > System.out.println("Composite Bundle is Active!"); > > Bundle apiBundle = > bundleContext1.installBundle("file:C:\\Users\\zaid.almahmoud\
[VOTE RESULT] Apache Felix Inventory 1.0.4
The vote passed with three binding +1 votes from Pierre De Rop, Guillaume Nodet, and Carsten Ziegeler - and three non-binding +1 votes from Jean-Baptiste Onofrè, Jamie Goodyear, and David Bosschaert. No other votes have been cast. Thanks everyone for voting Regards Carsten -- Carsten Ziegeler cziege...@apache.org