You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 128 Next »

Unable to render {include} The included page could not be found.
Unable to render {include} The included page could not be found.

Welcome to the Apache Tuscany SCA User guide. Here you will find information aimed to help you understand SCA concepts and an example walk through for building your own SCA application.


${renderedContent}

Unknown macro: {bgcolor}

Introduction

">
Unknown macro: {bgcolor}

Introduction

This user guide will help you become familiar with SCA concepts and walks you through an example that demonstrates how to build an SCA application. It also describes the different environments that Tuscany supports (such as command line clients or web applications) and how to package up applications to run in these environments.

There's nothing to it really! Building SCA applications is easy. One of the main goals of Tuscany and SCA is to avoid imposing rules and requirements on how people write applications. We want to let people write application code the way they want without being concerned about the environment in which it will be used. After all, writing code to handle plumbing just gets in the way of writing the interesting stuff. So basically, you write the code for interesting bits, and Tuscany provides the environment that lets it run. Therefore, this guide is just an example of how an SCA application can be developed and is not a rule.

Unknown macro: {bgcolor}

Quick Guide to SCA

">
Unknown macro: {bgcolor}

Quick Guide to SCA

The quick guide to SCA gives you an overview of SCA concepts and prepares you to work on the example below. You can skip this step if you are already familiar with SCA.

For more details on SCA please refer to the specifications at Open SOA web site.

Unknown macro: {bgcolor}

Getting Started with Tuscany SCA Java

">
Unknown macro: {bgcolor}

Getting Started with Tuscany SCA Java

There are sever guides that show you how to get started with Apache Tuscany SCA Java.

Getting Started with Tuscany using a Tuscany Distribution from the Command Line
This is a quick getting started guide that shows you how to download the latest release, run the calculator sample and then how to use the calculator sample project as a basis for you own projects

Getting Started with Tuscany using a Tuscany Distribution In Eclipse
This is a quick getting started guide that go trough the steps of building the store scenario using the Tuscany SCA distribution manually installed into Eclipse

Getting Started with Tuscany using the Tuscany Eclipse Plugin
This is a quick getting started guide that go trough the steps of building the store scenario using the Tuscany Eclipse plugin.

First Steps - Building your first web services using Tuscany
This is a quick guide that go trough the steps of exposing your pojo component as web services.

Unknown macro: {bgcolor}

SCA Contributions and Composites

">
Unknown macro: {bgcolor}

SCA Contributions and Composites

You will have seen from working with the calculator sample (Getting Started with Tuscany using a Tuscany Distribution from the Command Line) that an assembly of SCA components is described in a composite file, for example,

<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
           targetNamespace="http://sample"
           xmlns:sample="http://sample"
           name="Calculator">

    <component name="CalculatorServiceComponent">
		<implementation.java class="calculator.CalculatorServiceImpl"/>
        <reference name="addService" target="AddServiceComponent" />
        <reference name="subtractService" target="SubtractServiceComponent" />
        <reference name="multiplyService" target="MultiplyServiceComponent" />
        <reference name="divideService" target="DivideServiceComponent" />
    </component>

    <component name="AddServiceComponent">
        <implementation.java class="calculator.AddServiceImpl"/>
    </component>

    <component name="SubtractServiceComponent">
        <implementation.java class="calculator.SubtractServiceImpl"/>
    </component>

    <component name="MultiplyServiceComponent">
        <implementation.java class="calculator.MultiplyServiceImpl"/>
    </component>

    <component name="DivideServiceComponent">
        <implementation.java class="calculator.DivideServiceImpl"/>
    </component>

</composite>

The composite describes how SCA components are implemented and how they are assembled by wiring references to targets. This composite file has some dependencies, in this case the Java class and interface files that are used to implement the SCA components that it defines. The collection of composite files and other artifacts that are required to run an SCA application are collected together into one or more SCA contributions. A contribution can be a simple as a directory in a file system or could be packaged in, for example, a Jar file. SCA does not mandate any particular packing scheme. For our calculator sample you can imagine the contribution holding the calculator composite and all of its dependencies.

In fact if you look inside the jar file that the calculator sample produces, you will find the following

calculator/AddService.class
calculator/AddServiceImpl.class
calculator/CalculatorClient.class
calculator/CalculatorService.class
calculator/CalculatorServiceImpl.class
calculator/DivideService.class
calculator/DivideServiceImpl.class
calculator/MultiplyService.class
calculator/MultiplyServiceImpl.class
calculator/SubtractService.class
calculator/SubtractServiceImpl.class
Calculator.composite

Which are all the artifacts that are required to run the calculator sample. We just need to add this contribution to the Tuscany SCA java runtime and then call the services that will be enabled.

Unknown macro: {bgcolor}

