summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.3.2/samples/databinding-echo/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'branches/sca-java-1.3.2/samples/databinding-echo/src/main/java')
-rw-r--r--branches/sca-java-1.3.2/samples/databinding-echo/src/main/java/dbecho/ComponentAImpl.java74
-rw-r--r--branches/sca-java-1.3.2/samples/databinding-echo/src/main/java/dbecho/ComponentBImpl.java59
-rw-r--r--branches/sca-java-1.3.2/samples/databinding-echo/src/main/java/dbecho/Echo.java32
-rw-r--r--branches/sca-java-1.3.2/samples/databinding-echo/src/main/java/dbecho/EchoDataBindingClient.java45
-rw-r--r--branches/sca-java-1.3.2/samples/databinding-echo/src/main/java/dbecho/Interface1.java32
-rw-r--r--branches/sca-java-1.3.2/samples/databinding-echo/src/main/java/dbecho/Interface2.java36
6 files changed, 278 insertions, 0 deletions
diff --git a/branches/sca-java-1.3.2/samples/databinding-echo/src/main/java/dbecho/ComponentAImpl.java b/branches/sca-java-1.3.2/samples/databinding-echo/src/main/java/dbecho/ComponentAImpl.java
new file mode 100644
index 0000000000..5679614164
--- /dev/null
+++ b/branches/sca-java-1.3.2/samples/databinding-echo/src/main/java/dbecho/ComponentAImpl.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 dbecho;
+
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ComponentAImpl implements Interface1 {
+
+ private Interface1 componentBReference;
+
+ @Constructor
+ public ComponentAImpl(@Reference(name = "componentBReference", required = true)
+ Interface1 componentBReference) {
+ this.componentBReference = componentBReference;
+ }
+
+ public String call(String msg) {
+ String request = msg + " [" + msg.getClass().getName() + "]";
+ System.out.println("ComponentA --> Received message: " + request);
+ Object ret = componentBReference.call(msg);
+ String response = ret + " [" + ret.getClass().getName() + "]";
+ System.out.println("ComponentA --> Returned message: " + response);
+ return (String) ret;
+ }
+
+ public String call1(String msg) {
+ String request = msg + " [" + msg.getClass().getName() + "]";
+ System.out.println("ComponentA --> Received message: " + request);
+ Object ret = componentBReference.call1(msg);
+ String response = ret + " [" + ret.getClass().getName() + "]";
+ System.out.println("ComponentA --> Returned message: " + response);
+ return (String) ret;
+ }
+
+ @Property(name="prefix")
+ public void setPrefix(String prefix) {
+ System.out.println("[Property] prefix: " + prefix);
+ }
+
+ @Property(name="prefix1")
+ public void setPrefix1(String prefix1) {
+ System.out.println("[Property] prefix1: " + prefix1);
+ }
+
+ /**
+ * @param bar the bar to set
+ */
+ @Property(name="bar")
+ public void setBar(String bar) {
+ System.out.println("[Property] bar: " + bar);
+ }
+
+}
diff --git a/branches/sca-java-1.3.2/samples/databinding-echo/src/main/java/dbecho/ComponentBImpl.java b/branches/sca-java-1.3.2/samples/databinding-echo/src/main/java/dbecho/ComponentBImpl.java
new file mode 100644
index 0000000000..ff8968837d
--- /dev/null
+++ b/branches/sca-java-1.3.2/samples/databinding-echo/src/main/java/dbecho/ComponentBImpl.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package dbecho;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.osoa.sca.annotations.AllowsPassByReference;
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Reference;
+import org.w3c.dom.Node;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@AllowsPassByReference
+public class ComponentBImpl implements Interface2 {
+
+ private Echo echoReference;
+
+ @Constructor
+ public ComponentBImpl(@Reference(name = "echoReference", required = true)
+ Echo echoReference) {
+ this.echoReference = echoReference;
+ }
+
+ public Node call(Node msg) {
+ String request = msg + " [" + msg.getClass().getName() + "]";
+ System.out.println("ComponentB --> Received message: " + request);
+ Node ret = (Node) echoReference.echo(msg);
+ String response = ret + " [" + ret.getClass().getName() + "]";
+ System.out.println("ComponentB --> Returned message: " + response);
+ return ret;
+ }
+
+ public XMLStreamReader call1(XMLStreamReader msg) {
+ String request = msg + " [" + msg.getClass().getName() + "]";
+ System.out.println("ComponentB --> Received message: " + request);
+// XMLStreamReader ret = (XMLStreamReader) echoReference.echo(msg);
+ String response = request;
+ System.out.println("ComponentB --> Returned message: " + response);
+ return msg;
+ }
+}
diff --git a/branches/sca-java-1.3.2/samples/databinding-echo/src/main/java/dbecho/Echo.java b/branches/sca-java-1.3.2/samples/databinding-echo/src/main/java/dbecho/Echo.java
new file mode 100644
index 0000000000..25ecc90454
--- /dev/null
+++ b/branches/sca-java-1.3.2/samples/databinding-echo/src/main/java/dbecho/Echo.java
@@ -0,0 +1,32 @@
+/*
+ * 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 dbecho;
+
+import org.apache.tuscany.sca.databinding.annotation.DataBinding;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * @version $Rev$ $Date$
+ */
+
+@DataBinding("org.w3c.dom.Node")
+@Remotable
+public interface Echo {
+ Object echo(Object msg);
+}
diff --git a/branches/sca-java-1.3.2/samples/databinding-echo/src/main/java/dbecho/EchoDataBindingClient.java b/branches/sca-java-1.3.2/samples/databinding-echo/src/main/java/dbecho/EchoDataBindingClient.java
new file mode 100644
index 0000000000..9ec3819899
--- /dev/null
+++ b/branches/sca-java-1.3.2/samples/databinding-echo/src/main/java/dbecho/EchoDataBindingClient.java
@@ -0,0 +1,45 @@
+/*
+ * 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 dbecho;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ * @version $Rev$ $Date$
+ */
+public class EchoDataBindingClient {
+ public static void main(String[] args) throws Exception {
+
+ SCADomain scaDomain = SCADomain.newInstance("EchoDataBinding.composite");
+
+ Interface1 componentA = scaDomain.getService(Interface1.class, "ComponentA");
+ String response = componentA.call("<message><foo>123</foo></message>");
+ String response1= componentA.call1("<message><foo>123</foo></message>");
+
+
+ System.out.println("call response = " + response );
+ System.out.println("call1 response = " + response1 );
+
+ scaDomain.close();
+
+ }
+
+}
diff --git a/branches/sca-java-1.3.2/samples/databinding-echo/src/main/java/dbecho/Interface1.java b/branches/sca-java-1.3.2/samples/databinding-echo/src/main/java/dbecho/Interface1.java
new file mode 100644
index 0000000000..70b450e358
--- /dev/null
+++ b/branches/sca-java-1.3.2/samples/databinding-echo/src/main/java/dbecho/Interface1.java
@@ -0,0 +1,32 @@
+/*
+ * 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 dbecho;
+
+import org.apache.tuscany.sca.databinding.annotation.DataBinding;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@DataBinding("java.lang.String")
+@Remotable
+public interface Interface1 {
+ String call(String msg);
+ String call1(String msg);
+}
diff --git a/branches/sca-java-1.3.2/samples/databinding-echo/src/main/java/dbecho/Interface2.java b/branches/sca-java-1.3.2/samples/databinding-echo/src/main/java/dbecho/Interface2.java
new file mode 100644
index 0000000000..b62f1f425d
--- /dev/null
+++ b/branches/sca-java-1.3.2/samples/databinding-echo/src/main/java/dbecho/Interface2.java
@@ -0,0 +1,36 @@
+/*
+ * 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 dbecho;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.annotation.DataBinding;
+import org.osoa.sca.annotations.Remotable;
+import org.w3c.dom.Node;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@DataBinding("org.w3c.dom.Node")
+@Remotable
+public interface Interface2 {
+ Node call(Node msg);
+ @DataBinding("javax.xml.stream.XMLStreamReader")
+ XMLStreamReader call1(XMLStreamReader msg);
+}