You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Michiel Vermandel <mv...@yahoo.com> on 2013/04/25 21:19:12 UTC

[iPOJO] constructor with BundleContext issue

Hi,

I have a simple pojo annotated with iPOJO.

This works:

package com.ce.flowbeans.impl;

import org.apache.felix.ipojo.annotations.Component;
import org.apache.felix.ipojo.annotations.Instantiate;
import org.apache.felix.ipojo.annotations.Provides;
import org.apache.felix.ipojo.annotations.Validate;

import com.ce.flowbeans.spi.FlowAdmin;

@Component
@Instantiate
@Provides
public class FlowAdminImpl implements FlowAdmin {
    
    public FlowAdminImpl(){
        System.out.println("Instantiated");
    }
    
    @Override 
    public void sayHello() {
        System.out.println("I say hello");
    }
    
    @Validate
    public void starts(){
        System.out.println("Started");
    }
    
}

I get 

 
 Instantiated
 Started


But when I use a constructor with the BundleContext, the component is not instantiated nor started.
It is also not listed in the iPOJO instances:

package com.ce.flowbeans.impl;

import org.apache.felix.ipojo.annotations.Component;
import org.apache.felix.ipojo.annotations.Instantiate;
import org.apache.felix.ipojo.annotations.Provides;
import org.apache.felix.ipojo.annotations.Validate;
import org.osgi.framework.BundleContext;

import com.ce.flowbeans.spi.FlowAdmin;

@Component
@Instantiate
@Provides
public class FlowAdminImpl implements FlowAdmin {
    
    public FlowAdminImpl(BundleContext context){
        System.out.println("Instanciated");
    }
    
    @Override 
    public void sayHello() {
        System.out.println("I say hello");
    }
    
    @Validate
    public void starts(){
        System.out.println("Started");
    }
    
}

what can be the cause of this?

Thanks!

 
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials

Re: [iPOJO] constructor with BundleContext issue

Posted by Michiel Vermandel <mv...@yahoo.com>.
Own, right, I think I meant BndTools.
Yes, then bnd could be an option.

Thanks!


 
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials


________________________________
 From: Neil Bartlett <nj...@gmail.com>
To: users@felix.apache.org; Michiel Vermandel <mv...@yahoo.com> 
Sent: Friday, April 26, 2013 5:41 PM
Subject: Re: [iPOJO] constructor with BundleContext issue
 


Bnd does not have its own instance of Felix.

Actually it can run entirely standalone, outside an OSGi framework. 

Regards
Neil (bnd committer)

-- 
Neil Bartlett
Sent from a phone