Tuscany SCA Node

">
Unknown macro: {bgcolor}

Tuscany SCA Node

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.

A node runs within a single JVM. A JVM can run many Nodes.

Unknown macro: {bgcolor}

Hosting Tuscany SCA Nodes

">
Unknown macro: {bgcolor}

Hosting Tuscany SCA Nodes

You can run SCA applications in many different ways but the same underlying runtime is used but packaged in slightly different ways as follows

Command Line

Most of the samples that are shipped with the Tuscany SCA Java distribution run from the command line.

WebApp

Some of the samples that are shipped with the Tuscany SCA Java distribution run as web apps

Tomcat

Running a Tuscany SCA Java enabled webapp in Tomcat is as simple as copying the webapp to the Tomcat webapps directory.

Geronimo

TBD

WebSphere

Please see this blog entry to learn how to do this: http://jsdelfino.blogspot.com/2007/10/how-to-use-apache-tuscany-with.html

WebLogic

Please see this user's blog to learn how to do this: http://davesowerby.blogspot.com/2008/02/using-tuscany-with-weblogic.html

Eclipse

There are two Getting Started documents that discuss this.

Getting Started with Tuscany using a Tuscany Distribution In Eclipse
Getting Started with Tuscany using the Tuscany Eclipse Plugin

Unknown macro: {bgcolor}

Tuscany SCA Domain

">
Unknown macro: {bgcolor}

Tuscany SCA Domain

SCA has the concept of a domain. Section 10 of the SCA Assembly specification describes an SCA Domain as defining "the boundary of visibility for all SCA mechanisms". SCA wires can be used to connect components within a single SCA Domain.

From the calculator sample you can see that the wires between the component references and services, formed by adding a target component name to a reference, are resolved inside an SCA domain.

<component name="CalculatorServiceComponent">
        <implementation.java class="calculator.CalculatorServiceImpl"/>
        <reference name="addService" target="AddServiceComponent" />
        <reference name="subtractService" target="SubtractServiceComponent" />
        <reference name="multiplyService" target="MultiplyServiceComponent" />
        <reference name="divideService" target="DivideServiceComponent" />
    </component>

    <component name="AddServiceComponent">
        <implementation.java class="calculator.AddServiceImpl"/>
    </component>

The target="AddServiceComponent" of the CalculatorServiceComponent's addService reference refers to the AddServiceComponent defined later on in this composite. A domain can consist of more than one composite and wires can run between components defined in the composites. The SCA Domain describes the boundary within which target component services can be located.

To connect to services outside of the SCA Domain (whether they be services provided by SCA or by other means) you configure an explicit binding, for example, lets assume that the AddServiceComponent is a non-sca web service out there on the network somewhere. As this is outside the SCA domain we can use an explicit remote binding to talk to it.

 <component name="CalculatorServiceComponent">
		<implementation.java class="calculator.CalculatorServiceImpl"/>
        <reference name="addService" >
           <interface.java interface="calculator.AddService" />        
            <binding.ws uri="http://localhost:8080/sample-calculator-ws-webapp/AddServiceComponent"/>        
        </reference>   
        <reference name="subtractService" target="SubtractServiceComponent"></reference>
        <reference name="multiplyService" target="MultiplyServiceComponent"></reference>
        <reference name="divideService" target="DivideServiceComponent"></reference>
    </component>

Tuscany SCA supports running an SCA Domain in a single Node or spread across multiple Nodes potentially on different machines. We have seen a domain with a single node before.

A domain with multiple nodes allows wires to run between components running in the separate nodes which may be running on different JVMs on different machines.

Unknown macro: {bgcolor}

Tuscany SCA Extensions

">
Unknown macro: {bgcolor}

Tuscany SCA Extensions

Unknown macro: {bgcolor}

The Extensible Runtime

">
Unknown macro: {bgcolor}

The Extensible Runtime

The Tuscany SCA runtime comprises a small set of core software which deals with:

  • Managing extesions to the Tuscany SCA Runtime(core)
  • Building and in memory assembly model of SCA applications (assembly)
  • Processing SCA applcations that are contributed (contribution)
  • Supporting databindings (databinding)
  • Supporting Tuscany SCA when its embedded in other environments (embedded)
  • Supporting Tuscany SCA when its running in a servlet container (http)

The collections of interfaces that describe these features are referred to as the System Programming Interface (SPI). The [developer guide] discusses them in more detail but from a user perspective the important thing to realize is that the majority of interesting functionality in Tuscany SCA is provided by extensions which build upon this core SPI. These extensions provide Tuscany SCA with its ability to support a wide variety features.

  • Implementation types
  • Binding types
  • Databinding types
  • Interface description styles
  • Hosting environments

