summaryrefslogtreecommitdiffstats
path: root/site/trunk/site-publish/sca-java-extension-developer-guide.html
diff options
context:
space:
mode:
Diffstat (limited to 'site/trunk/site-publish/sca-java-extension-developer-guide.html')
-rw-r--r--site/trunk/site-publish/sca-java-extension-developer-guide.html245
1 files changed, 245 insertions, 0 deletions
diff --git a/site/trunk/site-publish/sca-java-extension-developer-guide.html b/site/trunk/site-publish/sca-java-extension-developer-guide.html
new file mode 100644
index 0000000000..4bacbebae7
--- /dev/null
+++ b/site/trunk/site-publish/sca-java-extension-developer-guide.html
@@ -0,0 +1,245 @@
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML>
+ <HEAD>
+ <LINK type="text/css" rel="stylesheet" href="http://people.apache.org/~svkrish/tuscanySite/style/default.css">
+ <LINK rel="SHORTCUT ICON" href="http://cwiki.apache.org/confluence/display/TUSCANY/$images/favicon.ico">
+ <TITLE>SCA Java Extension Developer Guide : Apache Tuscany</TITLE>
+ <META http-equiv="Content-Type" content="text/html;charset=UTF-8"></HEAD>
+
+ <BODY onload="init()">
+
+ <TABLE valign="top" border="0" cellspacing="0" cellpadding="0" width="100%" background="http://people.apache.org/~svkrish/tuscanySite/images/TuscanyLogoNEW_Text_120px_bg.jpg">
+ <TR>
+ <TD valing="top" align="left">
+ <A href="http://cwiki.apache.org/confluence/pages/viewpage.action?spaceKey=TUSCANY&title=$siteroot"><IMG src="http://people.apache.org/~svkrish/tuscanySite/images/TuscanyLogoNEW_Text_120px_bg.jpg" height="91" width="25" border="0"></A>
+ </TD>
+ <TD>
+ <A href="http://cwiki.apache.org/confluence/pages/viewpage.action?spaceKey=TUSCANY&title=$siteroot"><IMG src="http://people.apache.org/~svkrish/tuscanySite/images/TuscanyLogo.jpg" border="0"></A>
+ </TD>
+
+ <TD width="100%">
+ &nbsp;
+ </TD>
+ <TD align="right">
+ <IMG src="http://people.apache.org/~svkrish/tuscanySite/images/apache-incubator-logo.png" border="0">
+ </TD>
+
+ <!-- Adds the edit page link to the top banner-->
+ <TD valign="bottom">
+ <DIV style="padding: 2px 10px; margin: 0px;">
+ <A href="http://cwiki.apache.org/confluence/pages/editpage.action?pageId=51879">
+ <IMG src="http://people.apache.org/~svkrish/tuscanySite/images/notep_16.gif" height="16" width="16" border="0" align="absmiddle" title="Edit Page"></A>
+ </DIV>
+ </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="home.html" title="Apache Tuscany">Apache Tuscany</A>&nbsp;&gt;&nbsp;<A href="home.html" title="Home">Home</A>&nbsp;&gt;&nbsp;<A href="sca-overview.html" title="SCA Overview">SCA Overview</A>&nbsp;&gt;&nbsp;<A href="sca-java-subproject.html" title="SCA Java Subproject">SCA Java Subproject</A>&nbsp;&gt;&nbsp;<A href="java-sca-documentation-menu.html" title="Java SCA Documentation Menu">Java SCA Documentation Menu</A>&nbsp;&gt;&nbsp;<A href="" title="SCA Java Extension Developer Guide">SCA Java Extension Developer Guide</A>
+ </TD>
+
+ <TD align="left" valign="middle" class="topBarDiv" nowrap="true">
+ <A href="http://mail-archives.apache.org/mod_mbox/ws-tuscany-user">User List</A> | <A href="http://mail-archives.apache.org/mod_mbox/ws-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 align="left" valign="top">
+ <DIV id="PageContent">
+
+ <DIV class="pagecontent">
+ <DIV class="wiki-content">
+ <DIV class="panel" style="border-style: solid; border-color: #6699ff; "><DIV class="panelHeader" style="border-bottom-style: solid; border-bottom-color: #6699ff; background-color: #D5EFFF; "><B>Apache Tuscany SCA Java Extension Guide</B></DIV><DIV class="panelContent" style="background-color: #ffffff; ">
+
+</DIV></DIV>
+
+<P><B>This page is work in progress. Thanks for your contribution</B> <IMG class="emoticon" src="http://cwiki.apache.org/confluence/images/icons/emoticons/smile.gif" height="20" width="20" align="absmiddle" alt="" border="0"><BR>
+This is a guide for developers who would like to extend Tuscany SCA Java.</P>
+<UL>
+ <LI><A href="#SCAJavaExtensionDeveloperGuide-extension" title="extension on SCA Java Extension Developer Guide">What is an extension?</A></LI>
+ <LI><A href="#SCAJavaExtensionDeveloperGuide-component" title="component on SCA Java Extension Developer Guide">How to add a new component implementation? </A></LI>
+ <LI><A href="#SCAJavaExtensionDeveloperGuide-binding" title="binding on SCA Java Extension Developer Guide">How to add a new binding? </A></LI>
+ <LI><A href="#SCAJavaExtensionDeveloperGuide-interface" title="interface on SCA Java Extension Developer Guide">How to add a new interface binding? </A></LI>
+</UL>
+
+
+<UL>
+ <LI><A href="#SCAJavaExtensionDeveloperGuide-databinding" title="databinding on SCA Java Extension Developer Guide">How to add a databinding </A></LI>
+ <LI><A href="#SCAJavaExtensionDeveloperGuide-generalguide" title="general guide on SCA Java Extension Developer Guide">General guide for developing extensions</A></LI>
+ <LI><A href="#SCAJavaExtensionDeveloperGuide-details" title="details on SCA Java Extension Developer Guide">Details on extension architecture</A> <B>can move to architecture doc</B></LI>
+ <LI><SPAN class="nobr"><A href="http://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=TUSCANY&title=Java%20SCA%20Extension%20Modules&linkCreation=true&fromPageId=51879" title="Create Page: Java SCA Extension Modules" class="createlink">Extension Modules<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/plus.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
+ <LI><SPAN class="nobr"><A href="http://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=TUSCANY&title=Java%20SCA%20Extension%20Modules&linkCreation=true&fromPageId=51879" title="Create Page: Java SCA Extension Modules" class="createlink">Extension Modules<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/plus.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN>
+<BR clear="all">
+&nbsp;<TABLE class="sectionMacro" border="0" cellpadding="5" cellspacing="0" width="100%"><TBODY><TR></TR></TBODY></TABLE>&nbsp;</LI>
+</UL>
+
+
+<H3><A name="SCAJavaExtensionDeveloperGuide-"></A><A name="SCAJavaExtensionDeveloperGuide-extension"></A><FONT color="#0099cc">A presentation on how to extend Tuscany in Microsoft PowerPoint format</FONT></H3>
+<P><SPAN class="nobr"><A href="sca-java-extension-developer-guide.data/ExtendingTuscany.ppt" title="ExtendingTuscany.ppt attached to SCA Java Extension Developer Guide">ExtendingTuscany <SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/link_attachment_7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></P>
+
+
+<H3><A name="SCAJavaExtensionDeveloperGuide-"></A><A name="SCAJavaExtensionDeveloperGuide-extension"></A><FONT color="#0099cc">What is an extension?</FONT></H3>
+
+<P>Extension is a module (or a set of modules),when built with Tuscany SCA, can extend it to work with additional bindings, language implementations, programming models or databindings.</P>
+
+<P>SCA assembly model is defined such that extensions can be added for new interface types or for new implementation types such as ruby and python, or new binding types such as CXF. However, the definition of extension SPIs is left to the implementor. Tuscany SCA Java provides a simple set of SPIs for implementing extensions. It also defines additional extension points such as data binding, for example support for SDO and JAXB.</P>
+
+<P>This guide explains the steps to add each of these extension types. Please help us refine the guide as you go through the steps of adding extensions.</P>
+
+<H4><A name="SCAJavaExtensionDeveloperGuide-Namespacesusedbyextensions"></A>Name spaces used by extensions</H4>
+
+
+<H3><A name="SCAJavaExtensionDeveloperGuide-"></A><A name="SCAJavaExtensionDeveloperGuide-component"></A><FONT color="#0099cc">How to add a new component implementation?</FONT></H3>
+
+<P><A href="mike-edwards-ramble-through-adding-a-new-component-type.html" title="Mike Edwards Ramble through Adding a New Component Type">Musings on Adding a New Component Type by Mike E</A>&nbsp;</P>
+
+<H3><A name="SCAJavaExtensionDeveloperGuide-"></A><A name="SCAJavaExtensionDeveloperGuide-binding"></A><FONT color="#0099cc">How to add a new binding?</FONT></H3>
+
+
+<H3><A name="SCAJavaExtensionDeveloperGuide-"></A><A name="SCAJavaExtensionDeveloperGuide-interface"></A><FONT color="#0099cc">How to add a new interface binding?</FONT></H3>
+
+
+<H3><A name="SCAJavaExtensionDeveloperGuide-"></A><A name="SCAJavaExtensionDeveloperGuide-databinding"></A><FONT color="#0099cc">How to add a new databinding?</FONT></H3>
+
+
+<H3><A name="SCAJavaExtensionDeveloperGuide-"></A><A name="SCAJavaExtensionDeveloperGuide-generalguide"></A><FONT color="#0099cc">General guide for developing extensions</FONT></H3>
+
+<UL>
+ <LI>Familiarize yourself with SCA 1.0 Assembly and the SCA Java 1.0 programming model. Specifications can be found at www.osoa.org.</LI>
+ <LI>Never reference any classes in core. These classes are implementation-specific and subject to change; they are not part of the public SPI contract.</LI>
+ <LI>Use autowire when assembling extension components.</LI>
+ <LI>Do not play with classloaders such as setting the current context classloader unless it is absolutely necessary, i.e. a library used by an extension makes assumptions about context classloaders. Ideally the library can be refactored to not make these assumptions. If not, make sure the extension properly resets the current context classloader.</LI>
+</UL>
+
+
+<H3><A name="SCAJavaExtensionDeveloperGuide-"></A><A name="SCAJavaExtensionDeveloperGuide-details"></A><FONT color="#0099cc">Detail on extension architecture</FONT></H3>
+
+
+<H4><A name="SCAJavaExtensionDeveloperGuide-TheExtensionPointRegistry"></A>The ExtensionPointRegistry</H4>
+
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java"><SPAN class="code-keyword">package</SPAN> org.apache.tuscany.sca.core;
+
+
+/**
+ * The registry <SPAN class="code-keyword">for</SPAN> the Tuscany core extension points. As the point of contact
+ * <SPAN class="code-keyword">for</SPAN> all extension artifacts <SPAN class="code-keyword">this</SPAN> registry allows loaded extensions to find
+ * all other parts of the system and register themselves appropriately.
+ *
+ * @version $Rev: 539355 $ $Date: 2007-05-18 03:05:14 -0700 (Fri, 18 May 2007) $
+ */
+<SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">interface</SPAN> ExtensionPointRegistry {
+
+ /**
+ * Add an extension point to the registry
+ * @param extensionPoint The instance of the extension point
+ */
+ void addExtensionPoint(<SPAN class="code-object">Object</SPAN> extensionPoint);
+
+ /**
+ * Get the extension point by the <SPAN class="code-keyword">interface</SPAN>
+ * @param extensionPointType The lookup key (extension point <SPAN class="code-keyword">interface</SPAN>)
+ * @<SPAN class="code-keyword">return</SPAN> The instance of the extension point
+ */
+ &lt;T&gt; T getExtensionPoint(<SPAN class="code-object">Class</SPAN>&lt;T&gt; extensionPointType);
+
+ /**
+ * Remove an extension point
+ * @param extensionPoint The extension point to remove
+ */
+ void removeExtensionPoint(<SPAN class="code-object">Object</SPAN> extensionPoint);
+}</PRE>
+</DIV></DIV>
+
+<H4><A name="SCAJavaExtensionDeveloperGuide-TheModuleActivator"></A>The ModuleActivator</H4>
+
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java"><SPAN class="code-keyword">package</SPAN> org.apache.tuscany.core;
+
+<SPAN class="code-keyword">import</SPAN> java.util.Map;
+
+/**
+ * ModuleActivator represents a module that plugs into the Tuscany system. Each module should
+ * provide an implementation of <SPAN class="code-keyword">this</SPAN> <SPAN class="code-keyword">interface</SPAN> and registry the implementation class by defining
+ * a file named as <SPAN class="code-quote">&quot;META-INF/services/org.apache.tuscany.spi.bootstrp.ModuleActivator&quot;</SPAN>. The
+ * content of the file is the class name of the implementation. The implementation class must
+ * have a no-arg constructor. The same instance will be used to invoke all the methods during
+ * different phases of the module activation.
+ *
+ * @version $Rev: 529327 $ $Date: 2007-04-16 10:10:43 -0700 (Mon, 16 Apr 2007) $
+ */
+<SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">interface</SPAN> ModuleActivator {
+ /**
+ * Get a map of the extension points defined by <SPAN class="code-keyword">this</SPAN> module. The key is the
+ * java <SPAN class="code-keyword">interface</SPAN> to represent the extension point and the the value is the
+ * instance of the implementation of the <SPAN class="code-keyword">interface</SPAN>.
+ *
+ * @<SPAN class="code-keyword">return</SPAN> All the extension points defined by <SPAN class="code-keyword">this</SPAN> module
+ */
+ Map&lt;<SPAN class="code-object">Class</SPAN>, <SPAN class="code-object">Object</SPAN>&gt; getExtensionPoints();
+
+ /**
+ * This method is invoked when the module is started by the Tuscany system.
+ * It can be used by <SPAN class="code-keyword">this</SPAN> module to registr extensions against extension
+ * points.
+ *
+ * @param registry The extension point registry
+ */
+ void start(ExtensionPointRegistry registry);
+
+ /**
+ * This method is invoked when the module is stopped by the Tuscany system.
+ * It can be used by <SPAN class="code-keyword">this</SPAN> module to unregister extensions against the
+ * extension points.
+ *
+ * @param registry The extension point registry
+ */
+ void stop(ExtensionPointRegistry registry);
+}</PRE>
+</DIV></DIV>
+<P>The ModuleActivator represents a module that plugs into the Tuscany system.<BR>
+Each module should provide an implementation <SPAN class="nobr"><A href="http://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=TUSCANY&title=3&linkCreation=true&fromPageId=51879" title="Create Page: 3" class="createlink">3<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/plus.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN> of this interface and<BR>
+registry the implementation class by defining a file named as<BR>
+&quot;META-INF/services/org.apache.tuscany.spi.bootstrp.ModuleActivator&quot; <SPAN class="nobr"><A href="http://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=TUSCANY&title=4&linkCreation=true&fromPageId=51879" title="Create Page: 4" class="createlink">4<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/plus.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN>. The<BR>
+content of the file is the class name of the implementation. The<BR>
+implementation class must have a no-arg constructor. The same instance will<BR>
+be used to invoke all the methods during different phases of the module<BR>
+activation.</P>
+
+<P>During bootstraping, the following sequence will happen:</P>
+
+<P>1) All the module activators will be discovered by the presence of<BR>
+META-INF/services/org.apache.tuscany.spi.bootstrp.ModuleActivator<BR>
+2) The activator class is instantiated using the no-arg constructor.<BR>
+3) ModuleActivator.getExtensionPoints() is invoked for all modules and the<BR>
+extension points contributed by each module are added to the<BR>
+ExtensionRegistry.<BR>
+4) ModuleActivator.start(ExtensionRegistry) is invoked for all the modules.<BR>
+The module can then get interested extension points and contribute<BR>
+extensions to them. The contract bwteen the extension and extension point is<BR>
+private to the extension point. The extension point can follow similar<BR>
+patterns such as Registry. If it happens that one extension point has a<BR>
+dependency on another extension point, they can linked at this phase.</P>
+
+<P>During shutting down, the stop() method is invoked for all the modules to<BR>
+perform cleanups. A module can choose to unregister the extension from the<BR>
+extension points.</P>
+ </DIV>
+ </DIV>
+ </DIV>
+ </TD>
+ </TR>
+ </TABLE>
+
+ <DIV class="footer">
+ Copyright &copy; 2003-2007, The Apache Software Foundation&nbsp;&nbsp;
+ </DIV>
+
+ </BODY>
+</HTML> \ No newline at end of file