On Friday, 26 April 2013 at 16:24, Michiel Vermandel wrote:
Hi,
>
>
>Thanks for clarifying. Yes I know bnd.
>One of the issues I had in the past with bnd is that it has its own instance of Felix.
>And it was not possible to point to an existing instance of Felix.
>I don't know if that is still the case in the latest versions.
>
>
>Regards,
>
>
>Michiel
>
>
>
>
> 
>-----------------
>http://www.codessentials.com - Your essential software, for free!
>Follow us at http://twitter.com/#!/Codessentials
>
>
>
>
>________________________________
>From: Richard S. Hall <he...@ungoverned.org>
>To: users@felix.apache.org 
>Sent: Friday, April 26, 2013 2:49 PM
>Subject: Re: [iPOJO] constructor with BundleContext issue
>
>
>On 4/26/13 03:01 , Michiel Vermandel wrote:
>Hi Richard,
>>
>>
>>Can you tell me some more on the "band"?
>
>
>Sorry, that was a typo, apparently.
>
>
>It should be "bnd"...it is a tool used by both iPOJO and 
>maven-bundle-plugin to analyze JAR files and automatically add OSGi 
>metadata to them. It is from Peter Kriens, just google for it.
>
>
>-> richard
>
>
>
>>
>>Thank you,
>>
>>
>>Michiel
>>
>>
>>
>>
>>  
>>-----------------
>>http://www.codessentials.com - Your essential software, for free!
>>Follow us at http://twitter.com/#!/Codessentials
>>
>>
>>
>>
>>________________________________
>>   From: Richard Hall <he...@ungoverned.org>
>>To: users@felix.apache.org
>>Sent: Thursday, April 25, 2013 10:45 PM
>>Subject: Re: [iPOJO] constructor with BundleContext issue
>>  
>>
>>
>>You can also use band directly in your build to generate your manifest to
>>avoid such errors.
>>On Apr 25, 2013 3:47 PM, "Michiel Vermandel" <mv...@yahoo.com> wrote:
>>
>>
>>O-o, no I did not.
>>>Now I do and it works!
>>>Thank you so much!
>>>
>>>
>>>
>>>
>>>-----------------
>>>http://www.codessentials.com - Your essential software, for free!
>>>Follow us at http://twitter.com/#!/Codessentials
>>>
>>>
>>>
>>>
>>>________________________________
>>>    From: Richard S. Hall <he...@ungoverned.org>
>>>To: users@felix.apache.org
>>>Sent: Thursday, April 25, 2013 9:26 PM
>>>Subject: Re: [iPOJO] constructor with BundleContext issue
>>>
>>>
>>>
>>>
>>>If I recall, you have your own build system...are you importing the
>>>org.osgi.framework package in your bundle?
>>>
>>>
>>>-> richard
>>>
>>>
>>>On 4/25/13 15:19 , Michiel Vermandel wrote:
>>>Hi,
>>>>
>>>>
>>>>I have a simple pojo annotated with iPOJO.
>>>>
>>>>
>>>>This works:
>>>>
>>>>
>>>>package com.ce.flowbeans.impl;
>>>>
>>>>
>>>>import org.apache.felix.ipojo.annotations.Component;
>>>>import org.apache.felix.ipojo.annotations.Instantiate;
>>>>import org.apache.felix.ipojo.annotations.Provides;
>>>>import org.apache.felix.ipojo.annotations.Validate;
>>>>
>>>>
>>>>import com.ce.flowbeans.spi.FlowAdmin;
>>>>
>>>>
>>>>@Component
>>>>@Instantiate
>>>>@Provides
>>>>public class FlowAdminImpl implements FlowAdmin {
>>>>
>>>>
>>>>        public FlowAdminImpl(){
>>>>            System.out.println("Instantiated");
>>>>        }
>>>>
>>>>
>>>>        @Override
>>>>        public void sayHello() {
>>>>            System.out.println("I say hello");
>>>>        }
>>>>
>>>>
>>>>        @Validate
>>>>        public void starts(){
>>>>            System.out.println("Started");
>>>>        }
>>>>
>>>>
>>>>}
>>>>
>>>>
>>>>I get
>>>>
>>>>
>>>>
>>>>
>>>>     Instantiated
>>>>     Started
>>>>
>>>>
>>>>
>>>>
>>>>But when I use a constructor with the BundleContext, the component is
>>>not instantiated nor started.
>>>It is also not listed in the iPOJO instances:
>>>>
>>>>
>>>>package com.ce.flowbeans.impl;
>>>>
>>>>
>>>>import org.apache.felix.ipojo.annotations.Component;
>>>>import org.apache.felix.ipojo.annotations.Instantiate;
>>>>import org.apache.felix.ipojo.annotations.Provides;
>>>>import org.apache.felix.ipojo.annotations.Validate;
>>>>import org.osgi.framework.BundleContext;
>>>>
>>>>
>>>>import com.ce.flowbeans.spi.FlowAdmin;
>>>>
>>>>
>>>>@Component
>>>>@Instantiate
>>>>@Provides
>>>>public class FlowAdminImpl implements FlowAdmin {
>>>>
>>>>
>>>>        public FlowAdminImpl(BundleContext context){
>>>>            System.out.println("Instanciated");
>>>>        }
>>>>
>>>>
>>>>        @Override
>>>>        public void sayHello() {
>>>>            System.out.println("I say hello");
>>>>        }
>>>>
>>>>
>>>>        @Validate
>>>>        public void starts(){
>>>>            System.out.println("Started");
>>>>        }
>>>>
>>>>
>>>>}
>>>>
>>>>
>>>>what can be the cause of this?
>>>>
>>>>
>>>>Thanks!
>>>>
>>>>
>>>>
>>>>
>>>>-----------------
>>>>http://www.codessentials.com - Your essential software, for free!
>>>>Follow us at http://twitter.com/#!/Codessentials
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>For additional commands, e-mail: users-help@felix.apache.org
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>For additional commands, e-mail: users-help@felix.apache.org

Re: [iPOJO] constructor with BundleContext issue

Posted by Neil Bartlett <nj...@gmail.com>.
Bnd does not have its own instance of Felix.

Actually it can run entirely standalone, outside an OSGi framework. 

Regards
Neil (bnd committer)

-- 
Neil Bartlett
Sent from a phone


