What's the functional difference b/t

@Component
@Instantiate

And 

@Component( immediate=true)

??

-----Original Message-----
From: Clement Escoffier [mailto:[email protected]] 
Sent: Tuesday, June 29, 2010 10:08 AM
To: [email protected]
Subject: Re: iPOJO and OSGi LogService

Hi,


On 29.06.2010, at 16:28, LongkerDandy wrote:

> Hi
> 
> I've problem to inject the LogService with iPOJO.
> My environment is:
> Framwork 3.0.1 with Gogo Shell 
> org.apache.felix.log-1.0.0
> iPOJO 1.6.2
> 
> I'm trying to inject the LogService with a field:
> "private transient LogService logger;"
> And with iPOJO metadata.xml configured
> 
> 
> <ipojo>
>       <component name="disks-service"
> classname="net.redrabbit.homecenter.system.DisksService">
>               <requires field="logger"/>
>               <provides />
>               <callback transition="validate" method="start"/>
>               <callback transition="invalidate" method="stop"/>               
>       </component>
>       <instance name="disks-instance" component="disks-service"/>
> </ipojo>
> 
> 
> But the logger turned out to be NULL when executing.
> I can't understand.

This should work. I tried:
@Component
@Instantiate
public class Test {
    
        @Requires
        private transient LogService logger;
        
        @Validate
        public void start() {
            logger.log(LogService.LOG_INFO, "Hello");
        }
}

And I got the expected result.

Could to post the code of your component ?

Regards,

Clement


> 
> Regards
> LongkerDandy
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to