SCA Java support in STP
This wiki page is used to explain the current SCA Java support in STP Service Creation project.
It's just a draft version, please give your valuable feedback to help us improving in the next milestone.
Johnson Ma (Jan 24, 2007)
- 1 Introduction
- 2 Setup Eclipse Plugins
- 3 Creating SCA Java Component using STP Service Creation and Tuscany
- 3.1 Creating SCA Java component project
- 3.2 SCDL Editing
- 3.3 SCA annotation editing
- 3.4 Generating WSDL
- 3.5 WSDL Editor
- 3.6 Generating Jar file
- 3.7 Run the SCA Java component
- 3.8 Create client project
- 3.9 Deploy to tomcat container
- 4 Todo list
- 5 References
We just added SCA Java support in STP service creation project. It allows user to create/debug SCA component within Eclipse by providing following functions:
* Project wizard to help user to create sca java component * Fasttrack wizard to generate default.composite and java empty interface/impl class * SCDL Editor. which is indeed the WST XML Editor with sca.xsd loaded * SCA and tuscany annotations editing support. * launch configuration to run & debug sca java component with Eclipse. * Integrated with Tuscany Java2Wsdl tool - apache-tuscany-sca-0.91-incubating release
* SCA java impl v1.00 * SCA Assemble model v1.00 * apache-tuscany-sca-0.91-incubating release
Setup Eclipse Plugins
The STP does not have update site yet. So we need to setup the Eclipse env manually. Please download and install the following plugins:
- Eclipse SDK 3.2
- STP Plugins http://download.eclipse.org/stp/committers/
- Apache Tuscany plugin http://www.eclipse.org/stp/sc/plugins/tuscany-eclipse-plugin-1.0-incubator-M2.zip
- Apache CXF Plugin http://www.eclipse.org/stp/sc/plugins/cxf-eclipse-plugin-2.0-incubator-M1-SNAPSHOT.zip
- Eclipse WST
- Eclipse DTP
- Eclipse EMF
- Eclipse GEF
Please set the Tuscany kit location in preference page as the image below before do any SCA related work.
Creating SCA Java Component using STP Service Creation and Tuscany
Creating SCA Java component project
From this fasttrak page, We will generate scdl file, Manifest file, empty Java class with @Service annotation for uesr to get started.
The SCA Java project has been created with following folders structure
|/bin||The build output jar file.|
|/META-INF/sca||holding the SCDL file for this component|
|/src||Java Source code|
|/WSDL||The WSDL file will be generated here by Tuscany J2W if it is WS binding|
The SCDL Editing is provided by customizing the standard XML Editor as following:
- Register SCDL file as XML content type
- Register sca.xsd to schema validator
Design View of the SCDL Editor
Source View of the SCDL Editor
You will got error message from schema validator for the generated scdl file. Please leave it for now, since those default.scdl comes with Tuscany1.0 M2 examples also have same problem.
SCA annotation editing
The SCA and Tuscany annotations are supported by extending the annotation editing framework in STP. In the java source editor, once you select java class, method or field, we will show the applicable annotations in the Annotation Properties View. Then you can add appreciate annotation from there. Notice: the sca annotation validation rules hasn't been setup yet. It will be provided in the next milestone
The Tuscany Java2wsdl tool has been integrated as an incremental builder, which is linking to java interface class with @Service annotation. For our example, the HelloWorld.wsdl will be automatically generated every time user modify the HelloWorld interface class. The current J2W option has been set according to those values defined in default.scdl file :
* service name ("-sn") = JavaInterfaceName + "Service" * soap address ("-l") = "http://localhost:8080/service/"
Later on, We will provide preference/project properties to configure all J2W options including style, use, target namespace and output WSDL file name...etc
Directly use WST WSDL Editor here.
Generating Jar file
I created a JarBuilder to automatically package all classes, scdl and wsdl files into one single jar file, and put it under /Project/bin.
Run the SCA Java component
The java launch configuration will be created for user to run & debug the SCA component within Eclipse. In the launch config:
- Set mainclass to "org.apache.tuscany.launcher.MainLauncherBooter".
- Set program args to the jar file of the component.
- Set vmargs to "-Dtuscany.installDir=kit_dir_from_perference"
I plan to add '-Doffline=true' flag in the launch configuration and preference page later.
Notice: You will get error when try to run the webservice binding component in this release. the RMI binding works fine
Create client project
For WebService binding component, you can use Eclipse WTP to generate the client File->New->Others..->WebService->WebService Client
Deploy to tomcat container
- Apache Tuscany project http://incubator.apache.org/tuscany/
- SCA & SDO spec http://www.osoa.org/display/Main/Home
- Eclipse STP project http://www.eclipse.org/stp/