SlideShare a Scribd company logo
IBM Software Group
1
http://tuscany.apache.org
Building Applications with Apache Tuscany
Luciano Resende
lresende@apache.org
http://lresende.blogspot.com
Jean-Sebastien Delfino
jsdelfino@apache.org
http://jsdelfino.blogspot.com
Simon Laws
slaws@apache.org
IBM Software Group
2
http://tuscany.apache.org
Abstract
Building and composing the components of a distributed
application can be a challenge and complex bespoke solutions are
commonplace. The Apache Tuscany runtime, and the Service
Component Architecture (SCA) on which the runtime is based,
simplify the process by presenting a component based application
assembly model. In this talk we look at the Tuscany travel booking
application and explain how the individual components of the
application are constructed using a variety of technologies
including Java, Spring, BPEL and Python. We also look at how
these services are wired together using a variety of communication
protocols such as SOAP/HTTP and JSON-RPC. The complete
model can then be deployed to both stand-alone and distributed
runtimes without changes to the application itself.
IBM Software Group
3
http://tuscany.apache.org
Agenda
 Service Component Architecture
 Apache Tuscany
 TuscanySCATours, a Sample Travel Booking App
– Development Process
 Packaging, Build, Test
 Extending the App
o Bindings
o Spring
o BPEL
o Policies
 Deploying to an SCA Domain
 Getting Involved
IBM Software Group
4
http://tuscany.apache.org
SCA and Apache Tuscany
IBM Software Group
5
http://tuscany.apache.org
Enterprise App Development - History
Time
Web Services
 services
 service Interfaces
X business logic mixed with
tech APIs
X no Components
X no policy model
Service Component
Architecture (SCA)
 service Components
 business logic shielded from
tech APIs
 reusable components in
multiple programming languages
 easy to assemble into
compositions
 easy to bind to different
protocols
 external policy configuration
Flexibility
Agility
ROI
Monolithic
X business logic mixed
with communication logic
X no service interfaces
X no components
X no policies
SCA and Cloud Computing
 elastic composites
 more componentization
 portability across clouds
 easy to wire, rewire,
reconfigure
 policies and Provisioning
