Hi,

I have made good progress to improve the Tuscany implementation of Distributed OSGi over SCA, especially toward the OSGi filter/property driven remote services in a dynamic fashion. The changes checked in under [1] are summarized as follows.

1) Refactor the code into three major players:

A controller that uses OSGi ListenerHook and ServiceTracker to watch the registrations of service listeners (that represent references to OSGi services using OSGi filters) and services (that represent the services provided by OSGi bundles).

A remote admin that implements the importService and exportService functions. Importing a remote service creates a service proxy in the OSGi service registry to allow OSGi bundles to consume remote services. Exporting a service publishes the OSGi service to protocols that enable the remote access to the OSGi service. We now generate SCA composite/component with <implementation.osgi> on the fly based on the detection of exportable OSGi services or matching endpoints from the service discovery that satisfy the filter from service listeners. Then the composite is started using the Node API to import/export the service. Once the imported or exported service is no longer needed, we stop the node to unimport/unexport the service.

A discovery service that receives the endpoints from the local service descriptions files or replicated endpoint registry that holds the endpoints in the SCA domain. The discovery notifies the controller (registered as an EndpointListener). If the filter matches the endpoint properties, the controller calls the remote admin to import the service.

2) Support both the preconfigured SCA composite and dynamic introspection of OSGi service export/import

* The static approach knows the OSGi service import/export up front based on the descriptions such as OSGi DS, RFC 124 or SCA componentType files. It encapsulates the OSGi entities as SCA components so that they can be assembled with other non-OSGi services in the SCA domain.

* The dynamic approach drives everything based on OSGi properties. In this case, SCA is an infrastructure from an OSGi perspective. From SCA's point of the view, the OSGi properties contribute to the componentType and the SCA can use component definitions to override some of the configurations.

I added two extra samples [4][5] to demonstrate the dynamic approach in addition to the static approach [2][3].

[1] http://svn.apache.org/viewvc?rev=797580&view=rev

[2] https://svn.apache.org/repos/asf/tuscany/java/sca/samples/dosgi-calculator/ [3] https://svn.apache.org/repos/asf/tuscany/java/sca/samples/dosgi-calculator-operations/ [4] https://svn.apache.org/repos/asf/tuscany/java/sca/samples/dosgi-dynamic-calculator/ [5] https://svn.apache.org/repos/asf/tuscany/java/sca/samples/dosgi-dynamic-calculator-operations/

Thanks,
Raymond

---
Raymond Feng
Apache Tuscany PMC Member: http://tuscany.apache.org
Co-author of Tuscany In Action: http://www.manning.com/laws


Reply via email to