summaryrefslogtreecommitdiffstats
path: root/site/trunk/site-publish/documentation-2x/osgi-enablement-for-tuscany-runtime.html
diff options
context:
space:
mode:
authorcoreyg <coreyg@13f79535-47bb-0310-9956-ffa450edef68>2014-11-21 09:30:19 +0000
committercoreyg <coreyg@13f79535-47bb-0310-9956-ffa450edef68>2014-11-21 09:30:19 +0000
commit200a40b332420f94992eb39a6d0ea1cf1490ffc4 (patch)
tree1c76ef1d254c7bfc91128a313d319bd60da9d01e /site/trunk/site-publish/documentation-2x/osgi-enablement-for-tuscany-runtime.html
parent85f53ab6ab4f664d63774c94b672a875c9e52b8a (diff)
Adding tuscany's website to their svn repo for svnpubsub
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1640879 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--site/trunk/site-publish/documentation-2x/osgi-enablement-for-tuscany-runtime.html381
1 files changed, 381 insertions, 0 deletions
diff --git a/site/trunk/site-publish/documentation-2x/osgi-enablement-for-tuscany-runtime.html b/site/trunk/site-publish/documentation-2x/osgi-enablement-for-tuscany-runtime.html
new file mode 100644
index 0000000000..38a82c3242
--- /dev/null
+++ b/site/trunk/site-publish/documentation-2x/osgi-enablement-for-tuscany-runtime.html
@@ -0,0 +1,381 @@
+
+
+
+
+
+
+<!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>OSGi Enablement for Tuscany Runtime : 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> &gt;&nbsp;<A href="index.html" title="Apache Tuscany Docs 2.x">Apache Tuscany Docs 2.x</A>&nbsp;&gt;&nbsp;<A href="index.html" title="Index">Index</A>&nbsp;&gt;&nbsp;<A href="development-guides.html" title="Development Guides">Development Guides</A>&nbsp;&gt;&nbsp;<A href="" title="OSGi Enablement for Tuscany Runtime">OSGi Enablement for Tuscany Runtime</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%">
+ &nbsp;<A href="index.html" title="Apache Tuscany Docs 2.x">Apache Tuscany Docs 2.x</A>&nbsp;&gt;&nbsp;<A href="index.html" title="Index">Index</A>&nbsp;&gt;&nbsp;<A href="development-guides.html" title="Development Guides">Development Guides</A>&nbsp;&gt;&nbsp;<A href="" title="OSGi Enablement for Tuscany Runtime">OSGi Enablement for Tuscany Runtime</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>&nbsp;&nbsp;
+ </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">OSGi Enablement for Tuscany Runtime</DIV>
+
+ <DIV class="greynavbar" align="right" style="padding: 2px 10px; margin: 0px;">
+<!-- -->
+ <A href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=109741">
+ <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=109741">Edit Page</A>
+ &nbsp;
+ <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>
+ &nbsp;
+ <A href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=TUSCANYxDOCx2x&fromPageId=109741">
+ <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=109741">Add Page</A>
+ &nbsp;
+ <A href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=TUSCANYxDOCx2x&fromPageId=109741">
+ <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=109741">Add News</A>
+<!-- -->
+ </DIV>
+ </DIV>
+
+ <DIV class="pagecontent">
+ <DIV class="wiki-content">
+ <H1><A name="OSGiEnablementforTuscanyRuntime-OSGiEnablementforTuscanyRuntime"></A>OSGi Enablement for Tuscany Runtime</H1>
+
+<P><A href="osgi-enablement-for-tuscany-runtime.data/OSGi%20Enablement%20for%20Tuscany.ppt">OSGi Enablement for Tuscany.ppt</A></P>
+
+<H2><A name="OSGiEnablementforTuscanyRuntime-MovtivationstoenableOSGiforTuscany%3A"></A>Movtivations to enable OSGi for Tuscany:</H2>
+
+<UL>
+ <LI>Provide modularity for Tuscany to formalize the SPI contracts and enforce the package dependencies across modules</LI>
+ <LI>Enable Tuscany to work with OSGi environment such as JEE application servers, Eclipse RCP or Spring DM (see <A href="http://www.infoq.com/news/2008/11/osgi-in-the-enterprise" class="external-link" rel="nofollow">http://www.infoq.com/news/2008/11/osgi-in-the-enterprise</A> )</LI>
+ <LI>Provide versioning and isolation so that Tuscany extensions can depend on different versions of the same library</LI>
+ <LI>Provide dynamic lifecycle for extensions, install/uninstall/start/stop a module</LI>
+</UL>
+
+
+<H2><A name="OSGiEnablementforTuscanyRuntime-Objectives"></A>Objectives</H2>
+
+<UL>
+ <LI>Tuscany runtime will be able to run in both non-OSGi and OSGi environment</LI>
+ <LI>A consistent OSGi story across development, build, runtime and testing</LI>
+</UL>
+
+
+<H2><A name="OSGiEnablementforTuscanyRuntime-StepstomakeTuscanyworkwithOSGi%28Basicenablement%29"></A>Steps to make Tuscany work with OSGi (Basic enablement)</H2>
+
+<UL>
+ <LI>Add OSGi MANIFEST.MF for each module to make it an OSGi bundle
+ <UL>
+ <LI>The generated MANIFEST.MF from maven-bundle-plugin is a good starting point. The result may not be accurate and it doesn't help to reduce the coupling</LI>
+ <LI>It should be developers' reponsibility to maintain it for the optimal dependencies</LI>
+ </UL>
+ </LI>
+ <LI>Convert each non-OSGi 3rd-party jar into an OSGi bundle
+ <UL>
+ <LI>Exception: Aggregate a group of 3rd-party jars if they have split packages</LI>
+ </UL>
+ </LI>
+ <LI>Add an OSGi-based service discoverer to discover tuscany extension points and extensions from the installed bundles
+ <UL>
+ <LI>Use the same JDK service provider pattern (META-INF/services) as JSE</LI>
+ <LI>The discoverer is configured based on the running environment (JSE or OSGi)</LI>
+ </UL>
+ </LI>
+ <LI>Change how JDK factories such as XMLInputFactory, XPathFactory, and DocumentBuilderFactory, are discovered and instantiated
+ <UL>
+ <LI>XMLInputFactory.newInstance() used the JSE service provider pattern which doesn't work with OSGi</LI>
+ <LI>We need to use Tuscany's service discovery mechanism to discover and instantiate the factories</LI>
+ </UL>
+ </LI>
+ <LI>Adjust the code that assumes there is a flat thread context classloader that can access all the classes in the Tuscany runtime
+ <UL>
+ <LI>With OSGi, there is a network of classloaders (one classloader per module) and the class visibility is constrained by the OSGi headers such as Import-Package and Export-Package</LI>
+ <LI>The classloader for the current class is a good starting point for Class.forName() with OSGi</LI>
+ </UL>
+ </LI>
+ <LI>Provide a SCA node launcher to start an OSGi runtime and run SCA application with the OSGi-enabled Tuscany runtime</LI>
+ <LI>Produce distributions that are compatible with the OSGi bundle structure in an efficient way (in one-two minutes)</LI>
+ <LI>Bring samples and itests to use the Tuscany SCA OSGi node launcher or run with the Eclipse Equinox profile</LI>
+</UL>
+
+
+<DIV class="panelMacro"><TABLE class="noteMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="https://cwiki.apache.org/confluence/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD>To learn from the excerises we went through, please see the slides: <A href="osgi-enablement-for-tuscany-runtime.data/tuscany-osgi.pdf">tuscany-osgi.pdf</A></TD></TR></TABLE></DIV>
+
+<H2><A name="OSGiEnablementforTuscanyRuntime-UseOSGitohelpTuscanymaintainandenforcegoodmodularitywithcleanSPIsfollowingtheOSGibestpractices"></A>Use OSGi to help Tuscany maintain and enforce good modularity with clean SPIs following the OSGi best practices</H2>
+
+<UL>
+ <LI>Identify the absolutely necessary SPI packages that need to be exported
+ <UL>
+ <LI>Don't try to export everything</LI>
+ <LI>For model modules, try to only export the package that contains the interfaces</LI>
+ <LI>Try not to export any package from the xxx-runtime moudles</LI>
+ <LI>Any classes that can be accessed via the ExtensionPointRegistry using interfaces should not be exported</LI>
+ </UL>
+ </LI>
+ <LI>Only import other packages when it's needed
+ <UL>
+ <LI>For example, we used to have a lot of modules pull in assembly for just a constant for the SCA namespace</LI>
+ <LI>Avoid DynamicImport-Package=&#42;</LI>
+ </UL>
+ </LI>
+ <LI>Do not export &quot;private&quot; packages as a workaround or hack which can fail the &quot;clean SPI&quot;. Refactor things into SPIs if necessary
+ <UL>
+ <LI>For example, tuscany-core has quite a few packages that are exported. We need to define a SPI layer if these exports are required.</LI>
+ <LI>implementation-java: extract out the annotation processing so that they can be reused for introspecting other java-based implementation technologies such as Spring or EJB</LI>
+ <LI>implementation-java-runtime: extract out the IoC</LI>
+ <LI>add common modules such as common-java and common-xml to host java or XML related utilities</LI>
+ </UL>
+ </LI>
+ <LI>Split modules into model/runtime to promote modularity</LI>
+ <LI>Fix some of the unit testcases that pull in too many dependencies and they should be itests</LI>
+</UL>
+
+
+<P>To help developers to develop Tuscany modules as OSGi bundles and receive errors if OSGI constraints are violated, we integrated with a set of tools (help for improvement is welcome):</P>
+<UL>
+ <LI>A maven plugin to generate .classpath and .project files and target definition file to produce Eclipse PDE plugin projects for Tuscany modules so that we can leverage the nice OSGi development tooling
+ <UL>
+ <LI>Compile dependencies are now pulled in by the PDE requiredPlugins classpath container</LI>
+ <LI>Runtime dependencies are now generated as an explict classpath entry</LI>
+ <LI>Test dependencies can be optional Import-Package or an explicit classpath entry</LI>
+ </UL>
+ </LI>
+ <LI>A maven compiler to use Eclipse JDT and OSGi bundle resolver
+ <UL>
+ <LI>The JDT compiler is much faster that javac</LI>
+ <LI>The OSGi resolution reports unsatisfied OSGi constraints</LI>
+ </UL>
+ </LI>
+ <LI>A maven plugin to generate OSGi-compatible distribution structure which hosts 3rd-party jars that can be used a bundle for OSGi as well as a plain jar for JSE classpath
+ <UL>
+ <LI>Copy OSGi bundles as jars</LI>
+ <LI>Create a folder structure to hold the MANIFEST.MF which keep the 3rd-party jar as-is</LI>
+ </UL>
+ </LI>
+</UL>
+
+
+<DIV class="panelMacro"><TABLE class="noteMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="https://cwiki.apache.org/confluence/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD>For more details, please see: <A href="osgi-aware-programming-in-tuscany.html" title="OSGi Aware Programming in Tuscany">OSGi Aware Programming in Tuscany</A>?</TD></TR></TABLE></DIV>
+
+<H2><A name="OSGiEnablementforTuscanyRuntime-DevelopingTuscanymodulesasOSGibundles"></A>Developing Tuscany modules as OSGi bundles</H2>
+
+<H3><A name="OSGiEnablementforTuscanyRuntime-DesignofanOSGibundle"></A>Design of an OSGi bundle</H3>
+
+<UL>
+ <LI>Modularity/Granularity
+ <UL>
+ <LI>Not just a simple packaging scheme such as all jars are consolidated into one big bundle, export/import everything</LI>
+ </UL>
+ </LI>
+ <LI>Maven is designed to manage build dependency
+ <UL>
+ <LI>Visibility at module level (too high)</LI>
+ <LI>Transitive dependency</LI>
+ <LI>Classloading is flat</LI>
+ <LI>No runtime control</LI>
+ </UL>
+ </LI>
+</UL>
+
+
+<H3><A name="OSGiEnablementforTuscanyRuntime-CreatinganOSGibundle"></A>Creating an OSGi bundle</H3>
+
+<UL>
+ <LI>Converting Tuscany modules into OSGi bundles
+ <UL>
+ <LI>META-INF/MANIFEST.MF</LI>
+ </UL>
+ </LI>
+ <LI>Converting 3rd-party jars into OSGi bundles
+ <UL>
+ <LI>Plain Jars</LI>
+ <LI>Patching existing bundles</LI>
+ </UL>
+ </LI>
+ <LI>Distribution Structure</LI>
+</UL>
+
+
+<UL>
+ <LI>Eclipse PDE integration
+ <UL>
+ <LI>Target platform</LI>
+ <LI>Classpath setting</LI>
+ <LI>PDE tools
+ <UL>
+ <LI>
+ <UL>
+ <LI>Build path</LI>
+ <LI>PDE dependency view</LI>
+ <LI>MANIFEST.MF editor</LI>
+ <LI>Equinox run/debug profile</LI>
+ </UL>
+ </LI>
+ </UL>
+ </LI>
+ </UL>
+ </LI>
+</UL>
+
+
+<H3><A name="OSGiEnablementforTuscanyRuntime-MavenpluginstohelpOSGidevelopment"></A>Maven plugins to help OSGi development</H3>
+
+<UL>
+ <LI>Maven Eclipse Compiler
+ <UL>
+ <LI>Use Eclipse JDT as the compiler</LI>
+ <LI>Validate the MANIFEST.MF</LI>
+ </UL>
+ </LI>
+ <LI>Tuscany Maven Bundle Plugin
+ <UL>
+ <LI>Generating modules</LI>
+ <LI>Generating PDE target</LI>
+ <LI>Generating Equinox Configuration</LI>
+ </UL>
+ </LI>
+</UL>
+
+
+<H3><A name="OSGiEnablementforTuscanyRuntime-Runtimeconcerns"></A>Runtime concerns</H3>
+
+<UL>
+ <LI>Equinox OSGi launcher</LI>
+ <LI>META-INF/services Service Provider discovery</LI>
+ <LI>Avoid XMLInputFactory.newInstance(), DocumentBuilderFactory.newInstance()...</LI>
+ <LI>Classloading (TCCL is evil)
+ <UL>
+ <LI>Equinox ContextFinder</LI>
+ </UL>
+ </LI>
+</UL>
+
+
+<H3><A name="OSGiEnablementforTuscanyRuntime-TestTuscanycodewithOSGi"></A>Test Tuscany code with OSGi</H3>
+
+<UL>
+ <LI>How to run maven surefire plugin with OSGi?</LI>
+ <LI>Eclipse run as JUnit plugin test</LI>
+</UL>
+
+
+<H3><A name="OSGiEnablementforTuscanyRuntime-TroubleshoottheOSGiconstraintviolations"></A>Troubleshoot the OSGi constraint violations</H3>
+
+<UL>
+ <LI>OSGi console
+ <UL>
+ <LI>&#45;Dosgi.console=&lt;port #&gt;</LI>
+ </UL>
+ </LI>
+ <LI>Eclipse PDE state view</LI>
+ <LI>Traps
+ <UL>
+ <LI>Split Packages</LI>
+ <LI>System packages</LI>
+ <LI>Version mismatch</LI>
+ </UL>
+ </LI>
+</UL>
+
+
+
+<P><A href="osgi-enablement-for-tuscany-runtime.data/OSGi%20Enablement%20for%20Tuscany.ppt">OSGi Enablement for Tuscany.ppt</A></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">
+ &nbsp;&nbsp;
+ <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>
+ &nbsp;&nbsp;
+ <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 : OSGi Enablement for Tuscany Runtime';
+ digg_topic = 'programming';
+ </script>
+ <script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
+ -->
+ &nbsp;&nbsp;
+ </TD>
+ <TD align="right" valign="middle" class="footer">
+ <A href="http://cwiki.apache.org/GMOxPMGT/geronimo-privacy-policy.html">Privacy Policy</A>&nbsp;&nbsp;-&nbsp;&nbsp;
+ Copyright &copy; 2003-2010, The Apache Software Foundation, Licensed under <A href="http://www.apache.org/licenses/LICENSE-2.0">ASL 2.0.</A>&nbsp;&nbsp;
+ </TD>
+ </TR>
+ </TABLE>
+
+ </BODY>
+</HTML> \ No newline at end of file