Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: for the plan.

Jump to: navigation, search

SCA/Components/SCA Composite to Java



With SCA, one can easily make errors by mispelling an element name (e.g. a service name) or by making incompatible interfaces (e.g. in a wire). A conveninent solution to avoid these errors when starting from zero, is to create a complete composite and then to generate the Java code skeleton of your SCA application. SCA Tools now provides such a feature.

  1. First, start by creating a composite using the composite editors (most likely the SCA Designer).
  2. Fill in the element properties (interface names, etc...).
  3. Then, right-click on your composite and select SCA > Generate Java Skeleton.
  4. In the dialog which appears, select the output source folder and the Java files to generate.
  5. The Java code skeleton is then generated. It declares the types with the right class hierarchy, the SCA annotations, the references and the properties.

Complete the Java artifacts by adding the service operations in the interfaces and by implementing them in the implementations.


At the beginning, you only have your composite.

SCA Composite to Java 2.jpg

If you look at it in the SCA Designer, you will notice warning markers on elements referencing Java artifacts.

SCA Composite to Java 1.jpg

These markers will simply indicate that the Java artifacts do not exist in the class path.

SCA Composite to Java 0.jpg

Once your composite is complete, right-click on the composite and ask to generate the Java skeletons.

SCA Composite to Java 3.jpg

The opening dialog lists the elements it can create (already existing ones are skipped) and the output folder.

SCA Composite to Java 4.jpg

Clicking OK results in the code generation.

SCA Composite to Java 5.jpg

Here is a sample of a generated implementation of the diagram above.

 * Generated from WeatherApplication.composite on 05/26/09 at 16:28:12.
package weather.impl;
import org.toto2.Toto2;
import simpleweather.interfaces.SimpleWeatherService_PortType;
import weather.interfaces.GlobalWeatherService;
@Service( interfaces={Toto2.class, GlobalWeatherService.class})
public class GlobalWeatherImpl implements Toto2, GlobalWeatherService {
	// Properties
	public Object pouf24;	// TODO: replace "Object" by the right type.
	public Object pouf23;	// TODO: replace "Object" by the right type.
	// References
	private SimpleWeatherService_PortType simpleWeatherReference;
	public void setSimpleWeatherReference( SimpleWeatherService_PortType simpleWeatherReference ) {
		this.simpleWeatherReference = simpleWeatherReference;
	// TODO: define the service implementation.

Known limitations

  • This tool is for the moment restricted to Java interfaces and implementations.
    • It could be upgraded to support other interfaces (e.g. WSDLs) and other implementations (e.g. script).
  • This tool does not support code merge for the moment.
    • That is to say you can not regenerate code if the target file already exists.
  • Complex properties are not well supported.
    • Their type is always set to Object.

Back to the top