You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by na...@apache.org on 2008/01/31 00:59:26 UTC

svn commit: r616963 - in /incubator/tuscany/sandbox/nash/scenarios/callback-no-injection: ./ callback-ws-client/ callback-ws-client/src/ callback-ws-client/src/main/ callback-ws-client/src/main/java/ callback-ws-client/src/main/java/myapp/ callback-ws-...

Author: nash
Date: Wed Jan 30 15:59:24 2008
New Revision: 616963

URL: http://svn.apache.org/viewvc?rev=616963&view=rev
Log:
Add callback-no-injection to scenarios

Added:
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/build.xml
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/pom.xml
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/java/
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/java/myapp/
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/java/myapp/MyClient.java
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/java/myapp/MyClientImpl.java
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/java/myserver/
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/java/myserver/MyService.java
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/java/myserver/MyServiceCallback.java
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/resources/
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/resources/META-INF/
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/resources/META-INF/sca-contribution.xml
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/resources/myapp.composite
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/test/
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/test/java/
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/test/java/myapp/
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/test/java/myapp/CallbackClientTestCase.java
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/build.xml
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/pom.xml
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/java/
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/java/myserver/
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/java/myserver/CallbackServer.java
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/java/myserver/MyService.java
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/java/myserver/MyServiceCallback.java
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/java/myserver/MyServiceImpl.java
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/resources/
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/resources/META-INF/
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/resources/META-INF/sca-contribution.xml
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/resources/callbackws.composite
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/test/
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/test/java/
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/test/java/myserver/
    incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.java