On Friday, 26 April 2013 at 16:24, Michiel Vermandel wrote:

> Hi,
> 
> Thanks for clarifying. Yes I know bnd.
> One of the issues I had in the past with bnd is that it has its own instance of Felix.
> And it was not possible to point to an existing instance of Felix.
> I don't know if that is still the case in the latest versions.
> 
> Regards,
> 
> Michiel
> 
> 
>  
> -----------------
> http://www.codessentials.com - Your essential software, for free!
> Follow us at http://twitter.com/#!/Codessentials
> 
> 
> ________________________________
> From: Richard S. Hall <he...@ungoverned.org>
> To: users@felix.apache.org 
> Sent: Friday, April 26, 2013 2:49 PM
> Subject: Re: [iPOJO] constructor with BundleContext issue
> 
> On 4/26/13 03:01 , Michiel Vermandel wrote:
> > Hi Richard,
> > 
> > Can you tell me some more on the "band"?
> 
> Sorry, that was a typo, apparently.
> 
> It should be "bnd"...it is a tool used by both iPOJO and 
> maven-bundle-plugin to analyze JAR files and automatically add OSGi 
> metadata to them. It is from Peter Kriens, just google for it.
> 
> -> richard
> 
> > 
> > Thank you,
> > 
> > Michiel
> > 
> > 
> >   
> > -----------------
> > http://www.codessentials.com - Your essential software, for free!
> > Follow us at http://twitter.com/#!/Codessentials
> > 
> > 
> > ________________________________
> >   From: Richard Hall <he...@ungoverned.org>
> > To: users@felix.apache.org
> > Sent: Thursday, April 25, 2013 10:45 PM
> > Subject: Re: [iPOJO] constructor with BundleContext issue
> >   
> > 
> > You can also use band directly in your build to generate your manifest to
> > avoid such errors.
> > On Apr 25, 2013 3:47 PM, "Michiel Vermandel" <mv...@yahoo.com> wrote:
> > 
> > > O-o, no I did not.
> > > Now I do and it works!
> > > Thank you so much!
> > > 
> > > 
> > > -----------------
> > > http://www.codessentials.com - Your essential software, for free!
> > > Follow us at http://twitter.com/#!/Codessentials
> > > 
> > > 
> > > ________________________________
> > >     From: Richard S. Hall <he...@ungoverned.org>
> > > To: users@felix.apache.org
> > > Sent: Thursday, April 25, 2013 9:26 PM
> > > Subject: Re: [iPOJO] constructor with BundleContext issue
> > > 
> > > 
> > > If I recall, you have your own build system...are you importing the
> > > org.osgi.framework package in your bundle?
> > > 
> > > -> richard
> > > 
> > > On 4/25/13 15:19 , Michiel Vermandel wrote:
> > > > Hi,
> > > > 
> > > > I have a simple pojo annotated with iPOJO.
> > > > 
> > > > This works:
> > > > 
> > > > package com.ce.flowbeans.impl;
> > > > 
> > > > import org.apache.felix.ipojo.annotations.Component;
> > > > import org.apache.felix.ipojo.annotations.Instantiate;
> > > > import org.apache.felix.ipojo.annotations.Provides;
> > > > import org.apache.felix.ipojo.annotations.Validate;
> > > > 
> > > > import com.ce.flowbeans.spi.FlowAdmin;
> > > > 
> > > > @Component
> > > > @Instantiate
> > > > @Provides
> > > > public class FlowAdminImpl implements FlowAdmin {
> > > > 
> > > >         public FlowAdminImpl(){
> > > >             System.out.println("Instantiated");
> > > >         }
> > > > 
> > > >         @Override
> > > >         public void sayHello() {
> > > >             System.out.println("I say hello");
> > > >         }
> > > > 
> > > >         @Validate
> > > >         public void starts(){
> > > >             System.out.println("Started");
> > > >         }
> > > > 
> > > > }
> > > > 
> > > > I get
> > > > 
> > > > 
> > > >     Instantiated
> > > >     Started
> > > > 
> > > > 
> > > > But when I use a constructor with the BundleContext, the component is
> > > not instantiated nor started.
> > > > It is also not listed in the iPOJO instances:
> > > > 
> > > > package com.ce.flowbeans.impl;
> > > > 
> > > > import org.apache.felix.ipojo.annotations.Component;
> > > > import org.apache.felix.ipojo.annotations.Instantiate;
> > > > import org.apache.felix.ipojo.annotations.Provides;
> > > > import org.apache.felix.ipojo.annotations.Validate;
> > > > import org.osgi.framework.BundleContext;
> > > > 
> > > > import com.ce.flowbeans.spi.FlowAdmin;
> > > > 
> > > > @Component
> > > > @Instantiate
> > > > @Provides
> > > > public class FlowAdminImpl implements FlowAdmin {
> > > > 
> > > >         public FlowAdminImpl(BundleContext context){
> > > >             System.out.println("Instanciated");
> > > >         }
> > > > 
> > > >         @Override
> > > >         public void sayHello() {
> > > >             System.out.println("I say hello");
> > > >         }
> > > > 
> > > >         @Validate
> > > >         public void starts(){
> > > >             System.out.println("Started");
> > > >         }
> > > > 
> > > > }
> > > > 
> > > > what can be the cause of this?
> > > > 
> > > > Thanks!
> > > > 
> > > > 
> > > > -----------------
> > > > http://www.codessentials.com - Your essential software, for free!
> > > > Follow us at http://twitter.com/#!/Codessentials
> > > > 
> > > 
> > > 
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > > For additional commands, e-mail: users-help@felix.apache.org
> > > 
> > 
> > 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 
> 



