Using Declarative Services with Composite Subsystems ?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Using Declarative Services with Composite Subsystems ?

Cristiano Gavião

Hi,

I'm trying to deploy some bundles as contents of a composite subsystem. They are coming from a R5 repository and they have many DS components.

I'm using SCR 2.0.10 and Aries Subsystems 2.0.9-SNAPSHOT.

The subsystem is being installed and started properly (not error at least). But the content bundles are in the STARTING state and they are not being detected by DS.

  ID|State      |Level|Symbolic name
    0|Active     |    0|org.apache.felix.framework (5.6.2)|5.6.2
    1|Active     |    1|ch.qos.logback.classic (1.2.1)|1.2.1
    2|Active     |    1|ch.qos.logback.core (1.2.1)|1.2.1
    3|Active     |    1|org.fusesource.jansi (1.14.0)|1.14.0
    4|Active     |    1|org.jline (3.0.1)|3.0.1
    5|Active     |    1|org.apache.aries.subsystem.api (2.0.9.SNAPSHOT)|2.0.9.SNAPSHOT
    6|Active     |    1|org.apache.aries.subsystem.core (2.0.9.SNAPSHOT)|2.0.9.SNAPSHOT
    7|Active     |    1|org.apache.aries.subsystem.gogo-command (1.0.0)|1.0.0
    8|Active     |    1|org.apache.aries.util (1.1.3)|1.1.3
    9|Active     |    1|org.apache.felix.bundlerepository (2.0.10)|2.0.10
   10|Active     |    1|org.apache.felix.configadmin (1.8.14)|1.8.14
   11|Active     |    1|org.apache.felix.coordinator (1.0.2)|1.0.2
   12|Active     |    1|org.apache.felix.eventadmin (1.4.8)|1.4.8
   13|Active     |    1|org.apache.felix.gogo.command (1.0.2)|1.0.2
   14|Active     |    1|org.apache.felix.gogo.jline (1.0.6)|1.0.6
   15|Active     |    1|org.apache.felix.gogo.runtime (1.0.6)|1.0.6
   16|Active     |    1|org.apache.felix.prefs (1.1.0)|1.1.0
   17|Active     |    1|org.apache.felix.resolver (1.12.0)|1.12.0
   18|Active     |    1|org.apache.felix.scr (2.0.10)|2.0.10
   19|Resolved   |    1|org.eclipse.equinox.region (1.4.0.v20170117-1425)|1.4.0.v20170117-1425
   20|Active     |    1|com.c8tech.hawkeyes.kernel.bootstrap (0.1.1.qualifier)|0.1.1.qualifier
   21|Active     |    1|slf4j.api (1.7.25)|1.7.25
   22|Active     |    1|org.osgi.service.subsystem.region.context.0 (1.0.0)|1.0.0
   23|Active     |    1|org.osgi.service.subsystem.region.context.1 (1.0.0)|1.0.0
   24|Starting   |    1|com.c8tech.hawkeyes.kernel.lib.control (0.1.1.qualifier)|0.1.1.qualifier
   25|Starting   |    1|com.c8tech.hawkeyes.kernel.lib (0.1.1.qualifier)|0.1.1.qualifier

I've set ds.showtrace to true and I didn't see anything related to them and also scr:list  command doesn't show any of their components.

In the subsystem manifest I have declared:

Subsystem-ImportService: org.osgi.service.component.runtime.ServiceCom
 ponentRuntime;effective:=active;resolution:=mandatory;cardinality:=si
 ngle,org.osgi.service.cm.ConfigurationAdmin;effective:=active;resolut
 ion:=mandatory;cardinality:=single,org.osgi.service.event.EventAdmin;
 effective:=active;resolution:=mandatory;cardinality:=single

Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
 ;effective:=resolve;resolution:=mandatory;cardinality:=single,osgi.se
 rvice;filter:="(objectClass=org.osgi.service.event.EventAdmin)";effec
 tive:=active;resolution:=mandatory;cardinality:=single,osgi.extender;
 filter:="(&(osgi.extender=osgi.component)(version>=1.3.0)(!(version>=
 2.0)))";effective:=resolve;resolution:=mandatory;cardinality:=single,
 osgi.extender;filter:="(&(osgi.extender=osgi.component)(version>=1.3.
 0)(!(version>=2.0.0)))";effective:=resolve;resolution:=mandatory;card
 inality:=single,osgi.service;filter:="(objectClass=org.osgi.service.c
 m.ConfigurationAdmin)";effective:=active;resolution:=mandatory;cardin
 ality:=single

could someone please tell me what am I missing ?

thanks,

Cristiano
Reply | Threaded
Open this post in threaded view
|

Re: Using Declarative Services with Composite Subsystems ?

David Jencks
I don't have the code or docs here but you might need to set a property, I think ds.global.extender, to true; if the property is false ds only looks in its own region.

Hope this helpS
David Jencks

Sent from my iPhone

