You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2010/08/29 20:25:26 UTC

svn commit: r990618 - in /tuscany/sca-java-2.x/trunk/samples/implementation-extension: ./ src/ src/main/ src/main/java/ src/main/java/sample/ src/main/java/sample/api/ src/main/java/sample/impl/ src/main/resources/ src/main/resources/META-INF/ src/main...

Author: jsdelfino
Date: Sun Aug 29 18:25:24 2010
New Revision: 990618

URL: http://svn.apache.org/viewvc?rev=990618&view=rev
Log:
Sample implementation extension that shows how to support both Java and WSDL interfaces and different data bindings.

Added:
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/README
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/build.xml
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/pom.xml
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/api/
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/api/Java.java
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/api/WSDL.java
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/api/WSDLReference.java
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleImplementation.java
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleImplementationProcessor.java
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleJavaInvoker.java
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleProvider.java
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleProviderFactory.java
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleUtil.java
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleWSDLInvoker.java
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleWSDLProxy.java
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/resources/
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/resources/META-INF/
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/resources/META-INF/services/
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/resources/sample/
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/resources/sample/impl/
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/resources/sample/impl/sample.xsd
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/Client.java
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/ClientTest.java
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/Hello.java
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/JelloTest.java
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/Upper.java
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/UpperTest.java
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/WelloTest.java
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/Xutil.java
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/impl/
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/impl/ReadWriteTestCase.java
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/impl/RunTestCase.java
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/resources/
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/resources/Hello.wsdl
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/resources/Upper.wsdl
    tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/resources/test.composite

Added: tuscany/sca-java-2.x/trunk/samples/implementation-extension/README
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/implementation-extension/README?rev=990618&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/implementation-extension/README (added)
+++ tuscany/sca-java-2.x/trunk/samples/implementation-extension/README Sun Aug 29 18:25:24 2010
@@ -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.
+

Added: tuscany/sca-java-2.x/trunk/samples/implementation-extension/build.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/implementation-extension/build.xml?rev=990618&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/implementation-extension/build.xml (added)
+++ tuscany/sca-java-2.x/trunk/samples/implementation-extension/build.xml Sun Aug 29 18:25:24 2010
@@ -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>

Added: tuscany/sca-java-2.x/trunk/samples/implementation-extension/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/implementation-extension/pom.xml?rev=990618&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/implementation-extension/pom.xml (added)
+++ tuscany/sca-java-2.x/trunk/samples/implementation-extension/pom.xml Sun Aug 29 18:25:24 2010
@@ -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>

Added: tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/api/Java.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/api/Java.java?rev=990618&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/api/Java.java (added)
+++ tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/api/Java.java Sun Aug 29 18:25:24 2010
@@ -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();
+}

Added: tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/api/WSDL.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/api/WSDL.java?rev=990618&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/api/WSDL.java (added)
+++ tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/api/WSDL.java Sun Aug 29 18:25:24 2010
@@ -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();
+}

Added: tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/api/WSDLReference.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/api/WSDLReference.java?rev=990618&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/api/WSDLReference.java (added)
+++ tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/api/WSDLReference.java Sun Aug 29 18:25:24 2010
@@ -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);
+
+}

Added: tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleImplementation.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleImplementation.java?rev=990618&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleImplementation.java (added)
+++ tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleImplementation.java Sun Aug 29 18:25:24 2010
@@ -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;
+    }
+
+}

Added: tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleImplementationProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleImplementationProcessor.java?rev=990618&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleImplementationProcessor.java (added)
+++ tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleImplementationProcessor.java Sun Aug 29 18:25:24 2010
@@ -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);
+        }
+    }
+}

Added: tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleJavaInvoker.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleJavaInvoker.java?rev=990618&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleJavaInvoker.java (added)
+++ tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleJavaInvoker.java Sun Aug 29 18:25:24 2010
@@ -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;
+    }
+}

Added: tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleProvider.java?rev=990618&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleProvider.java (added)
+++ tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleProvider.java Sun Aug 29 18:25:24 2010
@@ -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);
+        }
+    }
+}

Added: tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleProviderFactory.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleProviderFactory.java?rev=990618&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleProviderFactory.java (added)
+++ tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleProviderFactory.java Sun Aug 29 18:25:24 2010
@@ -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;
+    }
+}