So to understand how to use the Tuscany SCA runtime is to understand how to use its extensions.

Unknown macro: {bgcolor}

Available Extensions

">
Unknown macro: {bgcolor}

Available Extensions

More often than not using an extension involves adding information to the SCDL files or the implementation files but this is not always the case. The links below describe each of the extensions and how they can be used and configured.

Unknown macro: {table}
Unknown macro: {table-row}
Unknown macro: {table-cell}

Unknown macro: {bgcolor}

Implementation Types

">
Unknown macro: {bgcolor}

Implementation Types

Unknown macro: {table-row}
Unknown macro: {table-cell}

implementation.java

Unknown macro: {table-cell}

Support for SCA components implemented with Java classes

Unknown macro: {table-cell}

Available from 0.90

Unknown macro: {table-row}
Unknown macro: {table-cell}

implementation.script

Unknown macro: {table-cell}

Support for SCA components implemented with scripting languages

Unknown macro: {table-cell}

Available from 0.90

Unknown macro: {table-row}
Unknown macro: {table-cell}

implementation.spring

Unknown macro: {table-cell}

Support for spring

Unknown macro: {table-cell}

Available from 0.91

Unknown macro: {table-row}
Unknown macro: {table-cell}

implementation.resource

Unknown macro: {table-cell}

exposes file resources

Unknown macro: {table-cell}

Available from 0.91

Unknown macro: {table-row}
Unknown macro: {table-cell}

implementation.bpel

Unknown macro: {table-cell}

Support for components implemented in BPEL

Unknown macro: {table-cell}

Available from 1.0

Unknown macro: {table-row}
Unknown macro: {table-cell}

implementation.osgi

Unknown macro: {table-cell}

Support for osgi

Unknown macro: {table-cell}

Available from 1.0

Unknown macro: {table-cell}

implementation.xquery

Unknown macro: {table-cell}

Support for components implemented in xquery

Unknown macro: {table-cell}

Available from 1.0

Unknown macro: {table-row}
Unknown macro: {table-cell}

implementation.widget

Unknown macro: {table-cell}

Support wiring of SCA components in Web 2.0 style applications

Unknown macro: {table-cell}

Available from 1.0

Unknown macro: {table-row}
Unknown macro: {table-cell}

Unknown macro: {bgcolor}

Protocol Bindings

">
Unknown macro: {bgcolor}

Protocol Bindings

Unknown macro: {table-row}
Unknown macro: {table-cell}

binding.ajax

Unknown macro: {table-cell}

Communication with AJAX clients

Unknown macro: {table-cell}

Available from 0.90

Unknown macro: {table-row}
Unknown macro: {table-cell}

binding.jms

Unknown macro: {table-cell}

Asynchronous JMS messaging

Unknown macro: {table-cell}

Available from 1.1

Unknown macro: {table-row}
Unknown macro: {table-cell}

binding.jsonrpc

Unknown macro: {table-cell}

The JSON-RPC protocol

Unknown macro: {table-cell}

Available from 0.90

Unknown macro: {table-row}
Unknown macro: {table-cell}

binding.rmi

Unknown macro: {table-cell}

The Java RMI protocol

Unknown macro: {table-cell}

Available from 0.90

Unknown macro: {table-row}
Unknown macro: {table-cell}

binding.ws

Unknown macro: {table-cell}

SOAP/HTTP web services

Unknown macro: {table-cell}

Available from 0.90

Unknown macro: {table-row}
Unknown macro: {table-cell}

binding.ejb

Unknown macro: {table-cell}

EJB Binding

Unknown macro: {table-cell}

Available from 0.90

Unknown macro: {table-row}
Unknown macro: {table-cell}

binding.rss

Unknown macro: {table-cell}

Consumes or provides an RSS feed

Unknown macro: {table-cell}

Available from 0.91

Unknown macro: {table-cell}

binding.atom

Unknown macro: {table-cell}

supports Atom-publishing (a standard REST protocol), allowing you to create, retrieve, update, delete Atom entries

Unknown macro: {table-cell}

Available from 0.91

Unknown macro: {table-row}
Unknown macro: {table-cell}

Unknown macro: {bgcolor}

Data Bindings

">
Unknown macro: {bgcolor}

Data Bindings

Unknown macro: {table-row}
Unknown macro: {table-cell}

databinding-axiom

Unknown macro: {table-cell}

Support for AXIOM databinding

Unknown macro: {table-cell}

Available from 0.90

Unknown macro: {table-row}
Unknown macro: {table-cell}

databinding-jaxb

Unknown macro: {table-cell}

Support for JAXB databinding

Unknown macro: {table-cell}

Available from 0.90

Unknown macro: {table-row}
Unknown macro: {table-cell}

