Getting Started with Tuscany Release 1.0 (TUSCANY) edited by S Venkatakrishnan
Page:
http://cwiki.apache.org/confluence/display/TUSCANY/Getting+Started+with+Tuscany+Release+1.0
Changes:
http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=67902&originalVersion=2&revisedVersion=3
Content:
---------------------------------------------------------------------
h1. Ready, Set, Go - Getting started with Tuscany
h2. Install the Tuscany Distribution
The first thing you do is to create a folder on you disk into which you will
download the TUSCANY distribution.!tuscany_folder.png|align=center!
Next you download the latest release distribution. Launch your browser and
enter one of the
following URL's.
Latest Release - [http://cwiki.apache.org/TUSCANY/sca-java-releases.html]
Download both the *{_}bin zip{_}* as well as the *{_}src zip{_}* to the folder
that you created on your disk. Once
you completed the download you should see the following on your disk.
!release_zips.png!
Next you unzip the *{_}bin zip{_}* in place, you should see the following
folder file structure on your disk
after unzip is complete.
!folder_structure.png!
h2. Setup Eclipse for Tuscany
Start Eclipse and create a User Library to contain the TUSCANY runtime jar's as
well as their
depending jar's.
>From the menu bar select *{_}Window{_}* and then *{_}Preferences..._* . The
>Preferences dialog will appear,
in its left navigation tree select *{_}Java{_}*, followed by *{_}Build
Path{_}*, and followed by *{_}User Libraries{_}*.
Select the *{_}New..._* pushbutton on the right of the New Libraries dialog to
create a new user library.
!New_User_Lib.png!
The user library created is empty, select the *{_}Add JARs..._* pushbutton on
the right to add all the
jar's from your Tuscany installation *{_}lib folder{_}*. When completed all the
jar's will appear under the
TUSCANY user library.
!Tuscany_User_Lib.png!
Since some of you maybe interested in *{_}debugging{_}* also the Tuscany
runtime code we will attach
the Tuscany source to the Tuscany runtime jar in the following step. In the
User Libraies dialog
scroll down until you see the *{_}Tuscany runtime jar{_}* and select its
*{_}Source attachment._*
!source_attachment.png!
Select the *{_}Edit..._* pushbutton on the right and in the Edit dialog use the
*{_}External File..._* pushbutton
to the select the Tuscany *{_}src zip{_}* that we downloaded earlier.
!source_attachment_config.png!
Select *{_}OK{_}* to complete this and the Preferences dialog, and you are done
with the Tuscany setup
for Eclipse.
h2. Create your 1st Composite Service Application
The following shows the composition diagram for the composite service
application you are about
to create.
!first_composite.png!
The composite service application you will create is a composition of four
services. The composed
service provided is that of an on-line store.
There is a Catalog service which you can ask for catalog items, and depending
on its currency
code property configuration it will provide the item prices in USD or EUR. The
Catalog service is not
doing the currency conversion itself it references a CurrencyConverter service
to do that task. Then
there is the ShoppingCart service into which items chosen from the catalog can
be added, it is
implemented as a REST service. The Catalog is bound using the JSONRPC binding,
and the
ShoppingCart service is bound using the ATOM binding. Finally there is the
Store user facing
service that provides the browser based user interface of the store. The Store
service makes use of
the Catalog and ShoppingCart service using the JSONRPC, and ATOM binding
respectively.
h2. Create a Java Project
In this step you create a Java Project in Eclipse to hold the composite service
application.
Click on the *{_}New Java Project{_}* button !new_java_project.png! in
the toolbar to launch the project creation dialog.
Next you enter "store" as the *{_}Project name{_}*, and for *{_}Project
Layout{_}* select *{_}Create separate{_}*
*{_}folders for sources and class files._*
!new_java_project_dlg.png!
!project_layout.png!
Hit the *{_}Next{_}* button, and on the following page go to the
*{_}Libraries{_}* tab. Use the *{_}Add Library..._*
button on the right to add the TUSCANY user library to the project.
!new_java_project_lib.png!
Hit the *{_}Finish{_}* button to complete the *{_}New Java Project{_}* dialog
to create the "store" java project.
!new_java_project_folder.png!
h2. Construct Services
First you create two package folders into which later in this step you place
service implementations.
Select the "store" project and click on the *{_}New Java Package{_}* button
!new_java_pkg_btn.png! in the toolbar to launch
the package creation dialog.
Next you enter "services" as the package *{_}Name{_}*, and press the
*{_}Finish{_}* button to complete the
dialog.
!new_java_pkg_dlg.png!
Repeat the previous step to create another package named "ufservices". The
store project now
should look as follows.
!new_java_pkg_folder.png!
In the following you will place in the "services" package the regular services,
and in the "ufservices"
package the user facing services of the composite service application you
create.
h3. Catalog
In this step you create the Catalog service interface and implementation.
Select the "services" package. Next you click on the dropdown arrow next to the
*{_}New Java Class{_}*
button !class_btn.png! and select the *{_}New Java
Interface{_}* !interface_btn.png!
option from the dropdown list. In the dialog
enter "Catalog" as the *{_}Name{_}* of the interface and select the Finish
button to complete the dialog.
The Java editor will open on the new created Java interface. Replace the
content of the editor by
*{_}copy-paste{_}* of the following Java interface code snippet.
package services;
import org.osoa.sca.annotations.Remotable;
@Remotable
public interface Catalog {
String\[\] get();
}
---------------------------------------------------------------------
CONFLUENCE INFORMATION
This message is automatically generated by Confluence
Unsubscribe or edit your notifications preferences
http://cwiki.apache.org/confluence/users/viewnotifications.action
If you think it was sent incorrectly contact one of the administrators
http://cwiki.apache.org/confluence/administrators.action
If you want more information on Confluence, or have a bug to report see
http://www.atlassian.com/software/confluence
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]