summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-0.91/samples/binding-echo-extension
diff options
context:
space:
mode:
authordims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
committerdims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
commitbdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a (patch)
tree38a92061c0793434c4be189f1d70c3458b6bc41d /branches/sca-java-0.91/samples/binding-echo-extension
Move Tuscany from Incubator to top level.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-0.91/samples/binding-echo-extension')
-rw-r--r--branches/sca-java-0.91/samples/binding-echo-extension/README78
-rw-r--r--branches/sca-java-0.91/samples/binding-echo-extension/build.xml51
-rw-r--r--branches/sca-java-0.91/samples/binding-echo-extension/pom.xml78
-rw-r--r--branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/DefaultEchoBindingFactory.java33
-rw-r--r--branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java28
-rw-r--r--branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/EchoBindingFactory.java33
-rw-r--r--branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java77
-rw-r--r--branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java71
-rw-r--r--branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/module/EchoModuleActivator.java69
-rw-r--r--branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java48
-rw-r--r--branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java55
-rw-r--r--branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java62
-rw-r--r--branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java74
-rw-r--r--branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/server/EchoServer.java72
-rw-r--r--branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/server/EchoService.java53
-rw-r--r--branches/sca-java-0.91/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--branches/sca-java-0.91/samples/binding-echo-extension/src/test/java/echo/Echo.java29
-rw-r--r--branches/sca-java-0.91/samples/binding-echo-extension/src/test/java/echo/EchoComponentImpl.java44
-rw-r--r--branches/sca-java-0.91/samples/binding-echo-extension/src/test/java/echo/EchoReferenceTestCase.java48
-rw-r--r--branches/sca-java-0.91/samples/binding-echo-extension/src/test/java/echo/EchoServiceTestCase.java48
-rw-r--r--branches/sca-java-0.91/samples/binding-echo-extension/src/test/resources/EchoBinding.composite40
21 files changed, 1109 insertions, 0 deletions
diff --git a/branches/sca-java-0.91/samples/binding-echo-extension/README b/branches/sca-java-0.91/samples/binding-echo-extension/README
new file mode 100644
index 0000000000..d8ded49e21
--- /dev/null
+++ b/branches/sca-java-0.91/samples/binding-echo-extension/README
@@ -0,0 +1,78 @@
+Binding Echo Sample
+===================
+This sample demonstrates how new bindings are constructed for Apache Tuscany
+SCA.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you want to try out the echo binding that this sample provides
+please see the binding-echo sample that provides the necessary client and
+application code to bring up an application that uses this binding
+
+Sample Overview
+---------------
+This sample contains a implementation of an SCA binding that simply echoes back
+any messages that are sent to it.
+
+binding-echo-extension/
+ src/
+ main/
+ java/
+ echo/ - The binding interfaces
+ impl/ - The bindings model classes
+ module/ - The activator that loads the binding into the
+ SCA runtime
+ provider/ - The bindings runtime classes
+ server/ - A dummy server that the binding is plugged into
+ resources/
+ META-INF/
+ services/
+ org.apache.sca.tuscany.sca.core.ModuleActivator - specifies the
+ module activation class to call
+ test/
+ java/
+ echo/ - test code
+ resources/
+ EchoBinding.composite - the SCA assembly used by the unit test
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building The Sample Using Ant
+-----------------------------
+With the binary distribution the sample can be built using Ant as
+follows
+
+cd binding-echo-extension
+ant compile
+
+See the binding-echo sample to run a sample that uses this binding.
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd binding-echo-extension
+mvn
+
+Maven will also test that the sample extension built properly. You should see
+the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running echo.EchoServiceTestCase
+Returned message: foo
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.011 sec
+Running echo.EchoReferenceTestCase
+Returned message: foo
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.06 sec
+
+Results :
+
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
+
+
+This shows that the Junit test cases have run successfully.
diff --git a/branches/sca-java-0.91/samples/binding-echo-extension/build.xml b/branches/sca-java-0.91/samples/binding-echo-extension/build.xml
new file mode 100644
index 0000000000..17defccb6d
--- /dev/null
+++ b/branches/sca-java-0.91/samples/binding-echo-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="bining-echo" default="compile">
+ <property name="test.jar" value="sample-binding-echo-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/branches/sca-java-0.91/samples/binding-echo-extension/pom.xml b/branches/sca-java-0.91/samples/binding-echo-extension/pom.xml
new file mode 100644
index 0000000000..18c3105820
--- /dev/null
+++ b/branches/sca-java-0.91/samples/binding-echo-extension/pom.xml
@@ -0,0 +1,78 @@
+<?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-sca</artifactId>
+ <version>0.91-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-binding-echo-extension</artifactId>
+ <name>Apache Tuscany Echo Binding Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>0.91-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>0.91-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.91-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.91-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/DefaultEchoBindingFactory.java b/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/DefaultEchoBindingFactory.java
new file mode 100644
index 0000000000..b27b936302
--- /dev/null
+++ b/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/DefaultEchoBindingFactory.java
@@ -0,0 +1,33 @@
+/*
+ * 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 echo;
+
+import echo.impl.EchoBindingImpl;
+
+/**
+ * A factory for the sample Echo binding model.
+ */
+public class DefaultEchoBindingFactory implements EchoBindingFactory {
+
+ public EchoBinding createEchoBinding() {
+ return new EchoBindingImpl();
+ }
+
+}
diff --git a/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java b/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java
new file mode 100644
index 0000000000..446f720634
--- /dev/null
+++ b/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/EchoBinding.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 echo;
+
+import org.apache.tuscany.sca.assembly.Binding;
+
+/**
+ * A model for the sample Echo binding.
+ */
+public interface EchoBinding extends Binding {
+}
diff --git a/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/EchoBindingFactory.java b/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/EchoBindingFactory.java
new file mode 100644
index 0000000000..0f6fee82be
--- /dev/null
+++ b/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/EchoBindingFactory.java
@@ -0,0 +1,33 @@
+/*
+ * 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 echo;
+
+/**
+ * A factory for the sample Echo binding model.
+ */
+public interface EchoBindingFactory {
+
+ /**
+ * Creates a new Echo binding.
+ *
+ * @return a new Echo binding
+ */
+ EchoBinding createEchoBinding();
+}
diff --git a/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java b/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java
new file mode 100644
index 0000000000..ef1629d519
--- /dev/null
+++ b/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java
@@ -0,0 +1,77 @@
+/*
+ * 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 echo.impl;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+import echo.EchoBinding;
+
+/**
+ * Implementation of the Echo binding model.
+ */
+public class EchoBindingImpl implements EchoBinding {
+
+ private String name;
+ private String uri;
+
+ public String getName() {
+ return name;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ // The sample binding does not support policies
+ return Collections.emptyList();
+ }
+
+ public List<Intent> getRequiredIntents() {
+ // The sample binding does not support policies
+ return Collections.emptyList();
+ }
+
+ public List<Object> getExtensions() {
+ // The sample binding does not support extensions
+ return Collections.emptyList();
+ }
+
+ public boolean isUnresolved() {
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ // The sample binding is always resolved
+ }
+
+}
diff --git a/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java b/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java
new file mode 100644
index 0000000000..1d82cd860c
--- /dev/null
+++ b/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java
@@ -0,0 +1,71 @@
+/*
+ * 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 echo.impl;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+
+import echo.EchoBinding;
+import echo.EchoBindingFactory;
+
+/**
+ * A processor for <binding.echo> elements.
+ */
+public class EchoBindingProcessor implements StAXArtifactProcessor<EchoBinding> {
+
+ private QName BINDING_ECHO = new QName("http://echo", "binding.echo");
+
+ private final EchoBindingFactory factory;
+
+ public EchoBindingProcessor(EchoBindingFactory factory) {
+ this.factory = factory;
+ }
+
+ public QName getArtifactType() {
+ return BINDING_ECHO;
+ }
+
+ public Class<EchoBinding> getModelType() {
+ return EchoBinding.class;
+ }
+
+ public EchoBinding read(XMLStreamReader reader) throws ContributionReadException {
+ String uri = reader.getAttributeValue(null, "uri");
+ EchoBinding echoBinding = factory.createEchoBinding();
+ if (uri != null) {
+ echoBinding.setURI(uri.trim());
+ }
+ return echoBinding;
+ }
+
+ public void write(EchoBinding echoBinding, XMLStreamWriter writer) throws ContributionWriteException {
+ }
+
+ public void resolve(EchoBinding echoBinding, ModelResolver resolver) throws ContributionResolveException {
+ }
+
+}
diff --git a/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/module/EchoModuleActivator.java b/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/module/EchoModuleActivator.java
new file mode 100644
index 0000000000..268b903e54
--- /dev/null
+++ b/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/module/EchoModuleActivator.java
@@ -0,0 +1,69 @@
+/*
+ * 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 echo.module;
+
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
+
+import echo.DefaultEchoBindingFactory;
+import echo.EchoBindingFactory;
+import echo.impl.EchoBindingProcessor;
+import echo.provider.EchoBindingProviderFactory;
+import echo.server.EchoServer;
+
+/**
+ * A module activator for the sample Echo binding extension.
+ */
+public class EchoModuleActivator implements ModuleActivator {
+
+ public Object[] getExtensionPoints() {
+ // No extensionPoints being contributed here
+ return null;
+ }
+
+ public void start(ExtensionPointRegistry registry) {
+
+ ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ MessageFactory messageFactory = factories.getFactory(MessageFactory.class);
+
+ // Create the Echo model factory
+ EchoBindingFactory echoFactory = new DefaultEchoBindingFactory();
+
+ // Add the EchoProcessor extension
+ StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ EchoBindingProcessor echoBindingProcessor = new EchoBindingProcessor(echoFactory);
+ processors.addArtifactProcessor(echoBindingProcessor);
+
+ ProviderFactoryExtensionPoint providerFactories = registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+ providerFactories.addProviderFactory(new EchoBindingProviderFactory(messageFactory));
+
+ // Start the Echo server
+ EchoServer.start();
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ EchoServer.stop();
+ }
+
+}
diff --git a/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java b/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java
new file mode 100644
index 0000000000..e3d52fa703
--- /dev/null
+++ b/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.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 echo.provider;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+
+/**
+ * Interceptor for the sample echo binding.
+ */
+public class EchoBindingInvoker implements Invoker {
+
+ private Object echo(Object[] args) throws InvocationTargetException {
+ // echo back the result, a real binding would invoke some API for flowing the request
+ return args[0];
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ Object resp = echo((Object[])msg.getBody());
+ msg.setBody(resp);
+ } catch (InvocationTargetException e) {
+ msg.setFaultBody(e.getCause());
+ } catch (Throwable e) {
+ msg.setFaultBody(e);
+ }
+ return msg;
+ }
+
+}
diff --git a/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java b/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java
new file mode 100644
index 0000000000..623cb0e16e
--- /dev/null
+++ b/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java
@@ -0,0 +1,55 @@
+/*
+ * 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 echo.provider;
+
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.provider.BindingProviderFactory;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+import echo.EchoBinding;
+
+
+/**
+ * Implementation of the Echo binding model.
+ */
+public class EchoBindingProviderFactory implements BindingProviderFactory<EchoBinding> {
+
+ private MessageFactory messageFactory;
+
+ public EchoBindingProviderFactory(MessageFactory messageFactory) {
+ this.messageFactory = messageFactory;
+ }
+
+ public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component, RuntimeComponentReference reference, EchoBinding binding) {
+ return new EchoReferenceBindingProvider(component, reference, binding);
+ }
+
+ public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component, RuntimeComponentService service, EchoBinding binding) {
+ return new EchoServiceBindingProvider(component, service, binding, messageFactory);
+ }
+
+ public Class<EchoBinding> getModelType() {
+ return EchoBinding.class;
+ }
+}
diff --git a/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java b/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java
new file mode 100644
index 0000000000..dd1a8f42f8
--- /dev/null
+++ b/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java
@@ -0,0 +1,62 @@
+/*
+ * 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 echo.provider;
+
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+
+import echo.EchoBinding;
+
+/**
+ * Implementation of the Echo binding provider.
+ */
+public class EchoReferenceBindingProvider implements ReferenceBindingProvider {
+
+ private RuntimeComponentReference reference;
+
+ public EchoReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ EchoBinding binding) {
+ this.reference = reference;
+ }
+
+ public Invoker createInvoker(Operation operation, boolean isCallback) {
+ if (isCallback) {
+ throw new UnsupportedOperationException();
+ } else {
+ return new EchoBindingInvoker();
+ }
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return reference.getInterfaceContract();
+ }
+
+ public void start() {
+ }
+
+ public void stop() {
+ }
+
+}
diff --git a/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java b/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java
new file mode 100644
index 0000000000..896e40df8d
--- /dev/null
+++ b/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java
@@ -0,0 +1,74 @@
+/*
+ * 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 echo.provider;
+
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+import echo.EchoBinding;
+import echo.server.EchoServer;
+import echo.server.EchoService;
+
+/**
+ * Implementation of the Echo binding provider.
+ */
+public class EchoServiceBindingProvider implements ServiceBindingProvider {
+
+ private RuntimeComponent component;
+ private RuntimeComponentService service;
+ private EchoBinding binding;
+ private MessageFactory messageFactory;
+
+ public EchoServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service, EchoBinding binding, MessageFactory messageFactory) {
+ this.component = component;
+ this.service = service;
+ this.binding = binding;
+ this.messageFactory = messageFactory;
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return service.getInterfaceContract();
+ }
+
+ public void start() {
+
+ RuntimeComponentService componentService = (RuntimeComponentService) service;
+ RuntimeWire wire = componentService.getRuntimeWire(binding);
+ InvocationChain chain = wire.getInvocationChains().get(0);
+
+ // Register with the hosting server
+ String uri = component.getURI() + "/" + binding.getName();
+ EchoServer.getServer().register(uri, new EchoService(chain.getHeadInvoker(), messageFactory));
+ }
+
+ public void stop() {
+
+ // Unregister from the hosting server
+ String uri = component.getURI() + "/" + binding.getName();
+ EchoServer.getServer().unregister(uri);
+ }
+
+}
diff --git a/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/server/EchoServer.java b/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/server/EchoServer.java
new file mode 100644
index 0000000000..e1c88c38f9
--- /dev/null
+++ b/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/server/EchoServer.java
@@ -0,0 +1,72 @@
+/*
+ * 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 echo.server;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A sample Echo server, showing how to integrate service bindings.
+ */
+public class EchoServer {
+
+ public static EchoServer server;
+
+ private Map<String, EchoService> services = new HashMap<String, EchoService>();
+
+ public static void start() {
+ server = new EchoServer();
+ }
+
+ public static void stop() {
+ server = null;
+ }
+
+ public static EchoServer getServer() {
+ return server;
+ }
+
+ /**
+ * Register a service under the given name.
+ *
+ * @param service
+ * @param name
+ */
+ public void register(String uri, EchoService service) {
+ services.put(uri, service);
+ }
+
+ public void unregister(String uri) {
+ services.remove(uri);
+ }
+
+ /**
+ * Dispatch an incoming interaction to the corresponding service.
+ *
+ * @param uri
+ * @param input
+ * @return
+ */
+ public String sendReceive(String uri, String input) throws InvocationTargetException {
+ return services.get(uri).sendReceive(input);
+ }
+
+}
diff --git a/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/server/EchoService.java b/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/server/EchoService.java
new file mode 100644
index 0000000000..79593b2b6c
--- /dev/null
+++ b/branches/sca-java-0.91/samples/binding-echo-extension/src/main/java/echo/server/EchoService.java
@@ -0,0 +1,53 @@
+/*
+ * 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 echo.server;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+
+/**
+ * The EchoService
+ */
+public class EchoService {
+ private Invoker invoker;
+ private MessageFactory messageFactory;
+
+ public EchoService(Invoker invoker, MessageFactory messageFactory) {
+ super();
+ this.invoker = invoker;
+ this.messageFactory = messageFactory;
+ }
+
+ public String sendReceive(String input) throws InvocationTargetException {
+
+ Message request = messageFactory.createMessage();
+ request.setBody(new Object[] {input});
+ // dispatch and get the response
+ Message response = invoker.invoke(request);
+ Object body = response.getBody();
+ if (response.isFault()) {
+ throw new InvocationTargetException((Throwable)body);
+ }
+ return (String)body;
+ }
+
+}
diff --git a/branches/sca-java-0.91/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/branches/sca-java-0.91/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..13d0d6f570
--- /dev/null
+++ b/branches/sca-java-0.91/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -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.
+# Implementation class for the ExtensionActivator
+echo.module.EchoModuleActivator
diff --git a/branches/sca-java-0.91/samples/binding-echo-extension/src/test/java/echo/Echo.java b/branches/sca-java-0.91/samples/binding-echo-extension/src/test/java/echo/Echo.java
new file mode 100644
index 0000000000..1d5e973f33
--- /dev/null
+++ b/branches/sca-java-0.91/samples/binding-echo-extension/src/test/java/echo/Echo.java
@@ -0,0 +1,29 @@
+/*
+ * 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 echo;
+
+/**
+ * Interface of our sample Echo service.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Echo {
+
+ String echo(String msg);
+}
diff --git a/branches/sca-java-0.91/samples/binding-echo-extension/src/test/java/echo/EchoComponentImpl.java b/branches/sca-java-0.91/samples/binding-echo-extension/src/test/java/echo/EchoComponentImpl.java
new file mode 100644
index 0000000000..ba68dfe908
--- /dev/null
+++ b/branches/sca-java-0.91/samples/binding-echo-extension/src/test/java/echo/EchoComponentImpl.java
@@ -0,0 +1,44 @@
+/*
+ * 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 echo;
+
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Reference;
+
+
+/**
+ * A simple client component that uses a reference with an Echo binding.
+ *
+ * @version $Rev$ $Date$
+ */
+public class EchoComponentImpl implements Echo {
+
+ private Echo echoReference;
+
+ @Constructor
+ public EchoComponentImpl(@Reference(name = "echoReference", required = true) Echo echoReference) {
+ this.echoReference = echoReference;
+ }
+
+ public String echo(String msg) {
+ String result = echoReference.echo(msg);
+ System.out.println("Returned message: "+ result);
+ return result;
+ }
+}
diff --git a/branches/sca-java-0.91/samples/binding-echo-extension/src/test/java/echo/EchoReferenceTestCase.java b/branches/sca-java-0.91/samples/binding-echo-extension/src/test/java/echo/EchoReferenceTestCase.java
new file mode 100644
index 0000000000..dc6a37c11f
--- /dev/null
+++ b/branches/sca-java-0.91/samples/binding-echo-extension/src/test/java/echo/EchoReferenceTestCase.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 echo;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EchoReferenceTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private Echo service;
+
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("EchoBinding.composite");
+ service = scaDomain.getService(Echo.class, "EchoComponent");
+ }
+
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testEchoBinding() {
+ String result = service.echo("foo");
+ assertEquals(result, "foo");
+ }
+
+
+}
diff --git a/branches/sca-java-0.91/samples/binding-echo-extension/src/test/java/echo/EchoServiceTestCase.java b/branches/sca-java-0.91/samples/binding-echo-extension/src/test/java/echo/EchoServiceTestCase.java
new file mode 100644
index 0000000000..fafc112d01
--- /dev/null
+++ b/branches/sca-java-0.91/samples/binding-echo-extension/src/test/java/echo/EchoServiceTestCase.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 echo;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import echo.server.EchoServer;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EchoServiceTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("EchoBinding.composite");
+ }
+
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testEchoBinding() throws Exception {
+ String result = EchoServer.getServer().sendReceive("EchoComponent/EchoService", "foo");
+ assertEquals(result, "foo");
+ }
+
+
+}
diff --git a/branches/sca-java-0.91/samples/binding-echo-extension/src/test/resources/EchoBinding.composite b/branches/sca-java-0.91/samples/binding-echo-extension/src/test/resources/EchoBinding.composite
new file mode 100644
index 0000000000..d0d138533b
--- /dev/null
+++ b/branches/sca-java-0.91/samples/binding-echo-extension/src/test/resources/EchoBinding.composite
@@ -0,0 +1,40 @@
+<?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://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample/echo"
+ xmlns:se="http://sample/echo"
+ xmlns:e="http://echo"
+ name="EchoBinding">
+
+ <service name="EchoService" promote="EchoComponent">
+ <interface.java interface="echo.Echo"/>
+ <e:binding.echo uri="http://tempuri.org" />
+ </service>
+
+ <component name="EchoComponent">
+ <implementation.java class="echo.EchoComponentImpl"/>
+ </component>
+
+ <reference name="EchoReference" promote="EchoComponent/echoReference">
+ <interface.java interface="echo.Echo"/>
+ <e:binding.echo uri="http://tempuri.org" />
+ </reference>
+
+</composite>