IBM Software Group
6
http://tuscany.apache.org
SCA Assembly Model
Composite A
Component
AService
Service Binding
Web Service
JMS
SLSB
Rest
JSONRPC
JCA
…
Reference Binding
Web Service
JMS
SLSB
Rest
JSONRPC
JCA
…
Component
B
Service Interface
- Java
- WSDL
Reference Interface
Reference
property setting
Property
promotepromote wire
Implementation
Java
BPEL
PHP
SCA composite
Spring
EJB module
…
- Java
- WSDL
IBM Software Group
7
http://tuscany.apache.org
Assembly
Implementation
Languages
Policy Framework Bindings
Java Java EE
Spring
C++
BPEL
Security
RM
Transactions
Web services
JMS
JCA
SCA Specifications
• SCA is going through a formal standardization process at
OASIS OpenCSA (http://www.oasis-opencsa.org)
IBM Software Group
8
http://tuscany.apache.org
OASIS Open CSA - http://www.oasis-opencsa.org/
IBM Software Group
9
http://tuscany.apache.org
Apache Tuscany
 Apache Tuscany provides a component based programming model
which simplifies development, assembly and deployment and
management of composite applications.
 Apache Tuscany implements SCA standards defined by OASIS
OpenCSA + extensions based on community feedback.
9
IBM Software Group
10
http://tuscany.apache.org
TuscanySCATours
Sample Travel Booking Application
IBM Software Group
11
http://tuscany.apache.org
Tuscany SCA In Action
 Example from Tuscany Book
 http://www.manning.com/laws/
Example can be downloaded from Apache Tuscany
– http://tuscany.apache.org/sca-java-travel-sample-1x-releases.html
IBM Software Group
12
http://tuscany.apache.org
The TuscanySCATours Shopping Site
IBM Software Group
13
http://tuscany.apache.org
TuscanySCATours App on a Napkin
>ls -lsa
UI
Partner
Coordination
Trip
Hotel
Flight
Car
Partners
Shopping
Cart
Payment
Credit
Card
Payment
Partner
Links to other
organizations
IBM Software Group
14
http://tuscany.apache.org
Map to SCA composites and components
Payment
composite
component
referenceservice
As an SCA composite:
Payment
Java
payment
Payment
creditCard
Payment
EmailGateway
Java
Email
Gateway
email
Gateway
CustomerRegistry
Java
Customer
Registry
customer
Registry
transactionFee
property
IBM Software Group
15
http://tuscany.apache.org
Prototype and Fill in the Blanks
• Very easy to create simple components, wire them together
and get them running
• Doing this with simple implementations allows you to get a
feel for the app without implementing all of the moving
parts in detail
• A quick way to prototype an app and define the important
components and their service interfaces
• The prototype components can then be distributed to a team
for detailed implementation and testing
IBM Software Group
16
http://tuscany.apache.org
Payment Java Component Implementation
@Service(Payment.class)
public class PaymentImpl implements Payment {
@Reference
protected CustomerRegistry customerRegistry;
@Reference
protected CreditCardPayment creditCardPayment;
@Reference
protected EmailGateway emailGateway;
@Property
protected float transactionFee = 0.01f;
public String makePaymentMember(String customerId, float amount) {
try {
Customer customer = customerRegistry.getCustomer(customerId);
String status = creditCardPayment.authorize(customer.getCreditCard(), amount + transactionFee);
emailGateway.sendEmail("order@tuscanyscatours.com",
customer.getEmail(),
"Status for your payment",
customer + " >>> Status = " + status);
return status;
} catch (CustomerNotFoundException ex) {
return "Payment failed due to " + ex.getMessage();
} catch (AuthorizeFault_Exception e) {
return e.getFaultInfo().getErrorCode();
} catch (Throwable t) {
return "Payment failed due to system error " + t.getMessage();
}
}
}
IBM Software Group
17
http://tuscany.apache.org
Payment Composite
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://tuscanyscatours.com/"
name="payment">
<component name="Payment">
<implementation.java class="com.tuscanyscatours.payment.impl.PaymentImpl" />
<service name="Payment"/>
<reference name="customerRegistry" target="CustomerRegistry" />
<reference name="creditCardPayment" />
<reference name="emailGateway" target="EmailGateway" />
<property name="transactionFee">0.02</property>
</component>
<component name="CustomerRegistry">
<implementation.java class="com.tuscanyscatours.customer.impl.CustomerRegistryImpl" />
</component>
<component name="EmailGateway">
<implementation.java class="com.tuscanyscatours.emailgateway.impl.EmailGatewayImpl" />
</component>
</composite>
IBM Software Group
18
http://tuscany.apache.org
SCA and WS Bindings
Payment
CreditCard
Payment
EmailGateway
Java
Java
creditcard
Java
payment
Payment
Email
Gateway
CreditCard
Payment
creditCard
Payment
email
Gateway
CustomerRegistry
Java
Customer
Registry
customer
Registry
transactionFee
(8081)
(8082)
binding.ws
binding.sca
binding.ws
binding.ws
binding.sca
binding.sca
binding.sca
IBM Software Group
19
http://tuscany.apache.org
SCA Payment Composite – with WS Bindings
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://tuscanyscatours.com/"
name="payment">
<component name="Payment">
<implementation.java class="com.tuscanyscatours.payment.impl.PaymentImpl" />
<service name="Payment">
<binding.ws uri="http://localhost:8081/Payment" />
</service>
<reference name="customerRegistry" target="CustomerRegistry" />
<reference name="creditCardPayment">
<binding.ws uri="http://localhost:8082/CreditCardPayment" />
</reference>
<reference name="emailGateway" target="EmailGateway" />
<property name="transactionFee">0.02</property>
</component>
<component name="CustomerRegistry">
<implementation.java class="com.tuscanyscatours.customer.impl.CustomerRegistryImpl" />
</component>
<component name="EmailGateway">
<implementation.java class="com.tuscanyscatours.emailgateway.impl.EmailGatewayImpl" />
</component>
</composite>
IBM Software Group
20
http://tuscany.apache.org
Web 2.0 Bindings and Widget Components
• Web 2.0 bindings: REST, JSON, JSONRPC, DWR,
Feeds (ATOM, RSS)
• Tuscany Widget implementation representing Web components,
with Javascript dependency injection
• Other scripting implementation types
IBM Software Group
21
http://tuscany.apache.org
SCA Payment Composite – JSON-RPC Bindings
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://tuscanyscatours.com/"
name="payment">
<component name="Payment">
<implementation.java class="com.tuscanyscatours.payment.impl.PaymentImpl" />
<service name="Payment">
<binding.jsonrpc uri="http://localhost:8081/Payment" />
</service>
<reference name="customerRegistry" target="CustomerRegistry" />
<reference name="creditCardPayment">
<binding.jsonrpc uri="http://localhost:8082/CreditCardPayment" />
</reference>
<reference name="emailGateway" target="EmailGateway" />
<property name="transactionFee">0.02</property>
</component>
<component name="CustomerRegistry">
<implementation.java class="com.tuscanyscatours.customer.impl.CustomerRegistryImpl" />
</component>
<component name="EmailGateway">
<implementation.java class="com.tuscanyscatours.emailgateway.impl.EmailGatewayImpl" />
</component>
</composite>
IBM Software Group
22
http://tuscany.apache.org
Packaging and Deployment
• Service implementations are deployed into an SCA Domain
– Represents the SCA runtime configuration
– In general heterogeneous with distributed SCA runtime Nodes.
– Defines the scope of what can be connected by SCA Wires
• SCA Domain configuration is a Domain Composite
– Final configuration for service dependencies, properties, bindings,
policies
• Implementation artifacts and their configuration added to a Domain as
Contributions
– Many packaging formats (JAR, ZIP, Folder etc.)
– Artifacts (Classes, XSD, WSDL, BPEL etc.) may be shared
between Contributions
IBM Software Group
23
http://tuscany.apache.org
Building Contributions with Maven
• Using Maven project layout, place composites, component
implementations, interfaces and other required artifacts together
• Use mvn eclipse:eclipse to build an Eclipse project
IBM Software Group
24
http://tuscany.apache.org
Developing in Eclipse
• To import an SCA contribution built using Maven into Eclipse
– Set M2_REPO
 Import your contribution project previously built using mvn eclipse:eclipse
• If you're building an SCA contribution from scratch in Eclipse, add a
dependency on the Tuscany runtime Jars
 An easy way to do this is to create an Eclipse user defined library that includes
all the Tuscany Jars and dependencies, and add this library to your new
contribution
IBM Software Group
25
http://tuscany.apache.org
Payment-java Contribution in Eclipse
IBM Software Group
26
http://tuscany.apache.org
Running in a Single JVM
• To test payment-java we need three more things
 The creditcard-payment-jaxb contribution. This contains the
composite that defines the CreditCardPayment service that the
Payment component references
 The launcher-payment-java project that loads these two
contributions into Tuscany and then calls the Payment
component
 The util-launcher-common project which contains a few utilities
that we wrote for the TuscanySCATours application
IBM Software Group
27
http://tuscany.apache.org
Embedding Tuscany
public class PaymentLauncher {
public static void main(String[] args) throws Exception {
SCANode node = SCANodeFactory.newInstance().createSCANode(null,
locate("payment-java"),
locate("creditcard-payment-jaxb"));
node.start();
SCAClient client = (SCAClient)node;
Payment payment = client.getService(Payment.class, "Payment");
System.out.println("Payment Java test");
System.out.println("nSuccessful Payment - Status = nn" + payment.makePaymentMember("c-0", 100.00f));
System.out.println("nnFailed Payment - Status = nn" + payment.makePaymentMember("c-1", 100.00f));
node.stop();
}
The locate() operation is a utility we created for this sample which simply locates
a contribution in the sample directory structure and returns its location.
IBM Software Group
28
http://tuscany.apache.org
Spring Bean Component Implementation
Property
Name: transactionFee
Type: float
</bean>
</bean>
<property name="transactionFee"
value="0.5f"/>
Payment
component
type
<property name="creditCardPayment"
ref="creditCardPaymentReference"/>
<bean id="Payment"
class="com.tuscanyscatours.payment.impl.PaymentImpl">
Service
Name: Payment
Interface: payment.Payment
Reference
Name: creditCardPaymentReference
Interface:
payment.creditcard.CreditCardPayment
IBM Software Group
29
http://tuscany.apache.org
Payment Spring Component
Payment
CreditCard
Payment
Spring
creditcard
Java
payment
Payment
CreditCard
Payment
creditCard
Payment
transactionFee
(8082)
binding.ws
binding.ws
binding.ws
IBM Software Group
30
http://tuscany.apache.org
Payment Spring Context
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:sca="http://www.springframework.org/schema/sca"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="Payment" class="com.tuscanyscatours.payment.impl.PaymentImpl">
<property name="creditCardPayment" ref="creditCardPaymentReference"/>
<property name="emailGateway" ref="EmailGateway"/>
<property name="customerRegistry" ref="CustomerRegistry"/>
<property name="transactionFee" value="0.5f"/>
</bean>
<bean id="CustomerRegistry"
class="com.tuscanyscatours.customer.impl.CustomerRegistryImpl">
</bean>
<bean id="EmailGateway"
class="com.tuscanyscatours.emailgateway.impl.EmailGatewayImpl">
</bean>
</beans>
IBM Software Group
31
http://tuscany.apache.org
Payment Composite
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://tuscanyscatours.com/"
name="payment">
<component name="Payment">
<implementation.spring location="Payment-context.xml"/>
<service name="Payment">
<binding.ws uri="http://localhost:8081/Payment"/>
</service>
<reference name="creditCardPaymentReference">
<binding.ws uri="http://localhost:8082/CreditCardPayment"/>
</reference>
<property name="transactionFee">1.23</property>
</component>
</composite>
IBM Software Group
32
http://tuscany.apache.org
•BPEL Process Component Implementation
ShoppingCart
Payment
Payment Process
Email
Gateway
implementation.bpel
<variable/>
<partnerLink/>
<partnerLink/>
<partnerLink/>
<process>
<sequence>
<receive/>
...
<invoke/>
...
<invoke/>
...
<reply/>
</sequence>
</process>
reference
referenceservice
property
IBM Software Group
33
http://tuscany.apache.org
Payment BPEL Process Component
Payment
CreditCard
Payment
EmailGateway
BPEL
Java
creditcard
Java
payment
Payment
Email
Gateway
CreditCard
Payment
creditCard
Payment
email
Gateway
CustomerRegistry
Java
Customer
Registry
customer
Registry
transactionFee
(8081)
(8082)
binding.ws
binding.sca
binding.ws
binding.ws
binding.sca
binding.sca
binding.sca
IBM Software Group
34
http://tuscany.apache.org
Payment BPEL process
<process name="Payment" targetNamespace="http://www.tuscanyscatours.com/Payment" ...>
<import location="Payment.wsdl"
importType="http://schemas.xmlsoap.org/wsdl/"
namespace="http://www.tuscanyscatours.com/Payment/"/>
<import location="CreditCardPayment.wsdl"
importType="http://schemas.xmlsoap.org/wsdl/"
namespace="http://www.tuscanyscatours.com/CreditCardPayment/"/>
<import location="EmailGateway.wsdl"
importType="http://schemas.xmlsoap.org/wsdl/"
namespace="http://www.tuscanyscatours.com/EmailGateway/"/>
<partnerLinks>
<partnerLink name="paymentPartnerLink" partnerLinkType="pp:PaymentLinkType" myRole="forward" />
<partnerLink name="creditCardPaymentPartnerLink" partnerLinkType="ccp:CreditCardPaymentLinkType"
partnerRole="forward" initializePartnerRole="yes" />
<partnerLink name="emailGatewayPartnerLink" partnerLinkType="eg:EmailGatewayLinkType"
partnerRole="forward" initializePartnerRole="yes" />
</partnerLinks>
<variables>
<variable name="makePaymentMemberRequestMessage" messageType="pp:MakePaymentMemberRequest"/>
<variable name="makePaymentMemberResponseMessage" messageType="pp:MakePaymentMemberResponse"/>
....
</variables>
<sequence>
<receive name="start"
partnerLink="paymentPartnerLink"
portType="pp:Payment"
operation="makePaymentMember"
variable="makePaymentMemberRequestMessage"
createInstance="yes"/>
IBM Software Group
35
http://tuscany.apache.org
Payment Composite
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
xmlns:pp="http://www.tuscanyscatours.com/Payment"
targetNamespace="http://www.tuscanyscatours.com/Payment"
name="payment">
<component name="Payment">
<implementation.bpel process="pp:Payment"/>
<service name="paymentPartnerLink">
<interface.wsdl interface="http://www.tuscanyscatours.com/Payment/#wsdl.interface(Payment)" />
<binding.ws uri="http://localhost:8080/Payment"
wsdlElement="http://www.tuscanyscatours.com/Payment/#wsdl.service(PaymentService)"/>
</service>
<reference name="creditCardPaymentPartnerLink">
<binding.ws uri="http://localhost:8082/CreditCardPayment"/>
</reference>
<reference name="emailGatewayPartnerLink">
<binding.ws uri="http://localhost:8088/EmailGateway"/>
</reference>
</component>
</composite>
IBM Software Group
36
http://tuscany.apache.org
SCA Policies
Payment
CreditCard
Payment
EmailGateway
Spring
Java
creditcard
Java
payment
Authentication
Payment
Email
Gateway
CreditCard
Payment
creditCard
Payment
email
Gateway
CustomerRegistry
Java
Customer
Registry
customer
Registry
transactionFee
(8081)
(8082)
Authentication
binding.ws
binding.sca
binding.ws
binding.ws
binding.sca
binding.sca
binding.sca
IBM Software Group
37
http://tuscany.apache.org
Adding Policy Intents
<component name="Payment">
<implementation.spring location="Payment-context.xml"/>
<service name="Payment">
<binding.ws uri="http://localhost:8081/Payment"/>
</service>
<reference name="creditCardPaymentReference" >
<binding.ws uri="http://localhost:8082/CreditCardPayment" requires="authentication"/>
</reference>
<reference name="emailGateway" target="EmailGateway"/>
<reference name="customerRegistry" target="CustomerRegistry"/>
<property name="transactionFee">1.23</property>
</component>
<component name="CreditCardPayment">
<implementation.java class="com.tuscanyscatours.payment.creditcard.impl.CreditCardPaymentImpl" />
<service name="CreditCardPayment">
<interface.wsdl
interface="http://www.tuscanyscatours.com/CreditCardPayment/#wsdl.interface(CreditCardPayment)" />
<binding.ws uri="http://localhost:8082/CreditCardPayment" requires="authentication"/>
<binding.sca/>
</service>
</component>
IBM Software Group
38
http://tuscany.apache.org
Defining policy sets
<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
<policySet name="BasicAuthenticationPolicySet"
provides="authentication"
appliesTo="sca:binding.ws">
<tuscany:basicAuthentication>
<tuscany:userName>myname</tuscany:userName>
<tuscany:password>mypassword</tuscany:password>
</tuscany:basicAuthentication>
</policySet>
</definitions>
IBM Software Group
39
http://tuscany.apache.org
Adding more components - 1
TuscanySCA
ToursUser
Interface
TravelCatalog
TripBooking
ShoppingCart
Hotel
Partner
Flight
Partner
Car
Partner
Currency
Converter
Trip
Partner
Java
Java
Java
Java
Java
widget
(8080)
fullapp-coordination fullapp-packagedtrip
fullapp-bespoketrip
fullapp-currency
fullapp-shoppingcart
Java
Java
Java
CartStore
Java
>ls -lsa
SCATours
Java
LoggingquoteCurrency
Code
TravelCatalog
Search
TripBooking
SCATours
Booking
SCATours
Cart
SCATours
Search
Search
Search
Search
Search
Book
Book
Book
Book
Currency
Converter
Cart
Updates
Cart
Initialize
CartStore
trip
Search
hotel
Search
flight
Search
car
Search
currency
Converter
trip
Book
hotel
Book
flight
Book
car
Book
car
Book
cart
Updates
scaTours
Search
scaTours
Booking
scaTours
Cart
travelCatalog
Search
tripBooking
cartInitialize
payment
cartStore
cartCheckout
Cart
Checkout
to Payment component
(8085)
fullapp-ui
(8084) (8083)
(8086)
(8087)
IBM Software Group
40
http://tuscany.apache.org
Adding more components - 2
Payment
CreditCard
Payment
EmailGateway
Spring
Java
creditcard
Java
payment
Authentication
Payment
Email
Gateway
CreditCard
Payment
creditCard
Payment
email
Gateway
CustomerRegistry
Java
Customer
Registry
customer
Registry
from ShoppingCart
component transactionFee
(8081)
(8082)
Authentication
IBM Software Group
41
http://tuscany.apache.org
SCA Domain
A distributed deployment
of the assembly.
IBM Software Group
42
http://tuscany.apache.org
Running Multiple Tuscany Nodes
public class FullAppNodesLauncher {
public static void main(String[] args) throws Exception {
SCANode nodeCreditcard =
SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/creditcard");
nodeCreditcard.start();
SCANode nodePayment =
SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/payment");
nodePayment.start();
SCANode nodeShoppingcart =
SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/shoppingcart");
nodeShoppingcart.start();
SCANode nodeCurrency =
SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/currency");
nodeCurrency.start();
SCANode nodePackagedtrip =
SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/packagedtrip");
nodePackagedtrip.start();
SCANode nodeBespoketrip =
SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/bespoketrip");
nodeBespoketrip.start();
SCANode nodeFrontend =
SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/coordination");
nodeFrontend.start();
SCANode nodeUI = SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/ui");
nodeUI.start();
...
}
IBM Software Group
43
http://tuscany.apache.org
Getting Involved
with Apache Tuscany
IBM Software Group
44
http://tuscany.apache.org
SCA - Resources
 Good introduction to SCA
 http://www.davidchappell.com/articles/Introducing_SCA.pdf
 OASIS Open CSA – http://www.oasis-opencsa.org
 V1.1 level specs
 http://www.oasis-opencsa.org/sca
 Open CSA Technical Committees
 http://www.oasis-opencsa.org/committees
 OSOA
 http://osoa.org/display/Main/Home
 More information on that site
 http://osoa.org/display/Main/SCA+Resources
IBM Software Group
45
http://tuscany.apache.org
Apache Tuscany Resources
 Apache Tuscany
 http://tuscany.apache.org
 Getting Involved
 http://tuscany.apache.org/getting-involved.html
 Tuscany SCA Java Releases
 http://tuscany.apache.org/sca-java-2x-releases.html
 http://tuscany.apache.org/sca-java-releases.html
 Tuscany SCA Java Documentation
 http://tuscany.apache.org/java-sca-documentation-menu.html
 Tuscany Dashboard
 http://tuscany.apache.org/tuscany-dashboard.html
IBM Software Group
46
http://tuscany.apache.org
Getting Involved
with Apache Nuvem
IBM Software Group
47
http://tuscany.apache.org
Apache Nuvem Resources
 Apache Nuvem
 http://incubator.apache.org/nuvem/
 Getting Involved
 http://incubator.apache.org/nuvem/nuvem-getting-involved.html
IBM Software Group
48
http://tuscany.apache.org
Thank You !!!

More Related Content

PDF
ApacheCon NA 2010 - High Performance Cloud-enabled SCA Runtimes
PDF
SCA Reaches the Cloud
PPT
Lamp
PPTX
Laravel Tutorial PPT
PPTX
Phalcon 2 High Performance APIs - DevWeekPOA 2015
PPTX
Introduction to laravel framework
PDF
Installing and Getting Started with Alfresco
PPT
Php Asp Net Interoperability Rc Jao
ApacheCon NA 2010 - High Performance Cloud-enabled SCA Runtimes
SCA Reaches the Cloud
Lamp
Laravel Tutorial PPT
Phalcon 2 High Performance APIs - DevWeekPOA 2015
Introduction to laravel framework
Installing and Getting Started with Alfresco
Php Asp Net Interoperability Rc Jao

What's hot (19)

PPTX
Laravel ppt
PDF
Flows for APEX
PPTX
A introduction to Laravel framework
PDF
AWS Observability Made Simple
PDF
Laravel (8) php_framework_handbook__start_from_zer_18604872_(z-lib.org)
ODP
Jazoon2010 - Edgar Silva - Open source SOA on Steroids
PDF
What is LAMP?
PPTX
開放原始碼 Ch1.2 intro - oss - apahce foundry (ver 2.0)
PDF
Spring In Alfresco Ecm
PPTX
API Development with Laravel
PDF
Native REST Web Services with Oracle 11g
PDF
APEX richtig installieren und konfigurieren
PPT
Ruby On Rails Seminar Basis Softexpo Feb2010
PDF
FOSSASIA 2015: MySQL Group Replication
PDF
How to Use NDS eDirectory to Secure Apache Web Server for NetWare
PDF
Mastering Universal Theme with corporate design from Union Investment
PDF
Oracle API Gateway Installation
PPTX
ASP.NET 5: What's the Big Deal
PDF
Lifecycleofhostdeployedwithforemanandautomated
Laravel ppt
Flows for APEX
A introduction to Laravel framework
AWS Observability Made Simple
Laravel (8) php_framework_handbook__start_from_zer_18604872_(z-lib.org)
Jazoon2010 - Edgar Silva - Open source SOA on Steroids
What is LAMP?
開放原始碼 Ch1.2 intro - oss - apahce foundry (ver 2.0)
Spring In Alfresco Ecm
API Development with Laravel
Native REST Web Services with Oracle 11g
APEX richtig installieren und konfigurieren
Ruby On Rails Seminar Basis Softexpo Feb2010
FOSSASIA 2015: MySQL Group Replication
How to Use NDS eDirectory to Secure Apache Web Server for NetWare
Mastering Universal Theme with corporate design from Union Investment
Oracle API Gateway Installation
ASP.NET 5: What's the Big Deal
Lifecycleofhostdeployedwithforemanandautomated
Ad

Viewers also liked (7)

PPTX
Presentation1
PDF
03 leitor
PDF
ApacheCon NA 2010 - Developing Composite Apps for the Cloud with Apache Tuscany
PDF
GRALHA AZUL no. 57 - JANEIRO 2016
PPT
Job analysis
PDF
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
PDF
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Presentation1
03 leitor
ApacheCon NA 2010 - Developing Composite Apps for the Cloud with Apache Tuscany
GRALHA AZUL no. 57 - JANEIRO 2016
Job analysis
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Ad

Similar to ApacheCon NA 2010 - Building Apps with Apache Tuscany (20)

PDF
Building apps with tuscany
PDF
S314011 - Developing Composite Applications for the Cloud with Apache Tuscany
PDF
Maxim Salnikov - Service Worker: taking the best from the past experience for...
PPTX
How to use soap component
PPTX
Let's play with adf 3.0
PPTX
Soap Component
PDF
Apache Stratos Hangout VI
PDF
Apache Samza 1.0 - What's New, What's Next
PDF
Rest web service_with_spring_hateoas
PPTX
Using state-engine-as-sca-component-final
PPT
Dh2 Apps Training Part2
PDF
Bn1001 demo ppt advance dot net
PDF
Service-Oriented Integration With Apache ServiceMix
PPT
Asp.net tips
PDF
JavaEE6 my way
PPTX
Apache Camel framework Presentation and selection of apache camel for various...
PDF
RAHUL_Updated( (2)
PDF
sap in one day Activites fir basis person
PPTX
StrongLoop Overview
ODP
Interoperable Web Services with JAX-WS and WSIT
Building apps with tuscany
S314011 - Developing Composite Applications for the Cloud with Apache Tuscany
Maxim Salnikov - Service Worker: taking the best from the past experience for...
How to use soap component
Let's play with adf 3.0
Soap Component
Apache Stratos Hangout VI
Apache Samza 1.0 - What's New, What's Next
Rest web service_with_spring_hateoas
Using state-engine-as-sca-component-final
Dh2 Apps Training Part2
Bn1001 demo ppt advance dot net
Service-Oriented Integration With Apache ServiceMix
Asp.net tips
JavaEE6 my way
Apache Camel framework Presentation and selection of apache camel for various...
RAHUL_Updated( (2)
sap in one day Activites fir basis person
StrongLoop Overview
Interoperable Web Services with JAX-WS and WSIT

Recently uploaded (20)

PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Encapsulation theory and applications.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
KodekX | Application Modernization Development
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Electronic commerce courselecture one. Pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Empathic Computing: Creating Shared Understanding
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Network Security Unit 5.pdf for BCA BBA.
Encapsulation theory and applications.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
NewMind AI Monthly Chronicles - July 2025
Diabetes mellitus diagnosis method based random forest with bat algorithm
Review of recent advances in non-invasive hemoglobin estimation
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
20250228 LYD VKU AI Blended-Learning.pptx
KodekX | Application Modernization Development
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Understanding_Digital_Forensics_Presentation.pptx
Electronic commerce courselecture one. Pdf
The AUB Centre for AI in Media Proposal.docx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Encapsulation_ Review paper, used for researhc scholars
Empathic Computing: Creating Shared Understanding
Mobile App Security Testing_ A Comprehensive Guide.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf

ApacheCon NA 2010 - Building Apps with Apache Tuscany

  • 1. IBM Software Group 1 http://tuscany.apache.org Building Applications with Apache Tuscany Luciano Resende lresende@apache.org http://lresende.blogspot.com Jean-Sebastien Delfino jsdelfino@apache.org http://jsdelfino.blogspot.com Simon Laws slaws@apache.org
  • 2. IBM Software Group 2 http://tuscany.apache.org Abstract Building and composing the components of a distributed application can be a challenge and complex bespoke solutions are commonplace. The Apache Tuscany runtime, and the Service Component Architecture (SCA) on which the runtime is based, simplify the process by presenting a component based application assembly model. In this talk we look at the Tuscany travel booking application and explain how the individual components of the application are constructed using a variety of technologies including Java, Spring, BPEL and Python. We also look at how these services are wired together using a variety of communication protocols such as SOAP/HTTP and JSON-RPC. The complete model can then be deployed to both stand-alone and distributed runtimes without changes to the application itself.
  • 3. IBM Software Group 3 http://tuscany.apache.org Agenda  Service Component Architecture  Apache Tuscany  TuscanySCATours, a Sample Travel Booking App – Development Process  Packaging, Build, Test  Extending the App o Bindings o Spring o BPEL o Policies  Deploying to an SCA Domain  Getting Involved
  • 5. IBM Software Group 5 http://tuscany.apache.org Enterprise App Development - History Time Web Services  services  service Interfaces X business logic mixed with tech APIs X no Components X no policy model Service Component Architecture (SCA)  service Components  business logic shielded from tech APIs  reusable components in multiple programming languages  easy to assemble into compositions  easy to bind to different protocols  external policy configuration Flexibility Agility ROI Monolithic X business logic mixed with communication logic X no service interfaces X no components X no policies SCA and Cloud Computing  elastic composites  more componentization  portability across clouds  easy to wire, rewire, reconfigure  policies and Provisioning
  • 6. IBM Software Group 6 http://tuscany.apache.org SCA Assembly Model Composite A Component AService Service Binding Web Service JMS SLSB Rest JSONRPC JCA … Reference Binding Web Service JMS SLSB Rest JSONRPC JCA … Component B Service Interface - Java - WSDL Reference Interface Reference property setting Property promotepromote wire Implementation Java BPEL PHP SCA composite Spring EJB module … - Java - WSDL
  • 7. IBM Software Group 7 http://tuscany.apache.org Assembly Implementation Languages Policy Framework Bindings Java Java EE Spring C++ BPEL Security RM Transactions Web services JMS JCA SCA Specifications • SCA is going through a formal standardization process at OASIS OpenCSA (http://www.oasis-opencsa.org)
  • 8. IBM Software Group 8 http://tuscany.apache.org OASIS Open CSA - http://www.oasis-opencsa.org/
  • 9. IBM Software Group 9 http://tuscany.apache.org Apache Tuscany  Apache Tuscany provides a component based programming model which simplifies development, assembly and deployment and management of composite applications.  Apache Tuscany implements SCA standards defined by OASIS OpenCSA + extensions based on community feedback. 9
  • 11. IBM Software Group 11 http://tuscany.apache.org Tuscany SCA In Action  Example from Tuscany Book  http://www.manning.com/laws/ Example can be downloaded from Apache Tuscany – http://tuscany.apache.org/sca-java-travel-sample-1x-releases.html
  • 13. IBM Software Group 13 http://tuscany.apache.org TuscanySCATours App on a Napkin >ls -lsa UI Partner Coordination Trip Hotel Flight Car Partners Shopping Cart Payment Credit Card Payment Partner Links to other organizations
  • 14. IBM Software Group 14 http://tuscany.apache.org Map to SCA composites and components Payment composite component referenceservice As an SCA composite: Payment Java payment Payment creditCard Payment EmailGateway Java Email Gateway email Gateway CustomerRegistry Java Customer Registry customer Registry transactionFee property
  • 15. IBM Software Group 15 http://tuscany.apache.org Prototype and Fill in the Blanks • Very easy to create simple components, wire them together and get them running • Doing this with simple implementations allows you to get a feel for the app without implementing all of the moving parts in detail • A quick way to prototype an app and define the important components and their service interfaces • The prototype components can then be distributed to a team for detailed implementation and testing
  • 16. IBM Software Group 16 http://tuscany.apache.org Payment Java Component Implementation @Service(Payment.class) public class PaymentImpl implements Payment { @Reference protected CustomerRegistry customerRegistry; @Reference protected CreditCardPayment creditCardPayment; @Reference protected EmailGateway emailGateway; @Property protected float transactionFee = 0.01f; public String makePaymentMember(String customerId, float amount) { try { Customer customer = customerRegistry.getCustomer(customerId); String status = creditCardPayment.authorize(customer.getCreditCard(), amount + transactionFee); emailGateway.sendEmail("order@tuscanyscatours.com", customer.getEmail(), "Status for your payment", customer + " >>> Status = " + status); return status; } catch (CustomerNotFoundException ex) { return "Payment failed due to " + ex.getMessage(); } catch (AuthorizeFault_Exception e) { return e.getFaultInfo().getErrorCode(); } catch (Throwable t) { return "Payment failed due to system error " + t.getMessage(); } } }
  • 17. IBM Software Group 17 http://tuscany.apache.org Payment Composite <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://tuscanyscatours.com/" name="payment"> <component name="Payment"> <implementation.java class="com.tuscanyscatours.payment.impl.PaymentImpl" /> <service name="Payment"/> <reference name="customerRegistry" target="CustomerRegistry" /> <reference name="creditCardPayment" /> <reference name="emailGateway" target="EmailGateway" /> <property name="transactionFee">0.02</property> </component> <component name="CustomerRegistry"> <implementation.java class="com.tuscanyscatours.customer.impl.CustomerRegistryImpl" /> </component> <component name="EmailGateway"> <implementation.java class="com.tuscanyscatours.emailgateway.impl.EmailGatewayImpl" /> </component> </composite>
  • 18. IBM Software Group 18 http://tuscany.apache.org SCA and WS Bindings Payment CreditCard Payment EmailGateway Java Java creditcard Java payment Payment Email Gateway CreditCard Payment creditCard Payment email Gateway CustomerRegistry Java Customer Registry customer Registry transactionFee (8081) (8082) binding.ws binding.sca binding.ws binding.ws binding.sca binding.sca binding.sca
  • 19. IBM Software Group 19 http://tuscany.apache.org SCA Payment Composite – with WS Bindings <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://tuscanyscatours.com/" name="payment"> <component name="Payment"> <implementation.java class="com.tuscanyscatours.payment.impl.PaymentImpl" /> <service name="Payment"> <binding.ws uri="http://localhost:8081/Payment" /> </service> <reference name="customerRegistry" target="CustomerRegistry" /> <reference name="creditCardPayment"> <binding.ws uri="http://localhost:8082/CreditCardPayment" /> </reference> <reference name="emailGateway" target="EmailGateway" /> <property name="transactionFee">0.02</property> </component> <component name="CustomerRegistry"> <implementation.java class="com.tuscanyscatours.customer.impl.CustomerRegistryImpl" /> </component> <component name="EmailGateway"> <implementation.java class="com.tuscanyscatours.emailgateway.impl.EmailGatewayImpl" /> </component> </composite>
  • 20. IBM Software Group 20 http://tuscany.apache.org Web 2.0 Bindings and Widget Components • Web 2.0 bindings: REST, JSON, JSONRPC, DWR, Feeds (ATOM, RSS) • Tuscany Widget implementation representing Web components, with Javascript dependency injection • Other scripting implementation types
  • 21. IBM Software Group 21 http://tuscany.apache.org SCA Payment Composite – JSON-RPC Bindings <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://tuscanyscatours.com/" name="payment"> <component name="Payment"> <implementation.java class="com.tuscanyscatours.payment.impl.PaymentImpl" /> <service name="Payment"> <binding.jsonrpc uri="http://localhost:8081/Payment" /> </service> <reference name="customerRegistry" target="CustomerRegistry" /> <reference name="creditCardPayment"> <binding.jsonrpc uri="http://localhost:8082/CreditCardPayment" /> </reference> <reference name="emailGateway" target="EmailGateway" /> <property name="transactionFee">0.02</property> </component> <component name="CustomerRegistry"> <implementation.java class="com.tuscanyscatours.customer.impl.CustomerRegistryImpl" /> </component> <component name="EmailGateway"> <implementation.java class="com.tuscanyscatours.emailgateway.impl.EmailGatewayImpl" /> </component> </composite>
  • 22. IBM Software Group 22 http://tuscany.apache.org Packaging and Deployment • Service implementations are deployed into an SCA Domain – Represents the SCA runtime configuration – In general heterogeneous with distributed SCA runtime Nodes. – Defines the scope of what can be connected by SCA Wires • SCA Domain configuration is a Domain Composite – Final configuration for service dependencies, properties, bindings, policies • Implementation artifacts and their configuration added to a Domain as Contributions – Many packaging formats (JAR, ZIP, Folder etc.) – Artifacts (Classes, XSD, WSDL, BPEL etc.) may be shared between Contributions
  • 23. IBM Software Group 23 http://tuscany.apache.org Building Contributions with Maven • Using Maven project layout, place composites, component implementations, interfaces and other required artifacts together • Use mvn eclipse:eclipse to build an Eclipse project
  • 24. IBM Software Group 24 http://tuscany.apache.org Developing in Eclipse • To import an SCA contribution built using Maven into Eclipse – Set M2_REPO  Import your contribution project previously built using mvn eclipse:eclipse • If you're building an SCA contribution from scratch in Eclipse, add a dependency on the Tuscany runtime Jars  An easy way to do this is to create an Eclipse user defined library that includes all the Tuscany Jars and dependencies, and add this library to your new contribution
  • 26. IBM Software Group 26 http://tuscany.apache.org Running in a Single JVM • To test payment-java we need three more things  The creditcard-payment-jaxb contribution. This contains the composite that defines the CreditCardPayment service that the Payment component references  The launcher-payment-java project that loads these two contributions into Tuscany and then calls the Payment component  The util-launcher-common project which contains a few utilities that we wrote for the TuscanySCATours application
  • 27. IBM Software Group 27 http://tuscany.apache.org Embedding Tuscany public class PaymentLauncher { public static void main(String[] args) throws Exception { SCANode node = SCANodeFactory.newInstance().createSCANode(null, locate("payment-java"), locate("creditcard-payment-jaxb")); node.start(); SCAClient client = (SCAClient)node; Payment payment = client.getService(Payment.class, "Payment"); System.out.println("Payment Java test"); System.out.println("nSuccessful Payment - Status = nn" + payment.makePaymentMember("c-0", 100.00f)); System.out.println("nnFailed Payment - Status = nn" + payment.makePaymentMember("c-1", 100.00f)); node.stop(); } The locate() operation is a utility we created for this sample which simply locates a contribution in the sample directory structure and returns its location.
  • 28. IBM Software Group 28 http://tuscany.apache.org Spring Bean Component Implementation Property Name: transactionFee Type: float </bean> </bean> <property name="transactionFee" value="0.5f"/> Payment component type <property name="creditCardPayment" ref="creditCardPaymentReference"/> <bean id="Payment" class="com.tuscanyscatours.payment.impl.PaymentImpl"> Service Name: Payment Interface: payment.Payment Reference Name: creditCardPaymentReference Interface: payment.creditcard.CreditCardPayment
  • 29. IBM Software Group 29 http://tuscany.apache.org Payment Spring Component Payment CreditCard Payment Spring creditcard Java payment Payment CreditCard Payment creditCard Payment transactionFee (8082) binding.ws binding.ws binding.ws
  • 30. IBM Software Group 30 http://tuscany.apache.org Payment Spring Context <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sca="http://www.springframework.org/schema/sca" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="Payment" class="com.tuscanyscatours.payment.impl.PaymentImpl"> <property name="creditCardPayment" ref="creditCardPaymentReference"/> <property name="emailGateway" ref="EmailGateway"/> <property name="customerRegistry" ref="CustomerRegistry"/> <property name="transactionFee" value="0.5f"/> </bean> <bean id="CustomerRegistry" class="com.tuscanyscatours.customer.impl.CustomerRegistryImpl"> </bean> <bean id="EmailGateway" class="com.tuscanyscatours.emailgateway.impl.EmailGatewayImpl"> </bean> </beans>
  • 31. IBM Software Group 31 http://tuscany.apache.org Payment Composite <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://tuscanyscatours.com/" name="payment"> <component name="Payment"> <implementation.spring location="Payment-context.xml"/> <service name="Payment"> <binding.ws uri="http://localhost:8081/Payment"/> </service> <reference name="creditCardPaymentReference"> <binding.ws uri="http://localhost:8082/CreditCardPayment"/> </reference> <property name="transactionFee">1.23</property> </component> </composite>
  • 32. IBM Software Group 32 http://tuscany.apache.org •BPEL Process Component Implementation ShoppingCart Payment Payment Process Email Gateway implementation.bpel <variable/> <partnerLink/> <partnerLink/> <partnerLink/> <process> <sequence> <receive/> ... <invoke/> ... <invoke/> ... <reply/> </sequence> </process> reference referenceservice property
  • 33. IBM Software Group 33 http://tuscany.apache.org Payment BPEL Process Component Payment CreditCard Payment EmailGateway BPEL Java creditcard Java payment Payment Email Gateway CreditCard Payment creditCard Payment email Gateway CustomerRegistry Java Customer Registry customer Registry transactionFee (8081) (8082) binding.ws binding.sca binding.ws binding.ws binding.sca binding.sca binding.sca
  • 34. IBM Software Group 34 http://tuscany.apache.org Payment BPEL process <process name="Payment" targetNamespace="http://www.tuscanyscatours.com/Payment" ...> <import location="Payment.wsdl" importType="http://schemas.xmlsoap.org/wsdl/" namespace="http://www.tuscanyscatours.com/Payment/"/> <import location="CreditCardPayment.wsdl" importType="http://schemas.xmlsoap.org/wsdl/" namespace="http://www.tuscanyscatours.com/CreditCardPayment/"/> <import location="EmailGateway.wsdl" importType="http://schemas.xmlsoap.org/wsdl/" namespace="http://www.tuscanyscatours.com/EmailGateway/"/> <partnerLinks> <partnerLink name="paymentPartnerLink" partnerLinkType="pp:PaymentLinkType" myRole="forward" /> <partnerLink name="creditCardPaymentPartnerLink" partnerLinkType="ccp:CreditCardPaymentLinkType" partnerRole="forward" initializePartnerRole="yes" /> <partnerLink name="emailGatewayPartnerLink" partnerLinkType="eg:EmailGatewayLinkType" partnerRole="forward" initializePartnerRole="yes" /> </partnerLinks> <variables> <variable name="makePaymentMemberRequestMessage" messageType="pp:MakePaymentMemberRequest"/> <variable name="makePaymentMemberResponseMessage" messageType="pp:MakePaymentMemberResponse"/> .... </variables> <sequence> <receive name="start" partnerLink="paymentPartnerLink" portType="pp:Payment" operation="makePaymentMember" variable="makePaymentMemberRequestMessage" createInstance="yes"/>
  • 35. IBM Software Group 35 http://tuscany.apache.org Payment Composite <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0" xmlns:pp="http://www.tuscanyscatours.com/Payment" targetNamespace="http://www.tuscanyscatours.com/Payment" name="payment"> <component name="Payment"> <implementation.bpel process="pp:Payment"/> <service name="paymentPartnerLink"> <interface.wsdl interface="http://www.tuscanyscatours.com/Payment/#wsdl.interface(Payment)" /> <binding.ws uri="http://localhost:8080/Payment" wsdlElement="http://www.tuscanyscatours.com/Payment/#wsdl.service(PaymentService)"/> </service> <reference name="creditCardPaymentPartnerLink"> <binding.ws uri="http://localhost:8082/CreditCardPayment"/> </reference> <reference name="emailGatewayPartnerLink"> <binding.ws uri="http://localhost:8088/EmailGateway"/> </reference> </component> </composite>
  • 36. IBM Software Group 36 http://tuscany.apache.org SCA Policies Payment CreditCard Payment EmailGateway Spring Java creditcard Java payment Authentication Payment Email Gateway CreditCard Payment creditCard Payment email Gateway CustomerRegistry Java Customer Registry customer Registry transactionFee (8081) (8082) Authentication binding.ws binding.sca binding.ws binding.ws binding.sca binding.sca binding.sca
  • 37. IBM Software Group 37 http://tuscany.apache.org Adding Policy Intents <component name="Payment"> <implementation.spring location="Payment-context.xml"/> <service name="Payment"> <binding.ws uri="http://localhost:8081/Payment"/> </service> <reference name="creditCardPaymentReference" > <binding.ws uri="http://localhost:8082/CreditCardPayment" requires="authentication"/> </reference> <reference name="emailGateway" target="EmailGateway"/> <reference name="customerRegistry" target="CustomerRegistry"/> <property name="transactionFee">1.23</property> </component> <component name="CreditCardPayment"> <implementation.java class="com.tuscanyscatours.payment.creditcard.impl.CreditCardPaymentImpl" /> <service name="CreditCardPayment"> <interface.wsdl interface="http://www.tuscanyscatours.com/CreditCardPayment/#wsdl.interface(CreditCardPayment)" /> <binding.ws uri="http://localhost:8082/CreditCardPayment" requires="authentication"/> <binding.sca/> </service> </component>
  • 38. IBM Software Group 38 http://tuscany.apache.org Defining policy sets <definitions xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://www.osoa.org/xmlns/sca/1.0" xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"> <policySet name="BasicAuthenticationPolicySet" provides="authentication" appliesTo="sca:binding.ws"> <tuscany:basicAuthentication> <tuscany:userName>myname</tuscany:userName> <tuscany:password>mypassword</tuscany:password> </tuscany:basicAuthentication> </policySet> </definitions>
  • 39. IBM Software Group 39 http://tuscany.apache.org Adding more components - 1 TuscanySCA ToursUser Interface TravelCatalog TripBooking ShoppingCart Hotel Partner Flight Partner Car Partner Currency Converter Trip Partner Java Java Java Java Java widget (8080) fullapp-coordination fullapp-packagedtrip fullapp-bespoketrip fullapp-currency fullapp-shoppingcart Java Java Java CartStore Java >ls -lsa SCATours Java LoggingquoteCurrency Code TravelCatalog Search TripBooking SCATours Booking SCATours Cart SCATours Search Search Search Search Search Book Book Book Book Currency Converter Cart Updates Cart Initialize CartStore trip Search hotel Search flight Search car Search currency Converter trip Book hotel Book flight Book car Book car Book cart Updates scaTours Search scaTours Booking scaTours Cart travelCatalog Search tripBooking cartInitialize payment cartStore cartCheckout Cart Checkout to Payment component (8085) fullapp-ui (8084) (8083) (8086) (8087)
  • 40. IBM Software Group 40 http://tuscany.apache.org Adding more components - 2 Payment CreditCard Payment EmailGateway Spring Java creditcard Java payment Authentication Payment Email Gateway CreditCard Payment creditCard Payment email Gateway CustomerRegistry Java Customer Registry customer Registry from ShoppingCart component transactionFee (8081) (8082) Authentication
  • 41. IBM Software Group 41 http://tuscany.apache.org SCA Domain A distributed deployment of the assembly.
  • 42. IBM Software Group 42 http://tuscany.apache.org Running Multiple Tuscany Nodes public class FullAppNodesLauncher { public static void main(String[] args) throws Exception { SCANode nodeCreditcard = SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/creditcard"); nodeCreditcard.start(); SCANode nodePayment = SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/payment"); nodePayment.start(); SCANode nodeShoppingcart = SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/shoppingcart"); nodeShoppingcart.start(); SCANode nodeCurrency = SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/currency"); nodeCurrency.start(); SCANode nodePackagedtrip = SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/packagedtrip"); nodePackagedtrip.start(); SCANode nodeBespoketrip = SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/bespoketrip"); nodeBespoketrip.start(); SCANode nodeFrontend = SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/coordination"); nodeFrontend.start(); SCANode nodeUI = SCANodeFactory.newInstance().createSCANodeFromURL("http://localhost:9990/node-config/ui"); nodeUI.start(); ... }
  • 44. IBM Software Group 44 http://tuscany.apache.org SCA - Resources  Good introduction to SCA  http://www.davidchappell.com/articles/Introducing_SCA.pdf  OASIS Open CSA – http://www.oasis-opencsa.org  V1.1 level specs  http://www.oasis-opencsa.org/sca  Open CSA Technical Committees  http://www.oasis-opencsa.org/committees  OSOA  http://osoa.org/display/Main/Home  More information on that site  http://osoa.org/display/Main/SCA+Resources
  • 45. IBM Software Group 45 http://tuscany.apache.org Apache Tuscany Resources  Apache Tuscany  http://tuscany.apache.org  Getting Involved  http://tuscany.apache.org/getting-involved.html  Tuscany SCA Java Releases  http://tuscany.apache.org/sca-java-2x-releases.html  http://tuscany.apache.org/sca-java-releases.html  Tuscany SCA Java Documentation  http://tuscany.apache.org/java-sca-documentation-menu.html  Tuscany Dashboard  http://tuscany.apache.org/tuscany-dashboard.html
  • 47. IBM Software Group 47 http://tuscany.apache.org Apache Nuvem Resources  Apache Nuvem  http://incubator.apache.org/nuvem/  Getting Involved  http://incubator.apache.org/nuvem/nuvem-getting-involved.html