Issue Details (XML | Word | Printable)

Key: OSGI-144
Type: New Feature New Feature
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Costin Leau
Reporter: Adrian Colyer
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Spring OSGi

Make it easy to discover properties of a service (ServiceReference / ServiceRegistration)

Created: 23/May/07 12:33 PM   Updated: 31/May/07 05:08 AM
Component/s: None
Affects Version/s: 1.0 M3
Fix Version/s: 1.0 M3

Time Tracking:
Not Specified


 Description  « Hide
For a service reference defined as an <osgi:reference> bean, there should be an easy way to find the properties that the service was published with etc..

Given eg.

  <osgi:reference id="someService" interface="SomeService"/>

How can we find out the properties of the service currently bound as the target of someService? One suggestion is to have the service proxy implement a well-known interface that the someService bean instance could be cast to. We could opt for the proxy implementing org.osgi.framework.ServiceReference directly, but that interface is wide enough that clashes with operations defined in the business interface may occur. Introducing our own interface such as org.springframework.osgi.ServiceReferenceAware:

public interface ServiceReferenceAware {

  ServiceReference getServiceReference() ;

}

should do the trick.

For a service published as an OSGi service, it should also be possible to get hold of the ServiceRegistration object for that service (if desired). The current specification doesn't define the type of the bean defined by an osgi:service element. One design option here would be to have that bean be of type ServiceRegistration.

 All   Comments   Work Log   Change History   FishEye   Builds      Sort Order: Ascending order - Click to sort in descending order
Costin Leau added a comment - 30/May/07 08:04 AM
osgi:service already returns the ServiceRegistration.