How to get ServiceReference from service instance? [message #73326] |
Tue, 19 September 2006 13:02 |
Eclipse User |
|
|
|
Originally posted by: stepper.sympedia.de
Hi,
I'm trying to rewrite the following example to use declarative services:
http://www.knopflerfish.org/osgi_service_tutorial.html#white
My component metadata looks like:
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0"
name="org.eclipse.net4j.http.ServletRegistrar">
<implementation
class="org.eclipse.net4j.http.internal.ServletRegistrarImpl "/>
<reference
name="httpServices"
cardinality="0..n"
policy="dynamic"
bind="addHttpService"
unbind="removeHttpService"/>
<reference
name="servlets"
cardinality="0..n"
policy="dynamic"
bind="addServlet"
unbind="removeServlet"/>
</scr:component>
The signature of the bind method for the servlets reference is:
protected synchronized void addServlet(Servlet servlet)
Now my problem:
I want to register the new servlet with each of the already known HttpService instances.
For this purpose I need access to the ServiceReference of the servlet because this is the
entity that should know the alias property to use in registerServlet().
Any idea how to get this ServiceReference?
Cheers
/Eike
|
|
|
Re: How to get ServiceReference from service instance? [message #73384 is a reply to message #73326] |
Tue, 19 September 2006 15:51 |
Eclipse User |
|
|
|
Originally posted by: stepper.sympedia.de
Have solved it:
void addServlet(ServiceReference serviceReference)
Eike Stepper schrieb:
> Hi,
>
> I'm trying to rewrite the following example to use declarative services:
> http://www.knopflerfish.org/osgi_service_tutorial.html#white
>
> My component metadata looks like:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0"
> name="org.eclipse.net4j.http.ServletRegistrar">
> <implementation
> class="org.eclipse.net4j.http.internal.ServletRegistrarImpl "/>
> <reference
> name="httpServices"
> cardinality="0..n"
> policy="dynamic"
> bind="addHttpService"
> unbind="removeHttpService"/>
> <reference
> name="servlets"
> cardinality="0..n"
> policy="dynamic"
> bind="addServlet"
> unbind="removeServlet"/>
> </scr:component>
>
> The signature of the bind method for the servlets reference is:
>
> protected synchronized void addServlet(Servlet servlet)
>
> Now my problem:
> I want to register the new servlet with each of the already known
> HttpService instances.
> For this purpose I need access to the ServiceReference of the servlet
> because this is the
> entity that should know the alias property to use in registerServlet().
>
> Any idea how to get this ServiceReference?
>
> Cheers
> /Eike
|
|
|
Powered by
FUDForum. Page generated in 0.02997 seconds