> On May 16, 2017, at 6:48 AM, Cristiano Gavião <[hidden email]> wrote:
>
> EventAdmin

Reply | Threaded
Open this post in threaded view
|

Re: Using Declarative Services with Composite Subsystems ?

Cristiano Gavião
Oh, that is great !

Do you remember if that property must be set as a system one while
starting the container (-Dds.global.extender) or perhaps it can be set
by a bundle using ConfigAdmin before installing the subsystem?

many thanks David!


On 16/05/2017 11:54, David Jencks wrote:

> I don't have the code or docs here but you might need to set a property, I think ds.global.extender, to true; if the property is false ds only looks in its own region.
>
> Hope this helpS
> David Jencks
>
> Sent from my iPhone
>
>> On May 16, 2017, at 6:48 AM, Cristiano Gavião <[hidden email]> wrote:
>>
>> EventAdmin

Reply | Threaded
Open this post in threaded view
|

Re: Using Declarative Services with Composite Subsystems ?

Cristiano Gavião

ok, I found that DS can be configured by ConfigAdmin. great !

        Configuration dsConfig = getConfigurationAdmin()
                .getConfiguration("org.apache.felix.scr.ScrService", null);
        Dictionary<String, Object> props = new Hashtable<>();
        props.put("ds.global.extender", true);
        dsConfig.update(props);


Now the components of subsystem bundles are being processed by DS.

After have started I used the inspect cap service command and saw that the services were created properly. but scr:list needs to be improved since it doesn't list the components of scoped bundles.


anyway many thanks again David !

regards,

Cristiano


On 16/05/2017 12:26, Cristiano Gavião wrote:
Oh, that is great !

Do you remember if that property must be set as a system one while starting the container (-Dds.global.extender) or perhaps it can be set by a bundle using ConfigAdmin before installing the subsystem?

many thanks David!


On 16/05/2017 11:54, David Jencks wrote:
I don't have the code or docs here but you might need to set a property, I think ds.global.extender, to true; if the property is false ds only looks in its own region.

Hope this helpS
David Jencks

Sent from my iPhone

On May 16, 2017, at 6:48 AM, Cristiano Gavião [hidden email] wrote:

EventAdmin


Reply | Threaded
Open this post in threaded view
|

Re: Using Declarative Services with Composite Subsystems ?

David Jencks

My recollection is that the scr:list command from ds did show components from all regions. Are you  using the ds command or the karaf one?

Thanks
David Jencks
Sent from my iPhone

> On May 16, 2017, at 9:49 AM, Cristiano Gavião <[hidden email]> wrote:
>
> Gavião

Reply | Threaded
Open this post in threaded view
|

Re: Using Declarative Services with Composite Subsystems ?

Cristiano Gavião
I'm using scr:list from org.apache.felix.scr and tried it on both felix
and equinox. no karaf involved.

See bellow, it returned only the component from the bundle outside the
subsystem.


> scr:list
>  BundleId Component Name Default State
>     Component Id State      PIDs (Factory PID)
>  [  13]
> com.c8tech.hawkeyes.kernel.internal.bootstrap.ComponentCommandKernelBootstrap
> enabled
>     [   0] [active      ]
>  [  21]   org.eclipse.equinox.event  enabled
>     [   1] [active      ]



On 16/05/2017 14:17, David Jencks wrote:
> My recollection is that the scr:list command from ds did show components from all regions. Are you  using the ds command or the karaf one?
>
> Thanks
> David Jencks
> Sent from my iPhone
>
>> On May 16, 2017, at 9:49 AM, Cristiano Gavião <[hidden email]> wrote:
>>
>> Gavião

Reply | Threaded
Open this post in threaded view
|

Re: Using Declarative Services with Composite Subsystems ?

David Jencks
I'm not sure what's going on, I don't see any way a component managed by a ds instance could avoid showing up in the list command, and my recollection was that they did. Unfortunately I don't have ready access to a test environment at the moment.

David Jencks

Sent from my iPhone

> On May 16, 2017, at 1:35 PM, Cristiano Gavião <[hidden email]> wrote:
>
> I'm using scr:list from org.apache.felix.scr and tried it on both felix and equinox. no karaf involved.
>
> See bellow, it returned only the component from the bundle outside the subsystem.
>
>
>> scr:list
>> BundleId Component Name Default State
>>    Component Id State      PIDs (Factory PID)
>> [  13] com.c8tech.hawkeyes.kernel.internal.bootstrap.ComponentCommandKernelBootstrap enabled
>>    [   0] [active      ]
>> [  21]   org.eclipse.equinox.event  enabled
>>    [   1] [active      ]
>
>
>
>> On 16/05/2017 14:17, David Jencks wrote:
>> My recollection is that the scr:list command from ds did show components from all regions. Are you  using the ds command or the karaf one?
>>
>> Thanks
>> David Jencks
>> Sent from my iPhone
>>
>>> On May 16, 2017, at 9:49 AM, Cristiano Gavião <[hidden email]> wrote:
>>>
>>> Gavião
>