Getting started with SCA

Introduction

SCA stands for Service Component Architecture.
SCA is a component model to build applications that are respectful of SOA principles.
In Petals, we only consider the use of SCA 1.0 (the version 1.0 of the SCA specification).

Concepts

SCA aims at building applications.
Inside the application, everything is organized as components.
Outside the application, everything is organized as services.


SCA consitutes a simple and standard solution to easily create applications that:

  • Respect SOA principles.
  • Can interoperate with various communication protocols.
  • Support various implementation langauges.
  • Help to organize code and define a clean architecture.


Here are the main elements of a SCA application:

  • The composite is the overall container, some kind of macro-component. It represents the application.
  • A component is a part of a composite. A composite may contain several components. A component belongs to only one composite.
  • A service associates an interface, a set of bindings (communication protocols) and policies. It represents a service provided by a component or a composite.
  • A reference associates an interface, a set of bindings (communication protocols) and policies. It represents a service required by a component or a composite.
  • A binding represents a communication protocol. It can be associated with a service or a reference.
  • An interface describes a set of operations to invoke. It can be associated with a service or a reference. Interfaces can be described with Java interfaces, CPP interfaces or WSDL definitions.
  • An implementation is a set of code associated with a component. In general, it is said components are a configured instance of code.
    This code can be implemented in several languages, including Java, C++, scripting languages, BPEL, etc. An implementation must implement the interfaces of the services its component owns.
  • A promotion allows to expose a component service or a component reference at the composite level.
    Component services and component references are only visible within the scope of the composite. To make them visible outside, they must be promoted at the composite level.

Interest for Petals

In Petals, a SCA application can be used to implement a Petals service or to orchestrate Petals services.
Petals SCA applications must be implemented with Java and only use JBI bindings.
A JBI binding is a SCA binding that defines a Petals service (to invoke or to expose).


Service orchestration entirely relies on WSDL definitions, like BPEL.
Except the orchestration language is not BPEL (or XML-based), but implemented in Java.
The SCA reference mechanism allows to invoke a service like a simple Java object.


Here is a small sample illustrating the SCA orchestration of 2 services.

@Service(MainService.class)
public class MainServiceImpl implements MainService {
	
	//
	// References
	
	private NemoJobServicePortType nemoJobServicePortType;

	@Reference
	public void setNemoJobServicePortType( NemoJobServicePortType nemoJobServicePortType ) {
		this.nemoJobServicePortType = nemoJobServicePortType;
	}
	
	
	private ValidationInterface validationInterface;

	@Reference
	public void setValidationInterface( ValidationInterface validationInterface ) {
		this.validationInterface = validationInterface;
	}
	
	
	private FileTransferInterface fileTransferInterface;

	@Reference
	public void setFileTransferInterface( FileTransferInterface fileTransferInterface ) {
		this.fileTransferInterface = fileTransferInterface;
	}

	//
	// Business code

	/*
	 * (non-Javadoc)
	 * @see org.ow2.petals.MainService
	 * #processXmlMessage(org.ow2.petals.components.validation.version_1.InputType)
	 */
	@Override
	public void processXmlMessage(InputType inputType) {

		// The two next lines invoke 2 Petals services
		if( validationInterface.validate( inputType ).isValid())
			fileTransferInterface.del( inputType.getOtherAttributes().get( "VALUE" ));
	}
}

Tooling

Petals Studio emebds the Eclipse SCA Tools.
They are completed by some specific tools for Petals, in particular to work with JBI bindings.
Thes tools include:

  • A graphical editor for SCA applications.
  • An advanced XML editor to edit composite files.
  • A complete validation mechanism.
  • Creation wizards, to ease the creation of SCA artifacts.



If there is a graphical editor for SCA, it should not be mistaken with an editor like the BPEL Designer.
A SCA composite defines the architecture of an application, not a processing flow.


With the BPEL designer, an element located after an arrow means this elements will be executed after the element before.
With the SCA designer, arrows only describe architectural dependencies, but not executions flows. Even if you have a complete diagram, there needs to be code behind to be executed. It is this code that is in charge of defining the flow (e.g. which service WILL be invoked and in which order - while the composite only defines which services MAY be invoked).

More information can be found about the general SCA tooling on the Eclipse wiki.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.