summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-integration/samples/sca/echo-binding/src
diff options
context:
space:
mode:
Diffstat (limited to 'branches/sca-java-integration/samples/sca/echo-binding/src')
-rw-r--r--branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBinding.java31
-rw-r--r--branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBindingLoader.java59
-rw-r--r--branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBuilder.java52
-rw-r--r--branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoInvoker.java66
-rw-r--r--branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoReference.java49
-rw-r--r--branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoService.java45
-rw-r--r--branches/sca-java-integration/samples/sca/echo-binding/src/main/resources/META-INF/sca/extension.composite36
-rw-r--r--branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/Client.java27
-rw-r--r--branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/ClientImpl.java40
-rw-r--r--branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/Echo.java27
-rw-r--r--branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/EchoBindingTestCase.java47
-rw-r--r--branches/sca-java-integration/samples/sca/echo-binding/src/test/resources/EchoBinding.composite37
12 files changed, 0 insertions, 516 deletions
diff --git a/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBinding.java b/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBinding.java
deleted file mode 100644
index dbab7cb4b5..0000000000
--- a/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBinding.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.spi.model.BindingDefinition;
-
-/**
- * @version $Rev$ $Date$
- */
-public class EchoBinding extends BindingDefinition {
- public Object clone() {
- return this;
- }
-
-}
diff --git a/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBindingLoader.java b/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBindingLoader.java
deleted file mode 100644
index b01510bc74..0000000000
--- a/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBindingLoader.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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 javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import static org.osoa.sca.Constants.SCA_NS;
-import org.osoa.sca.annotations.Constructor;
-
-import org.apache.tuscany.spi.annotation.Autowire;
-import org.apache.tuscany.spi.component.CompositeComponent;
-import org.apache.tuscany.spi.deployer.DeploymentContext;
-import org.apache.tuscany.spi.extension.LoaderExtension;
-import org.apache.tuscany.spi.loader.LoaderException;
-import org.apache.tuscany.spi.loader.LoaderRegistry;
-import org.apache.tuscany.spi.model.ModelObject;
-
-/**
- * @version $Rev$ $Date$
- */
-public class EchoBindingLoader extends LoaderExtension<EchoBinding> {
-
- public static final QName BINDING_ECHO = new QName(SCA_NS, "binding.echo");
-
- @Constructor
- public EchoBindingLoader(@Autowire LoaderRegistry registry) {
- super(registry);
- }
-
- public QName getXMLType() {
- return BINDING_ECHO;
- }
-
- public EchoBinding load(CompositeComponent parent,
- ModelObject object,
- XMLStreamReader reader,
- DeploymentContext context) throws XMLStreamException, LoaderException {
- return new EchoBinding();
- }
-
-}
diff --git a/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBuilder.java b/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBuilder.java
deleted file mode 100644
index 7cf1b35617..0000000000
--- a/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBuilder.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.spi.builder.BuilderException;
-import org.apache.tuscany.spi.component.CompositeComponent;
-import org.apache.tuscany.spi.component.ReferenceBinding;
-import org.apache.tuscany.spi.component.ServiceBinding;
-import org.apache.tuscany.spi.deployer.DeploymentContext;
-import org.apache.tuscany.spi.extension.BindingBuilderExtension;
-import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
-import org.apache.tuscany.spi.model.ServiceDefinition;
-
-/**
- * @version $Rev$ $Date$
- */
-public class EchoBuilder extends BindingBuilderExtension<EchoBinding> {
-
- public ServiceBinding build(CompositeComponent parent,
- ServiceDefinition boundServiceDefinition,
- EchoBinding bindingDefinition,
- DeploymentContext deploymentContext) throws BuilderException {
- return new EchoService(boundServiceDefinition.getName(), parent);
- }
-
- public ReferenceBinding build(CompositeComponent parent,
- AbstractReferenceDefinition boundReferenceDefinition,
- EchoBinding bindingDefinition,
- DeploymentContext deploymentContext) throws BuilderException {
- return new EchoReference(boundReferenceDefinition.getName(), parent);
- }
-
- protected Class<EchoBinding> getBindingType() {
- return EchoBinding.class;
- }
-}
diff --git a/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoInvoker.java b/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoInvoker.java
deleted file mode 100644
index 83c3dd824d..0000000000
--- a/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoInvoker.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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 java.lang.reflect.InvocationTargetException;
-
-import org.apache.tuscany.spi.wire.InvocationRuntimeException;
-import org.apache.tuscany.spi.wire.Message;
-import org.apache.tuscany.spi.wire.TargetInvoker;
-
-/**
- * @version $Rev$ $Date$
- */
-public class EchoInvoker implements TargetInvoker {
-
- private boolean cacheable;
-
- public boolean isCacheable() {
- return cacheable;
- }
-
- public void setCacheable(boolean cacheable) {
- this.cacheable = cacheable;
- }
-
- public boolean isOptimizable() {
- return isCacheable();
- }
-
- public Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException {
- // echo back the result, a real binding would invoke some API for flowing the request
- return ((Object[])payload)[0];
- }
-
- public Message invoke(Message msg) throws InvocationRuntimeException {
- try {
- Object resp = invokeTarget(msg.getBody(), NONE);
- msg.setBody(resp);
- } catch (InvocationTargetException e) {
- msg.setBodyWithFault(e.getCause());
- } catch (Throwable e) {
- msg.setBodyWithFault(e);
- }
- return msg;
- }
-
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-}
diff --git a/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoReference.java b/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoReference.java
deleted file mode 100644
index 5d9f5329f5..0000000000
--- a/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoReference.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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 javax.xml.namespace.QName;
-
-import static org.osoa.sca.Constants.SCA_NS;
-
-import org.apache.tuscany.spi.component.CompositeComponent;
-import org.apache.tuscany.spi.extension.ReferenceBindingExtension;
-import org.apache.tuscany.spi.model.Operation;
-import org.apache.tuscany.spi.model.ServiceContract;
-import org.apache.tuscany.spi.wire.TargetInvoker;
-
-/**
- * @version $Rev$ $Date$
- */
-public class EchoReference extends ReferenceBindingExtension {
- private static final QName BINDING_ECHO = new QName(SCA_NS, "binding.echo");
-
- public EchoReference(String name, CompositeComponent parent) {
- super(name, parent);
- }
-
- public QName getBindingType() {
- return BINDING_ECHO;
- }
-
- public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation) {
- return new EchoInvoker();
- }
-
-}
diff --git a/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoService.java b/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoService.java
deleted file mode 100644
index 084777a632..0000000000
--- a/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoService.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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 javax.xml.namespace.QName;
-
-import static org.osoa.sca.Constants.SCA_NS;
-
-import org.apache.tuscany.spi.CoreRuntimeException;
-import org.apache.tuscany.spi.component.CompositeComponent;
-import org.apache.tuscany.spi.extension.ServiceBindingExtension;
-
-/**
- * @version $Rev$ $Date$
- */
-public class EchoService extends ServiceBindingExtension {
- private static final QName BINDING_ECHO = new QName(SCA_NS, "binding.echo");
-
- public EchoService(String name, CompositeComponent parent) throws CoreRuntimeException {
- super(name, parent);
- // do nothing, but this could register with the host environment
- }
-
-
- public QName getBindingType() {
- return BINDING_ECHO;
- }
-
-}
diff --git a/branches/sca-java-integration/samples/sca/echo-binding/src/main/resources/META-INF/sca/extension.composite b/branches/sca-java-integration/samples/sca/echo-binding/src/main/resources/META-INF/sca/extension.composite
deleted file mode 100644
index 12e295bee7..0000000000
--- a/branches/sca-java-integration/samples/sca/echo-binding/src/main/resources/META-INF/sca/extension.composite
+++ /dev/null
@@ -1,36 +0,0 @@
-<?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.
--->
-<!--
- JavaScript configuration for the launcher environment.
--->
-<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
-
- name="echobinding-extension">
-
- <component name="BindingLoader">
- <system:implementation.system class="echo.EchoBindingLoader"/>
- </component>
-
- <component name="BindingBuilder">
- <system:implementation.system class="echo.EchoBuilder"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/Client.java b/branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/Client.java
deleted file mode 100644
index 46c4f760d0..0000000000
--- a/branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/Client.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface Client {
-
- void call(String msg);
-}
diff --git a/branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/ClientImpl.java b/branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/ClientImpl.java
deleted file mode 100644
index f66d84cc4f..0000000000
--- a/branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/ClientImpl.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ClientImpl implements Client {
-
- private Echo echoReference;
-
- @Constructor
- public ClientImpl(@Reference(name = "echoReference", required = true) Echo echoReference) {
- this.echoReference = echoReference;
- }
-
- public void call(String msg) {
- String ret = echoReference.invoke(msg);
- System.out.println("Returned message: "+ ret);
- }
-}
diff --git a/branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/Echo.java b/branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/Echo.java
deleted file mode 100644
index 045609853a..0000000000
--- a/branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/Echo.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface Echo {
-
- String invoke(String msg);
-}
diff --git a/branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/EchoBindingTestCase.java b/branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/EchoBindingTestCase.java
deleted file mode 100644
index 8526924253..0000000000
--- a/branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/EchoBindingTestCase.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.api.SCARuntime;
-import org.osoa.sca.CompositeContext;
-import org.osoa.sca.CurrentCompositeContext;
-
-/**
- * @version $Rev$ $Date$
- */
-public class EchoBindingTestCase extends TestCase {
-
- private Client client;
-
- public void testEchoBinding() {
- client.call("foo");
- }
-
- protected void setUp() throws Exception {
- SCARuntime.start("EchoBinding.composite");
- CompositeContext context = CurrentCompositeContext.getContext();
- client = context.locateService(Client.class, "Client");
- }
-
- protected void tearDown() throws Exception {
- SCARuntime.stop();
- }
-}
diff --git a/branches/sca-java-integration/samples/sca/echo-binding/src/test/resources/EchoBinding.composite b/branches/sca-java-integration/samples/sca/echo-binding/src/test/resources/EchoBinding.composite
deleted file mode 100644
index b4e214869e..0000000000
--- a/branches/sca-java-integration/samples/sca/echo-binding/src/test/resources/EchoBinding.composite
+++ /dev/null
@@ -1,37 +0,0 @@
-<?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" name="echo">
-
- <service name="ClientService">
- <interface.java class="echo.Client"/>
- <binding.echo/>
- <reference>Client</reference>
- </service>
-
- <component name="Client">
- <implementation.java class="echo.ClientImpl"/>
- </component>
-
- <reference name="EchoReference" promote="Client">
- <interface.java interface="echo.Echo"/>
- <binding.echo/>
- </reference>
-
-</composite>