On 3/12/2015 8:41 AM, Peter Hermsdorf
wrote:
Hi Wim,
I'll take a closer look at that - maybe I can somehow relax the
service dependencies on startup
I now (again) have the problem that my edef
registration/description bundles are not honoured. This time in
the integration Testsuite.
When running the testsuite with -console -noExit i see:
> ss edef
194 ACTIVE com.godyo.IService1.edef_1.0.0
195 ACTIVE com.godyo.IService2.edef_1.0.0
but the services do not get bound. When refreshing the bundles the
binding is triggered immediately.
Any ideas how to fix that?
I'm still catching up with the emails this morning, and Wim just
responded to this question with some info on DS startup sequence. I
do also suspect start ordering and/or the problem I mentioned
before...it seems that Equinox/framework restarts don't end up
triggering edef bundles detection/reading (via BundleTracker).
There could be several explanations for this...e.g. start
level/start order (Wim's point), and it could relate to some
framework subtlety about starting of bundles without activator
(which I assume your edef bundles don't have an activator as they
usually do not).
One thing that occurred to me: are you using the 'eclipse lazy
start of bundles' approach or the 'osgi server eager start of
bundles' approach (I'm mostly interested in consumer-side, since
that is where you seem to be having difficulties getting things done
in the right order.
What would be another "easy" approach to trigger the import? Is
there some code that i can use to configure the
EndpointDescriptions programmatically?
The answer to this is a definite 'yes' :).
One way: have piece of code that explicitly starts (and first
stops, if necessary) the edef bundles. If this is in an activator
then at least you can determine exactly *when* it's run, or it
can/could be triggered via some UI event (e.g. menu
selection/whatever).
Second way: The RSA spec defines a service:
org.osgi.service.remoteserviceadmin.RemoteServiceAdmin that allows
programmatic control of the importing of a service. Specifically
the method RemoteServiceAdmin.importService(EndpointDescription).
If you like, you can/could simply create an ecf EndpointDescription
by passing in a Map of properties, and call
RemoteServiceAdmin.importService with your EndpointDescription.
A third way: Create and use your own TopologyManager. The RSA spec
defines a role called the 'topology manager' that does the above
import (and export actually). ECF's default topology manager is the
BasicTopologyManager in the org.eclipse.ecf.osgi.distribution
bundle. The TopologyManager defines the link between endpoint
description discovery and calling RemoteServiceAdmin.importService.
There are actually additional ECF-specific ways to programmatically
get the discovery + import to happen...but customizing/overriding
one of the ECF-specific services that implement the RSA
specification (i.e. interfaces in
org.eclipse.ecf.osgi.service.remoteserviceadmin package). I'm
happy to discuss and describe these methods, but before I take that
step it would probably be better to explore/discuss/exhaust the 3
methods described above.
Scott
|