diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-11 23:13:31 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-11 23:13:31 +0000 |
commit | 3caf8614f25d6b1962e20331fdf423c863bc02f3 (patch) | |
tree | 069fa30b63dd4804846385d8571928bdaa7b73ad /sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld | |
parent | 6d0e93c68d3aeaeb4bb6d96ac0460eec40ef786e (diff) |
Moving 1.x branches
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835144 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld')
5 files changed, 196 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldCallback.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldCallback.java new file mode 100644 index 0000000000..adc48e85a4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldCallback.java @@ -0,0 +1,27 @@ +/* + * 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 helloworld; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface HelloWorldCallback { + + public void getGreetingsCallback(String getGreetingsReturn); +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldClient.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldClient.java new file mode 100644 index 0000000000..f59c409f45 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldClient.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * This client program shows how to invoke a web service asynchronously with a callback + */ + +public class HelloWorldClient { + + public final static void main(String[] args) throws Exception { + + CompositeContext compositeContext = CurrentCompositeContext.getContext(); + HelloWorldLocal helloWorldLocal = + compositeContext.locateService(HelloWorldLocal.class, "HelloWorldServiceComponent"); + helloWorldLocal.getGreetings("John"); + + // Sleep for 5 seconds to wait the callback to happen + Thread.sleep(5000); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldLocal.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldLocal.java new file mode 100644 index 0000000000..a5b9074af0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldLocal.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 helloworld; + +import org.apache.tuscany.api.annotation.DataType; +import org.osoa.sca.annotations.Service; + +import commonj.sdo.DataObject; + +@Service +public interface HelloWorldLocal { + + public String getGreetings(String name); + @DataType(name="commonj.sdo.DataObject") + public String getGreetings1(DataObject name); + +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..fc64f62a7b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,38 @@ +/* + * 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 helloworld; + +import org.apache.tuscany.api.annotation.DataType; +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Remotable; +import org.osoa.sca.annotations.Service; + +import commonj.sdo.DataObject; + +@Remotable +@Service +@Callback(HelloWorldCallback.class) +public interface HelloWorldService { + + public String getGreetings(String name); + @DataType(name="commonj.sdo.DataObject") + public String getGreetings1(DataObject name); + + public void getGreetingsWithCallback(String name); +} diff --git a/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldServiceComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldServiceComponent.java new file mode 100644 index 0000000000..132b44efd8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldServiceComponent.java @@ -0,0 +1,58 @@ +/* + * 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 helloworld; + +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +import commonj.sdo.DataObject; + + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the HelloWorld service and invoke it. + */ + +@Service(HelloWorldLocal.class) +@Scope("COMPOSITE") +public class HelloWorldServiceComponent implements HelloWorldLocal, HelloWorldCallback { + + HelloWorldService helloWorldService; + + public String getGreetings(String name) { + + return helloWorldService.getGreetings(name); + } + + public HelloWorldService getHelloWorldService() { + return helloWorldService; + } + + public void setHelloWorldService(HelloWorldService helloWorldService) { + this.helloWorldService = helloWorldService; + } + + public String getGreetings1(DataObject name) { + return helloWorldService.getGreetings1(name); + } + + public void getGreetingsCallback(String getGreetingsReturn) { + System.out.println("Callback: " + getGreetingsReturn); + } +} |