Added: tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleUtil.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleUtil.java?rev=990618&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleUtil.java (added)
+++ tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleUtil.java Sun Aug 29 18:25:24 2010
@@ -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;
+    }
+}

Added: tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleWSDLInvoker.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleWSDLInvoker.java?rev=990618&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleWSDLInvoker.java (added)
+++ tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleWSDLInvoker.java Sun Aug 29 18:25:24 2010
@@ -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;
+    }
+}

Added: tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleWSDLProxy.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleWSDLProxy.java?rev=990618&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleWSDLProxy.java (added)
+++ tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/java/sample/impl/SampleWSDLProxy.java Sun Aug 29 18:25:24 2010
@@ -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);
+        }
+    }
+}

Added: tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor?rev=990618&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor (added)
+++ tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor Sun Aug 29 18:25:24 2010
@@ -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
+

Added: tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema?rev=990618&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema (added)
+++ tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema Sun Aug 29 18:25:24 2010
@@ -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

Added: tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory?rev=990618&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory (added)
+++ tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory Sun Aug 29 18:25:24 2010
@@ -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
+

Added: tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/resources/sample/impl/sample.xsd
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/resources/sample/impl/sample.xsd?rev=990618&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/resources/sample/impl/sample.xsd (added)
+++ tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/main/resources/sample/impl/sample.xsd Sun Aug 29 18:25:24 2010
@@ -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>

Added: tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/Client.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/Client.java?rev=990618&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/Client.java (added)
+++ tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/Client.java Sun Aug 29 18:25:24 2010
@@ -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);
+}

Added: tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/ClientTest.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/ClientTest.java?rev=990618&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/ClientTest.java (added)
+++ tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/ClientTest.java Sun Aug 29 18:25:24 2010
@@ -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);
+    }
+}

Added: tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/Hello.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/Hello.java?rev=990618&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/Hello.java (added)
+++ tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/Hello.java Sun Aug 29 18:25:24 2010
@@ -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);
+}

Added: tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/JelloTest.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/JelloTest.java?rev=990618&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/JelloTest.java (added)
+++ tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/JelloTest.java Sun Aug 29 18:25:24 2010
@@ -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);
+    }
+}

Added: tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/Upper.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/Upper.java?rev=990618&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/Upper.java (added)
+++ tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/Upper.java Sun Aug 29 18:25:24 2010
@@ -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);
+}

Added: tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/UpperTest.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/UpperTest.java?rev=990618&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/UpperTest.java (added)
+++ tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/UpperTest.java Sun Aug 29 18:25:24 2010
@@ -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();
+    }
+}

Added: tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/WelloTest.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/WelloTest.java?rev=990618&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/WelloTest.java (added)
+++ tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/WelloTest.java Sun Aug 29 18:25:24 2010
@@ -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))));
+    }
+}

Added: tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/Xutil.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/Xutil.java?rev=990618&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/Xutil.java (added)
+++ tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/Xutil.java Sun Aug 29 18:25:24 2010
@@ -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);
+        }
+    }
+
+}

Added: tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/impl/ReadWriteTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/impl/ReadWriteTestCase.java?rev=990618&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/impl/ReadWriteTestCase.java (added)
+++ tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/impl/ReadWriteTestCase.java Sun Aug 29 18:25:24 2010
@@ -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\""));
+    }
+}

Added: tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/impl/RunTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/impl/RunTestCase.java?rev=990618&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/impl/RunTestCase.java (added)
+++ tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/java/sample/impl/RunTestCase.java Sun Aug 29 18:25:24 2010
@@ -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"));
+    }
+
+}

Added: tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/resources/Hello.wsdl
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/resources/Hello.wsdl?rev=990618&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/resources/Hello.wsdl (added)
+++ tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/resources/Hello.wsdl Sun Aug 29 18:25:24 2010
@@ -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>

Added: tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/resources/Upper.wsdl
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/resources/Upper.wsdl?rev=990618&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/resources/Upper.wsdl (added)
+++ tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/resources/Upper.wsdl Sun Aug 29 18:25:24 2010
@@ -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>

Added: tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/resources/test.composite
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/resources/test.composite?rev=990618&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/resources/test.composite (added)
+++ tuscany/sca-java-2.x/trunk/samples/implementation-extension/src/test/resources/test.composite Sun Aug 29 18:25:24 2010
@@ -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>