diff options
Diffstat (limited to '')
-rw-r--r-- | site/trunk/site-publish/documentation-2x/sca-java-implementationosgi.html | 206 |
1 files changed, 206 insertions, 0 deletions
diff --git a/site/trunk/site-publish/documentation-2x/sca-java-implementationosgi.html b/site/trunk/site-publish/documentation-2x/sca-java-implementationosgi.html new file mode 100644 index 0000000000..2d5f0d8b44 --- /dev/null +++ b/site/trunk/site-publish/documentation-2x/sca-java-implementationosgi.html @@ -0,0 +1,206 @@ + + + + + + +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<HTML> + <HEAD> + <META name="description" content="Apache Tuscany"> + <META name="keywords" content="apache, apache tuscany, tuscany, service, services, fabric, soa, service oriented architecture, sca, service component architecture, das, sdo, csa, ruby, opensource"> + + <LINK type="text/css" rel="stylesheet" href="http://tuscany.apache.org/stylesheets/default.css"> + <LINK rel="SHORTCUT ICON" href="https://cwiki.apache.org/confluence/display/TUSCANYxDOCx2x/$images/favicon.ico"> + <TITLE>SCA Java implementation.osgi : Apache Tuscany</TITLE> + <META http-equiv="Content-Type" content="text/html;charset=UTF-8"></HEAD> + + <STYLE> + .spacetree * ul { + padding-left:0px; + margin-left: 0px; + } + .spacetree * li { + margin-left: 5px; + padding-left:5px; + } + </STYLE> + + <BODY onload="init()"> + <!-- topNav --> + <TABLE border="0" cellpadding="2" cellspacing="0" width="100%"> + <TR class="topBar"> + <TD align="left" valign="middle" class="topBarDiv" align="left" nowrap=""> + <A href="https://cwiki.apache.org/geronimo"> Home</A> > <A href="index.html" title="Apache Tuscany Docs 2.x">Apache Tuscany Docs 2.x</A> > <A href="index.html" title="Index">Index</A> > <A href="sca-java-extensions-guide.html" title="SCA Java Extensions Guide">SCA Java Extensions Guide</A> > <A href="" title="SCA Java implementation.osgi">SCA Java implementation.osgi</A> + </TD> + <TD align="right" valign="middle" nowrap=""> + <FORM name="search" action="http://www.google.com/search" method="get"> + <INPUT type="hidden" name="ie" value="UTF-8"> + <INPUT type="hidden" name="oe" value="UTF-8"> + <INPUT type="hidden" name="domains" value=""> + <INPUT type="hidden" name="sitesearch" value=""> + <INPUT type="text" name="q" maxlength="255" value=""> + <INPUT type="submit" name="btnG" value="Google Search"> + </FORM> + </TD> + </TR> + </TABLE> + + + <TABLE border="0" cellpadding="2" cellspacing="0" width="100%"> + <TR class="topBar"> + <TD align="left" valign="middle" class="topBarDiv" nowrap="true" width="100%"> + <A href="index.html" title="Apache Tuscany Docs 2.x">Apache Tuscany Docs 2.x</A> > <A href="index.html" title="Index">Index</A> > <A href="sca-java-extensions-guide.html" title="SCA Java Extensions Guide">SCA Java Extensions Guide</A> > <A href="" title="SCA Java implementation.osgi">SCA Java implementation.osgi</A> + </TD> + + <TD align="right" valign="middle" class="topBarDiv" align="left" nowrap="true"> + <A href="http://tuscany.apache.org/">Tuscany Home</A> | <A href="http://mail-archives.apache.org/mod_mbox/tuscany-user">User List</A> | <A href="http://mail-archives.apache.org/mod_mbox/tuscany-dev">Dev List</A> | <A href="http://issues.apache.org/jira/browse/Tuscany">Issue Tracker</A> + </TD> + </TR> + </TABLE> + + <TABLE border="0" cellpadding="0" width="100%" bgcolor="#FFFFFF"> + <TR> + <TD valign="top" align="left" width="22%" bgcolor="#F9F9F9" class="noprint"> + <DIV class="tabletitle">Table of Contents</DIV> + <DIV class="spacetree"> + + + </DIV> + </TD> + <TD align="left" valign="top" width="78%"> + <!-- pageContent --> + <DIV id="PageContent"> + <DIV class="pageheader" style="padding: 6px 0px 0px 0px;"> + <!-- We'll enable this once we figure out how to access (and save) the logo resource --> + <!--img src="http://geronimo.apache.org/images/confluence_logo.gif" style="float: left; margin: 4px 4px 4px 10px;" border="0"--> + <DIV style="margin: 0px 10px 0px 10px" class="smalltext">Apache Tuscany Docs 2.x</DIV> + <DIV style="margin: 0px 10px 8px 10px" class="pagetitle">SCA Java implementation.osgi</DIV> + + <DIV class="greynavbar" align="right" style="padding: 2px 10px; margin: 0px;"> +<!-- --> + <A href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=5964937"> + <IMG src="http://geronimo.apache.org/images/icons/notep_16.gif" height="16" width="16" border="0" align="absmiddle" title="Edit Page"></A> + <A href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=5964937">Edit Page</A> + + <A href="https://cwiki.apache.org/confluence/pages/listpages.action?key=TUSCANYxDOCx2x"> + <IMG src="http://geronimo.apache.org/images/icons/browse_space.gif" height="16" width="16" border="0" align="absmiddle" title="Browse Space"></A> + <A href="https://cwiki.apache.org/confluence/pages/listpages.action?key=TUSCANYxDOCx2x">Browse Space</A> + + <A href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=TUSCANYxDOCx2x&fromPageId=5964937"> + <IMG src="http://geronimo.apache.org/images/icons/add_page_16.gif" height="16" width="16" border="0" align="absmiddle" title="Add Page"></A> + <A href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=TUSCANYxDOCx2x&fromPageId=5964937">Add Page</A> + + <A href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=TUSCANYxDOCx2x&fromPageId=5964937"> + <IMG src="http://geronimo.apache.org/images/icons/add_blogentry_16.gif" height="16" width="16" border="0" align="absmiddle" title="Add News"></A> + <A href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=TUSCANYxDOCx2x&fromPageId=5964937">Add News</A> +<!-- --> + </DIV> + </DIV> + + <DIV class="pagecontent"> + <DIV class="wiki-content"> + +<H3><A name="SCAJavaimplementation.osgi-%3Cimplementation.osgi%3E"></A><implementation.osgi></H3> + +<P>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 OSGi declarative services or through the OSGi procedural services API can be exposed as services of the SCA component.</P> + +<P>The OSGi component implementation SCDL has the following format:</P> +<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent"> +<PRE class="code-java"> +<implementation.osgi + bundleSymbolicName="" + [bundleVersion=""] + [classes=""] + [imports=""]> + <properties service="">...</properties>* + <properties reference="">...</properties>* + <properties serviceCallback="">...</properties>* + <properties referenceCallback="">...</properties>* +</implementation.osgi> +</PRE> +</DIV></DIV> +<P>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.</P> + +<P>The list of classes in the bundle which 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. A list of dependent bundles can also be specified in the imports attribute. If provided, these bundles are installed and started before the implementation bundle.</P> + +<P>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. </P> + +<P>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.</P> + +<H4><A name="SCAJavaimplementation.osgi-Example%3A"></A>Example:</H4> + +<P>This example shows a simple composite with two components that use <implementation.osgi/>:</P> +<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent"> +<PRE class="code-java"> +<composite xmlns=http:<SPAN class="code-comment">//www.osoa.org/xmlns/sca/1.0 +</SPAN> targetNamespace=http:<SPAN class="code-comment">//helloworld +</SPAN> name=<SPAN class="code-quote">"HelloWorld"</SPAN>> + + <component name=<SPAN class="code-quote">"HelloWorldClient"</SPAN>> + <implementation.osgi xmlns=http:<SPAN class="code-comment">//tuscany.apache.org/xmlns/sca/1.0 +</SPAN> bundleSymbolicName=<SPAN class="code-quote">"helloworld.HelloWorldClient"</SPAN> + bundleVersion=<SPAN class="code-quote">"1.0.0"</SPAN>> + <properties reference=<SPAN class="code-quote">"helloWorldService"</SPAN>> + <property name=<SPAN class="code-quote">"language"</SPAN>>English</property> + </properties> + </implementation.osgi> + <reference name=<SPAN class="code-quote">"helloWorldService"</SPAN> target=<SPAN class="code-quote">"HelloWorldService"</SPAN>/> + </component> + <component name=<SPAN class="code-quote">"HelloWorldService"</SPAN>> + <implementation.osgi xmlns=http:<SPAN class="code-comment">//tuscany.apache.org/xmlns/sca/1.0 +</SPAN> bundleSymbolicName=<SPAN class="code-quote">"helloworld.HelloWorldService"</SPAN> + bundleVersion=<SPAN class="code-quote">"1.0.0"</SPAN>> + <properties service=<SPAN class="code-quote">"HelloWorldService"</SPAN>> + <property name=<SPAN class="code-quote">"language"</SPAN>>English</property> + </properties> + </implementation.osgi> + </component> +</composite> +</PRE> +</DIV></DIV> +<P>This example shows two components which use OSGi implementation. Each component implementation is an OSGi bundle, and one of the services from 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.</P> + +<P>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. </P> + +<P>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 implementation.</P> + +<P>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 properties.</P> + </DIV> + + </DIV> + </DIV> + </TD> + </TR> + </TABLE> + + <!-- footer --> + <TABLE border="0" cellpadding="2" cellspacing="0" width="100%"> + <TR> + <TD align="left" valign="middle" class="footer"> + + <IMG src="http://static.delicious.com/img/delicious.small.gif" height="10" width="10" alt="Delicious"> + <A href="http://delicious.com/save" onclick="window.open('http://delicious.com/save?v=5&noui&jump=close&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title),'delicious','toolbar=no,width=550,height=550'); return false;">Bookmark this on Delicious</A> + + <IMG src="http://digg.com/img/badges/16x16-digg-guy.gif" width="16" height="16" alt="Digg!"> + <A href="" onclick="window.open('http://digg.com/submit?url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)+'&topic=programming');">Digg this</A> + <!-- Slicker, but no text + <script type="text/javascript"> + digg_skin = 'icon'; + digg_window = 'new'; + digg_title = 'Apache Geronimo v2.2 Documentation : SCA Java implementation.osgi'; + digg_topic = 'programming'; + </script> + <script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script> + --> + + </TD> + <TD align="right" valign="middle" class="footer"> + <A href="http://cwiki.apache.org/GMOxPMGT/geronimo-privacy-policy.html">Privacy Policy</A> - + Copyright © 2003-2010, The Apache Software Foundation, Licensed under <A href="http://www.apache.org/licenses/LICENSE-2.0">ASL 2.0.</A> + </TD> + </TR> + </TABLE> + + </BODY> +</HTML>
\ No newline at end of file |