Re: [iPOJO] constructor with BundleContext issue

Posted by Michiel Vermandel <mv...@yahoo.com>.
Hi,

Thanks for clarifying. Yes I know bnd.
One of the issues I had in the past with bnd is that it has its own instance of Felix.
And it was not possible to point to an existing instance of Felix.
I don't know if that is still the case in the latest versions.

Regards,

Michiel


 
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials


________________________________
 From: Richard S. Hall <he...@ungoverned.org>
To: users@felix.apache.org 
Sent: Friday, April 26, 2013 2:49 PM
Subject: Re: [iPOJO] constructor with BundleContext issue
 

On 4/26/13 03:01 , Michiel Vermandel wrote:
> Hi Richard,
>
> Can you tell me some more on the "band"?

Sorry, that was a typo, apparently.

It should be "bnd"...it is a tool used by both iPOJO and 
maven-bundle-plugin to analyze JAR files and automatically add OSGi 
metadata to them. It is from Peter Kriens, just google for it.

-> richard

>
> Thank you,
>
> Michiel
>
>
>  
> -----------------
> http://www.codessentials.com - Your essential software, for free!
> Follow us at http://twitter.com/#!/Codessentials
>
>
> ________________________________
>   From: Richard Hall <he...@ungoverned.org>
> To: users@felix.apache.org
> Sent: Thursday, April 25, 2013 10:45 PM
> Subject: Re: [iPOJO] constructor with BundleContext issue
>  
>
> You can also use band directly in your build to generate your manifest to
> avoid such errors.
> On Apr 25, 2013 3:47 PM, "Michiel Vermandel" <mv...@yahoo.com> wrote:
>
>> O-o, no I did not.
>> Now I do and it works!
>> Thank you so much!
>>
>>
>> -----------------
>> http://www.codessentials.com - Your essential software, for free!
>> Follow us at http://twitter.com/#!/Codessentials
>>
>>
>> ________________________________
>>    From: Richard S. Hall <he...@ungoverned.org>
>> To: users@felix.apache.org
>> Sent: Thursday, April 25, 2013 9:26 PM
>> Subject: Re: [iPOJO] constructor with BundleContext issue
>>
>>
>> If I recall, you have your own build system...are you importing the
>> org.osgi.framework package in your bundle?
>>
>> -> richard
>>
>> On 4/25/13 15:19 , Michiel Vermandel wrote:
>>> Hi,
>>>
>>> I have a simple pojo annotated with iPOJO.
>>>
>>> This works:
>>>
>>> package com.ce.flowbeans.impl;
>>>
>>> import org.apache.felix.ipojo.annotations.Component;
>>> import org.apache.felix.ipojo.annotations.Instantiate;
>>> import org.apache.felix.ipojo.annotations.Provides;
>>> import org.apache.felix.ipojo.annotations.Validate;
>>>
>>> import com.ce.flowbeans.spi.FlowAdmin;
>>>
>>> @Component
>>> @Instantiate
>>> @Provides
>>> public class FlowAdminImpl implements FlowAdmin {
>>>
>>>        public FlowAdminImpl(){
>>>            System.out.println("Instantiated");
>>>        }
>>>
>>>        @Override
>>>        public void sayHello() {
>>>            System.out.println("I say hello");
>>>        }
>>>
>>>        @Validate
>>>        public void starts(){
>>>            System.out.println("Started");
>>>        }
>>>
>>> }
>>>
>>> I get
>>>
>>>
>>>     Instantiated
>>>     Started
>>>
>>>
>>> But when I use a constructor with the BundleContext, the component is
>> not instantiated nor started.
>>> It is also not listed in the iPOJO instances:
>>>
>>> package com.ce.flowbeans.impl;
>>>
>>> import org.apache.felix.ipojo.annotations.Component;
>>> import org.apache.felix.ipojo.annotations.Instantiate;
>>> import org.apache.felix.ipojo.annotations.Provides;
>>> import org.apache.felix.ipojo.annotations.Validate;
>>> import org.osgi.framework.BundleContext;
>>>
>>> import com.ce.flowbeans.spi.FlowAdmin;
>>>
>>> @Component
>>> @Instantiate
>>> @Provides
>>> public class FlowAdminImpl implements FlowAdmin {
>>>
>>>        public FlowAdminImpl(BundleContext context){
>>>            System.out.println("Instanciated");
>>>        }
>>>
>>>        @Override
>>>        public void sayHello() {
>>>            System.out.println("I say hello");
>>>        }
>>>
>>>        @Validate
>>>        public void starts(){
>>>            System.out.println("Started");
>>>        }
>>>
>>> }
>>>
>>> what can be the cause of this?
>>>
>>> Thanks!
>>>
>>>
>>> -----------------
>>> http://www.codessentials.com - Your essential software, for free!
>>> Follow us at http://twitter.com/#!/Codessentials
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org

