diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2008-08-11 07:29:53 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2008-08-11 07:29:53 +0000 |
commit | 23297fa3b1f66d74325c8352cb8f5aae599a3090 (patch) | |
tree | 2c3017479edf2ae3f45e656975db5a53eed71b10 /branches/sca-java-1.3.1/itest/interfaces/src/main | |
parent | c5ab90dd4248519034478db64a9c32a0c3f91f3a (diff) |
Start branch for 1.3.1, the only changes in this commit are for the version
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@684661 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
12 files changed, 603 insertions, 0 deletions
diff --git a/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalCallbackInterface.java b/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalCallbackInterface.java new file mode 100644 index 0000000000..5bc872ef83 --- /dev/null +++ b/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalCallbackInterface.java @@ -0,0 +1,31 @@ +/* + * 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 org.apache.tuscany.sca.itest.interfaces; + + +/** + * only for callBack + */ +public interface LocalCallbackInterface { + + public void callbackMethod(String str); + + public void modifyParameter(ParameterObject po); + +} diff --git a/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponent.java b/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponent.java new file mode 100644 index 0000000000..7bfcf5de11 --- /dev/null +++ b/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponent.java @@ -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 org.apache.tuscany.sca.itest.interfaces; + +import org.osoa.sca.annotations.OneWay; + +/* + * itest for interface: local,method-overloading + */ +public interface LocalClientComponent { + + String foo1(ParameterObject po); + + String foo1(String str) throws Exception; + + String foo2(String str, int i); + + String foo2(int i, String str) throws Exception; + + void callback(String str); + + void callModifyParameter(); + + @OneWay + void onewayMethod(String str); + + String getCallbackValue(); + + String getOnewayValue(); +} diff --git a/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponentImpl.java b/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponentImpl.java new file mode 100644 index 0000000000..d4f7694e8f --- /dev/null +++ b/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponentImpl.java @@ -0,0 +1,83 @@ +/* + * 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 org.apache.tuscany.sca.itest.interfaces; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +@Service(LocalClientComponent.class) +public class LocalClientComponentImpl implements LocalClientComponent, LocalCallbackInterface { + + @Reference + protected LocalServiceComponent aCallBackService; + private static String callbackValue; + private static String onewayValue; + + public String foo1(ParameterObject po) { + po.field1 = "AComponent"; + return "AComponent"; + } + + public String foo1(String str) throws Exception { + return str + "AComponent"; + } + + public String foo2(String str, int i) { + return str + "AComponent" + i; + } + + public String foo2(int i, String str) throws Exception { + return str + "AComponent" + i; + } + + public void callback(String str) { + aCallBackService.callback(str); + } + + public void callbackMethod(String str) { + callbackValue = str; + } + + public void callModifyParameter() { + this.aCallBackService.modifyParameter(); + } + + public String getCallbackValue() { + return callbackValue; + } + + public void onewayMethod(String str) { + onewayValue = str; + try { + Thread.sleep(200); + } catch (Exception e) { + //do nothing + } + } + + public String getOnewayValue() { + return onewayValue; + } + + public void modifyParameter(ParameterObject po) { + po.field1 = "AComponent"; + } + +} diff --git a/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponent.java b/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponent.java new file mode 100644 index 0000000000..4772303fab --- /dev/null +++ b/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponent.java @@ -0,0 +1,37 @@ +/* + * 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 org.apache.tuscany.sca.itest.interfaces; + +import org.osoa.sca.annotations.Callback; + +/** + * Local be-directional callBackService + */ +@Callback(LocalCallbackInterface.class) +public interface LocalServiceComponent { + + String foo(String str); + + void callback(String str); + + void modifyParameter(); + + ParameterObject getPO(); + +} diff --git a/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponentImpl.java b/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponentImpl.java new file mode 100644 index 0000000000..e100636b23 --- /dev/null +++ b/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponentImpl.java @@ -0,0 +1,49 @@ +/* + * 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 org.apache.tuscany.sca.itest.interfaces; + +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Service; + +@Service(LocalServiceComponent.class) +public class LocalServiceComponentImpl implements LocalServiceComponent { + + @Callback + protected LocalCallbackInterface callback; + + private static ParameterObject po; + + public void callback(String str) { + callback.callbackMethod(str); + } + + public void modifyParameter() { + po = new ParameterObject("CallBack"); + callback.modifyParameter(po); + } + + public String foo(String str) { + return str; + } + + public ParameterObject getPO() { + return po; + } + +} diff --git a/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/ParameterObject.java b/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/ParameterObject.java new file mode 100644 index 0000000000..0bc8d10904 --- /dev/null +++ b/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/ParameterObject.java @@ -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 org.apache.tuscany.sca.itest.interfaces; + +import java.io.Serializable; + +public class ParameterObject implements Serializable { + private static final long serialVersionUID = 1L; + public String field1; + + public ParameterObject() { + this.field1 = null; + } + + public ParameterObject(String field1) { + this.field1 = field1; + } + + @Override + public boolean equals(Object o) { + if (o == this) + return true; + if (o instanceof ParameterObject) { + ParameterObject other = (ParameterObject)o; + if (field1 != null) + return field1.equals(other.field1); + } + return false; + } +} diff --git a/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteCallbackInterface.java b/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteCallbackInterface.java new file mode 100644 index 0000000000..e2b70313ed --- /dev/null +++ b/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteCallbackInterface.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 org.apache.tuscany.sca.itest.interfaces; + +import org.osoa.sca.annotations.Remotable; + +/** + * only for callBack + */ +@Remotable +public interface RemoteCallbackInterface { + + public void callbackMethod(String str); + + public void modifyParameter(ParameterObject po); +} diff --git a/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponent.java b/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponent.java new file mode 100644 index 0000000000..dd591eabeb --- /dev/null +++ b/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponent.java @@ -0,0 +1,63 @@ +/* + * 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. + */ +/* + * 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 org.apache.tuscany.sca.itest.interfaces; + +import org.osoa.sca.annotations.Remotable; + +/* + * different signatures + */ + +@Remotable +public interface RemoteClientComponent { + + String foo1(ParameterObject po); + String foo3(ParameterObject po); + + String foo2(int i, String str1) throws Exception; + + void callback(String str); + + void callModifyParameter(); + + String getCallbackValue(); + + void onewayMethod(String str); + + String getOnewayValue(); +} diff --git a/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponentImpl.java b/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponentImpl.java new file mode 100644 index 0000000000..d4731f35d3 --- /dev/null +++ b/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponentImpl.java @@ -0,0 +1,81 @@ +/* + * 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 org.apache.tuscany.sca.itest.interfaces; + +import org.osoa.sca.annotations.AllowsPassByReference; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +@Service(RemoteClientComponent.class) +public class RemoteClientComponentImpl implements RemoteClientComponent, RemoteCallbackInterface { + + @Reference + protected RemoteServiceComponent aCallBackService; + private static String callbackValue; + private static String onewayValue; + + public String foo1(ParameterObject po) { + po.field1 = "BComponent"; + return "BComponent"; + } + + @AllowsPassByReference + public String foo3(ParameterObject po) { + po.field1 = "BComponent"; + return "BComponent"; + } + + public String foo2(int i, String str) throws Exception { + return str + "BComponent" + i; + } + + public void callback(String str) { + aCallBackService.callback(str); + } + + public void callModifyParameter() { + this.aCallBackService.modifyParameter(); + } + + public void callbackMethod(String str) { + callbackValue = str; + } + + public String getCallbackValue() { + return callbackValue; + } + + public void onewayMethod(String str) { + onewayValue = str; + try { + Thread.sleep(200); + } catch (Exception e) { + //do nothing + } + } + + public String getOnewayValue() { + return onewayValue; + } + + public void modifyParameter(ParameterObject po) { + po.field1 = "BComponent"; + } +} diff --git a/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponent.java b/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponent.java new file mode 100644 index 0000000000..6c40db0e70 --- /dev/null +++ b/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponent.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 org.apache.tuscany.sca.itest.interfaces; + +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Remotable; + +@Remotable +@Callback(RemoteCallbackInterface.class) +public interface RemoteServiceComponent { + + String foo(String str); + + void callback(String str); + + void modifyParameter(); + + ParameterObject getPO(); + + String[] bar(int[][] intArray); +} diff --git a/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponentImpl.java b/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponentImpl.java new file mode 100644 index 0000000000..3804d31902 --- /dev/null +++ b/branches/sca-java-1.3.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponentImpl.java @@ -0,0 +1,54 @@ +/* + * 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 org.apache.tuscany.sca.itest.interfaces; + +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Service; + +@Service(RemoteServiceComponent.class) +public class RemoteServiceComponentImpl implements RemoteServiceComponent { + + @Callback + protected RemoteCallbackInterface callback; + + private static ParameterObject po; + + public void callback(String str) { + callback.callbackMethod(str); + } + + public void modifyParameter() { + po = new ParameterObject("CallBack"); + callback.modifyParameter(po); + } + + public String foo(String str) { + return str; + } + + public ParameterObject getPO() { + return po; + } + + public String[] bar(int[][] intArray) { + return new String[] {"int"}; + } + +} diff --git a/branches/sca-java-1.3.1/itest/interfaces/src/main/resources/InterfacesTest.composite b/branches/sca-java-1.3.1/itest/interfaces/src/main/resources/InterfacesTest.composite new file mode 100644 index 0000000000..0361d8c83c --- /dev/null +++ b/branches/sca-java-1.3.1/itest/interfaces/src/main/resources/InterfacesTest.composite @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * 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" xmlns:foo="http://foo" targetNamespace="http://foo"
+ name="InterfacesTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <component name="LocalClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.interfaces.LocalClientComponentImpl" />
+ <reference name="aCallBackService" target="LocalServiceComponent" />
+ </component>
+
+ <component name="RemoteClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.interfaces.RemoteClientComponentImpl" />
+ <reference name="aCallBackService" target="RemoteServiceComponent" />
+ </component>
+
+ <component name="LocalServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.interfaces.LocalServiceComponentImpl" />
+ </component>
+
+ <component name="RemoteServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.interfaces.RemoteServiceComponentImpl" />
+ </component>
+
+</composite>
\ No newline at end of file |