| By Haleh Mahbod, Raymond Feng, Simon Laws | Article Rating: |
|
| November 9, 2007 08:30 AM EST | Reads: |
39,569 |
This very simple mechanism of applying bindings to the services and references defined by a component is at the root of SCA's ability to separate business logic from deployment concerns. It works regardless of whether the component implementation is brand new or wraps some existing business logic.
It is also the mechanism by which SCA components communicate with services outside of SCA. Bindings can be defined such that existing applications can access SCA services or can be referenced by SCA components. This flexibility allows the SCA approach to be introduced incrementally within an organization.
SCA simplifies business logic development with dependency injection by providing an Inversion of Control (IoC) container. As you can see from the Java code snippet below, the component simply declares references and properties using Java annotations. The account service talks to account data service, stock quote service, and calculator service by making direct calls on the interfaces. The code here deals with business logic only and no traditional technology API calls are required. Tuscany handles how the services are located, who provides the services, and how messages are delivered based on information in the SCA configuration.
@Service(AccountService.class)
public class AccountServiceImpl implements AccountService {
@Reference
protected StockQuoteService stockQuoteService;
...
@Property
protected String currency;
public double getAccountReport(String customerID) {
// Get the stock price in USD
double price = stockQuoteService.getQuote(stock.getSymbol());
// Convert to the configured currency
if (currency.equals("EURO")) {
price = calculatorService.multiply(price, 0.70);
}
...
}
}
SCA also provides a mechanism to separate organizational infrastructure concerns from business logic through policy statements that enable agreed constraints to be applied at deployment time. This could range from dictating which communications should be encrypted to describing which level of monitoring and logging is required. For example, the helloworld-ws-service-secure sample [6] shows how to express the intention that clients accessing a service must be authenticated before doing so.
<component name="HelloWorldServiceComponent">
<implementation.java class="helloworld.HelloWorldImpl" />
<service name="HelloWorldService" requires="authentication">
<interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
<binding.ws uri="http://localhost:8085/HelloWorldService"/>
</service>
</component>
Note that the <service> element carries a policy intent that interactions require "authentication." How authentication is actually implemented is then a matter of policy within the organization.
We have demonstrated how the flexibility of the SCA programming model helps address enterprise challenges. Another area to point out is the ability to use any implementation language and therefore leverage existing skills and investments. Tuscany SCA provides support for a selection of languages for building business logic, for example, XQuery, BPEL, script. The BigBank demo implements the various operations of the calculator using scripting languages. Tuscany SCA's implementation.script currently supports JavaScript, Groovy, Ruby, and Python. In the SCA configuration example below, implementation.script indicates that the business logic of the AccountServiceComponent is written in JavaScript.
<component name="AddServiceComponent"> <tuscany:implementation.script script="calculator/AddServiceImpl.js"/> </component>
Tuscany SCA also supports Spring and OSGi implementation types. New or existing Spring applications or OSGi bundles can be used to provide the implementation for SCA components. These components can be easily composed with other service components and deployed consistently in a distributed network of Tuscany SCA runtimes with the full range of communication methods made available to them.
Enabling Web 2.0
A typical Web 2.0 application will reference several services in the organization and integrate the provided data in the browser. Tuscany SCA enables such services using popular technologies such as JSONRPC, RSS, and Atom protocols.
Tuscany demonstrates how a Web 2.0 application, and the services it relies on, can be constructed using an Internet shopping example called "Store" [7]. There is a guide that walks through the steps required to build this sample [8].
From Figure 2 you can see a Catalog component providing a service to the Web 2.0 application over JSONRPC. The Catalog component provides information about the products the store has for sale and has been constructed without regard for how it might be accessed. Using Tuscany SCA the Catalog component's Java implementation is associated with the JSONRPC binding (binding.jsonrpc).
<component name="Catalog">
<implementation.java class="services.CatalogImpl"/>
<service name="Catalog">
<t:binding.jsonrpc/>
</service>
...
</component>
Published November 9, 2007 Reads 39,569
Copyright © 2007 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Haleh Mahbod
Haleh Mahbod is a program director with IBM, managing the team contributing to the Apache Tuscany as well as SOA for PHP open source. She has extensive development experience with database technologies and integration servers.
More Stories By Raymond Feng
Raymond Feng is a senior software engineer with IBM. He is now working on the Service Component Architecture (SCA) runtime implementation in Apache Tuscany project as a committer. Raymond has been developing SOA for more than 4 years and he was a key developer and team lead for WebSphere Process Server products since 2002.
More Stories By Simon Laws
Simon Laws is a member of the IBM Open Source SOA project team working with the open source Apache and PHP communities to build Java, C++, and PHP implementations of the Service Component Architecture (SCA) and Service Data Object (SDO) specifications. Prior to this role he was working in the distributed computing space building service-oriented solutions for customers with a particular interest in grid computing and virtualization.
![]() |
anonymous 03/12/08 06:13:08 PM EDT | |||
SCA sounds a lot like CORBA.. |
||||
![]() |
anonymous 11/11/07 09:28:46 PM EST | |||
SCA = CORBA |
||||
- Kindle 2 vs Nook
- Why IBM’s Server Chief Got Busted
- Is Cloud Computing Like Teenage Sex?
- Industry Experts Discuss the State of Cloud Computing
- Performance Tuning Essentials for Java
- Confessions of a Ulitzer Addict
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- It's the Java vs. C++ Shootout Revisited!
- Cloud Computing Can Revitalize Your Career as Software Developer
- IBM Could "Reinvent" Java: Mills
- Oracle & Cloud Computing: Exclusive Q&A with SVP Richard Sarwal
- A Brief History of Cloud Computing
- Kindle 2 vs Nook
- Cloud CEOs, CTOs & SVPs to Speak at 4th International Cloud Computing Expo
- Why IBM’s Server Chief Got Busted
- Is Cloud Computing Like Teenage Sex?
- Industry Experts Discuss the State of Cloud Computing
- Performance Tuning Essentials for Java
- The Difference Between Web Hosting and Cloud Computing
- Cloud Computing Expo: Exclusive Q&A with Yahoo! SVP Cloud Computing
- Ajax in RichFaces 3.3, JSF 2 and RichFaces 4
- Confessions of a Ulitzer Addict
- My Thoughts on Ulitzer
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- A Cup of AJAX? Nay, Just Regular Java Please
- Java Developer's Journal Exclusive: 2006 "JDJ Editors' Choice" Awards
- The i-Technology Right Stuff
- JavaServer Faces (JSF) vs Struts
- Rich Internet Applications with Adobe Flex 2 and Java
- Java vs C++ "Shootout" Revisited
- Bean-Managed Persistence Using a Proxy List
- Reporting Made Easy with JasperReports and Hibernate
- Creating a Pet Store Application with JavaServer Faces, Spring, and Hibernate
- What's New in Eclipse?
- Why Do 'Cool Kids' Choose Ruby or PHP to Build Websites Instead of Java?
- i-Technology Predictions for 2007: Where's It All Headed?









