Re: [iPOJO] constructor with BundleContext issue

Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 4/26/13 03:01 , Michiel Vermandel wrote:
> Hi Richard,
>
> Can you tell me some more on the "band"?

Sorry, that was a typo, apparently.

It should be "bnd"...it is a tool used by both iPOJO and 
maven-bundle-plugin to analyze JAR files and automatically add OSGi 
metadata to them. It is from Peter Kriens, just google for it.

-> richard

>
> Thank you,
>
> Michiel
>
>
>   
> -----------------
> http://www.codessentials.com - Your essential software, for free!
> Follow us at http://twitter.com/#!/Codessentials
>
>
> ________________________________
>   From: Richard Hall <he...@ungoverned.org>
> To: users@felix.apache.org
> Sent: Thursday, April 25, 2013 10:45 PM
> Subject: Re: [iPOJO] constructor with BundleContext issue
>   
>
> You can also use band directly in your build to generate your manifest to
> avoid such errors.
> On Apr 25, 2013 3:47 PM, "Michiel Vermandel" <mv...@yahoo.com> wrote:
>
>> O-o, no I did not.
>> Now I do and it works!
>> Thank you so much!
>>
>>
>> -----------------
>> http://www.codessentials.com - Your essential software, for free!
>> Follow us at http://twitter.com/#!/Codessentials
>>
>>
>> ________________________________
>>    From: Richard S. Hall <he...@ungoverned.org>
>> To: users@felix.apache.org
>> Sent: Thursday, April 25, 2013 9:26 PM
>> Subject: Re: [iPOJO] constructor with BundleContext issue
>>
>>
>> If I recall, you have your own build system...are you importing the
>> org.osgi.framework package in your bundle?
>>
>> -> richard
>>
>> On 4/25/13 15:19 , Michiel Vermandel wrote:
>>> Hi,
>>>
>>> I have a simple pojo annotated with iPOJO.
>>>
>>> This works:
>>>
>>> package com.ce.flowbeans.impl;
>>>
>>> import org.apache.felix.ipojo.annotations.Component;
>>> import org.apache.felix.ipojo.annotations.Instantiate;
>>> import org.apache.felix.ipojo.annotations.Provides;
>>> import org.apache.felix.ipojo.annotations.Validate;
>>>
>>> import com.ce.flowbeans.spi.FlowAdmin;
>>>
>>> @Component
>>> @Instantiate
>>> @Provides
>>> public class FlowAdminImpl implements FlowAdmin {
>>>
>>>        public FlowAdminImpl(){
>>>            System.out.println("Instantiated");
>>>        }
>>>
>>>        @Override
>>>        public void sayHello() {
>>>            System.out.println("I say hello");
>>>        }
>>>
>>>        @Validate
>>>        public void starts(){
>>>            System.out.println("Started");
>>>        }
>>>
>>> }
>>>
>>> I get
>>>
>>>
>>>     Instantiated
>>>     Started
>>>
>>>
>>> But when I use a constructor with the BundleContext, the component is
>> not instantiated nor started.
>>> It is also not listed in the iPOJO instances:
>>>
>>> package com.ce.flowbeans.impl;
>>>
>>> import org.apache.felix.ipojo.annotations.Component;
>>> import org.apache.felix.ipojo.annotations.Instantiate;
>>> import org.apache.felix.ipojo.annotations.Provides;
>>> import org.apache.felix.ipojo.annotations.Validate;
>>> import org.osgi.framework.BundleContext;
>>>
>>> import com.ce.flowbeans.spi.FlowAdmin;
>>>
>>> @Component
>>> @Instantiate
>>> @Provides
>>> public class FlowAdminImpl implements FlowAdmin {
>>>
>>>        public FlowAdminImpl(BundleContext context){
>>>            System.out.println("Instanciated");
>>>        }
>>>
>>>        @Override
>>>        public void sayHello() {
>>>            System.out.println("I say hello");
>>>        }
>>>
>>>        @Validate
>>>        public void starts(){
>>>            System.out.println("Started");
>>>        }
>>>
>>> }
>>>
>>> what can be the cause of this?
>>>
>>> Thanks!
>>>
>>>
>>> -----------------
>>> http://www.codessentials.com - Your essential software, for free!
>>> Follow us at http://twitter.com/#!/Codessentials
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: [iPOJO] constructor with BundleContext issue

