|
Re: Service activation - best practice for service availability? [message #90800 is a reply to message #90785] |
Tue, 19 June 2007 17:31 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Chris W![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=chris%40firestruck.com) Messages: 33 Registered: July 2009 |
Member |
|
|
Follow up...
1.) org.eclipse.ui.startup
This approach isn't recommend nor is it natural to start your bundle
during Eclipse. Within the IStartup implementation you cannot access
the BundleContext to manually start the bundle. I came across a post
suggestion one, albeit not preferred, way to initiate the bundle:
http://mea-bloga.blogspot.com/2006_03_05_archive.html
2.) Declarative Services
DS is promising not yet fruitful. I can run my client plugin in an OSGi
Framework Run As... and all services are created and available. I
assume this explicit launches all selected bundles. But, if I run the
plugin as an Eclipse Application, the services are not initiated because
the services have not been accessed. I tried, without success, to set
immediate="true" when defining the DS service component. My
understanding is that this would "activate [the service] as soon as its
dependencies are satisfied". In both the OSGi Framework and Eclipse
Application org.eclipse.equinox.ds is included in the launch.
3.) Manually in config.ini
Not flexible for service bundle additions.
4.) Manually in plugin activator using Platform.getBundle()
Again, this is tightly coupling the service bundles to the client. The
client should not know the names of the services and the bundles which
the reside.
What is the recommend way to start my service bundles despite not being
explicitly called? Again, I'm trying to gather services that implement
a specific interface. The plugin need not know the particulars of the
interface.
Any suggestions?
Chris wrote:
> Hey there.
>
> My use case is that I have multiple services that implement a given
> interface, and I'd like those services to be available when my plugin is
> activated. It's unlikely, but possible that additional services my be
> loaded once my plugin is active. My question is how should these
> services be started? Note that my plugin, the client, does not know
> where these services are coming from, but only that they implement a
> particular interface.
>
> <more_background>
> Upon plugin startup I setup a ServiceTracker to monitor the known
> service interface. Once a service is found/registered, the tracker
> stores the service in a registry and exposes the registry as a service.
> The plugin will use the registry service to obtain handles on
> services. The plugin first implicitly displays service options to the
> user. Once a service is selected, the plugin will work with this
> service to expose functionality. My goal is that this architecture
> allows for ease of service additions and robust selection of services -
> each workflow might select a different service.
> </more_background>
>
> <what_i_looked_into>
> This use case is more of a discovery/lookup scenario where the client
> doesn't explicit know about available services - just the interface for
> which they implement; therefore Lazy-Start doesn't apply. I've also
> read about org.eclipse.ui.startup. (Note that my service bundles will
> contribute extension points to the client plugin.) I've experimented
> with Declarative Services, but bundleContext.getService(reference)
> always returns null (related to the fact that 3.2.2 doesn't fully
> support DS?).
> </what_i_looked_into>
>
> How do you suggest I start my service bundles? Suggestions?
>
> Thanks in advance.
>
> -Chris
|
|
|
Declarative Services and 112.5.3 "Immediate Component" [message #91352 is a reply to message #90800] |
Fri, 29 June 2007 05:23 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Chris W![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=chris%40firestruck.com) Messages: 33 Registered: July 2009 |
Member |
|
|
Does anyone have any thoughts on this topic?
Basically I'm interested in defining a service via Declarative Services
(DS) that is activated per 112.5.3 "Immediate Component" in the R4 OSGi
Compendium.
I'm finding that when I launch my plugin from my workbench with my DS
service bundles that the services have null ServiceReferences which, if
I understand correctly, means that the services have not been activated.
immediate=true has no affect. How can can I tell the Service
Component Runtime to activate my services?
I'm launching w/ org.eclipse.equinox.ds_1.0.0.v20060601a and Eclipse 3.2.2.
-Chris
Chris Wall wrote:
> Follow up...
>
> 1.) org.eclipse.ui.startup
> This approach isn't recommend nor is it natural to start your bundle
> during Eclipse. Within the IStartup implementation you cannot access
> the BundleContext to manually start the bundle. I came across a post
> suggestion one, albeit not preferred, way to initiate the bundle:
> http://mea-bloga.blogspot.com/2006_03_05_archive.html
>
> 2.) Declarative Services
> DS is promising not yet fruitful. I can run my client plugin in an OSGi
> Framework Run As... and all services are created and available. I
> assume this explicit launches all selected bundles. But, if I run the
> plugin as an Eclipse Application, the services are not initiated because
> the services have not been accessed. I tried, without success, to set
> immediate="true" when defining the DS service component. My
> understanding is that this would "activate [the service] as soon as its
> dependencies are satisfied". In both the OSGi Framework and Eclipse
> Application org.eclipse.equinox.ds is included in the launch.
>
> 3.) Manually in config.ini
> Not flexible for service bundle additions.
>
> 4.) Manually in plugin activator using Platform.getBundle()
> Again, this is tightly coupling the service bundles to the client. The
> client should not know the names of the services and the bundles which
> the reside.
>
> What is the recommend way to start my service bundles despite not being
> explicitly called? Again, I'm trying to gather services that implement
> a specific interface. The plugin need not know the particulars of the
> interface.
>
> Any suggestions?
>
>
> Chris wrote:
>> Hey there.
>>
>> My use case is that I have multiple services that implement a given
>> interface, and I'd like those services to be available when my plugin
>> is activated. It's unlikely, but possible that additional services my
>> be loaded once my plugin is active. My question is how should these
>> services be started? Note that my plugin, the client, does not know
>> where these services are coming from, but only that they implement a
>> particular interface.
>>
>> <more_background>
>> Upon plugin startup I setup a ServiceTracker to monitor the known
>> service interface. Once a service is found/registered, the tracker
>> stores the service in a registry and exposes the registry as a
>> service. The plugin will use the registry service to obtain handles
>> on services. The plugin first implicitly displays service options to
>> the user. Once a service is selected, the plugin will work with this
>> service to expose functionality. My goal is that this architecture
>> allows for ease of service additions and robust selection of services
>> - each workflow might select a different service.
>> </more_background>
>>
>> <what_i_looked_into>
>> This use case is more of a discovery/lookup scenario where the client
>> doesn't explicit know about available services - just the interface
>> for which they implement; therefore Lazy-Start doesn't apply. I've
>> also read about org.eclipse.ui.startup. (Note that my service bundles
>> will contribute extension points to the client plugin.) I've
>> experimented with Declarative Services, but
>> bundleContext.getService(reference) always returns null (related to
>> the fact that 3.2.2 doesn't fully support DS?).
>> </what_i_looked_into>
>>
>> How do you suggest I start my service bundles? Suggestions?
>>
>> Thanks in advance.
>>
>> -Chris
|
|
|
|
Powered by
FUDForum. Page generated in 0.03673 seconds