summaryrefslogtreecommitdiffstats
path: root/site/trunk/site-publish/getting-started-with-tuscany-release-10.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/getting-started-with-tuscany-release-10.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 'site/trunk/site-publish/getting-started-with-tuscany-release-10.html')
-rw-r--r--site/trunk/site-publish/getting-started-with-tuscany-release-10.html726
1 files changed, 726 insertions, 0 deletions
diff --git a/site/trunk/site-publish/getting-started-with-tuscany-release-10.html b/site/trunk/site-publish/getting-started-with-tuscany-release-10.html
new file mode 100644
index 0000000000..58106f05ac
--- /dev/null
+++ b/site/trunk/site-publish/getting-started-with-tuscany-release-10.html
@@ -0,0 +1,726 @@
+
+<!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://incubator.apache.org/tuscany/stylesheets/default.css">
+ <LINK rel="SHORTCUT ICON" href="http://cwiki.apache.org/confluence/display/TUSCANY/$images/favicon.ico">
+ <TITLE>Getting Started with Tuscany Release 1.0 : 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://incubator.apache.org/tuscany/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://incubator.apache.org/tuscany/images/TuscanyLogoNEW_Text_120px_bg.jpg" height="91" width="25" border="0"></A>
+ </TD>
+ <TD>
+ <A href="http://incubator.apache.org/tuscany/"><IMG src="http://incubator.apache.org/tuscany/images/TuscanyLogo.jpg" border="0"></A>
+ </TD>
+
+ <TD width="100%">
+ &nbsp;
+ </TD>
+ <TD align="right">
+ <IMG src="http://incubator.apache.org/tuscany/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=67902">
+ <IMG src="http://incubator.apache.org/tuscany/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.html" title="SCA Java">SCA Java</A>&nbsp;&gt;&nbsp;<A href="" title="Getting Started with Tuscany Release 1.0">Getting Started with Tuscany Release 1.0</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">
+ <H1><A name="GettingStartedwithTuscanyRelease1.0-Ready%2CSet%2CGoGettingstartedwithTuscany"></A>Ready, Set, Go - Getting started with Tuscany</H1>
+
+
+<H2><A name="GettingStartedwithTuscanyRelease1.0-InstalltheTuscanyDistribution%26nbsp%3B"></A>Install the Tuscany Distribution&nbsp;</H2>
+
+<P>The first thing you do is to create a folder on you disk into which you will download the TUSCANY distribution.</P>
+
+<P><IMG src="getting-started-with-tuscany-release-10.data/tuscany_folder.png" align="absmiddle" border="0"></P>
+
+<P>Next you download the latest release distribution. Launch your browser and enter one of the<BR>
+following URL's.<BR>
+Latest Release - <SPAN class="nobr"><A href="http://cwiki.apache.org/TUSCANY/sca-java-releases.html" title="Visit page outside Confluence" rel="nofollow">http://cwiki.apache.org/TUSCANY/sca-java-releases.html<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN><BR>
+Download both the <B><EM>bin zip</EM></B> as well as the <B><EM>src zip</EM></B> to the folder that you created on your disk. Once you completed the download you should see the following on your disk.</P>
+
+<P><IMG src="getting-started-with-tuscany-release-10.data/release_zips.png" align="absmiddle" border="0"><BR>
+&nbsp;<BR>
+Next you unzip the <B><EM>bin zip</EM></B> in place, you should see the following folder file structure on your disk after unzip is complete.<BR>
+<IMG src="getting-started-with-tuscany-release-10.data/folder_structure.png" align="absmiddle" border="0"></P>
+
+<H2><A name="GettingStartedwithTuscanyRelease1.0-SetupEclipseforTuscany"></A>Setup Eclipse for Tuscany</H2>
+
+<P>Start Eclipse and create a User Library to contain the TUSCANY runtime jar's as well as their<BR>
+depending jar's.</P>
+
+<P>From the menu bar select <B><EM>Window</EM></B> and then <B><EM>Preferences...</EM></B> . The Preferences dialog will appear,<BR>
+in its left navigation tree select <B><EM>Java</EM></B>, followed by <B><EM>Build Path</EM></B>, and followed by <B><EM>User Libraries</EM></B>.<BR>
+Select the <B><EM>New...</EM></B> pushbutton on the right of the New Libraries dialog to create a new user library.</P>
+
+<P><IMG src="getting-started-with-tuscany-release-10.data/New_User_Lib.png" align="absmiddle" border="0"></P>
+
+<P>The user library created is empty, select the <B><EM>Add JARs...</EM></B> pushbutton on the right to add all the<BR>
+jar's from your Tuscany installation <B><EM>lib folder</EM></B>. When completed all the jar's will appear under the<BR>
+TUSCANY user library.</P>
+
+<P><IMG src="getting-started-with-tuscany-release-10.data/Tuscany_User_Lib.png" align="absmiddle" border="0"></P>
+
+<P>Since some of you maybe interested in <B><EM>debugging</EM></B> also the Tuscany runtime code we will attach<BR>
+the Tuscany source to the Tuscany runtime jar in the following step. In the User Libraies dialog<BR>
+scroll down until you see the <B><EM>Tuscany runtime jar</EM></B> and select its <B><EM>Source attachment.</EM></B></P>
+
+<P><IMG src="getting-started-with-tuscany-release-10.data/source_attachment.png" align="absmiddle" border="0"></P>
+
+<P>Select the <B><EM>Edit...</EM></B> pushbutton on the right and in the Edit dialog use the <B><EM>External File...</EM></B> pushbutton<BR>
+to the select the Tuscany <B><EM>src zip</EM></B> that we downloaded earlier.</P>
+
+<P><IMG src="getting-started-with-tuscany-release-10.data/source_attachment_config.png" align="absmiddle" border="0"></P>
+
+<P>Select <B><EM>OK</EM></B> to complete this and the Preferences dialog, and you are done with the Tuscany setup<BR>
+for Eclipse.</P>
+
+<H2><A name="GettingStartedwithTuscanyRelease1.0-Createyour1stCompositeServiceApplication"></A>Create your 1st Composite Service Application</H2>
+
+<P>The following shows the composition diagram for the composite service application you are about<BR>
+to create.</P>
+
+<P><IMG src="getting-started-with-tuscany-release-10.data/first_composite.png" align="absmiddle" border="0"></P>
+
+<P>The composite service application you will create is a composition of four services. The composed<BR>
+service provided is that of an on-line store.<BR>
+There is a Catalog service which you can ask for catalog items, and depending on its currency<BR>
+code property configuration it will provide the item prices in USD or EUR. The Catalog service is not<BR>
+doing the currency conversion itself it references a CurrencyConverter service to do that task. Then<BR>
+there is the ShoppingCart service into which items chosen from the catalog can be added, it is<BR>
+implemented as a REST service. The Catalog is bound using the JSONRPC binding, and the<BR>
+ShoppingCart service is bound using the ATOM binding. Finally there is the Store user facing<BR>
+service that provides the browser based user interface of the store. The Store service makes use of<BR>
+the Catalog and ShoppingCart service using the JSONRPC, and ATOM binding respectively.</P>
+
+<H2><A name="GettingStartedwithTuscanyRelease1.0-CreateaJavaProject"></A>Create a Java Project</H2>
+
+<P>In this step you create a Java Project in Eclipse to hold the composite service application.<BR>
+Click on the <B><EM>New Java Project</EM></B> button <IMG src="getting-started-with-tuscany-release-10.data/new_java_project.png" align="absmiddle" border="0">&nbsp; in the toolbar to launch the project creation dialog.<BR>
+Next you enter &quot;store&quot; as the <B><EM>Project name</EM></B>, and for <B><EM>Project Layout</EM></B> select <B><EM>Create separate</EM></B><BR>
+<B><EM>folders for sources and class files.</EM></B><BR>
+<IMG src="getting-started-with-tuscany-release-10.data/new_java_project_dlg.png" align="absmiddle" border="0"><BR>
+&nbsp;<BR>
+<IMG src="getting-started-with-tuscany-release-10.data/project_layout.png" align="absmiddle" border="0"><BR>
+&nbsp;<BR>
+Hit the <B><EM>Next</EM></B> button, and on the following page go to the <B><EM>Libraries</EM></B> tab. Use the <B><EM>Add Library...</EM></B><BR>
+button on the right to add the TUSCANY user library to the project.<BR>
+&nbsp;<BR>
+<IMG src="getting-started-with-tuscany-release-10.data/new_java_project_lib.png" align="absmiddle" border="0"><BR>
+&nbsp;<BR>
+&nbsp;<BR>
+Hit the <B><EM>Finish</EM></B> button to complete the <B><EM>New Java Project</EM></B> dialog to create the &quot;store&quot; java project.&nbsp;<BR>
+&nbsp;<BR>
+<IMG src="getting-started-with-tuscany-release-10.data/new_java_project_folder.png" align="absmiddle" border="0"><BR>
+&nbsp;<BR>
+&nbsp;</P>
+
+<H2><A name="GettingStartedwithTuscanyRelease1.0-ConstructServices"></A>Construct Services</H2>
+
+<P>First you create two package folders into which later in this step you place service implementations.<BR>
+Select the &quot;store&quot; project and click on the <B><EM>New Java Package</EM></B> button <IMG src="getting-started-with-tuscany-release-10.data/new_java_pkg_btn.png" align="absmiddle" border="0"> in the toolbar to launch<BR>
+the package creation dialog.</P>
+
+<P>Next you enter &quot;services&quot; as the package <B><EM>Name</EM></B>, and press the <B><EM>Finish</EM></B> button to complete the<BR>
+dialog.<BR>
+<IMG src="getting-started-with-tuscany-release-10.data/new_java_pkg_dlg.png" align="absmiddle" border="0"><BR>
+&nbsp;<BR>
+Repeat the previous step to create another package named &quot;ufservices&quot;. The store project now<BR>
+should look as follows.<BR>
+&nbsp;<BR>
+<IMG src="getting-started-with-tuscany-release-10.data/new_java_pkg_folder.png" align="absmiddle" border="0"><BR>
+&nbsp;<BR>
+In the following you will place in the &quot;services&quot; package the regular services, and in the &quot;ufservices&quot;<BR>
+package the user facing services of the composite service application you create.</P>
+
+<H3><A name="GettingStartedwithTuscanyRelease1.0-Catalog"></A><EM>Catalog</EM></H3>
+
+<P>In this step you create the Catalog service interface and implementation.<BR>
+Select the &quot;services&quot; package. Next you click on the dropdown arrow next to the <B><EM>New Java Class</EM></B><BR>
+button&nbsp; <IMG src="getting-started-with-tuscany-release-10.data/class_btn.png" align="absmiddle" border="0">&nbsp; and select the <B><EM>New Java Interface</EM></B>&nbsp;&nbsp;&nbsp;<IMG src="getting-started-with-tuscany-release-10.data/interface_btn.png" align="absmiddle" border="0"> option from the dropdown list. In the dialog<BR>
+enter &quot;Catalog&quot; as the <B><EM>Name</EM></B> of the interface and select the Finish button to complete the dialog.<BR>
+The Java editor will open on the new created Java interface. Replace the content of the editor by<BR>
+<B><EM>copy-paste</EM></B> of the following Java interface code snippet.</P>
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java"><SPAN class="code-keyword">package</SPAN> services;
+<SPAN class="code-keyword">import</SPAN> org.osoa.sca.annotations.Remotable;
+@Remotable
+<SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">interface</SPAN> Catalog {
+ <SPAN class="code-object">String</SPAN>[] get();
+}</PRE>
+</DIV></DIV>
+<P>Select the &quot;services&quot; package again. Select the <B><EM>New Java Class</EM></B> button <IMG src="getting-started-with-tuscany-release-10.data/class_btn.png" align="absmiddle" border="0"> . In the dialog enter<BR>
+&quot;CatalogImpl&quot; as the <B><EM>Name</EM></B> of the class, add &quot;Catalog&quot; as the interface this class implements, and<BR>
+then select <B><EM>Finish</EM></B> to complete the dialog.</P>
+
+<P>The Java editor will open on the new created Java class. Replace the content of the editor by<BR>
+<B><EM>copy-paste</EM></B> of the following Java class code snippet.</P>
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java"><SPAN class="code-keyword">package</SPAN> services;
+<SPAN class="code-keyword">import</SPAN> java.util.ArrayList;
+<SPAN class="code-keyword">import</SPAN> java.util.List;
+<SPAN class="code-keyword">import</SPAN> org.osoa.sca.annotations.Init;
+<SPAN class="code-keyword">import</SPAN> org.osoa.sca.annotations.Property;
+<SPAN class="code-keyword">import</SPAN> org.osoa.sca.annotations.Reference;
+<SPAN class="code-keyword">public</SPAN> class CatalogImpl <SPAN class="code-keyword">implements</SPAN> Catalog {
+ @Property
+ <SPAN class="code-keyword">public</SPAN> <SPAN class="code-object">String</SPAN> currencyCode = <SPAN class="code-quote">&quot;USD&quot;</SPAN>;
+ @Reference
+ <SPAN class="code-keyword">public</SPAN> CurrencyConverter currencyConverter;
+ <SPAN class="code-keyword">private</SPAN> List&lt;<SPAN class="code-object">String</SPAN>&gt; catalog = <SPAN class="code-keyword">new</SPAN> ArrayList&lt;<SPAN class="code-object">String</SPAN>&gt;();
+ @Init
+ <SPAN class="code-keyword">public</SPAN> void init() {
+ <SPAN class="code-object">String</SPAN> currencySymbol = currencyConverter.getCurrencySymbol(currencyCode);
+ catalog.add(<SPAN class="code-quote">&quot;Apple - &quot;</SPAN> + currencySymbol +
+ currencyConverter.getConversion(<SPAN class="code-quote">&quot;USD&quot;</SPAN>, currencyCode, 2.99f));
+ catalog.add(<SPAN class="code-quote">&quot;Orange - &quot;</SPAN> + currencySymbol +
+ currencyConverter.getConversion(<SPAN class="code-quote">&quot;USD&quot;</SPAN>, currencyCode, 3.55f));
+ catalog.add(<SPAN class="code-quote">&quot;Pear - &quot;</SPAN> + currencySymbol +
+ currencyConverter.getConversion(<SPAN class="code-quote">&quot;USD&quot;</SPAN>, currencyCode, 1.55f));
+ }
+ <SPAN class="code-keyword">public</SPAN> <SPAN class="code-object">String</SPAN>[] get() {
+ <SPAN class="code-object">String</SPAN>[] catalogArray = <SPAN class="code-keyword">new</SPAN> <SPAN class="code-object">String</SPAN>[catalog.size()];
+ catalog.toArray(catalogArray);
+ <SPAN class="code-keyword">return</SPAN> catalogArray;
+ }
+}</PRE>
+</DIV></DIV>
+<P>After completing these steps the content of the &quot;store&quot; project will look as follows.<BR>
+<IMG src="getting-started-with-tuscany-release-10.data/store_project.png" align="absmiddle" border="0"><BR>
+&nbsp;<BR>
+<B>Note:</B> CatalogImpl is red x'ed because it makes use of the CurrencyConverter interface that we<BR>
+have not implemented yet.<BR>
+&nbsp;</P>
+
+<H3><A name="GettingStartedwithTuscanyRelease1.0-CurrencyConverter"></A><EM>CurrencyConverter</EM></H3>
+
+<P>In this step you create the CurrencyConverter service interface and implementation.<BR>
+You follow the same steps that you learned previously to create the interface and implementation.<BR>
+First create a Java interface in the &quot;services&quot; package named &quot;CurrencyConverter&quot; and <B><EM>copy-paste</EM></B><BR>
+the following Java interface code snippet into it.<BR>
+&nbsp;&nbsp;</P>
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java"><SPAN class="code-keyword">package</SPAN> services;
+<SPAN class="code-keyword">import</SPAN> org.osoa.sca.annotations.Remotable;
+@Remotable
+<SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">interface</SPAN> CurrencyConverter {
+ <SPAN class="code-keyword">public</SPAN> <SPAN class="code-object">float</SPAN> getConversion(<SPAN class="code-object">String</SPAN> fromCurrenycCode,
+ <SPAN class="code-object">String</SPAN> toCurrencyCode, <SPAN class="code-object">float</SPAN> amount);
+ <SPAN class="code-keyword">public</SPAN> <SPAN class="code-object">String</SPAN> getCurrencySymbol(<SPAN class="code-object">String</SPAN> currencyCode);
+}</PRE>
+</DIV></DIV>
+<P>Next create a Java class in the &quot;services&quot; package named &quot;CurrencyConverterImpl&quot; and <B><EM>copy-paste</EM></B><BR>
+the following Java class code snippet into it.</P>
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java"><SPAN class="code-keyword">package</SPAN> services;
+<SPAN class="code-keyword">public</SPAN> class CurrencyConverterImpl <SPAN class="code-keyword">implements</SPAN> CurrencyConverter {
+ <SPAN class="code-keyword">public</SPAN> <SPAN class="code-object">float</SPAN> getConversion(<SPAN class="code-object">String</SPAN> fromCurrencyCode,
+ <SPAN class="code-object">String</SPAN> toCurrencyCode, <SPAN class="code-object">float</SPAN> amount) {
+ <SPAN class="code-keyword">if</SPAN> (toCurrencyCode.equals(<SPAN class="code-quote">&quot;USD&quot;</SPAN>))
+ <SPAN class="code-keyword">return</SPAN> amount;
+ <SPAN class="code-keyword">else</SPAN> <SPAN class="code-keyword">if</SPAN> (toCurrencyCode.equals(<SPAN class="code-quote">&quot;EUR&quot;</SPAN>))
+ <SPAN class="code-keyword">return</SPAN> amount*0.7256f;
+ <SPAN class="code-keyword">return</SPAN> 0;
+ }
+ <SPAN class="code-keyword">public</SPAN> <SPAN class="code-object">String</SPAN> getCurrencySymbol(<SPAN class="code-object">String</SPAN> currencyCode) {
+ <SPAN class="code-keyword">if</SPAN> (currencyCode.equals(<SPAN class="code-quote">&quot;USD&quot;</SPAN>))
+ <SPAN class="code-keyword">return</SPAN> <SPAN class="code-quote">&quot;$&quot;</SPAN>;
+ <SPAN class="code-keyword">else</SPAN>
+ <SPAN class="code-keyword">if</SPAN> (currencyCode.equals(<SPAN class="code-quote">&quot;EUR&quot;</SPAN>))
+ <SPAN class="code-keyword">return</SPAN> <SPAN class="code-quote">&quot;&euro;&quot;</SPAN>;
+ <SPAN class="code-keyword">return</SPAN> <SPAN class="code-quote">&quot;?&quot;</SPAN>;
+ }
+}</PRE>
+</DIV></DIV>
+<P>After completing these steps the content of the &quot;store&quot; project will look as follows.</P>
+
+<P><IMG src="getting-started-with-tuscany-release-10.data/store_project_1.png" align="absmiddle" border="0"></P>
+
+<H3><A name="GettingStartedwithTuscanyRelease1.0-ShoppingCart"></A><EM>ShoppingCart</EM></H3>
+
+<P>In this step you create the ShoppingCart service implementation.</P>
+
+<P>You follow the same steps that you learned previously to create the implementation.</P>
+
+<P>Create a Java class in the &quot;services&quot; package named &quot;ShoppingCartImpl&quot; and <B><EM>copy-paste</EM></B> the<BR>
+following Java class code snippet into it.</P>
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java"><SPAN class="code-keyword">package</SPAN> services;
+<SPAN class="code-keyword">import</SPAN> java.util.Date;
+<SPAN class="code-keyword">import</SPAN> java.util.HashMap;
+<SPAN class="code-keyword">import</SPAN> java.util.Map;
+<SPAN class="code-keyword">import</SPAN> java.util.UUID;
+<SPAN class="code-keyword">import</SPAN> org.apache.tuscany.sca.binding.feed.collection.Collection;
+<SPAN class="code-keyword">import</SPAN> org.apache.tuscany.sca.binding.feed.collection.NotFoundException;
+<SPAN class="code-keyword">import</SPAN> com.sun.syndication.feed.atom.Content;
+<SPAN class="code-keyword">import</SPAN> com.sun.syndication.feed.atom.Entry;
+<SPAN class="code-keyword">import</SPAN> com.sun.syndication.feed.atom.Feed;
+<SPAN class="code-keyword">import</SPAN> com.sun.syndication.feed.atom.Link;
+<SPAN class="code-keyword">public</SPAN> class ShoppingCartImpl <SPAN class="code-keyword">implements</SPAN> Collection {
+ <SPAN class="code-comment">// needs to change to instance <SPAN class="code-keyword">var</SPAN> once conversation scope works
+</SPAN> <SPAN class="code-keyword">private</SPAN> <SPAN class="code-keyword">static</SPAN> Map&lt;<SPAN class="code-object">String</SPAN>, Entry&gt; cart = <SPAN class="code-keyword">new</SPAN> HashMap&lt;<SPAN class="code-object">String</SPAN>, Entry&gt;();
+ <SPAN class="code-keyword">public</SPAN> Feed getFeed() {
+ Feed feed = <SPAN class="code-keyword">new</SPAN> Feed();
+ feed.setTitle(<SPAN class="code-quote">&quot;shopping cart&quot;</SPAN>);
+ Content subtitle = <SPAN class="code-keyword">new</SPAN> Content();
+ subtitle.setValue(<SPAN class="code-quote">&quot;Total : &quot;</SPAN> + getTotal());
+ feed.setSubtitle(subtitle);
+ feed.getEntries().addAll(cart.values());
+ <SPAN class="code-keyword">return</SPAN> feed;
+ }
+ <SPAN class="code-keyword">public</SPAN> Entry get(<SPAN class="code-object">String</SPAN> id) <SPAN class="code-keyword">throws</SPAN> NotFoundException {
+ <SPAN class="code-keyword">return</SPAN> cart.get(id);
+ }
+ <SPAN class="code-keyword">public</SPAN> Entry post(Entry entry) {
+ <SPAN class="code-object">String</SPAN> id = <SPAN class="code-quote">&quot;cart-&quot;</SPAN> + UUID.randomUUID().toString();
+ entry.setId(id);
+ Link link = <SPAN class="code-keyword">new</SPAN> Link();
+ link.setRel(<SPAN class="code-quote">&quot;edit&quot;</SPAN>);
+ link.setHref(&quot;&quot; + id);
+ entry.getOtherLinks().add(link);
+ link = <SPAN class="code-keyword">new</SPAN> Link();
+ link.setRel(<SPAN class="code-quote">&quot;alternate&quot;</SPAN>);
+ link.setHref(&quot;&quot; + id);
+ entry.getAlternateLinks().add(link);
+ entry.setCreated(<SPAN class="code-keyword">new</SPAN> Date());
+ cart.put(id, entry);
+ <SPAN class="code-keyword">return</SPAN> entry;
+ }
+ <SPAN class="code-keyword">public</SPAN> Entry put(<SPAN class="code-object">String</SPAN> id, Entry entry) <SPAN class="code-keyword">throws</SPAN> NotFoundException {
+ entry.setUpdated(<SPAN class="code-keyword">new</SPAN> Date());
+ cart.put(id, entry);
+ <SPAN class="code-keyword">return</SPAN> entry;
+ }
+ <SPAN class="code-keyword">public</SPAN> void delete(<SPAN class="code-object">String</SPAN> id) <SPAN class="code-keyword">throws</SPAN> NotFoundException {
+ <SPAN class="code-keyword">if</SPAN> (id.equals(&quot;&quot;))
+ cart.clear();
+ <SPAN class="code-keyword">else</SPAN>
+ cart.remove(id);
+ } <SPAN class="code-keyword">private</SPAN> <SPAN class="code-object">String</SPAN> getTotal() {
+ <SPAN class="code-object">float</SPAN> total = 0;
+ <SPAN class="code-object">String</SPAN> symbol = &quot;&quot;;
+ <SPAN class="code-keyword">if</SPAN> (!cart.isEmpty()) {
+ Entry entry = cart.values().iterator().next();
+ <SPAN class="code-object">String</SPAN> item = ((Content)entry.getContents().get(0)).getValue();
+ symbol = item.substring(item.indexOf(<SPAN class="code-quote">&quot;-&quot;</SPAN>)+2, item.indexOf(<SPAN class="code-quote">&quot;-&quot;</SPAN>)+3);
+ }
+ <SPAN class="code-keyword">for</SPAN> (Entry entry : cart.values()) {
+ <SPAN class="code-object">String</SPAN> item = ((Content)entry.getContents().get(0)).getValue();
+ total += <SPAN class="code-object">Float</SPAN>.valueOf(item.substring(item.indexOf(<SPAN class="code-quote">&quot;-&quot;</SPAN>)+3));
+ }
+ <SPAN class="code-keyword">return</SPAN> symbol + <SPAN class="code-object">String</SPAN>.valueOf(total);
+ }
+}</PRE>
+</DIV></DIV>
+<P><B>Note:</B> Since the Tuscany conversational support is not ready yet the cart is realized through a hack.<BR>
+The cart field is defined as static.</P>
+
+<P>After completing these steps the content of the &quot;store&quot; project will look as follows.</P>
+
+<P><IMG src="getting-started-with-tuscany-release-10.data/store_project_2.png" align="absmiddle" border="0"><BR>
+&nbsp;</P>
+
+<H3><A name="GettingStartedwithTuscanyRelease1.0-%7B%7DStore%7B%7D"></A><B><EM>Store</EM></B></H3>
+
+<P>In this step you create the user facing Store service that will run in a Web browser and provide the<BR>
+user interface to the other services you created.</P>
+
+<P>Select the &quot;ufservices&quot; package. <B><EM>Right click</EM></B> to get the context menu, select <B><EM>New</EM></B>, and then <B><EM>File</EM></B>. In<BR>
+the <B><EM>New File</EM></B> dialog enter &quot;store.html&quot; for the <B><EM>File name</EM></B>, and then select <B><EM>Finish</EM></B> to complete the<BR>
+dialog.</P>
+
+<P>The Text editor will open on the new created html file. Replace the content of the editor by <B><EM>copy-paste</EM></B><BR>
+of the following html snippet.</P>
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java">&lt;html&gt;
+ &lt;head&gt;
+ &lt;title&gt;Store&lt;/title&gt;
+ &lt;script type=<SPAN class="code-quote">&quot;text/javascript&quot;</SPAN> src=<SPAN class="code-quote">&quot;binding-atom.js&quot;</SPAN>&gt;&lt;/script&gt;
+ &lt;script type=<SPAN class="code-quote">&quot;text/javascript&quot;</SPAN> src=<SPAN class="code-quote">&quot;binding-jsonrpc.js&quot;</SPAN>&gt;&lt;/script&gt;
+ &lt;script language=<SPAN class="code-quote">&quot;JavaScript&quot;</SPAN>&gt;
+ <SPAN class="code-comment">//Reference
+</SPAN> catalog = (<SPAN class="code-keyword">new</SPAN> JSONRpcClient(<SPAN class="code-quote">&quot;../Catalog&quot;</SPAN>)).Catalog;
+ <SPAN class="code-comment">//Reference
+</SPAN> shoppingCart = <SPAN class="code-keyword">new</SPAN> AtomClient(<SPAN class="code-quote">&quot;../ShoppingCart&quot;</SPAN>);
+ function catalog_getResponse(items) {
+ <SPAN class="code-keyword">var</SPAN> catalog = &quot;&quot;;
+ <SPAN class="code-keyword">for</SPAN> (<SPAN class="code-keyword">var</SPAN> i=0; i&lt;items.length; i++)
+ catalog += '&lt;input name=<SPAN class="code-quote">&quot;items&quot;</SPAN> type=<SPAN class="code-quote">&quot;checkbox&quot;</SPAN> value=&quot;' +
+ items[i] + '&quot;&gt;' + items[i]+ ' &lt;br&gt;';
+ document.getElementById('catalog').innerHTML=catalog;
+ }
+ function shoppingCart_getResponse(feed) {
+ <SPAN class="code-keyword">if</SPAN> (feed != <SPAN class="code-keyword">null</SPAN>) {
+ <SPAN class="code-keyword">var</SPAN> entries = feed.getElementsByTagName(<SPAN class="code-quote">&quot;entry&quot;</SPAN>);
+ <SPAN class="code-keyword">var</SPAN> list = &quot;&quot;;
+ <SPAN class="code-keyword">for</SPAN> (<SPAN class="code-keyword">var</SPAN> i=0; i&lt;entries.length; i++) {
+ <SPAN class="code-keyword">var</SPAN> item =
+ entries[i].getElementsByTagName(<SPAN class="code-quote">&quot;content&quot;</SPAN>)[0].firstChild.nodeValue;
+ list += item + ' &lt;br&gt;';
+ }
+ document.getElementById(<SPAN class="code-quote">&quot;shoppingCart&quot;</SPAN>).innerHTML = list;
+ <SPAN class="code-keyword">if</SPAN> (list != &quot;&quot;)
+ document.getElementById('total').innerHTML =
+ feed.getElementsByTagName(<SPAN class="code-quote">&quot;subtitle&quot;</SPAN>)[0].firstChild.nodeValue;
+ }
+ }
+ function shoppingCart_postResponse(entry) {
+ shoppingCart.get(&quot;&quot;, shoppingCart_getResponse);
+ }
+ function addToCart() {
+ <SPAN class="code-keyword">var</SPAN> items = document.catalogForm.items;
+ <SPAN class="code-keyword">var</SPAN> j = 0;
+ <SPAN class="code-keyword">for</SPAN> (<SPAN class="code-keyword">var</SPAN> i=0; i&lt;items.length; i++)
+ <SPAN class="code-keyword">if</SPAN> (items[i].checked) {
+ <SPAN class="code-keyword">var</SPAN> entry = '&lt;entry xmlns=<SPAN class="code-quote">&quot;http:<SPAN class="code-comment">//www.w3.org/2005/Atom&quot;</SPAN>&gt;' +
+</SPAN> '&lt;title&gt;cart-item&lt;/title&gt;' +
+ '&lt;content type=<SPAN class="code-quote">&quot;text&quot;</SPAN>&gt;'+items[i].value+'&lt;/content&gt;' +
+ '&lt;/entry&gt;';
+ shoppingCart.post(entry, shoppingCart_postResponse);
+ items[i].checked = <SPAN class="code-keyword">false</SPAN>;
+ }
+ }
+ function checkoutCart() {
+ document.getElementById('store').innerHTML='&lt;h2&gt;' +
+ 'Thanks <SPAN class="code-keyword">for</SPAN> Shopping With Us!&lt;/h2&gt;'+
+ '&lt;h2&gt;Your Order&lt;/h2&gt;'+
+ '&lt;form name=<SPAN class="code-quote">&quot;orderForm&quot;</SPAN> action=<SPAN class="code-quote">&quot;/ufs/store.html&quot;</SPAN>&gt;'+
+ document.getElementById('shoppingCart').innerHTML+
+ '&lt;br&gt;'+
+ document.getElementById('total').innerHTML+
+ '&lt;br&gt;'+
+ '&lt;br&gt;'+
+ '&lt;input type=<SPAN class="code-quote">&quot;submit&quot;</SPAN> value=<SPAN class="code-quote">&quot;Continue Shopping&quot;</SPAN>&gt;'+
+ '&lt;/form&gt;';
+ shoppingCart.delete(&quot;&quot;, <SPAN class="code-keyword">null</SPAN>);
+ }
+ function deleteCart() {
+ shoppingCart.delete(&quot;&quot;, <SPAN class="code-keyword">null</SPAN>);
+ document.getElementById('shoppingCart').innerHTML = &quot;&quot;;
+ document.getElementById('total').innerHTML = &quot;&quot;;
+ }
+ window.onload = function() {
+ catalog.get(catalog_getResponse);
+ shoppingCart.get(&quot;&quot;, shoppingCart_getResponse);
+ }
+ &lt;/script&gt;
+ &lt;link rel=<SPAN class="code-quote">&quot;stylesheet&quot;</SPAN> type=<SPAN class="code-quote">&quot;text/css&quot;</SPAN> href=<SPAN class="code-quote">&quot;style.css&quot;</SPAN> /&gt;
+ &lt;/head&gt;
+ &lt;body&gt;
+ &lt;h1&gt;Store&lt;/h1&gt;
+ &lt;div id=<SPAN class="code-quote">&quot;store&quot;</SPAN>&gt;
+ &lt;h2&gt;Catalog&lt;/h2&gt;
+ &lt;form name=<SPAN class="code-quote">&quot;catalogForm&quot;</SPAN>&gt;
+ &lt;div id=<SPAN class="code-quote">&quot;catalog&quot;</SPAN> &gt;&lt;/div&gt;
+ &lt;br&gt;
+ &lt;input type=<SPAN class="code-quote">&quot;button&quot;</SPAN> onClick=<SPAN class="code-quote">&quot;addToCart()&quot;</SPAN> value=<SPAN class="code-quote">&quot;Add to Cart&quot;</SPAN>&gt;
+ &lt;/form&gt;
+ &lt;br&gt;
+ &lt;h2&gt;Your Shopping Cart&lt;/h2&gt;
+ &lt;form name=<SPAN class="code-quote">&quot;shoppingCartForm&quot;</SPAN>&gt;
+ &lt;div id=<SPAN class="code-quote">&quot;shoppingCart&quot;</SPAN>&gt;&lt;/div&gt;
+ &lt;br&gt;
+ &lt;div id=<SPAN class="code-quote">&quot;total&quot;</SPAN>&gt;&lt;/div&gt;
+ &lt;br&gt;
+ &lt;input type=<SPAN class="code-quote">&quot;button&quot;</SPAN> onClick=<SPAN class="code-quote">&quot;checkoutCart()&quot;</SPAN> value=<SPAN class="code-quote">&quot;Checkout&quot;</SPAN>&gt;
+ &lt;input type=<SPAN class="code-quote">&quot;button&quot;</SPAN> onClick=<SPAN class="code-quote">&quot;deleteCart()&quot;</SPAN> value=<SPAN class="code-quote">&quot;Empty&quot;</SPAN>&gt;
+ &lt;a href=<SPAN class="code-quote">&quot;../ShoppingCart/&quot;</SPAN>&gt;
+ &lt;img src=<SPAN class="code-quote">&quot;http:<SPAN class="code-comment">//projects.apache.org/images/blue-icon.png&quot;</SPAN> border=<SPAN class="code-quote">&quot;0&quot;</SPAN>&gt;
+</SPAN> &lt;/a&gt;
+ &lt;/form&gt;
+ &lt;/div&gt;
+ &lt;/body&gt;
+&lt;/html&gt;</PRE>
+</DIV></DIV>
+<P>Next select the &quot;ufservices&quot; package again. <B><EM>Right click</EM></B> to get the context menu, select <B><EM>New</EM></B>, and<BR>
+then <B><EM>File</EM></B>. In the <B><EM>New File</EM></B> dialog enter &quot;binding-jsonrpc.js&quot; for the <B><EM>File name</EM></B>, and then select<BR>
+<B><EM>Finish</EM></B> to complete the dialog.</P>
+
+<P>The Text editor will open on the new created javascript file. Replace the content of the editor by<BR>
+<B><EM>copy-paste</EM></B> of the javascript snippet you find here:</P>
+
+<P><SPAN class="nobr"><A href="http://svn.apache.org/repos/asf/incubator/tuscany/java/sca/modules/binding-jsonrpc/src/main/resources/org/apache/tuscany/sca/binding/jsonrpc/jsonrpc.js" title="Visit page outside Confluence" rel="nofollow">http://svn.apache.org/repos/asf/incubator/tuscany/java/sca/modules/binding-jsonrpc/src/main/resources/org/apache/tuscany/sca/binding/jsonrpc/jsonrpc.js<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></P>
+
+<P>Next select the &quot;ufservices&quot; package again. <B><EM>Right click</EM></B> to get the context menu, select <B><EM>New</EM></B>, and<BR>
+then <B><EM>File</EM></B>. In the <B><EM>New File</EM></B> dialog enter &quot;binding-atom.js&quot; for the <B><EM>File name</EM></B>, and then select <B><EM>Finish</EM></B><BR>
+to complete the dialog.</P>
+
+<P>The Text editor will open on the new created javascript file. Replace the content of the editor by<BR>
+<B><EM>copy-paste</EM></B> of the following javascript snippet.</P>
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java">function AtomClient(uri) {
+ <SPAN class="code-keyword">this</SPAN>.uri=uri;
+ <SPAN class="code-keyword">this</SPAN>.get = function(id, responseFunction) {
+ <SPAN class="code-keyword">var</SPAN> xhr = <SPAN class="code-keyword">this</SPAN>.createXMLHttpRequest();
+ xhr.onreadystatechange = function() {
+ <SPAN class="code-keyword">if</SPAN> (xhr.readyState == 4) {
+ <SPAN class="code-keyword">if</SPAN> (xhr.status == 200) {
+ <SPAN class="code-keyword">if</SPAN> (responseFunction != <SPAN class="code-keyword">null</SPAN>)
+ responseFunction(xhr.responseXML);
+ } <SPAN class="code-keyword">else</SPAN> {
+ alert(<SPAN class="code-quote">&quot;get - Error getting data from the server&quot;</SPAN>);
+ }
+ }
+ }
+ xhr.open(<SPAN class="code-quote">&quot;GET&quot;</SPAN>, uri + id, <SPAN class="code-keyword">true</SPAN>);
+ xhr.send(<SPAN class="code-keyword">null</SPAN>);
+ }
+ <SPAN class="code-keyword">this</SPAN>.post = function (entry, responseFunction) {
+ <SPAN class="code-keyword">var</SPAN> xhr = <SPAN class="code-keyword">this</SPAN>.createXMLHttpRequest();
+ xhr.onreadystatechange = function() {
+ <SPAN class="code-keyword">if</SPAN> (xhr.readyState == 4) {
+ <SPAN class="code-keyword">if</SPAN> (xhr.status == 201) {
+ <SPAN class="code-keyword">if</SPAN> (responseFunction != <SPAN class="code-keyword">null</SPAN>)
+ responseFunction(xhr.responseXML);
+ } <SPAN class="code-keyword">else</SPAN> {
+ alert(<SPAN class="code-quote">&quot;post - Error getting data from the server&quot;</SPAN>);
+ }
+ }
+ }
+ xhr.open(<SPAN class="code-quote">&quot;POST&quot;</SPAN>, uri, <SPAN class="code-keyword">true</SPAN>);
+ xhr.setRequestHeader(<SPAN class="code-quote">&quot;Content-Type&quot;</SPAN>, <SPAN class="code-quote">&quot;application/atom+xml&quot;</SPAN>);
+ xhr.send(entry);
+ }
+ <SPAN class="code-keyword">this</SPAN>.put = function (id, entry, responseFunction) {
+ <SPAN class="code-keyword">var</SPAN> xhr = <SPAN class="code-keyword">this</SPAN>.createXMLHttpRequest();
+ xhr.onreadystatechange = function() {
+ <SPAN class="code-keyword">if</SPAN> (xhr.readyState == 4) {
+ <SPAN class="code-keyword">if</SPAN> (xhr.status == 200) {
+ <SPAN class="code-keyword">if</SPAN> (responseFunction != <SPAN class="code-keyword">null</SPAN>)
+ responseFunction(xhr.responseXML);
+ } <SPAN class="code-keyword">else</SPAN> {
+ alert(<SPAN class="code-quote">&quot;put - Error getting data from the server&quot;</SPAN>);
+ }
+ }
+ }
+ xhr.open(<SPAN class="code-quote">&quot;PUT&quot;</SPAN>, uri + id, <SPAN class="code-keyword">true</SPAN>);
+ xhr.setRequestHeader(<SPAN class="code-quote">&quot;Content-Type&quot;</SPAN>, <SPAN class="code-quote">&quot;application/atom+xml&quot;</SPAN>);
+ xhr.send(entry);
+ }
+ <SPAN class="code-keyword">this</SPAN>.delete = function (id, responseFunction) {
+ <SPAN class="code-keyword">var</SPAN> xhr = <SPAN class="code-keyword">this</SPAN>.createXMLHttpRequest();
+ xhr.onreadystatechange = function() {
+ <SPAN class="code-keyword">if</SPAN> (xhr.readyState == 4) {
+ <SPAN class="code-keyword">if</SPAN> (xhr.status == 200) {
+ <SPAN class="code-keyword">if</SPAN> (responseFunction != <SPAN class="code-keyword">null</SPAN>) responseFunction();
+ } <SPAN class="code-keyword">else</SPAN> {
+ alert(<SPAN class="code-quote">&quot;delete - Error getting data from the server&quot;</SPAN>);
+ }
+ }
+ }
+ xhr.open(<SPAN class="code-quote">&quot;DELETE&quot;</SPAN>, uri + id, <SPAN class="code-keyword">true</SPAN>);
+ xhr.send(<SPAN class="code-keyword">null</SPAN>);
+ }
+ <SPAN class="code-keyword">this</SPAN>.createXMLHttpRequest = function () {
+ <SPAN class="code-keyword">try</SPAN> {<SPAN class="code-keyword">return</SPAN> <SPAN class="code-keyword">new</SPAN> XMLHttpRequest();} <SPAN class="code-keyword">catch</SPAN>(e) {}
+ <SPAN class="code-keyword">try</SPAN> {<SPAN class="code-keyword">return</SPAN> <SPAN class="code-keyword">new</SPAN> ActiveXObject(<SPAN class="code-quote">&quot;Msxml2.XMLHTTP&quot;</SPAN>);} <SPAN class="code-keyword">catch</SPAN>(e) {}
+ <SPAN class="code-keyword">try</SPAN> {<SPAN class="code-keyword">return</SPAN> <SPAN class="code-keyword">new</SPAN> ActiveXObject(<SPAN class="code-quote">&quot;Microsoft.XMLHTTP&quot;</SPAN>);} <SPAN class="code-keyword">catch</SPAN>(e) {}
+ alert(<SPAN class="code-quote">&quot;XML http request not supported&quot;</SPAN>);
+ <SPAN class="code-keyword">return</SPAN> <SPAN class="code-keyword">null</SPAN>;
+ }
+}</PRE>
+</DIV></DIV>
+<P><B>Note:</B> That we have to have the bindig-jsonrpc.js, and binding-atom.js local in our project is only<BR>
+temporary, so this step will be removed in the future.</P>
+
+<P>After completing these steps the content of the &quot;store&quot; project will look as follows.</P>
+
+<P>&nbsp;<IMG src="getting-started-with-tuscany-release-10.data/store_project_3.png" align="absmiddle" border="0"></P>
+
+<H2><A name="GettingStartedwithTuscanyRelease1.0-ComposeServices"></A>Compose Services</H2>
+
+<P>Now that you have all the required service implementations you compose them together to provide<BR>
+the store composite service. The composition is stored in a .composite file.</P>
+
+<P>Select the &quot;src&quot; folder of the &quot;store&quot; project. <B><EM>Right click</EM></B> to get the context menu, select <B><EM>New</EM></B>, and<BR>
+then <B><EM>File</EM></B>. In the <B><EM>New File</EM></B> dialog enter &quot;store.composite&quot; for the <B><EM>File name</EM></B>, and then select <B><EM>Finish</EM></B><BR>
+to complete the dialog.</P>
+
+<P>The Text editor will open on the new created composite file. Replace the content of the editor by<BR>
+<B><EM>copy-paste</EM></B> of the following composite snippet.</P>
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java">&lt;?xml version=<SPAN class="code-quote">&quot;1.0&quot;</SPAN> encoding=<SPAN class="code-quote">&quot;UTF-8&quot;</SPAN>?&gt;
+&lt;composite xmlns=<SPAN class="code-quote">&quot;http:<SPAN class="code-comment">//www.osoa.org/xmlns/sca/1.0&quot;</SPAN>
+</SPAN> xmlns:t=<SPAN class="code-quote">&quot;http:<SPAN class="code-comment">//tuscany.apache.org/xmlns/sca/1.0&quot;</SPAN>
+</SPAN> xmlns:s=<SPAN class="code-quote">&quot;http:<SPAN class="code-comment">//store&quot;</SPAN>
+</SPAN> name=<SPAN class="code-quote">&quot;store&quot;</SPAN>&gt;
+ &lt;component name=<SPAN class="code-quote">&quot;ufs&quot;</SPAN>&gt;
+ &lt;t:implementation.resource location=<SPAN class="code-quote">&quot;ufservices&quot;</SPAN>/&gt;
+ &lt;service name=<SPAN class="code-quote">&quot;Resource&quot;</SPAN>&gt;
+ &lt;t:binding.http/&gt;
+ &lt;/service&gt;
+ &lt;/component&gt;
+ &lt;component name=<SPAN class="code-quote">&quot;Catalog&quot;</SPAN>&gt;
+ &lt;implementation.java class=<SPAN class="code-quote">&quot;services.CatalogImpl&quot;</SPAN>/&gt;
+ &lt;property name=<SPAN class="code-quote">&quot;currencyCode&quot;</SPAN>&gt;USD&lt;/property&gt;
+ &lt;service name=<SPAN class="code-quote">&quot;Catalog&quot;</SPAN>&gt;
+ &lt;t:binding.jsonrpc/&gt;
+ &lt;/service&gt;
+ &lt;reference name=<SPAN class="code-quote">&quot;currencyConverter&quot;</SPAN> target=<SPAN class="code-quote">&quot;CurrencyConverter&quot;</SPAN>/&gt;
+ &lt;/component&gt;
+ &lt;component name=<SPAN class="code-quote">&quot;ShoppingCart&quot;</SPAN>&gt;
+ &lt;implementation.java class=<SPAN class="code-quote">&quot;services.ShoppingCartImpl&quot;</SPAN>/&gt;
+ &lt;service name=<SPAN class="code-quote">&quot;Collection&quot;</SPAN>&gt;
+ &lt;t:binding.atom/&gt;
+ &lt;/service&gt;
+ &lt;/component&gt;
+ &lt;component name=<SPAN class="code-quote">&quot;CurrencyConverter&quot;</SPAN>&gt;
+ &lt;implementation.java class=<SPAN class="code-quote">&quot;services.CurrencyConverterImpl&quot;</SPAN>/&gt;
+ &lt;/component&gt;
+&lt;/composite&gt;</PRE>
+</DIV></DIV>
+<P>After completing these steps the content of the &quot;store&quot; project will look as follows.</P>
+
+<P><IMG src="getting-started-with-tuscany-release-10.data/store_project_4.png" align="absmiddle" border="0"><BR>
+&nbsp;</P>
+
+<H2><A name="GettingStartedwithTuscanyRelease1.0-LaunchServices"></A>Launch Services</H2>
+
+<P>In this step you create the code to launch the Tuscany runtime with the new store composite<BR>
+service you created.</P>
+
+<P>Select the &quot;store&quot; project and click on the <B><EM>New Java Package</EM></B> button <IMG src="getting-started-with-tuscany-release-10.data/new_java_pkg_btn.png" align="absmiddle" border="0">&nbsp; in the toolbar to start the</P>
+
+<P>package creation dialog. Use the dialog to create a new package named &quot;launch&quot;.&nbsp;<BR>
+Select the &quot;launch&quot; package. Select the <B><EM>New Java Class</EM></B> button <IMG src="getting-started-with-tuscany-release-10.data/class_btn.png" align="absmiddle" border="0">&nbsp; . In the dialog enter &quot;Launch&quot;<BR>
+as the <B><EM>Name</EM></B> of the class, check the <B><EM>checkbox for creating a main method stub</EM></B>, and then select<BR>
+<B><EM>Finish</EM></B> to complete the dialog.</P>
+
+<P>The Java editor will open on the new created Java class. Replace the content of the editor by<BR>
+<B><EM>copy-paste</EM></B> of the following Java class code snippet.</P>
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java"><SPAN class="code-keyword">package</SPAN> launch;
+<SPAN class="code-keyword">import</SPAN> org.apache.tuscany.sca.host.embedded.SCADomain;
+<SPAN class="code-keyword">public</SPAN> class Launch {
+ <SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">static</SPAN> void main(<SPAN class="code-object">String</SPAN>[] args) <SPAN class="code-keyword">throws</SPAN> Exception {
+ <SPAN class="code-object">System</SPAN>.out.println(<SPAN class="code-quote">&quot;Starting ...&quot;</SPAN>);
+ SCADomain scaDomain = SCADomain.newInstance(<SPAN class="code-quote">&quot;store.composite&quot;</SPAN>);
+ <SPAN class="code-object">System</SPAN>.out.println(<SPAN class="code-quote">&quot;store.composite ready <SPAN class="code-keyword">for</SPAN> big business !!!&quot;</SPAN>);
+ <SPAN class="code-object">System</SPAN>.out.println();
+ <SPAN class="code-object">System</SPAN>.in.read();
+ scaDomain.close();
+ }
+}</PRE>
+</DIV></DIV>
+<P>&nbsp;After completing these steps the content of the &quot;store&quot; project will look as follows.</P>
+
+<P><IMG src="getting-started-with-tuscany-release-10.data/store_project_5.png" align="absmiddle" border="0"><BR>
+Congratulations you completed your 1st composite service applications, now its time to take it into<BR>
+action.</P>
+
+<H2><A name="GettingStartedwithTuscanyRelease1.0-UseServices"></A>Use Services</H2>
+
+<P>In this step you launch and use the store composite service application you created.</P>
+
+<P>First select the &quot;Launch&quot; class in the &quot;launch&quot; package of your &quot;store&quot; project. <B><EM>Right click</EM></B> to get the<BR>
+context menu, select <B><EM>Run As</EM></B>, and then <B><EM>Java application</EM></B>. The Tuscany runtime will start up adding<BR>
+the store composition to its domain.</P>
+
+<P>The Eclipse console will show the following messages.</P>
+
+<P>&nbsp;<IMG src="getting-started-with-tuscany-release-10.data/eclipse_console.png" align="absmiddle" border="0"></P>
+
+<P>&nbsp;Next Launch your Web browser and enter the following address:</P>
+
+<P><SPAN class="nobr"><A href="http://localhost:8080/ufs/store.html" title="Visit page outside Confluence" rel="nofollow">http://localhost:8080/ufs/store.html<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN>&nbsp;</P>
+
+<P>&nbsp;You get to the Store user facing service of the composite service application.</P>
+
+<P><IMG src="getting-started-with-tuscany-release-10.data/store_page.png" align="absmiddle" border="0"></P>
+
+<P>You can select items from the Catalog and add them to your Shopping Cart.</P>
+
+<P><B>Note:</B> When adding items for the first time you will be asked for <B><EM>userid and password</EM></B> by the<BR>
+browser. Enter &quot;admin&quot; for both.</P>
+
+<P> <IMG src="getting-started-with-tuscany-release-10.data/store_page_1.png" align="absmiddle" border="0"></P>
+
+<P>Since the ShoppingCart service is bound using the ATOM binding, you can also look at the<BR>
+shopping card content in ATOM feed form by clicking on the feed icon <IMG src="getting-started-with-tuscany-release-10.data/atom_feed.png" align="absmiddle" border="0">. You get the browsers default rendering for ATOM feeds.</P>
+
+<P>&nbsp;<IMG src="getting-started-with-tuscany-release-10.data/atom_feeds_page.png" align="absmiddle" border="0"></P>
+
+<P>&nbsp;Use the browser back button to get back to the Store page.</P>
+
+<P><IMG src="getting-started-with-tuscany-release-10.data/store_page_2.png" align="absmiddle" border="0"></P>
+
+<P>And then you can Checkout to complete your order.</P>
+
+<P><IMG src="getting-started-with-tuscany-release-10.data/store_page_3.png" align="absmiddle" border="0"></P>
+
+<H2><A name="GettingStartedwithTuscanyRelease1.0-ExploretheSamplesfromtheTuscanyDistribution"></A>Explore the Samples from the Tuscany Distribution</H2>
+
+<P>The sample folder of the Tuscany distribution provides a rich set of samples ready for you to explore.</P>
+
+<P><IMG src="getting-started-with-tuscany-release-10.data/tuscany_samples_folder.png" align="absmiddle" border="0"><BR>
+&nbsp;<BR>
+In Eclipse create a New Java Project, specify the project name, select Create project from<BR>
+existing source, and specify the folder that contains the sample source.</P>
+
+<P><IMG src="getting-started-with-tuscany-release-10.data/New_Calc_Java_Project.png" align="absmiddle" border="0"><BR>
+&nbsp;<BR>
+Use <B><EM>Next</EM></B> to get to the next page in the New Java Project dialog. There go to the <B><EM>Libraries</EM></B> tab, use<BR>
+the <B><EM>Add Library</EM></B>... pushbutton to add the JUnit library and the user library <B><EM>TUSCANY</EM></B>.</P>
+
+<P><IMG src="getting-started-with-tuscany-release-10.data/New_Calc_Java_Project_lib.png" align="absmiddle" border="0"><BR>
+&nbsp;<BR>
+Finish the New Java Project dialog. You now have the sample project available in the Eclipse workbench.</P>
+
+<P><IMG src="getting-started-with-tuscany-release-10.data/calculator_proj_dlg.png" align="absmiddle" border="0"><BR>
+&nbsp;<BR>
+For the calculator sample that we've chosen go to its <B><EM>CalculatorClient</EM></B> class and select <B><EM>Run As &#45;&gt;</EM></B><BR>
+<B><EM>Java Application.</EM></B> You will see the following output in the console.</P>
+
+<P>&nbsp;<IMG src="getting-started-with-tuscany-release-10.data/calculator_eclipse_console.png" align="absmiddle" border="0"></P>
+ </DIV>
+ </DIV>
+ </DIV>
+ </TD>
+ </TR>
+ </TABLE>
+
+ <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 &copy; 2003-2007, The Apache Software Foundation&nbsp;&nbsp;
+ </DIV>
+
+ </BODY>
+</HTML> \ No newline at end of file