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 03:24:34 UTC

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

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


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.


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

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-2010?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12805445#action_12805445 ] 

Felix Meschberger commented on FELIX-2010:
------------------------------------------

Hmm, ist there something else going on, which is not valid ?

I have just created (Rev. 903585) a test which checks various signatures (parameter types, visibility) and this test passes just fine.

> 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
>
> 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.


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

Posted by "Christopher Brind (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-2010?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12805417#action_12805417 ] 

Christopher Brind commented on FELIX-2010:
------------------------------------------

Thanks for the speedy follow up.

My component *is* in the v1.1.0 namespace and is based on the examples in the spec.  e.g.

<?xml version="1.0" encoding="UTF-8"?> <scr:component name="example.activator"
xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0">
<implementation class="com.acme.Activator"/> </scr:component>

public class Activator { 
    public Activator() {...} 
    private void activate(BundleContext context) {...} 
    private void deactivate() {...}
}

Thus, even though activate and deactivate are not explicit in the XML, I would still expect them to be called.



> 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
>
> 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.


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

Posted by "Christopher Brind (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-2010?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12805459#action_12805459 ] 

Christopher Brind commented on FELIX-2010:
------------------------------------------

Fresh pair of eyes has revealed the problem (Neil Bartlett) - my second snippet is NOT in the 1.1 namespace, thus falls back to 1.0 behaviour exactly as you said.  Sorry about that!!

> 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.


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

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-2010?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12805377#action_12805377 ] 

Felix Meschberger commented on FELIX-2010:
------------------------------------------

This works as designed and mandated by the DS 1.1 specification.

In the (initial) DS 1.0 specification, the activate (and deactivate) method had the signature

    [ protected | public ] void activate(ComponentContext);

Only with DS 1.1 has this been modified to allow for a number of different signatures.

For backwards compatibility reasons (see 112.11, Changes), this behaviour is only available for DS 1.1 (or later) components:

        The additional signatures and additional accessibility for the activate,
        deactivate, bind and unbind methods can cause problems for components
        written to version 1.0 of this specification. The behavior in this
        specification only applies to component descriptions using the v1.1.0
        namespace.

So, what you are experiencing is actually expected.

> 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
>
> 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.


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

Posted by "Neil Bartlett (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-2010?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12805460#action_12805460 ] 

Neil Bartlett commented on FELIX-2010:
--------------------------------------

Chris, your second XML snippet is NOT in the 1.1 namespace, therefore it will only work if your activate method has the correct 1.0 signature, i.e. public void activate(ComponentContext).

> 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.


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

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-2010?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12805463#action_12805463 ] 

Felix Meschberger commented on FELIX-2010:
------------------------------------------

Hmm, the component in scrtest-fails.jar is declared with this descriptor:

   <component name='scrtest.TestComponent'>
      <implementation class='scrtest.TestComponent'/>
   </component>

Since this descriptor has no namespace, it is assumed to be a DS 1.0 component and hence the activate method is not found - as expected. This is specified in Section 112.4.2, XML Document:

       If an XML document contains a single, root component element which does
       not specify a namespace, then the http://www.osgi.org/xmlns/scr/v1.0.0
       namespace is assumed. Component descriptions using the http://
       www.osgi.org/xmlns/scr/v1.0.0 namespace must be treated according to
       version 1.0 of this specification.

> 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.


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

Posted by "Christopher Brind (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-2010?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christopher Brind updated FELIX-2010:
-------------------------------------

    Attachment: scrtest-works.jar

The scrtest-works.jar bundle (includes source) does show "Hello World".

> 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.


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

Posted by "Christopher Brind (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-2010?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christopher Brind updated FELIX-2010:
-------------------------------------

    Attachment: scrtest-fails.jar

The attached bundle (which includes source) does not show "Hello World".

> 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.


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

Posted by "Christopher Brind (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-2010?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12805450#action_12805450 ] 

Christopher Brind edited comment on FELIX-2010 at 1/27/10 10:15 AM:
--------------------------------------------------------------------

The attached bundle, scrtest-fails.jar, (which includes source) does not show "Hello World".

      was (Author: brindy):
    The attached bundle (which includes source) does not show "Hello World".
  
> 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.


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

Posted by "Christopher Brind (JIRA)" <ji...@apache.org>.
     [ 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.


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

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-2010?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12805464#action_12805464 ] 

Felix Meschberger commented on FELIX-2010:
------------------------------------------

>  Sorry.

No problem. Glad the thing works as expected ;-)

> 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.