diff options
7 files changed, 174 insertions, 11 deletions
diff --git a/java/sca/modules/implementation-osgi/src/test/java/calculator/dosgi/CalculatorService.java b/java/sca/modules/implementation-osgi/src/test/java/calculator/dosgi/CalculatorService.java new file mode 100644 index 0000000000..656b78b717 --- /dev/null +++ b/java/sca/modules/implementation-osgi/src/test/java/calculator/dosgi/CalculatorService.java @@ -0,0 +1,39 @@ +/* + * 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.dosgi; + +import java.rmi.Remote; +import java.rmi.RemoteException; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * The Calculator service interface. + */ +@Remotable +public interface CalculatorService extends Remote { + + double add(double n1, double n2) throws RemoteException; + + double subtract(double n1, double n2) throws RemoteException; + + double multiply(double n1, double n2) throws RemoteException; + + double divide(double n1, double n2) throws RemoteException; +} diff --git a/java/sca/modules/implementation-osgi/src/test/java/calculator/dosgi/operations/AddService.java b/java/sca/modules/implementation-osgi/src/test/java/calculator/dosgi/operations/AddService.java new file mode 100644 index 0000000000..971500782f --- /dev/null +++ b/java/sca/modules/implementation-osgi/src/test/java/calculator/dosgi/operations/AddService.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 calculator.dosgi.operations; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * The interface for the add service + */ +@Remotable +public interface AddService { + + double add(double n1, double n2); + +} diff --git a/java/sca/modules/implementation-osgi/src/test/java/calculator/dosgi/operations/DivideService.java b/java/sca/modules/implementation-osgi/src/test/java/calculator/dosgi/operations/DivideService.java new file mode 100644 index 0000000000..49b8a1c0bf --- /dev/null +++ b/java/sca/modules/implementation-osgi/src/test/java/calculator/dosgi/operations/DivideService.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 calculator.dosgi.operations; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * The interface for the divide service + */ +@Remotable +public interface DivideService { + + double divide(double n1, double n2); + +} diff --git a/java/sca/modules/implementation-osgi/src/test/java/calculator/dosgi/operations/MultiplyService.java b/java/sca/modules/implementation-osgi/src/test/java/calculator/dosgi/operations/MultiplyService.java new file mode 100644 index 0000000000..f4e59d12ea --- /dev/null +++ b/java/sca/modules/implementation-osgi/src/test/java/calculator/dosgi/operations/MultiplyService.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 calculator.dosgi.operations; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * The interface for the multiply service + */ +@Remotable +public interface MultiplyService { + + double multiply(double n1, double n2); + +} diff --git a/java/sca/modules/implementation-osgi/src/test/java/calculator/dosgi/operations/SubtractService.java b/java/sca/modules/implementation-osgi/src/test/java/calculator/dosgi/operations/SubtractService.java new file mode 100644 index 0000000000..bfb9b820f7 --- /dev/null +++ b/java/sca/modules/implementation-osgi/src/test/java/calculator/dosgi/operations/SubtractService.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 calculator.dosgi.operations; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * The interface for the subtract service + */ +@Remotable +public interface SubtractService { + + double subtract(double n1, double n2); + +} diff --git a/java/sca/modules/implementation-osgi/src/test/resources/OSGI-INF/calculator-component.xml b/java/sca/modules/implementation-osgi/src/test/resources/OSGI-INF/calculator-component.xml index 442ab858e9..3e537df732 100644 --- a/java/sca/modules/implementation-osgi/src/test/resources/OSGI-INF/calculator-component.xml +++ b/java/sca/modules/implementation-osgi/src/test/resources/OSGI-INF/calculator-component.xml @@ -19,18 +19,18 @@ --> <scr:component name="CalculatorComponent" xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0"> - <implementation class="calculator.CalculatorServiceDSImpl" /> + <implementation class="calculator.dosgi.CalculatorServiceDSImpl" /> <service> - <provide interface="calculator.CalculatorService" /> + <provide interface="calculator.dosgi.CalculatorService" /> </service> - <reference name="addService" interface="calculator.operations.AddService" bind="setAddService" unbind="unsetAddService" + <reference name="addService" interface="calculator.dosgi.operations.AddService" bind="setAddService" unbind="unsetAddService" policy="dynamic" /> - <reference name="subtractService" interface="calculator.operations.SubtractService" bind="setSubtractService" + <reference name="subtractService" interface="calculator.dosgi.operations.SubtractService" bind="setSubtractService" unbind="unsetSubtractService" policy="dynamic" /> - <reference name="multiplyService" interface="calculator.operations.MultiplyService" bind="setMultiplyService" + <reference name="multiplyService" interface="calculator.dosgi.operations.MultiplyService" bind="setMultiplyService" unbind="unsetMultiplyService" policy="dynamic" /> - <reference name="divideService" interface="calculator.operations.DivideService" bind="setDivideService" + <reference name="divideService" interface="calculator.dosgi.operations.DivideService" bind="setDivideService" unbind="unsetDivideService" policy="dynamic" /> </scr:component> diff --git a/java/sca/modules/implementation-osgi/src/test/resources/OSGI-INF/sca/bundle.componentType b/java/sca/modules/implementation-osgi/src/test/resources/OSGI-INF/sca/bundle.componentType index 73c7ca7c13..7860094626 100644 --- a/java/sca/modules/implementation-osgi/src/test/resources/OSGI-INF/sca/bundle.componentType +++ b/java/sca/modules/implementation-osgi/src/test/resources/OSGI-INF/sca/bundle.componentType @@ -23,7 +23,7 @@ <!-- The service elment defines an SCA view of the OSGi service -->
<service name="Calculator">
<!-- The interface will be mapped into the OSGi service class -->
- <interface.java interface="calculator.CalculatorService"/>
+ <interface.java interface="calculator.dosgi.CalculatorService"/>
<!-- The list of OSGi properties -->
<t:osgi.property name="prop1">1</t:osgi.property>
<t:osgi.property name="prop2">ABC</t:osgi.property>
@@ -31,22 +31,22 @@ <!-- The reference elment defines an SCA proxy to a remote OSGi service -->
<reference name="addService">
- <interface.java interface="calculator.operations.AddService"/>
+ <interface.java interface="calculator.dosgi.operations.AddService"/>
<t:osgi.property name="prop1">1</t:osgi.property>
<t:osgi.property name="prop2">ABC</t:osgi.property>
</reference>
<reference name="subtractService">
- <interface.java interface="calculator.operations.SubtractService"/>
+ <interface.java interface="calculator.dosgi.operations.SubtractService"/>
<t:osgi.property name="prop1">1</t:osgi.property>
<t:osgi.property name="prop2">ABC</t:osgi.property>
</reference>
<reference name="multiplyService">
- <interface.java interface="calculator.operations.MultiplyService"/>
+ <interface.java interface="calculator.dosgi.operations.MultiplyService"/>
<t:osgi.property name="prop1">1</t:osgi.property>
<t:osgi.property name="prop2">ABC</t:osgi.property>
</reference>
<reference name="divideService">
- <interface.java interface="calculator.operations.DivideService"/>
+ <interface.java interface="calculator.dosgi.operations.DivideService"/>
<t:osgi.property name="prop1">1</t:osgi.property>
<t:osgi.property name="prop2">ABC</t:osgi.property>
</reference>
|