Posted by Michiel Vermandel <mv...@yahoo.com>.
Hi Richard,

Can you tell me some more on the "band"?

Thank you,

Michiel


 
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials


________________________________
 From: Richard Hall <he...@ungoverned.org>
To: users@felix.apache.org 
Sent: Thursday, April 25, 2013 10:45 PM
Subject: Re: [iPOJO] constructor with BundleContext issue
 

You can also use band directly in your build to generate your manifest to
avoid such errors.
On Apr 25, 2013 3:47 PM, "Michiel Vermandel" <mv...@yahoo.com> wrote:

> O-o, no I did not.
> Now I do and it works!
> Thank you so much!
>
>
> -----------------
> http://www.codessentials.com - Your essential software, for free!
> Follow us at http://twitter.com/#!/Codessentials
>
>
> ________________________________
>  From: Richard S. Hall <he...@ungoverned.org>
> To: users@felix.apache.org
> Sent: Thursday, April 25, 2013 9:26 PM
> Subject: Re: [iPOJO] constructor with BundleContext issue
>
>
> If I recall, you have your own build system...are you importing the
> org.osgi.framework package in your bundle?
>
> -> richard
>
> On 4/25/13 15:19 , Michiel Vermandel wrote:
> > Hi,
> >
> > I have a simple pojo annotated with iPOJO.
> >
> > This works:
> >
> > package com.ce.flowbeans.impl;
> >
> > import org.apache.felix.ipojo.annotations.Component;
> > import org.apache.felix.ipojo.annotations.Instantiate;
> > import org.apache.felix.ipojo.annotations.Provides;
> > import org.apache.felix.ipojo.annotations.Validate;
> >
> > import com.ce.flowbeans.spi.FlowAdmin;
> >
> > @Component
> > @Instantiate
> > @Provides
> > public class FlowAdminImpl implements FlowAdmin {
> >
> >      public FlowAdminImpl(){
> >          System.out.println("Instantiated");
> >      }
> >
> >      @Override
> >      public void sayHello() {
> >          System.out.println("I say hello");
> >      }
> >
> >      @Validate
> >      public void starts(){
> >          System.out.println("Started");
> >      }
> >
> > }
> >
> > I get
> >
> >
> >   Instantiated
> >   Started
> >
> >
> > But when I use a constructor with the BundleContext, the component is
> not instantiated nor started.
> > It is also not listed in the iPOJO instances:
> >
> > package com.ce.flowbeans.impl;
> >
> > import org.apache.felix.ipojo.annotations.Component;
> > import org.apache.felix.ipojo.annotations.Instantiate;
> > import org.apache.felix.ipojo.annotations.Provides;
> > import org.apache.felix.ipojo.annotations.Validate;
> > import org.osgi.framework.BundleContext;
> >
> > import com.ce.flowbeans.spi.FlowAdmin;
> >
> > @Component
> > @Instantiate
> > @Provides
> > public class FlowAdminImpl implements FlowAdmin {
> >
> >      public FlowAdminImpl(BundleContext context){
> >          System.out.println("Instanciated");
> >      }
> >
> >      @Override
> >      public void sayHello() {
> >          System.out.println("I say hello");
> >      }
> >
> >      @Validate
> >      public void starts(){
> >          System.out.println("Started");
> >      }
> >
> > }
> >
> > what can be the cause of this?
> >
> > Thanks!
> >
> >
> > -----------------
> > http://www.codessentials.com - Your essential software, for free!
> > Follow us at http://twitter.com/#!/Codessentials
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org

