tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Tuscany: SCA Java implementation.osgi (page edited)
Date Wed, 19 Sep 2007 15:57:00 GMT
SCA Java implementation.osgi (TUSCANY) edited by Luciano Resende
      Page: http://cwiki.apache.org/confluence/display/TUSCANY/SCA+Java+implementation.osgi
   Changes: http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=66255&originalVersion=1&revisedVersion=2


{include: SCA Java Subproject Menu}
{include: Java SCA Menu New}{column}{column:width=85%}

h3. <implementation.osgi>

Tuscany enables OSGi bundles to be used as the implementation of SCA components by using the
<implementation.osgi/> SCDL extension. OSGi services registered in the OSGi service
registry either using&nbsp;OSGi declarative services or &nbsp;through the OSGi procedural
services API can be exposed as services of the SCA component.

The OSGi component implementation SCDL has the following format:
    <properties service="">...</properties>*
    <properties reference="">...</properties>*
    <properties serviceCallback="">...</properties>*
    <properties referenceCallback="">...</properties>*
The bundle is identified by its symbolic name, which is used to locate the bundle in the SCA
contribution. The version of the bundle can be optionally specified if multiple versions of
the bundle are present in the contribution.

The list of classes in the bundle which&nbsp;contain SCA annotations that should be processed
by the SCA runtime can be specified in the classes attribute of <implementation.osgi/>.
If this list is not provided, only the implementation classes of service instances will be
scanned for SCA annotations.&nbsp;A list of&nbsp;dependent bundles can also be specified&nbsp;in
the imports attribute. If provided, these bundles are installed and started before the implementation

OSGi services registered in the OSGi registry can have properties associated with the service
registration. These properties can be used to lookup services in the registry. The properties
of services, references and callbacks associated with OSGi services can be optionally specified.
These will be used to create the filter for locating these services in the OSGi registry.&nbsp;

A component type file should be provided for SCA components using an OSGi bundle as its implementation.
This file should have the same base name and location as the bundle.

h4. Example:

This example shows a simple composite with&nbsp;two components that use <implementation.osgi/>:
<composite xmlns=http://www.osoa.org/xmlns/sca/1.0

    <component name="HelloWorldClient">
        <implementation.osgi xmlns=http://tuscany.apache.org/xmlns/sca/1.0
            <properties reference="helloWorldService">
                <property name="language">English</property>
        <reference name="helloWorldService" target="HelloWorldService"/>
   <component name="HelloWorldService">
        <implementation.osgi xmlns=http://tuscany.apache.org/xmlns/sca/1.0
            <properties service="HelloWorldService">
                <property name="language">English</property>
This example shows two components which use OSGi implementation. Each component implementation
is an OSGi bundle, and one of the services from&nbsp;each bundle is exposed through SCA.
The bundles are identified using their symbolic name and version which are values of the manifest
attributes Bundle-SymbolicName and Bundle-Version respectively in the bundle jar files. The
bundle jar files can either be a contribution in the SCA domain, or contained in a contribution
in the SCA domain.

The properties specified for the reference of HelloWorldClient are used to lookup HelloWorldService
in the OSGi registry. These properties should match the properties specified for the service
of HelloWorldService.&nbsp;

The OSGi bundles should register the services exposed through SCA when the bundle is activated.
Services are registered using standard OSGi service registration mechanism. References should
be looked up in the OSGi service registry using registry lookup. SCA runtime does not perform
reference injection for OSGi-based component implementation. Reference lookup should always
use the service registered with the highest ranking to ensure that SCA wiring and scope are
maintained. When OSGi declarative services are used, service registration and reference binding
are performed by the OSGi declarative services runtime. References from components using <implementation.osgi/>
can be wired to non-OSGi services, and non-OSGi components can access OSGi services. For example,
either of the two components in this example can use <implementation.java/> as their

Default scope for OSGi-based components is COMPOSITE. For scopes other than composite scope,
a service factory should be registered in the OSGi service registry. Service factories should
also be used for OSGi services which are used in multiple SCA components with different component

This message is automatically generated by Confluence

Unsubscribe or edit your notifications preferences

If you think it was sent incorrectly contact one of the administrators

If you want more information on Confluence, or have a bug to report see

To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org

View raw message