databinding-sdo

Unknown macro: {table-cell}

Support for SDO databinding 

Unknown macro: {table-cell}

Available from 0.90

Unknown macro: {table-row}
Unknown macro: {table-cell}

databinding-sdo-axiom

Unknown macro: {table-cell}

Support optimzed SDO to AXIOM transformation

Unknown macro: {table-cell}

Available from 0.90

Unknown macro: {table-row}
Unknown macro: {table-cell}

Unknown macro: {bgcolor}

Interfaces

">
Unknown macro: {bgcolor}

Interfaces

Unknown macro: {table-row}
Unknown macro: {table-cell}

interface-java

Unknown macro: {table-cell}

Interfaces described with java interfaces

Unknown macro: {table-cell}

Available from 0.90

Unknown macro: {table-row}
Unknown macro: {table-cell}

interface-wsdl

Unknown macro: {table-cell}

Interfaces described with WSDL definitions

Unknown macro: {table-cell}

Available from 0.90

Unknown macro: {table-row}
Unknown macro: {table-cell}

Unknown macro: {bgcolor}

Hosts

">
Unknown macro: {bgcolor}

Hosts

Unknown macro: {table-row}
Unknown macro: {table-cell}

http-jetty

Unknown macro: {table-cell}

The integration between Tuscany and the Jetty web container

Unknown macro: {table-cell}

Available from 0.90

Unknown macro: {table-row}
Unknown macro: {table-cell}

http-tomcat

Unknown macro: {table-cell}

The integration between Tuscany and the Tomcat web container

Unknown macro: {table-cell}

Available from 0.90

Unknown macro: {table-row}

Unknown macro: {bgcolor}

Using Extensions

">
Unknown macro: {bgcolor}

Using Extensions

Extensions are loaded into the Tuscany SCA runtime using the Java service loading mechanism. Each extension is packaged as a jar and provides a file;

META-INF/services/org.apache.tuscany.sca.core.ModuleActivator

Using this information the Tuscany SCA runtime will load each extensions present on the the Java CLASSPATH. So if you want to use a particular feature make sure that it's available on your classpath. Conversely if you don't want a particular feature to be active remove it from the classpath.

Writing a new extension is a subject in its own right and is described in the extension guide

Unknown macro: {bgcolor}

Tuscany SCA And IDEs

">
Unknown macro: {bgcolor}

Tuscany SCA And IDEs

Unknown macro: {bgcolor}

Using The Samples In An IDE Without Maven

">
Unknown macro: {bgcolor}

Using The Samples In An IDE Without Maven

We don't provide any IDE project files with our disitributions so you will have to import the sample files into your IDE manually. Here's an example of how it can be done using Eclipse. Here the directory tuscany_sca_install_dir is the directory whch holds the Tuscany SCA Java binary installation after it's been extracted from its archive file, for example, for the 0.90 release this will be tuscany-sca-0.90-incubating.

In a new or existing workspace

  • Create a new java project to represent the sample you want to work on, e.g.
    my working dir/calculator
    
  • Import all of the sample code and resources into this project, e.g.
    Use the File,Import menu and then select  tuscany_sca_install_dir/samples/calculator from the filesystem
    
  • Configure the source path to include
    tuscany_sca_install_dir/samples/calculator/src/main/java
    tuscany_sca_install_dir/samples/calculator/src/main/resources
    
  • Configure the output folder to be
    tuscany_sca_install_dir/samples/calculator/target
    
  • Configure the build path to include all of the jars provided in
    tuscany_sca_install_dir/lib
    
  • If you select calculator.CalculatorClient.java and run as "Java Application" you should see
    3 + 2=5.0
    3 - 2=1.0
    3 * 2=6.0
    3 / 2=1.5
    

The details of how to do this for other development environments will vary but the process will be similar.

Unknown macro: {bgcolor}

Using The Samples In An IDE If You Have Maven

">
Unknown macro: {bgcolor}

Using The Samples In An IDE If You Have Maven

If you are a Maven user you can use it to generate all of the IDE project files for you automatically. This works best if you generate IDE projects for all of the Apache Tuscany modules. You can then include the ones you are interested in working with in you IDE.

To build IDE project files for all of the modules in Apache Tuscany SCA;

cd sca 

If you are an Eclipse user do the following

mvn -Peclipse eclipse:eclipse  

If you are an IDEA user do the following

mvn idea:idea

These commands generate project files for each module in Apache Tuscany SCA. The modules you are interested in can now be included in your IDE, for example, in Eclipse, if you create a new Java project and use the option to "create a new project from existing source" you can specify an SCA module directory, which includes the generated project files, and Eclipse will treat it like any other Java project.

Unknown macro: {HTMLcomment}
  • No labels