Re: [iPOJO] constructor with BundleContext issue

Posted by Richard Hall <he...@ungoverned.org>.
You can also use band directly in your build to generate your manifest to
avoid such errors.
 On Apr 25, 2013 3:47 PM, "Michiel Vermandel" <mv...@yahoo.com> wrote:

> O-o, no I did not.
> Now I do and it works!
> Thank you so much!
>
>
> -----------------
> http://www.codessentials.com - Your essential software, for free!
> Follow us at http://twitter.com/#!/Codessentials
>
>
> ________________________________
>  From: Richard S. Hall <he...@ungoverned.org>
> To: users@felix.apache.org
> Sent: Thursday, April 25, 2013 9:26 PM
> Subject: Re: [iPOJO] constructor with BundleContext issue
>
>
> If I recall, you have your own build system...are you importing the
> org.osgi.framework package in your bundle?
>
> -> richard
>
> On 4/25/13 15:19 , Michiel Vermandel wrote:
> > Hi,
> >
> > I have a simple pojo annotated with iPOJO.
> >
> > This works:
> >
> > package com.ce.flowbeans.impl;
> >
> > import org.apache.felix.ipojo.annotations.Component;
> > import org.apache.felix.ipojo.annotations.Instantiate;
> > import org.apache.felix.ipojo.annotations.Provides;
> > import org.apache.felix.ipojo.annotations.Validate;
> >
> > import com.ce.flowbeans.spi.FlowAdmin;
> >
> > @Component
> > @Instantiate
> > @Provides
> > public class FlowAdminImpl implements FlowAdmin {
> >
> >      public FlowAdminImpl(){
> >          System.out.println("Instantiated");
> >      }
> >
> >      @Override
> >      public void sayHello() {
> >          System.out.println("I say hello");
> >      }
> >
> >      @Validate
> >      public void starts(){
> >          System.out.println("Started");
> >      }
> >
> > }
> >
> > I get
> >
> >
> >   Instantiated
> >   Started
> >
> >
> > But when I use a constructor with the BundleContext, the component is
> not instantiated nor started.
> > It is also not listed in the iPOJO instances:
> >
> > package com.ce.flowbeans.impl;
> >
> > import org.apache.felix.ipojo.annotations.Component;
> > import org.apache.felix.ipojo.annotations.Instantiate;
> > import org.apache.felix.ipojo.annotations.Provides;
> > import org.apache.felix.ipojo.annotations.Validate;
> > import org.osgi.framework.BundleContext;
> >
> > import com.ce.flowbeans.spi.FlowAdmin;
> >
> > @Component
> > @Instantiate
> > @Provides
> > public class FlowAdminImpl implements FlowAdmin {
> >
> >      public FlowAdminImpl(BundleContext context){
> >          System.out.println("Instanciated");
> >      }
> >
> >      @Override
> >      public void sayHello() {
> >          System.out.println("I say hello");
> >      }
> >
> >      @Validate
> >      public void starts(){
> >          System.out.println("Started");
> >      }
> >
> > }
> >
> > what can be the cause of this?
> >
> > Thanks!
> >
> >
> > -----------------
> > http://www.codessentials.com - Your essential software, for free!
> > Follow us at http://twitter.com/#!/Codessentials
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org

Re: [iPOJO] constructor with BundleContext issue

Posted by Michiel Vermandel <mv...@yahoo.com>.
O-o, no I did not.
Now I do and it works!
Thank you so much!

 
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials


________________________________
 From: Richard S. Hall <he...@ungoverned.org>
To: users@felix.apache.org 
Sent: Thursday, April 25, 2013 9:26 PM
Subject: Re: [iPOJO] constructor with BundleContext issue
 

If I recall, you have your own build system...are you importing the 
org.osgi.framework package in your bundle?

-> richard

