page2
Tuscany 1.x Extensions
Component Implementations
Implementation
<implementation.java class="helloworld.HelloWorldImpl"/> |
<implementation.composite name="sample:InnerComposite"/> |
<implementation.spring location="service-context.xml"/> |
<implementation.bpel process="hns:HelloWorld"/> |
<tuscany:implementation.script script="ServiceImpl.js |
ServiceImpl.rb |
ServiceImpl.py |
ServiceImpl.groovy"/>|
<tuscany:implementation.xquery location="quote_join.xq" />
<tuscany:implementation.widget location="ui.html"/>
Service/Reference Interfaces
Service/Reference Bindings
<interface.java interface="some.ServiceIface"
callbackInterface="some.ServiceCallbackIface"/> |
<interface.wsdl
interface=”http://xyy/svc#wsdl.interface(Service)”
callbackInterface=”http://xyy/svc#wsdl.interface(Clbk)”/>
<binding.sca/>
<binding.ws/>
<binding.jms/>
<binding.ejb/>
<binding.rmi/>
<binding.corba/>
<binding.http/>
<binding.jsonrpc/>
<binding.atom/>
<binding.rss/>
<binding.dwr/>
<binding.gdata/>
Reference
Component
Service
Property
Getting Started
Tuscany SCA Calculator
If you want to build SCA applications get a Tuscany binary release, try out the samples and include the jars in you development envionment. There are some guides about how to use the runtime here;
tuscany.apache.org/java-sca-documentation-menu.html
If you want to work with the Tuscany source code itself the do the following...
Development Environment
- Win/Lin/Mac are all OK.
- Java JDK (preferably 1.6)
java.sun.com/javase/downloads/index.jsp
- Maven (2.2.1)
maven.apache.org/download.html
- Subversion (1.6.6)
subversion.apache.org/packages.html (if not already on your system)
- Eclipse IDE for Java (or other IDE)
www.eclipse.org/downloads
Development Instructions
There are some development instructions at:
tuscany.apache.org/sca-java-development-guide.html
Basically install Java, Subversion, and Maven, then:
svn co https://svn.apache.org/repos/asf/tuscany/sca-java-1.x/trunk trunk
cd trunk
mvn clean install -fae
The first mvn build can take a long time as it downloads all the required
dependencies and may intermittently fail so just retry a few times.
The build compiles all the source and runs all the tests. You can run individual tests by changing directory to the module you're interested in an running maven.
cd samples/calculator
mvn
To build eclipse project files for all of the module do the following
cd trunk
mvn -o -fae -Peclipse eclipse:eclipse
You can then import these projects into Eclipse and develop there.
Composite File
<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>
CalculatorServiceImpl.java
public class CalculatorServiceImpl implements CalculatorService {
private AddService addService;
private SubtractService subtractService;
private MultiplyService multiplyService;
private DivideService divideService;
@Reference
public void setAddService(AddService addService) {
this.addService = addService;
}
@Reference
public void setSubtractService(SubtractService subtractService) {
this.subtractService = subtractService;
}
@Reference
public void setDivideService(DivideService divideService) {
this.divideService = divideService;
}
@Reference
public void setMultiplyService(MultiplyService multiplyService) {
this.multiplyService = multiplyService;
}
public double add(double n1, double n2) {
return addService.add(n1, n2);
}
public double subtract(double n1, double n2) {
return subtractService.subtract(n1, n2);
}
public double multiply(double n1, double n2) {
return multiplyService.multiply(n1, n2);
}
public double divide(double n1, double n2) {
return divideService.divide(n1, n2);
}
}