summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-08-29 17:44:58 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-08-29 17:44:58 +0000
commit3518556b241cf0ae6f71be798a35eeed4e3c8502 (patch)
treee0eef5fbafe7878d4c1455748abc0ed373199606
parentc6b787e89938ab5d3241094b2e31eb0c00e9f2f9 (diff)
Sample implementation extension that shows how to support both Java and WSDL interfaces and different data bindings.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@990608 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/README8
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/build.xml51
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/pom.xml79
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/api/Java.java34
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/api/WSDL.java34
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/api/WSDLReference.java28
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/impl/SampleImplementation.java41
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/impl/SampleImplementationProcessor.java162
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/impl/SampleJavaInvoker.java52
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/impl/SampleProvider.java91
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/impl/SampleProviderFactory.java48
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/impl/SampleUtil.java148
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/impl/SampleWSDLInvoker.java56
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/impl/SampleWSDLProxy.java57
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor20
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema18
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory20
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/main/resources/sample/impl/sample.xsd38
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/Client.java30
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/ClientTest.java59
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/Hello.java28
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/JelloTest.java40
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/Upper.java28
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/UpperTest.java37
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/WelloTest.java50
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/Xutil.java142
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/impl/ReadWriteTestCase.java83
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/impl/RunTestCase.java70
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/test/resources/Hello.wsdl62
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/test/resources/Upper.wsdl62
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/test/resources/test.composite45
31 files changed, 1721 insertions, 0 deletions
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/README b/sandbox/sebastien/java/extend/samples/implementation-extension/README
new file mode 100644
index 0000000000..3c3ef5e3d5
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/README
@@ -0,0 +1,8 @@
+Sample Implementation Extension
+===============================
+This sample demonstrates how to develop a new component implementation type
+for Apache Tuscany SCA.
+
+The README in the samples directory (the directory above this) provides
+instructions about building and running the samples. Take a look there.
+
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/build.xml b/sandbox/sebastien/java/extend/samples/implementation-extension/build.xml
new file mode 100644
index 0000000000..78bae79859
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/build.xml
@@ -0,0 +1,51 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project name="implementation-pojo-extension" default="compile">
+ <property name="test.jar" value="sample-implementation-pojo-extension.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/pom.xml b/sandbox/sebastien/java/extend/samples/implementation-extension/pom.xml
new file mode 100644
index 0000000000..47aff7e941
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/pom.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-samples</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-implementation-extension</artifactId>
+ <name>Apache Tuscany SCA Sample Implementation Extension</name>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-feature-api</artifactId>
+ <type>pom</type>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-feature-core</artifactId>
+ <type>pom</type>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-feature-webservice</artifactId>
+ <type>pom</type>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-feature-web20</artifactId>
+ <type>pom</type>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-webapp</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/api/Java.java b/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/api/Java.java
new file mode 100644
index 0000000000..6c9240005f
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/api/Java.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package sample.api;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+@Target( {TYPE, FIELD})
+@Retention(RUNTIME)
+public @interface Java {
+
+ Class<?> value();
+}
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/api/WSDL.java b/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/api/WSDL.java
new file mode 100644
index 0000000000..655770ec32
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/api/WSDL.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package sample.api;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+@Target( {TYPE, FIELD})
+@Retention(RUNTIME)
+public @interface WSDL {
+
+ String value();
+}
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/api/WSDLReference.java b/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/api/WSDLReference.java
new file mode 100644
index 0000000000..cad8478a2a
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/api/WSDLReference.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package sample.api;
+
+import org.w3c.dom.Element;
+
+public interface WSDLReference {
+
+ Element call(String op, Element e);
+
+}
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/impl/SampleImplementation.java b/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/impl/SampleImplementation.java
new file mode 100644
index 0000000000..41ce71a732
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/impl/SampleImplementation.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package sample.impl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.impl.ImplementationImpl;
+
+/**
+ * Model representing a Sample implementation in an SCA assembly.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SampleImplementation extends ImplementationImpl {
+ static final QName QN = new QName(SCA11_TUSCANY_NS, "implementation.sample");
+
+ final String name;
+ Class<?> clazz;
+
+ SampleImplementation(final String name) {
+ super(QN);
+ this.name = name;
+ }
+
+}
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/impl/SampleImplementationProcessor.java b/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/impl/SampleImplementationProcessor.java
new file mode 100644
index 0000000000..95f4655131
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/impl/SampleImplementationProcessor.java
@@ -0,0 +1,162 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package sample.impl;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static sample.impl.SampleImplementation.QN;
+import static sample.impl.SampleUtil.clazz;
+import static sample.impl.SampleUtil.definition;
+import static sample.impl.SampleUtil.implementation;
+import static sample.impl.SampleUtil.interfaze;
+import static sample.impl.SampleUtil.qname;
+import static sample.impl.SampleUtil.reference;
+import static sample.impl.SampleUtil.service;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
+import org.apache.tuscany.sca.contribution.processor.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.processor.ContributionWriteException;
+import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
+import org.apache.tuscany.sca.databinding.xml.DOMDataBinding;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLObject;
+
+import sample.api.Java;
+import sample.api.WSDL;
+
+/**
+ * StAX artifact processor for Sample implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SampleImplementationProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<SampleImplementation> {
+ final AssemblyFactory af;
+ final JavaInterfaceFactory jif;
+ final WSDLFactory wf;
+
+ public SampleImplementationProcessor(final ExtensionPointRegistry ep) {
+ final FactoryExtensionPoint fep = ep.getExtensionPoint(FactoryExtensionPoint.class);
+ this.af = fep.getFactory(AssemblyFactory.class);
+ this.jif = fep.getFactory(JavaInterfaceFactory.class);
+ this.wf = fep.getFactory(WSDLFactory.class);
+ }
+
+ public QName getArtifactType() {
+ return QN;
+ }
+
+ public Class<SampleImplementation> getModelType() {
+ return SampleImplementation.class;
+ }
+
+ public SampleImplementation read(final XMLStreamReader r, final ProcessorContext ctx) throws ContributionReadException, XMLStreamException {
+ // Read the component implementation element
+ final SampleImplementation impl = implementation(r.getAttributeValue(null, "class"));
+ while(r.hasNext() && !(r.next() == END_ELEMENT && QN.equals(r.getName())))
+ ;
+ return impl;
+ }
+
+ public void resolve(final SampleImplementation impl, final ModelResolver res, final ProcessorContext ctx) throws ContributionResolveException {
+ try {
+ // Resolve and introspect the implementation class
+ impl.clazz = resolve(impl.name, res, ctx);
+
+ for(final Annotation a: impl.clazz.getAnnotations()) {
+ if(a instanceof Java)
+ impl.getServices().add(service(clazz(a), jif, af));
+ else if(a instanceof WSDL)
+ impl.getServices().add(service(resolve(qname(a), res, ctx, wf), wf, af));
+ }
+
+ for(Field f: impl.clazz.getDeclaredFields()) {
+ for(final Annotation a: f.getAnnotations()) {
+ if(a instanceof Java)
+ impl.getReferences().add(reference(f.getName(), clazz(a), jif, af));
+ else if(a instanceof WSDL)
+ impl.getReferences().add(reference(f.getName(), resolve(qname(a), res, ctx, wf), wf, af));
+ }
+ }
+
+ impl.setUnresolved(false);
+ } catch(InvalidInterfaceException e) {
+ throw new ContributionResolveException(e);
+ }
+ }
+
+ public void write(final SampleImplementation impl, final XMLStreamWriter w, final ProcessorContext ctx) throws ContributionWriteException, XMLStreamException {
+ writeStart(w, QN.getNamespaceURI(), QN.getLocalPart(), new XAttr("class", impl.name));
+ writeEnd(w);
+ }
+
+ /**
+ * Resolve a Java class.
+ */
+ static Class<?> resolve(final String name, final ModelResolver res, final ProcessorContext ctx) throws ContributionResolveException {
+ final ClassReference cr = res.resolveModel(ClassReference.class, new ClassReference(name), ctx);
+ if(cr.getJavaClass() != null)
+ return cr.getJavaClass();
+ throw new ContributionResolveException(new ClassNotFoundException(name));
+ }
+
+ /**
+ * Resolve a WSDL interface.
+ */
+ static WSDLInterface resolve(final QName name, final ModelResolver res, final ProcessorContext ctx, final WSDLFactory wif) throws ContributionResolveException {
+ final WSDLInterface wi = res.resolveModel(WSDLInterface.class, interfaze(name, wif), ctx);
+ if(!wi.isUnresolved())
+ return wi;
+
+ final WSDLDefinition wd = res.resolveModel(WSDLDefinition.class, definition(wi.getName(), wif), ctx);
+ if(wd.isUnresolved())
+ throw new ContributionResolveException("Couldn't find " + name.getNamespaceURI());
+
+ WSDLObject<PortType> pt = wd.getWSDLObject(PortType.class, name);
+ if(pt == null)
+ throw new ContributionResolveException("Couldn't find " + name);
+ try {
+ final WSDLInterface nwi = wif.createWSDLInterface(pt.getElement(), wd, res, ctx.getMonitor());
+ nwi.setWsdlDefinition(wd);
+ nwi.resetDataBinding(DOMDataBinding.NAME);
+ res.addModel(nwi, ctx);
+ return nwi;
+ } catch(InvalidInterfaceException e) {
+ throw new ContributionResolveException(e);
+ }
+ }
+}
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/impl/SampleJavaInvoker.java b/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/impl/SampleJavaInvoker.java
new file mode 100644
index 0000000000..244251c4c9
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/impl/SampleJavaInvoker.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package sample.impl;
+
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.interfacedef.java.JavaOperation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+
+/**
+ * Invoker for Sample components that implement a Java interface.
+ *
+ * @version $Rev$ $Date$
+ */
+class SampleJavaInvoker implements Invoker {
+ final Object instance;
+ final Method method;
+
+ SampleJavaInvoker(final JavaOperation op, final Class<?> clazz, final Object instance) throws SecurityException, NoSuchMethodException {
+ this.instance = instance;
+ this.method = clazz.getMethod(op.getJavaMethod().getName(), op.getJavaMethod().getParameterTypes());
+ }
+
+ public Message invoke(final Message msg) {
+ try {
+ // Call the method that implements the operation
+ msg.setBody(method.invoke(instance, (Object[])msg.getBody()));
+ } catch(Exception e) {
+ e.printStackTrace();
+ msg.setFaultBody(e.getCause());
+ }
+ return msg;
+ }
+}
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/impl/SampleProvider.java b/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/impl/SampleProvider.java
new file mode 100644
index 0000000000..5d946b037b
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/impl/SampleProvider.java
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package sample.impl;
+
+import java.lang.reflect.Field;
+
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaOperation;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLOperation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * Implementation provider for Sample component implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+class SampleProvider implements ImplementationProvider {
+ final RuntimeComponent comp;
+ final SampleImplementation impl;
+ final ProxyFactory pxf;
+ Object instance;
+
+ SampleProvider(final RuntimeComponent comp, final SampleImplementation impl, ProxyFactory pf) {
+ this.comp = comp;
+ this.impl = impl;
+ this.pxf = pf;
+ }
+
+ public void start() {
+ // Construct implementation instance and inject reference proxies
+ try {
+ instance = impl.clazz.newInstance();
+
+ for(ComponentReference r: comp.getReferences()) {
+ final Field f = impl.clazz.getDeclaredField(r.getName());
+ f.setAccessible(true);
+ // Inject a Java or WSDLReference proxy
+ final Interface i = r.getInterfaceContract().getInterface();
+ if(i instanceof JavaInterface)
+ f.set(instance, pxf.createProxy(comp.getComponentContext().getServiceReference(f.getType(), r.getName())));
+ else
+ f.set(instance, new SampleWSDLProxy(r.getEndpointReferences().get(0), i));
+ }
+ } catch(Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void stop() {
+ instance = null;
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public Invoker createInvoker(final RuntimeComponentService s, final Operation op) {
+ try {
+ // Creating an invoker for a Java or WSDL-typed implementation
+ if(op instanceof JavaOperation)
+ return new SampleJavaInvoker((JavaOperation)op, impl.clazz, instance);
+ return new SampleWSDLInvoker((WSDLOperation)op, impl.clazz, instance);
+ } catch(Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/impl/SampleProviderFactory.java b/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/impl/SampleProviderFactory.java
new file mode 100644
index 0000000000..4ad24d33ff
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/impl/SampleProviderFactory.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package sample.impl;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.invocation.ExtensibleProxyFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * Factory for Sample implementation providers.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SampleProviderFactory implements ImplementationProviderFactory<SampleImplementation> {
+ final ProxyFactory pxf;
+
+ public SampleProviderFactory(final ExtensionPointRegistry ep) {
+ pxf = ExtensibleProxyFactory.getInstance(ep);
+ }
+
+ public ImplementationProvider createImplementationProvider(final RuntimeComponent comp, final SampleImplementation impl) {
+ return new SampleProvider(comp, impl, pxf);
+ }
+
+ public Class<SampleImplementation> getModelType() {
+ return SampleImplementation.class;
+ }
+}
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/impl/SampleUtil.java b/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/impl/SampleUtil.java
new file mode 100644
index 0000000000..5425431a99
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/impl/SampleUtil.java
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package sample.impl;
+
+import java.lang.annotation.Annotation;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
+
+import sample.api.Java;
+import sample.api.WSDL;
+
+/**
+ * Utility functions.
+ */
+class SampleUtil {
+
+ /**
+ * Return a Sample implementation with the given name.
+ */
+ static SampleImplementation implementation(String name) {
+ final SampleImplementation impl = new SampleImplementation(name);
+ impl.setUnresolved(true);
+ return impl;
+ }
+
+ /**
+ * Return the Java class configured on an annotation.
+ */
+ static Class<?> clazz(final Annotation a) {
+ return ((Java)a).value();
+ }
+
+ /**
+ * Return the WSDL QName configured on an annotation.
+ */
+ static QName qname(final Annotation a) {
+ final String uri = ((WSDL)a).value();
+ final int h = uri.indexOf('#');
+ return new QName(uri.substring(0, h), uri.substring(h + 1));
+ }
+
+ /**
+ * Convert a Java class to an interface contract.
+ */
+ static JavaInterfaceContract contract(final Class<?> c, final JavaInterfaceFactory jif) throws InvalidInterfaceException {
+ final JavaInterfaceContract ic = jif.createJavaInterfaceContract();
+ ic.setInterface(jif.createJavaInterface(c));
+ return ic;
+ }
+
+ /**
+ * Convert a WSDL interface to an interface contract.
+ */
+ static WSDLInterfaceContract contract(final WSDLInterface wi, final WSDLFactory wf) {
+ final WSDLInterfaceContract ic = wf.createWSDLInterfaceContract();
+ ic.setInterface(wi);
+ return ic;
+ }
+
+ /**
+ * Convert a Java class to a service.
+ */
+ static Service service(final Class<?> c, final JavaInterfaceFactory jif, final AssemblyFactory af) throws InvalidInterfaceException {
+ Service s = af.createService();
+ s.setName(c.getSimpleName());
+ s.setInterfaceContract(contract(c, jif));
+ return s;
+ }
+
+ /**
+ * Convert a WSDL interface to a service.
+ */
+ static Service service(final WSDLInterface wi, final WSDLFactory wf, final AssemblyFactory af) {
+ Service s = af.createService();
+ s.setName(wi.getName().getLocalPart());
+ s.setInterfaceContract(contract(wi, wf));
+ return s;
+ }
+
+ /**
+ * Convert a name and Java class to a reference.
+ */
+ static Reference reference(final String name, final Class<?> c, final JavaInterfaceFactory jif, final AssemblyFactory af) throws InvalidInterfaceException {
+ final Reference r = af.createReference();
+ r.setName(name);
+ r.setInterfaceContract(contract(c, jif));
+ return r;
+ }
+
+ /**
+ * Convert a name and WSDL interface to a reference.
+ */
+ static Reference reference(final String name, final WSDLInterface wi, final WSDLFactory wf, final AssemblyFactory af) {
+ final Reference r = af.createReference();
+ r.setName(name);
+ r.setInterfaceContract(contract(wi, wf));
+ return r;
+ }
+
+ /**
+ * Convert a WSDL qname to a WSDL interface.
+ */
+ static WSDLInterface interfaze(final QName name, final WSDLFactory wif) {
+ final WSDLInterface wir = wif.createWSDLInterface();
+ wir.setUnresolved(true);
+ wir.setName(name);
+ return wir;
+ }
+
+ /**
+ * Convert a WSDL qname to a WSDL definition.
+ */
+ static WSDLDefinition definition(final QName name, final WSDLFactory wif) {
+ final WSDLDefinition wdr = wif.createWSDLDefinition();
+ wdr.setUnresolved(true);
+ wdr.setNamespace(name.getNamespaceURI());
+ wdr.setNameOfPortTypeToResolve(name);
+ return wdr;
+ }
+}
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/impl/SampleWSDLInvoker.java b/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/impl/SampleWSDLInvoker.java
new file mode 100644
index 0000000000..6c5317274f
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/impl/SampleWSDLInvoker.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package sample.impl;
+
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLOperation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.w3c.dom.Element;
+
+/**
+ * Invoker for Sample components that implement a WSDL interface using a generic
+ * call method.
+ *
+ * @version $Rev$ $Date$
+ */
+class SampleWSDLInvoker implements Invoker {
+ final String name;
+ final Object instance;
+ final Method method;
+
+ SampleWSDLInvoker(final WSDLOperation op, final Class<?> clazz, final Object instance) throws SecurityException, NoSuchMethodException {
+ this.name = op.getName();
+ this.instance = instance;
+ this.method = clazz.getMethod("call", String.class, Element.class);
+ }
+
+ public Message invoke(final Message msg) {
+ try {
+ // Invoke the generic call method
+ msg.setBody(method.invoke(instance, name, ((Object[])msg.getBody())[0]));
+ } catch(Exception e) {
+ e.printStackTrace();
+ msg.setFaultBody(e.getCause());
+ }
+ return msg;
+ }
+}
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/impl/SampleWSDLProxy.java b/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/impl/SampleWSDLProxy.java
new file mode 100644
index 0000000000..a6882a0103
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/java/sample/impl/SampleWSDLProxy.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package sample.impl;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.assembly.EndpointReference;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
+import org.w3c.dom.Element;
+
+import sample.api.WSDLReference;
+
+/**
+ * Proxy used to call operations on WSDL references.
+ */
+class SampleWSDLProxy implements WSDLReference {
+ final RuntimeEndpointReference repr;
+ final Map<String, Operation> ops;
+
+ SampleWSDLProxy(EndpointReference epr, Interface wi) {
+ repr = (RuntimeEndpointReference)epr;
+ ops = new HashMap<String, Operation>();
+ for(Operation o: wi.getOperations())
+ ops.put(o.getName(), o);
+ }
+
+ @Override
+ public Element call(String op, Element e) {
+ try {
+ // Invoke the named operation on the endpoint reference
+ return (Element)repr.invoke(ops.get(op), new Object[] {e});
+ } catch(InvocationTargetException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+}
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..908ac95a2e
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+sample.impl.SampleImplementationProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#implementation.sample,model=sample.impl.SampleImplementation
+
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema b/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema
new file mode 100644
index 0000000000..85aff44074
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+sample/impl/sample.xsd
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
new file mode 100644
index 0000000000..32a7efcaf9
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation provider for Sample components
+sample.impl.SampleProviderFactory;model=sample.impl.SampleImplementation
+
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/resources/sample/impl/sample.xsd b/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/resources/sample/impl/sample.xsd
new file mode 100644
index 0000000000..c057aef1c1
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/main/resources/sample/impl/sample.xsd
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://tuscany.apache.org/xmlns/sca/1.1"
+ xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1"
+ elementFormDefault="qualified">
+
+ <import namespace="http://docs.oasis-open.org/ns/opencsa/sca/200912"/>
+
+ <element name="implementation.sample" type="t:SampleImplementation" substitutionGroup="sca:implementation"/>
+
+ <complexType name="SampleImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <attribute name="class" type="string" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/Client.java b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/Client.java
new file mode 100644
index 0000000000..4c473c987f
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/Client.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package sample;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+@Remotable
+public interface Client {
+
+ String jello(String s);
+
+ String wello(String s);
+}
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/ClientTest.java b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/ClientTest.java
new file mode 100644
index 0000000000..46350e26d6
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/ClientTest.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package sample;
+
+import static java.lang.System.out;
+import static sample.Xutil.dom;
+import static sample.Xutil.elem;
+import static sample.Xutil.text;
+import static sample.Xutil.xpath;
+
+import org.w3c.dom.Element;
+
+import sample.api.Java;
+import sample.api.WSDL;
+import sample.api.WSDLReference;
+
+/**
+ * Sample component implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+@Java(Client.class)
+public class ClientTest {
+
+ @Java(Hello.class)
+ Hello jello;
+
+ @WSDL("http://sample#Hello")
+ WSDLReference wello;
+
+ public String jello(String s) {
+ out.println("ClientTest.jello(" + s + ")");
+ return jello.hello(s);
+ }
+
+ public String wello(String s) {
+ out.println("ClientTest.wello(" + s + ")");
+ final Element hreq = dom("http://sample", "hello", elem("name", text(s)));
+ final Element hres = wello.call("hello", hreq);
+ return xpath("//*", hres);
+ }
+}
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/Hello.java b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/Hello.java
new file mode 100644
index 0000000000..f6e02591e5
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/Hello.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package sample;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+@Remotable
+public interface Hello {
+
+ String hello(String s);
+}
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/JelloTest.java b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/JelloTest.java
new file mode 100644
index 0000000000..53ed006132
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/JelloTest.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package sample;
+
+import static java.lang.System.out;
+import sample.api.Java;
+
+/**
+ * Sample component implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+@Java(Hello.class)
+public class JelloTest {
+
+ @Java(Upper.class)
+ Upper upper;
+
+ public String hello(String s) {
+ out.println("JelloTest.hello(" + s + ")");
+ return upper.upper("Hello " + s);
+ }
+}
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/Upper.java b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/Upper.java
new file mode 100644
index 0000000000..04e929ade7
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/Upper.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package sample;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+@Remotable
+public interface Upper {
+
+ String upper(String s);
+}
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/UpperTest.java b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/UpperTest.java
new file mode 100644
index 0000000000..fe90097efa
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/UpperTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package sample;
+
+import static java.lang.System.out;
+import sample.api.Java;
+
+/**
+ * Sample component implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+@Java(Upper.class)
+public class UpperTest {
+
+ public String upper(String s) {
+ out.println("UpperTest.upper(" + s + ")");
+ return s.toUpperCase();
+ }
+}
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/WelloTest.java b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/WelloTest.java
new file mode 100644
index 0000000000..2f647d1a8f
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/WelloTest.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package sample;
+
+import static java.lang.System.out;
+import static sample.Xutil.dom;
+import static sample.Xutil.elem;
+import static sample.Xutil.text;
+import static sample.Xutil.xpath;
+
+import org.w3c.dom.Element;
+
+import sample.api.WSDL;
+import sample.api.WSDLReference;
+
+/**
+ * Sample component implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+@WSDL("http://sample#Hello")
+public class WelloTest {
+
+ @WSDL("http://sample#Upper")
+ WSDLReference upper;
+
+ public Element call(String op, Element e) {
+ out.println("WelloTest." + op + "(" + Xutil.xml(e) + ")");
+ final Element ureq = dom("http://sample", "upper", elem("s", text("Hello " + xpath("//name", e))));
+ final Element ures = upper.call("upper", ureq);
+ return dom("http://sample", "helloResponse", elem("result", text(xpath("//*", ures))));
+ }
+}
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/Xutil.java b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/Xutil.java
new file mode 100644
index 0000000000..91af7c47e9
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/Xutil.java
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package sample;
+
+import java.io.StringWriter;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * A little bit of magic code and utility functions to help work with DOM.
+ */
+class Xutil {
+ static class NodeBuilder {
+ String ns;
+ String name;
+ NodeBuilder[] children;
+ String text;
+ }
+
+ /**
+ * Convert a name and a list of children to a document element.
+ */
+ static Element dom(String ns, String name, final NodeBuilder... nodes) {
+ return (Element)node(elem(ns, name, nodes), db.newDocument());
+ }
+
+ /**
+ * Convert a name and children to an element.
+ */
+ static NodeBuilder elem(final String uri, final String n, final NodeBuilder... nodes) {
+ return new NodeBuilder() {
+ {
+ this.ns = uri;
+ this.name = n;
+ this.children = nodes;
+ }
+ };
+ }
+
+ static NodeBuilder elem(final String n, final NodeBuilder... nodes) {
+ return new NodeBuilder() {
+ {
+ this.name = n;
+ this.children = nodes;
+ }
+ };
+ }
+
+ /**
+ * Convert a string to a text element.
+ */
+ static NodeBuilder text(final String t) {
+ return new NodeBuilder() {
+ {
+ this.text = t;
+ }
+ };
+ }
+
+ private final static DocumentBuilder db = db();
+
+ private static DocumentBuilder db() {
+ try {
+ return DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ } catch(ParserConfigurationException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private static Element link(final Element e, final Document doc, final NodeBuilder... nodes) {
+ for(final NodeBuilder c: nodes)
+ e.appendChild(node(c, doc));
+ return e;
+ }
+
+ private static Node node(NodeBuilder node, Document doc) {
+ if(node.text != null)
+ return doc.createTextNode(node.text);
+ return link(doc.createElementNS(node.ns, node.name), doc, node.children);
+ }
+
+ /**
+ * Convert an element to XML.
+ */
+ static TransformerFactory trf = TransformerFactory.newInstance();
+
+ static String xml(final Node node) {
+ try {
+ final StreamResult r = new StreamResult(new StringWriter());
+ trf.newTransformer().transform(new DOMSource(node), r);
+ return r.getWriter().toString();
+ } catch(TransformerException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Evaluate an xpath expression.
+ */
+ private static XPathFactory xpf = XPathFactory.newInstance();
+
+ static String xpath(final String expr, final Node node) {
+ final XPath xp = xpf.newXPath();
+ try {
+ return (String)xp.evaluate(expr, node, XPathConstants.STRING);
+ } catch(XPathExpressionException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+}
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/impl/ReadWriteTestCase.java b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/impl/ReadWriteTestCase.java
new file mode 100644
index 0000000000..8d01c82edf
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/impl/ReadWriteTestCase.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package sample.impl;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Test reading/writing Sample implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReadWriteTestCase {
+ static XMLInputFactory xif;
+ static XMLOutputFactory xof;
+ static StAXArtifactProcessor<Object> xproc;
+ static ProcessorContext ctx;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ final DefaultExtensionPointRegistry ep = new DefaultExtensionPointRegistry();
+ final Contribution contrib = new DefaultContributionFactory().createContribution();
+ contrib.setLocation(ReadWriteTestCase.class.getProtectionDomain().getCodeSource().getLocation().toString());
+ ctx = new ProcessorContext(contrib, null);
+ xif = XMLInputFactory.newInstance();
+ xof = XMLOutputFactory.newInstance();
+ final StAXArtifactProcessorExtensionPoint xpep = new DefaultStAXArtifactProcessorExtensionPoint(ep);
+ xproc = new ExtensibleStAXArtifactProcessor(xpep, xif, xof);
+ }
+
+ @Test
+ public void testRead() throws Exception {
+ final InputStream is = getClass().getClassLoader().getResourceAsStream("test.composite");
+ final Composite c = (Composite)xproc.read(xif.createXMLStreamReader(is), ctx);
+ assertNotNull(c);
+ assertEquals("sample.ClientTest", ((SampleImplementation)c.getComponents().get(0).getImplementation()).name);
+ }
+
+ @Test
+ public void testReadWrite() throws Exception {
+ final InputStream is = getClass().getClassLoader().getResourceAsStream("test.composite");
+ final Composite c = (Composite)xproc.read(xif.createXMLStreamReader(is), ctx);
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ xproc.write(c, xof.createXMLStreamWriter(bos), ctx);
+ assertTrue(bos.toString().contains("class=\"sample.WelloTest\""));
+ }
+}
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/impl/RunTestCase.java b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/impl/RunTestCase.java
new file mode 100644
index 0000000000..26cbd5d3e4
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/impl/RunTestCase.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package sample.impl;
+
+import static java.lang.System.out;
+
+import org.apache.tuscany.sca.node.Contribution;
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import sample.Client;
+
+/**
+ * Test run.
+ *
+ * @version $Rev$ $Date$
+ */
+public class RunTestCase {
+ static Node node;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ final NodeFactory nf = NodeFactory.newInstance();
+ final String here = RunTestCase.class.getProtectionDomain().getCodeSource().getLocation().toString();
+ node = nf.createNode(new Contribution("test", here));
+ node.start();
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ node.stop();
+ }
+
+ Client client() {
+ return node.getService(Client.class, "client-test/Client");
+ }
+
+ @Test
+ public void jello() {
+ out.println("RunTestCase.jello");
+ out.println(client().jello("Java"));
+ }
+
+ @Test
+ public void wello() {
+ out.println("RunTestCase.wello");
+ out.println(client().wello("WSDL"));
+ }
+
+}
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/resources/Hello.wsdl b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/resources/Hello.wsdl
new file mode 100644
index 0000000000..561e560e7a
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/resources/Hello.wsdl
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://sample" xmlns:tns="http://sample"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="Hello">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://sample"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="hello">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="helloResponse">
+ <complexType>
+ <sequence>
+ <element name="result" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="helloRequest">
+ <wsdl:part element="tns:hello" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="helloResponse">
+ <wsdl:part element="tns:helloResponse" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:portType name="Hello">
+ <wsdl:operation name="hello">
+ <wsdl:input message="tns:helloRequest" name="helloRequest" />
+ <wsdl:output message="tns:helloResponse" name="helloResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+</wsdl:definitions>
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/resources/Upper.wsdl b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/resources/Upper.wsdl
new file mode 100644
index 0000000000..60eaec9f27
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/resources/Upper.wsdl
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://sample" xmlns:tns="http://sample"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="Upper">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://sample"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="upper">
+ <complexType>
+ <sequence>
+ <element name="s" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="upperResponse">
+ <complexType>
+ <sequence>
+ <element name="result" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="upperRequest">
+ <wsdl:part element="tns:upper" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="upperResponse">
+ <wsdl:part element="tns:upperResponse" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:portType name="Upper">
+ <wsdl:operation name="upper">
+ <wsdl:input message="tns:upperRequest" name="upperRequest" />
+ <wsdl:output message="tns:upperResponse" name="upperResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+</wsdl:definitions>
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/resources/test.composite b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/resources/test.composite
new file mode 100644
index 0000000000..535488b74e
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/resources/test.composite
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1"
+ targetNamespace="http://test"
+ name="test">
+
+ <component name="client-test">
+ <t:implementation.sample class="sample.ClientTest"/>
+ <reference name="wello" target="wello-test"/>
+ <reference name="jello" target="jello-test"/>
+ </component>
+
+ <component name="wello-test">
+ <t:implementation.sample class="sample.WelloTest"/>
+ <reference name="upper" target="upper-test"/>
+ </component>
+
+ <component name="jello-test">
+ <t:implementation.sample class="sample.JelloTest"/>
+ <reference name="upper" target="upper-test"/>
+ </component>
+
+ <component name="upper-test">
+ <t:implementation.sample class="sample.UpperTest"/>
+ </component>
+
+</composite>