You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Christopher Brind (JIRA)" <ji...@apache.org> on 2010/01/27 11:37:34 UTC

[jira] Resolved: (FELIX-2010) activate on component not called if specified in class and omitted from xml

     [ https://issues.apache.org/jira/browse/FELIX-2010?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christopher Brind resolved FELIX-2010.
--------------------------------------

    Resolution: Not A Problem

I didn't check the XML bnd had generated for me closely enough.  Sorry.

> activate on component not called if specified in class and omitted from xml
> ---------------------------------------------------------------------------
>
>                 Key: FELIX-2010
>                 URL: https://issues.apache.org/jira/browse/FELIX-2010
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions:  scr-1.4.0
>         Environment: Mac OS X
> java version "1.6.0_17"
> Java(TM) SE Runtime Environment (build 1.6.0_17-b04-248-10M3025)
> Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01-101, mixed mode)
>            Reporter: Christopher Brind
>         Attachments: scrtest-fails.jar, scrtest-works.jar
>
>
> The component descriptor does not have to explicitly specify the activate and deactivate methods.   However, if activate/deactivate are in the class then they should still be called at the appropriate time.
> So for example the following code only prints "Hello world!" when the activate method is specified explicitly in the component descriptor xml.
> public class FooComponent {
>         // the same seems to apply regardless of the signature
> 	public void activate() {
> 		System.out.println("Hello world!");
> 	}
> }
> This XML causes "Hello world!" to appear:
> <?xml version='1.0' encoding='utf-8'?>
> <component name='uk.org.brindy.felixscrtest.FooComponent' xmlns='http://www.osgi.org/xmlns/scr/v1.1.0' activate='activate'>
>   <implementation class='uk.org.brindy.felixscrtest.FooComponent'/>
> </component>
> But this XML does not:
> <?xml version='1.0' encoding='utf-8'?>
> <component name='uk.org.brindy.felixscrtest.FooComponent'>
>   <implementation class='uk.org.brindy.felixscrtest.FooComponent'/>
> </component>
> I could not quote a specific reference from the OSGi spec, but generally the latter example of XML is how the examples are structured (i.e. with implicit activate methods), for example see section 112.2.2 (Immediate Component) of the OSGi 4.2 compendium.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.