On 4/25/13 15:19 , Michiel Vermandel wrote:
> Hi,
>
> I have a simple pojo annotated with iPOJO.
>
> This works:
>
> package com.ce.flowbeans.impl;
>
> import org.apache.felix.ipojo.annotations.Component;
> import org.apache.felix.ipojo.annotations.Instantiate;
> import org.apache.felix.ipojo.annotations.Provides;
> import org.apache.felix.ipojo.annotations.Validate;
>
> import com.ce.flowbeans.spi.FlowAdmin;
>
> @Component
> @Instantiate
> @Provides
> public class FlowAdminImpl implements FlowAdmin {
>      
>      public FlowAdminImpl(){
>          System.out.println("Instantiated");
>      }
>      
>      @Override
>      public void sayHello() {
>          System.out.println("I say hello");
>      }
>      
>      @Validate
>      public void starts(){
>          System.out.println("Started");
>      }
>      
> }
>
> I get
>
>  
>   Instantiated
>   Started
>
>
> But when I use a constructor with the BundleContext, the component is not instantiated nor started.
> It is also not listed in the iPOJO instances:
>
> package com.ce.flowbeans.impl;
>
> import org.apache.felix.ipojo.annotations.Component;
> import org.apache.felix.ipojo.annotations.Instantiate;
> import org.apache.felix.ipojo.annotations.Provides;
> import org.apache.felix.ipojo.annotations.Validate;
> import org.osgi.framework.BundleContext;
>
> import com.ce.flowbeans.spi.FlowAdmin;
>
> @Component
> @Instantiate
> @Provides
> public class FlowAdminImpl implements FlowAdmin {
>      
>      public FlowAdminImpl(BundleContext context){
>          System.out.println("Instanciated");
>      }
>      
>      @Override
>      public void sayHello() {
>          System.out.println("I say hello");
>      }
>      
>      @Validate
>      public void starts(){
>          System.out.println("Started");
>      }
>      
> }
>
> what can be the cause of this?
>
> Thanks!
>
>  
> -----------------
> http://www.codessentials.com - Your essential software, for free!
> Follow us at http://twitter.com/#!/Codessentials


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org

Re: [iPOJO] constructor with BundleContext issue

Posted by "Richard S. Hall" <he...@ungoverned.org>.
If I recall, you have your own build system...are you importing the 
org.osgi.framework package in your bundle?

-> richard

On 4/25/13 15:19 , Michiel Vermandel wrote:
> Hi,
>
> I have a simple pojo annotated with iPOJO.
>
> This works:
>
> package com.ce.flowbeans.impl;
>
> import org.apache.felix.ipojo.annotations.Component;
> import org.apache.felix.ipojo.annotations.Instantiate;
> import org.apache.felix.ipojo.annotations.Provides;
> import org.apache.felix.ipojo.annotations.Validate;
>
> import com.ce.flowbeans.spi.FlowAdmin;
>
> @Component
> @Instantiate
> @Provides
> public class FlowAdminImpl implements FlowAdmin {
>      
>      public FlowAdminImpl(){
>          System.out.println("Instantiated");
>      }
>      
>      @Override
>      public void sayHello() {
>          System.out.println("I say hello");
>      }
>      
>      @Validate
>      public void starts(){
>          System.out.println("Started");
>      }
>      
> }
>
> I get
>
>   
>   Instantiated
>   Started
>
>
> But when I use a constructor with the BundleContext, the component is not instantiated nor started.
> It is also not listed in the iPOJO instances:
>
> package com.ce.flowbeans.impl;
>
> import org.apache.felix.ipojo.annotations.Component;
> import org.apache.felix.ipojo.annotations.Instantiate;
> import org.apache.felix.ipojo.annotations.Provides;
> import org.apache.felix.ipojo.annotations.Validate;
> import org.osgi.framework.BundleContext;
>
> import com.ce.flowbeans.spi.FlowAdmin;
>
> @Component
> @Instantiate
> @Provides
> public class FlowAdminImpl implements FlowAdmin {
>      
>      public FlowAdminImpl(BundleContext context){
>          System.out.println("Instanciated");
>      }
>      
>      @Override
>      public void sayHello() {
>          System.out.println("I say hello");
>      }
>      
>      @Validate
>      public void starts(){
>          System.out.println("Started");
>      }
>      
> }
>
> what can be the cause of this?
>
> Thanks!
>
>   
> -----------------
> http://www.codessentials.com - Your essential software, for free!
> Follow us at http://twitter.com/#!/Codessentials


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org