2016/05/28 - Apache Tuscany has been retired.

For more information, please explore the Attic.

HomeApache Tuscany Docs 2.x > Index > Development Guides > Converting Tuscany 1.x Extensions
 Apache Tuscany Docs 2.x > Index > Development Guides > Converting Tuscany 1.x Extensions Tuscany Home | User List | Dev List | Issue Tracker  
Table of Contents

Converting 1.x dependencies

You should configure the project pom.xml and

1.x Dependencies   2.x Dependencies
===> <dependency>

The following core modules are not ported yet :

  • some policies

The following modules are deprecated :

  • host-embedded
    • use the new Node APIs

Converting Composites and other SCA XML Artifacts

Generating OSGi Manifest

Configure pom to use Apache Felix maven-bundle-plugin


                        <Import-Package>org.apache.tuscany.sca.assembly.xml;version="2.0.0", *</Import-Package>

Generate the manifest

mvn org.apache.felix:maven-bundle-plugin:manifest

Copy the generated manifest from target folder to


Add manifest to source control

git add META-INF
svn add META-INF

Make any manual modifications as necessary

Converting your extension model

Your extension model needs to provide a new getType method

public interface AtomCBinding extends Binding {
   QName TYPE = new QName(SCA11_TUSCANY_NS, "binding.atom");

public class AtomBindingImpl implements AtomBinding {
   private String name;
   private String uri;

   public QName getType() {
	return TYPE;


Converting Artifact Processors

Make sure you update your META-INF\services\org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor with new namespace and any other necessary changes to reflect the current 2.x structure.

Converting you Binding runtime artifacts

Provider Factory

  • The provider factory interface has changed to accommodate the new Endpoint/EndPointReference support
    • Although the interface has changed, all the previous available information are encapsulated and available from the Endpoint and EndpointReference object
public interface BindingProviderFactory<M extends Binding> extends ProviderFactory<M> {

     * Creates a new reference binding provider for the given endpoint reference
     * @param endpointReference defines the component/reference/binding against which to create the provider
     * @return The binding provider
    ReferenceBindingProvider createReferenceBindingProvider(EndpointReference endpointReference);

     * Creates a new service binding provider for the given component and
     * service.
     * @param endpoint defines the component/service/binding against which to create the provider
     * @return The binding provider
    ServiceBindingProvider createServiceBindingProvider(Endpoint endpoint);

  • If you are using ModelFactoryExtensionPoint, it was renamed to FactoryExtensionPoint
FactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class);

ReferenceBindingProvider and ServiceBindingProvider

The previous SCA Models that were previously passed directly to these SPIs, is now available via Endpoint and EndpointReference as described in the code below:

public class AtomReferenceBindingProvider implements ReferenceBindingProvider {

    private RuntimeComponentReference reference;
    private AtomBinding binding;

    public AtomReferenceBindingProvider(EndpointReference endpointReference,
                                        AtomBinding binding) {

    	this.reference = (RuntimeComponentReference) endpointReference.getReference();
        this.binding = (AtomBinding) endpointReference.getBinding();


public class AtomServiceBindingProvider implements ServiceBindingProvider {

    private MessageFactory messageFactory;

    private Endpoint endpoint;
    private RuntimeComponent component;
    private RuntimeComponentService service;
    private InterfaceContract serviceContract;
    private AtomBinding binding;
    private ServletHost servletHost;


    public AtomServiceBindingProvider(Endpoint endpoint,
                                         MessageFactory messageFactory,
                                         ServletHost servletHost) {
        this.endpoint = endpoint;
        this.component = (RuntimeComponent)endpoint.getComponent();
        this.service = (RuntimeComponentService)endpoint.getService();
        this.binding = (AtomBinding) endpoint.getBinding();
        this.messageFactory = messageFactory;
        this.servletHost = servletHost;



Converting you Implementation runtime artifacts


Converting test cases

In 2.x we removed the Host-Embedded module and the SCADomain, and the recommended way is to use the Node SPI to build your test cases. We also are recommending using JUnit 4.5 test styles. See below a quick

1.x Style

public class AtomTestCase {

	private SCADomain domain;

	public void setUp() throws Exception {
		domain = SCADomain.newInstance("AtomBinding.composite");

	public void tearDown() throws Exception {


2.x Style

public class AtomTestCase {

	private static Node node;

	public static void setUp() throws Exception {
	    try {
                // use the contribution helper to find the location of the contribution directory
                // based on a class that is know to be in the contribution
    		String contribution = ContributionLocationHelper.getContributionLocation(AtomTestCase.class);

                // create a note to load the contribution and run the named composite
    		node = NodeFactory.newInstance().createNode("AtomBinding.composite", new Contribution("test", contribution));

                // as an alternative to using the helper you can of course specify the location of the
                // contribution directly, for example,
                // node = NodeFactory.newInstance().createNode(new Contribution("test",
                //                                             "my/directory/structure/atom-contribution.zip"));
                // Note also that no composite is named here. It is assumed that the contribution
                // specifies a deployable composite in the sca-contribution.xml file

                // start the node to make SCA services available
    	    } catch (Exception e) {

	public static void tearDown() throws Exception {


NOTE You will need to add the node-impl as test dependency to your modules