summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-11-11 23:13:23 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-11-11 23:13:23 +0000
commit6d0e93c68d3aeaeb4bb6d96ac0460eec40ef786e (patch)
treea956ed510e14a5509b8ef49fae42cfd439629825 /sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java
parent3ac2d800d840f03618fc364090d786effde84b1f (diff)
Moving 1.x branches
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835143 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java')
-rw-r--r--sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/AddService.java25
-rw-r--r--sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/AddServiceImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/CalculatorService.java42
-rw-r--r--sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/CalculatorServiceImpl.java67
-rw-r--r--sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/DivideService.java25
-rw-r--r--sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/DivideServiceImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/MathService.java27
-rw-r--r--sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/MathServiceImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/MultiplyService.java25
-rw-r--r--sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/MultiplyServiceImpl.java34
-rw-r--r--sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/SubtractService.java25
-rw-r--r--sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/SubtractServiceImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/server/CalculatorRMIServer.java45
13 files changed, 447 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/AddService.java b/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/AddService.java
new file mode 100644
index 0000000000..6392676e76
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/AddService.java
@@ -0,0 +1,25 @@
+/*
+ * 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 calculator;
+
+public interface AddService {
+
+ double add(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/AddServiceImpl.java b/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..39e9be92e6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/AddServiceImpl.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 calculator;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * An implementation of the Add service
+ */
+@Scope("MODULE")
+public class AddServiceImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ return n1 + n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/CalculatorService.java b/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..f1185a2494
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/CalculatorService.java
@@ -0,0 +1,42 @@
+/*
+ * 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 calculator;
+
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * The Calculator service interface.
+ */
+@Remotable
+@Service
+public interface CalculatorService {
+
+ double add(double n1, double n2);
+
+ double subtract(double n1, double n2);
+
+ double multiply(double n1, double n2);
+
+ double divide(double n1, double n2);
+
+ double sqrt (double n);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/CalculatorServiceImpl.java b/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..d72c0d30c3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/CalculatorServiceImpl.java
@@ -0,0 +1,67 @@
+/*
+ * 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 calculator;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+
+/**
+ * An implementation of the Calculator service.
+ */
+@Scope("MODULE")
+public class CalculatorServiceImpl implements CalculatorService {
+
+ @Reference
+ protected AddService addService;
+
+ @Reference
+ protected SubtractService subtractService;
+
+ @Reference
+ protected MultiplyService multiplyService;
+
+ @Reference
+ protected DivideService divideService;
+
+ @Reference
+ protected MathService mathService;
+
+ public double add(double n1, double n2) {
+ return addService.add(n1, n2);
+ }
+
+ public double subtract(double n1, double n2) {
+ return subtractService.subtract(n1, n2);
+ }
+
+ public double multiply(double n1, double n2) {
+ return multiplyService.multiply(n1, n2);
+ }
+
+ public double divide(double n1, double n2) {
+ return divideService.divide(n1, n2);
+ }
+
+ public double sqrt(double n) {
+ // TODO Auto-generated method stub
+ return mathService.sqrt(n);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/DivideService.java b/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/DivideService.java
new file mode 100644
index 0000000000..3158458b5e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/DivideService.java
@@ -0,0 +1,25 @@
+/*
+ * 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 calculator;
+
+public interface DivideService {
+
+ double divide(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/DivideServiceImpl.java b/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..159ca463c9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/DivideServiceImpl.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 calculator;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * An implementation of the Divide service.
+ */
+@Scope("MODULE")
+public class DivideServiceImpl implements DivideService {
+
+ public double divide(double n1, double n2) {
+ return n1 / n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/MathService.java b/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/MathService.java
new file mode 100644
index 0000000000..42e8e5ca67
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/MathService.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 calculator;
+
+
+
+public interface MathService {
+
+ double sqrt(double n);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/MathServiceImpl.java b/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/MathServiceImpl.java
new file mode 100644
index 0000000000..76caace7bb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/MathServiceImpl.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 calculator;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * An implementation of the Divide service.
+ */
+@Scope("MODULE")
+public class MathServiceImpl implements MathService {
+
+ public double sqrt(double n1) {
+ return java.lang.Math.sqrt(n1);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/MultiplyService.java b/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..62db05175e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/MultiplyService.java
@@ -0,0 +1,25 @@
+/*
+ * 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 calculator;
+
+public interface MultiplyService {
+
+ double multiply(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/MultiplyServiceImpl.java b/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..2c9053f61a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/MultiplyServiceImpl.java
@@ -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 calculator;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * An implementation of the Multiply service.
+ */
+@Scope("MODULE")
+public class MultiplyServiceImpl implements MultiplyService {
+
+ public double multiply(double n1, double n2) {
+ System.out.println("Multiplying... " + n1 + " x " + n2);
+ return n1 * n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/SubtractService.java b/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..309f88f098
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/SubtractService.java
@@ -0,0 +1,25 @@
+/*
+ * 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 calculator;
+
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/SubtractServiceImpl.java b/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..3c3388f4cd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/SubtractServiceImpl.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 calculator;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * An implementation of the subtract service.
+ */
+@Scope("MODULE")
+public class SubtractServiceImpl implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ return n1 - n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/server/CalculatorRMIServer.java b/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/server/CalculatorRMIServer.java
new file mode 100644
index 0000000000..3608d6b92a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-M2/samples/standalone/calculatorRMIService/src/main/java/calculator/server/CalculatorRMIServer.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 calculator.server;
+
+/**
+ * The class holds up the Tuscany Runtime until a Enter key is pressed
+ *
+ */
+public class CalculatorRMIServer {
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+ try {
+ System.out.println("*********************************************");
+ System.out.println("Calculator RMI Service Started and Running...");
+ System.out.println("*********************************************");
+ System.out.println("Hit ENTER to exit");
+ System.in.read();
+ System.out.println("Calculator RMI Service Stopped!");
+ System.exit(0);
+ } catch ( Exception e ) {
+ e.printStackTrace();
+ }
+
+ }
+
+}