Added: incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/build.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/build.xml?rev=616963&view=auto
==============================================================================
--- incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/build.xml (added)
+++ incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/build.xml Wed Jan 30 15:59:24 2008
@@ -0,0 +1,73 @@
+<!--
+ * 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="callback-ws-client" default="compile">
+    <property name="test.class"   value="myapp.MyClientImpl" />
+    <property name="test.jar"     value="sample-callback-ws-client.jar" />
+    <property name="manifest.jar" value="../../lib/tuscany-sca-manifest.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="${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="run-classes">
+        <java classname="${test.class}"
+              fork="true">
+            <classpath>
+                <pathelement path="target/classes"/>
+            	<pathelement location="${manifest.jar}"/>
+            </classpath>
+        </java>
+    </target>
+	
+    <target name="run">
+        <java classname="${test.class}"
+              fork="true">
+            <classpath>
+                <pathelement path="target/${test.jar}"/>
+            	<pathelement location="${manifest.jar}"/>
+            </classpath>
+        </java>    	
+    </target>
+	
+    <target name="clean">
+        <delete quiet="true" includeemptydirs="true">
+            <fileset dir="target"/>
+        </delete>
+    </target>
+</project>

Added: incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/pom.xml?rev=616963&view=auto
==============================================================================
--- incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/pom.xml (added)
+++ incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/pom.xml Wed Jan 30 15:59:24 2008
@@ -0,0 +1,93 @@
+<?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>1.2-incubating-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+    <artifactId>sample-callback-ws-client</artifactId>
+    <name>Apache Tuscany SCA Callback Web Service Remote Client 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-node-api</artifactId>
+            <version>1.2-incubating-SNAPSHOT</version>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-implementation-java-runtime</artifactId>
+            <version>1.2-incubating-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-binding-ws-axis2</artifactId>
+            <version>1.2-incubating-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-host-tomcat</artifactId>
+            <version>1.2-incubating-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-node-impl</artifactId>
+            <version>1.2-incubating-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>        
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.2</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>sample-callback-ws-service</artifactId>
+            <version>1.2-incubating-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>        
+
+    </dependencies>
+
+    <build>
+       <finalName>${artifactId}</finalName>
+    </build>
+
+</project>

Added: incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/java/myapp/MyClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/java/myapp/MyClient.java?rev=616963&view=auto
==============================================================================
--- incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/java/myapp/MyClient.java (added)
+++ incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/java/myapp/MyClient.java Wed Jan 30 15:59:24 2008
@@ -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 myapp;
+
+import org.osoa.sca.annotations.OneWay;
+
+/**
+ * The client interface
+ */
+public interface MyClient {
+
+    void aClientMethod();
+}

Added: incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/java/myapp/MyClientImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/java/myapp/MyClientImpl.java?rev=616963&view=auto
==============================================================================
--- incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/java/myapp/MyClientImpl.java (added)
+++ incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/java/myapp/MyClientImpl.java Wed Jan 30 15:59:24 2008
@@ -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 myapp;
+
+import myserver.MyService;
+import myserver.MyServiceCallback;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Remote Web service client with callback interface
+ */
+@Service(MyClient.class)
+@Scope("COMPOSITE")
+public class MyClientImpl implements MyClient, MyServiceCallback {
+    @Reference
+    protected MyService myService;
+
+    public void aClientMethod() {
+        System.out.println("aClientMethod on thread " + Thread.currentThread());
+        myService.someMethod(" -> someMethod ");  // calls the server
+        System.out.println("aClientMethod return from someMethod on thread " + Thread.currentThread());
+    }
+
+    public void receiveResult(String result) {
+        System.out.println("receiveResult on thread " + Thread.currentThread());
+        System.out.println("Result: " + result);  // callback from the server
+    }
+
+    public static void main(String[] args) throws Exception {
+        SCANode node = SCANodeFactory.createNodeWithComposite("myapp.composite");
+        MyClient myClient = node.getDomain().getService(MyClient.class, "MyClientComponent");
+        myClient.aClientMethod();
+        Thread.sleep(5000);  // don't exit before callback arrives
+        System.out.println("Closing the domain");
+        node.destroy();
+    }
+}

Added: incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/java/myserver/MyService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/java/myserver/MyService.java?rev=616963&view=auto
==============================================================================
--- incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/java/myserver/MyService.java (added)
+++ incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/java/myserver/MyService.java Wed Jan 30 15:59:24 2008
@@ -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 myserver;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The remote service that will be invoked by the client
+ */
+@Remotable
+@Callback(MyServiceCallback.class)
+public interface MyService {
+
+    @OneWay
+    void someMethod(String arg);
+}

Added: incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/java/myserver/MyServiceCallback.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/java/myserver/MyServiceCallback.java?rev=616963&view=auto
==============================================================================
--- incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/java/myserver/MyServiceCallback.java (added)
+++ incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/java/myserver/MyServiceCallback.java Wed Jan 30 15:59:24 2008
@@ -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 myserver;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The callback interface for {@link MyService}.
+ */
+@Remotable
+public interface MyServiceCallback {
+
+    void receiveResult(String result);
+}

Added: incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/resources/META-INF/sca-contribution.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/resources/META-INF/sca-contribution.xml?rev=616963&view=auto
==============================================================================
--- incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/resources/META-INF/sca-contribution.xml (added)
+++ incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/resources/META-INF/sca-contribution.xml Wed Jan 30 15:59:24 2008
@@ -0,0 +1,22 @@
+<?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.    
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:app="http://myapp">
+    <deployable composite="app:myapp" />
+</contribution>

Added: incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/resources/myapp.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/resources/myapp.composite?rev=616963&view=auto
==============================================================================
--- incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/resources/myapp.composite (added)
+++ incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/main/resources/myapp.composite Wed Jan 30 15:59:24 2008
@@ -0,0 +1,36 @@
+<?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://myapp"
+        name="myapp">
+
+    <component name="MyClientComponent">
+        <implementation.java class="myapp.MyClientImpl" />
+        <reference name="myService">
+            <interface.java interface="myserver.MyService"
+                    callbackInterface="myserver.MyServiceCallback" />
+            <binding.ws uri="http://localhost:8086/MyServiceComponent" />
+            <callback>
+                <binding.ws />
+            </callback>
+        </reference>
+    </component>
+
+</composite>

Added: incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/test/java/myapp/CallbackClientTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/test/java/myapp/CallbackClientTestCase.java?rev=616963&view=auto
==============================================================================
--- incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/test/java/myapp/CallbackClientTestCase.java (added)
+++ incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-client/src/test/java/myapp/CallbackClientTestCase.java Wed Jan 30 15:59:24 2008
@@ -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 myapp;
+
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests that the callback server is available
+ */
+public class CallbackClientTestCase {
+
+    private SCANode node;
+
+    @Before
+	public void startServer() throws Exception {
+        node = SCANodeFactory.createNodeWithComposite("callbackws.composite");
+	}
+
+	@Test
+	public void testClient() throws Exception {
+		MyClientImpl.main(null);
+	}
+    
+	@After
+	public void stopServer() throws Exception {
+        node.destroy();
+	}
+}

Added: incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/build.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/build.xml?rev=616963&view=auto
==============================================================================
--- incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/build.xml (added)
+++ incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/build.xml Wed Jan 30 15:59:24 2008
@@ -0,0 +1,73 @@
+<!--
+ * 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="callback-ws-service" default="compile">
+    <property name="test.class"   value="myserver.CallbackServer" />
+    <property name="test.jar"     value="sample-callback-ws-service.jar" />
+    <property name="manifest.jar" value="../../lib/tuscany-sca-manifest.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="${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="run-classes">
+        <java classname="${test.class}"
+              fork="true">
+            <classpath>
+                <pathelement path="target/classes"/>
+            	<pathelement location="${manifest.jar}"/>
+            </classpath>
+        </java>
+    </target>
+	
+    <target name="run">
+        <java classname="${test.class}"
+              fork="true">
+            <classpath>
+                <pathelement path="target/${test.jar}"/>
+            	<pathelement location="${manifest.jar}"/>
+            </classpath>
+        </java>    	
+    </target>
+	
+    <target name="clean">
+        <delete quiet="true" includeemptydirs="true">
+            <fileset dir="target"/>
+        </delete>
+    </target>
+</project>

Added: incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/pom.xml?rev=616963&view=auto
==============================================================================
--- incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/pom.xml (added)
+++ incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/pom.xml Wed Jan 30 15:59:24 2008
@@ -0,0 +1,86 @@
+<?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>1.2-incubating-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+    <artifactId>sample-callback-ws-service</artifactId>
+    <name>Apache Tuscany SCA Callback Web Service 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-node-api</artifactId>
+            <version>1.2-incubating-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-implementation-java-runtime</artifactId>
+            <version>1.2-incubating-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-binding-ws-axis2</artifactId>
+            <version>1.2-incubating-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-host-tomcat</artifactId>
+            <version>1.2-incubating-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-node-impl</artifactId>
+            <version>1.2-incubating-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>        
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.2</version>
+            <scope>test</scope>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+       <finalName>${artifactId}</finalName>
+    </build>
+
+</project>

Added: incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/java/myserver/CallbackServer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/java/myserver/CallbackServer.java?rev=616963&view=auto
==============================================================================
--- incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/java/myserver/CallbackServer.java (added)
+++ incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/java/myserver/CallbackServer.java Wed Jan 30 15:59:24 2008
@@ -0,0 +1,47 @@
+/*
+ * 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 myserver;
+
+import java.io.IOException;
+
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+/**
+ * This server program shows how to create and start an SCA runtime that
+ * activates the MyService Web service endpoint.
+ */
+public class CallbackServer {
+
+    public static void main(String[] args) throws Exception {
+
+        SCANode node = SCANodeFactory.createNodeWithComposite("callbackws.composite");
+
+        try {
+            System.out.println("Callback server started (press enter to shutdown)");
+            System.in.read();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+        node.destroy();
+        System.out.println("Callback server stopped");
+    }
+
+}

Added: incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/java/myserver/MyService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/java/myserver/MyService.java?rev=616963&view=auto
==============================================================================
--- incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/java/myserver/MyService.java (added)
+++ incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/java/myserver/MyService.java Wed Jan 30 15:59:24 2008
@@ -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 myserver;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The remote service that will be invoked by the client
+ */
+@Remotable
+@Callback(MyServiceCallback.class)
+public interface MyService {
+
+    @OneWay
+    void someMethod(String arg);
+}

Added: incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/java/myserver/MyServiceCallback.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/java/myserver/MyServiceCallback.java?rev=616963&view=auto
==============================================================================
--- incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/java/myserver/MyServiceCallback.java (added)
+++ incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/java/myserver/MyServiceCallback.java Wed Jan 30 15:59:24 2008
@@ -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 myserver;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The callback interface for {@link MyService}.
+ */
+@Remotable
+public interface MyServiceCallback {
+
+    void receiveResult(String result);
+}

Added: incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/java/myserver/MyServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/java/myserver/MyServiceImpl.java?rev=616963&view=auto
==============================================================================
--- incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/java/myserver/MyServiceImpl.java (added)
+++ incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/java/myserver/MyServiceImpl.java Wed Jan 30 15:59:24 2008
@@ -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 myserver;
+
+//import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+import org.osoa.sca.ComponentContext;
+
+/**
+ * This class implements MyService and uses a callback.
+ */
+@Service(MyService.class)
+@Scope("COMPOSITE")
+public class MyServiceImpl implements MyService {
+
+    private MyServiceCallback myServiceCallback;
+
+    @Context
+    protected ComponentContext context;
+    
+    public void someMethod(String arg) {
+        System.out.println("someMethod on thread " + Thread.currentThread());
+        myServiceCallback = context.getRequestContext().getCallback();
+        // invoke the callback
+        try {
+            System.out.println("Sleeping ...");
+            Thread.sleep(2000);
+            myServiceCallback.receiveResult(arg + " -> receiveResult ");
+        } catch(Exception e) {
+            System.out.println("RuntimeException invoking receiveResult: " + e.toString());
+            e.printStackTrace();
+        }
+    }
+}

Added: incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/resources/META-INF/sca-contribution.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/resources/META-INF/sca-contribution.xml?rev=616963&view=auto
==============================================================================
--- incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/resources/META-INF/sca-contribution.xml (added)
+++ incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/resources/META-INF/sca-contribution.xml Wed Jan 30 15:59:24 2008
@@ -0,0 +1,24 @@
+<?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.    
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+              targetNamespace="http://callbackws"
+              xmlns:cbws="http://callbackws">
+    <deployable composite="cbws:callbackws" />
+</contribution>

Added: incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/resources/callbackws.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/resources/callbackws.composite?rev=616963&view=auto
==============================================================================
--- incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/resources/callbackws.composite (added)
+++ incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/main/resources/callbackws.composite Wed Jan 30 15:59:24 2008
@@ -0,0 +1,35 @@
+<?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://callbackws"
+	name="callbackws">
+
+    <component name="MyServiceComponent">
+        <implementation.java class="myserver.MyServiceImpl" />
+        <service name="MyService">
+            <interface.java interface="myserver.MyService"
+                callbackInterface="myserver.MyServiceCallback" />
+            <binding.ws uri="http://localhost:8086/MyServiceComponent" />
+            <callback>
+                <binding.ws />
+            </callback>
+        </service>
+    </component>
+</composite>
\ No newline at end of file

Added: incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.java?rev=616963&view=auto
==============================================================================
--- incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.java (added)
+++ incubator/tuscany/sandbox/nash/scenarios/callback-no-injection/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.java Wed Jan 30 15:59:24 2008
@@ -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.
+ */
+package myserver;
+
+import java.io.IOException;
+import java.net.Socket;
+
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests that the callback server is available
+ */
+public class CallbackServerTestCase {
+
+    private SCANode node;
+
+    @Before
+	public void startServer() throws Exception {
+        node = SCANodeFactory.createNodeWithComposite("callbackws.composite");
+	}
+
+	@Test
+	public void testPing() throws IOException {
+		new Socket("127.0.0.1", 8086);
+	}
+    
+	@After
+	public void stopServer() throws Exception {
+        node.destroy();
+	}
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org