summaryrefslogtreecommitdiffstats
path: root/site/trunk/site-publish/java-sca-distributed.html
diff options
context:
space:
mode:
Diffstat (limited to 'site/trunk/site-publish/java-sca-distributed.html')
-rw-r--r--site/trunk/site-publish/java-sca-distributed.html210
1 files changed, 210 insertions, 0 deletions
diff --git a/site/trunk/site-publish/java-sca-distributed.html b/site/trunk/site-publish/java-sca-distributed.html
new file mode 100644
index 0000000000..850b909dfa
--- /dev/null
+++ b/site/trunk/site-publish/java-sca-distributed.html
@@ -0,0 +1,210 @@
+
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE- 2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML>
+ <HEAD>
+ <!-- generateKeywords macro -->
+ <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">
+ <!-- generateKeywords macro end -->
+
+ <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/TUSCANY/$images/favicon.ico">
+ <TITLE>Apache Tuscany : Java SCA Distributed</TITLE>
+ <META http-equiv="Content-Type" content="text/html;charset=UTF-8"></HEAD>
+
+ <BODY onload="init()">
+ <!-- topNav macro -->
+ <TABLE valign="top" border="0" cellspacing="0" cellpadding="0" width="100%" background="http://tuscany.apache.org/images/TuscanyLogoNEW_Text_120px_bg.jpg">
+ <TR>
+ <TD valing="top" align="left">
+ <A href="https://cwiki.apache.org/confluence/pages/viewpage.action?spaceKey=TUSCANY&title=$siteroot"><IMG src="http://tuscany.apache.org/images/TuscanyLogoNEW_Text_120px_bg.jpg" height="91" width="25" border="0"></A>
+ </TD>
+ <TD>
+ <A href="http://tuscany.apache.org/"><IMG src="http://tuscany.apache.org/images/TuscanyLogo.jpg" border="0"></A>
+ </TD>
+
+ <TD width="100%">
+ &nbsp;
+ </TD>
+
+ <!-- Adds the edit page link to the top banner-->
+ <TD valign="bottom">
+ <DIV style="padding: 2px 10px; margin: 0px;">
+ <A href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=107027">
+ <IMG src="http://tuscany.apache.org/images/notep_16.gif" height="16" width="16" border="0" align="absmiddle" title="Edit Page"></A>
+ </DIV>
+ </TD>
+
+ </TR>
+ </TABLE>
+ <!-- topNav macro end -->
+
+ <!-- breadCrumbs macro -->
+ <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.html" title="SCA Java">SCA Java</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="sca-java-user-guide.html" title="SCA Java User Guide">SCA Java User Guide</A>&nbsp;&gt;&nbsp;<A href="" title="Java SCA Distributed">Java SCA Distributed</A>
+ </TD>
+
+ <TD align="right" valign="middle" class="topBarDiv" align="left" nowrap="true">
+ <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>
+ <!-- breadCrumbs macro end -->
+
+
+ <TABLE border="0" cellpadding="0" width="100%" bgcolor="#FFFFFF">
+ <TR>
+ <TD align="left" valign="top">
+
+ <!-- pageContent macro -->
+ <DIV id="PageContent">
+
+ <DIV class="pagecontent">
+ <DIV class="wiki-content">
+ <P><A href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=TUSCANY&title=note&linkCreation=true&fromPageId=107027" class="createlink">note</A> moved all node related content from the old user doc to here. This page can explain node in the context of distributed calculator.</P>
+
+
+<H3><A name="JavaSCADistributed-TuscanySCANode"></A>Tuscany SCA Node</H3>
+<P>In order to run an SCA application Tuscany SCA Java provides a runtime that is wrapped up in a Node. The runtime itself is made up of many of the modules that are present in the modules directory of the Tuscany SCA Java distribution. As you might expect there are functions that read XML, create an in memory mode model of the SCA assembly, create the components and wire them together ready to process incoming messages. All of these functions are wrapped up in a Node. A node is configured using SCA contributions and will run a single composite. When running standalone the node also defines the scope of component services that references can target by name. SCA defines the term Domain to describe this scope. <SPAN class="error">Unable to render embedded object: File (calculator2.png) not found.</SPAN><BR>
+A node runs within a single JVM. A JVM can run many Nodes.</P>
+
+<H3><A name="JavaSCADistributed-hostembedded"></A>host embedded</H3>
+<P>For a long time in Tuscany we have had a modules called <A href="sca-java-hostembedded.html" title="SCA JAVA host.embedded">host.embedded</A> that contains the code required to get the runtime up and running in standalone configuration. This was developed before the distributed domain support was added but the main interface here is called an SCADomain. It's just a very small domain with only one node inside it. You can't see the node and you configure and access it via the SCADomain interface. The majority of samples and tests use this today. However the new SCA Node implementation can work in both standalone and distributed configuration so may be more appropriate in situations other than the simple Tuscany samples and tests. We will convert more samples ant tests to this approach over time to show the benefit of using the node implementation.</P>
+
+<H3><A name="JavaSCADistributed-TuscanySCANodeImplementation"></A>Tuscany SCA Node Implementation</H3>
+<P>Available from release 1.2 there is a new domain/node implementation. The node part of this can be run either stand alone or as part of a distributed domain. Most of the sample and test code has not started using this implementation yet and there may be more changes to the API.</P>
+
+<H4><A name="JavaSCADistributed-CreatingandConfiguringNode"></A>Creating and Configuring Node</H4>
+
+<P>Creating a node in code is straightforward. For example,</P>
+
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+SCANode2 node = SCANode2Factory.newInstance().createSCANodeFromClassLoader(<SPAN class="code-quote">&quot;calculator.composite&quot;</SPAN>, <SPAN class="code-keyword">null</SPAN>);
+</PRE>
+</DIV></DIV>
+<P>The node uses current classes classloader to located the named composite file. The location of the composite file is assumed to be the location if the SCA contribution. The assumption here is that only one contribution is required. </P>
+
+<P>If more contributions must be loaded by the node the following interface can be used.</P>
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+SCANode2 node = SCANode2Factory.newInstance().createSCANode(<SPAN class="code-quote">&quot;file:/C:/CalculatorContribution1/Calculator.composite&quot;</SPAN>,
+ <SPAN class="code-keyword">new</SPAN> SCAContribution(<SPAN class="code-quote">&quot;CalculatorContribution1&quot;</SPAN>,
+ <SPAN class="code-quote">&quot;file:/C:/CalculatorContribution1&quot;</SPAN>),
+ <SPAN class="code-keyword">new</SPAN> SCAContribution(<SPAN class="code-quote">&quot;CalculatorContribution2&quot;</SPAN>,
+ <SPAN class="code-quote">&quot;file:/C:/CalculatorContribution2&quot;</SPAN>));
+</PRE>
+</DIV></DIV>
+<P>Where</P>
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+<SPAN class="code-quote">&quot;file:/C:/CalculatorContribution1/Calculator.composite&quot;</SPAN>
+</PRE>
+</DIV></DIV>
+<P>Is the explicit location of the composite file to be run and</P>
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+<SPAN class="code-keyword">new</SPAN> SCAContribution(<SPAN class="code-quote">&quot;CalculatorContribution1&quot;</SPAN>,
+ <SPAN class="code-quote">&quot;file:/C:/CalculatorContribution1&quot;</SPAN>)
+</PRE>
+</DIV></DIV>
+<P>Shows how to provide contribution details. Multiple contributions can be specified. You might have multiple contributions if, for example, you have chosen to separate common artifacts from those specific to this composite. The contribution containing common artifacts can then be used in other SCA applications without change.</P>
+
+<H4><A name="JavaSCADistributed-StartingaNode"></A>Starting a Node</H4>
+
+<P>Once the node is created it is configured and ready for use. It can be started as follows.</P>
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+node.start();
+</PRE>
+</DIV></DIV>
+
+<H4><A name="JavaSCADistributed-LocatingServices"></A>Locating Services</H4>
+
+<P>A local service reference can be retrieved in the following way.</P>
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+calculatorService = ((SCAClient)node).getService(CalculatorService.class, <SPAN class="code-quote">&quot;CalculatorServiceComponent&quot;</SPAN>);
+</PRE>
+</DIV></DIV>
+
+<H4><A name="JavaSCADistributed-StoppingaNode"></A>Stopping a Node</H4>
+
+<P>If you are done with the node or need to stop is processing messages use the following.</P>
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+node.stop();
+</PRE>
+</DIV></DIV>
+
+<H4><A name="JavaSCADistributed-"></A><A name="JavaSCADistributed-HostingTuscanySCANodes"></A></H4>
+
+<DIV class="" style="background-color: #C3CDA1;">Hosting Tuscany SCA Nodes</DIV>
+
+<P>You can run SCA applications in many different ways but the same underlying runtime is used but packaged in slightly different ways as follows</P>
+
+<H4><A name="JavaSCADistributed-CommandLine"></A>Command Line</H4>
+
+<P>Most of the samples that are shipped with the Tuscany SCA Java distribution run from the command line by driving the Node API or old SCADomain API programmatically.</P>
+
+<P>There is a pre-packaed launcher that has a mainline for starting nodes. When run from the command line it expects to be running in the context of the binary distribution where &quot;modules&quot; and &quot;lib&quot; directories are present.</P>
+
+<P>It loads all of the jars from</P>
+
+<P>1) the directory where the launcher class is found.<BR>
+2) the ../modules directory<BR>
+3) the ../libs directory</P>
+
+<P>It then repeats the process looking for ../modules and ../lib dirs based on the contents of a TUSCANY_HOME environment variable</P>
+
+<P>With the final list it creates a URLClassLoader with the current classloader as the parent and enforces a parent first classloading strategy.</P>
+
+<P><IMG class="emoticon" src="https://cwiki.apache.org/confluence/images/icons/emoticons/warning.gif" height="16" width="16" align="absmiddle" alt="" border="0"> TODO - how does it find the composite file to run?</P>
+ </DIV>
+ </DIV>
+ </DIV>
+ <!-- pageContent macro end -->
+
+ </TD>
+ </TR>
+ </TABLE>
+
+ <!-- footer macro -->
+ <SCRIPT src="http://www.google-analytics.com/urchin.js" type="text/javascript">
+ </SCRIPT>
+ <SCRIPT type="text/javascript">
+ _uacct = "UA-1174707-5";
+ urchinTracker();
+ </SCRIPT>
+
+ <A href="http://www.statcounter.com/" target="_blank"><IMG src="http://c26.statcounter.com/counter.php?sc_project=2619156&java=0&security=94bd7e7d&invisible=0" alt="website stats" border="0"></A>
+
+ <DIV class="footer">
+ Copyright � 2003-2012, The Apache Software Foundation&nbsp;&nbsp;</BR>
+ Apache Tuscany and the Apache Tuscany project logo are trademarks of The Apache Software Foundation.
+ </DIV>
+ <!-- footer macro end -->
+
+ </BODY>
+</HTML>