From 6fadbc9cd1fcf03d0b3630f772d91df149b70428 Mon Sep 17 00:00:00 2001 From: lresende Date: Wed, 11 Nov 2009 23:07:19 +0000 Subject: Moving 1.x branches git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835123 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/java/supplychain/OSGiBundleImpl.java | 163 --------------------- .../main/java/supplychain/customer/Customer.java | 39 ----- .../customer/JavaCustomerComponentImpl.java | 88 ----------- .../customer/OSGiCustomerComponentImpl.java | 104 ------------- .../customer/OSGiCustomerFactoryImpl.java | 65 -------- .../supplychain/customer/OSGiCustomerImpl.java | 92 ------------ .../OSGiCustomerWithQueryComponentImpl.java | 100 ------------- .../customer/OSGiCustomerWithQueryImpl.java | 82 ----------- .../OSGiStatelessCustomerComponentImpl.java | 30 ---- .../customer/OSGiStatelessCustomerImpl.java | 35 ----- .../customer/OSGiVersionedCustomerImpl.java | 98 ------------- .../retailer/JavaRetailerComponentImpl.java | 67 --------- .../retailer/OSGiRetailerComponentImpl.java | 64 -------- .../supplychain/retailer/OSGiRetailerImpl.java | 58 -------- .../retailer/OSGiRetailerServiceImpl.java | 45 ------ .../OSGiRetailerWithQueryComponentImpl.java | 78 ---------- .../retailer/OSGiRetailerWithQueryImpl.java | 64 -------- .../retailer/OSGiVersionedRetailerImpl.java | 75 ---------- .../retailer/OSGiVersionedRetailerServiceImpl.java | 47 ------ .../main/java/supplychain/retailer/Retailer.java | 28 ---- .../java/supplychain/retailer/RetailerQuery.java | 28 ---- .../shipper/JavaShipperComponentImpl.java | 58 -------- .../shipper/OSGiShipperComponentImpl.java | 62 -------- .../shipper/OSGiShipperFactoryImpl.java | 78 ---------- .../java/supplychain/shipper/OSGiShipperImpl.java | 57 ------- .../shipper/OSGiShipperServiceImpl.java | 43 ------ .../shipper/OSGiStatelessShipperComponentImpl.java | 30 ---- .../shipper/OSGiStatelessShipperServiceImpl.java | 35 ----- .../shipper/OSGiVersionedShipperImpl.java | 78 ---------- .../shipper/OSGiVersionedShipperServiceImpl.java | 46 ------ .../src/main/java/supplychain/shipper/Shipper.java | 28 ---- .../warehouse/JavaWarehouseComponentImpl.java | 48 ------ .../JavaWarehouseWithQueryComponentImpl.java | 52 ------- .../warehouse/OSGiWarehouseComponentImpl.java | 57 ------- .../supplychain/warehouse/OSGiWarehouseImpl.java | 68 --------- .../warehouse/OSGiWarehouseServiceImpl.java | 62 -------- .../main/java/supplychain/warehouse/Warehouse.java | 28 ---- .../java/supplychain/warehouse/WarehouseQuery.java | 28 ---- 38 files changed, 2308 deletions(-) delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/OSGiBundleImpl.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/Customer.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerFactoryImpl.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerImpl.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryComponentImpl.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryImpl.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerComponentImpl.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerImpl.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiVersionedCustomerImpl.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerImpl.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerServiceImpl.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerWithQueryComponentImpl.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerWithQueryImpl.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiVersionedRetailerImpl.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiVersionedRetailerServiceImpl.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/Retailer.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/RetailerQuery.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperFactoryImpl.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperImpl.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperServiceImpl.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiStatelessShipperComponentImpl.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiStatelessShipperServiceImpl.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiVersionedShipperImpl.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiVersionedShipperServiceImpl.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/Shipper.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/warehouse/JavaWarehouseWithQueryComponentImpl.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseServiceImpl.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/warehouse/Warehouse.java delete mode 100644 branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/warehouse/WarehouseQuery.java (limited to 'branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain') diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/OSGiBundleImpl.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/OSGiBundleImpl.java deleted file mode 100644 index 25d7bcf2ff..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/OSGiBundleImpl.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * 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 supplychain; - - - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Hashtable; - -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceEvent; -import org.osgi.framework.ServiceListener; -import org.osgi.framework.ServiceReference; - - -/** - * This class implements the Customer service component. - */ -public class OSGiBundleImpl implements ServiceListener, BundleActivator { - - - String name; - - String[] references; - Class[] referenceClasses; - Field[] referenceFields; - String[] referenceFilters; - - Class myClass; - ArrayList serviceNames = new ArrayList(); - ArrayList serviceObjs = new ArrayList(); - ArrayList> serviceProperties = new ArrayList>(); - - - private BundleContext bundleContext; - - public OSGiBundleImpl() {} - - public OSGiBundleImpl(String[] references, String[] filters) { - - myClass = this.getClass(); - this.name = this.getClass().getSimpleName(); - this.references = references == null?new String[0] : references; - - - try { - referenceClasses = new Class[references.length]; - referenceFields = new Field[references.length]; - referenceFilters = new String[references.length]; - for (int i = 0; i < references.length; i++) { - referenceFields[i] = this.getClass().getDeclaredField(references[i]); - referenceFields[i].setAccessible(true); - referenceClasses[i] = referenceFields[i].getType(); - - if (filters != null && filters.length > i) - referenceFilters[i] = filters[i]; - } - - } catch (Exception e) { - throw new RuntimeException(e); - } - - } - - public void start(BundleContext bc) { - - System.out.println("Started bundle " + name); - - this.bundleContext = bc; - - boolean useSingleRegisterService = serviceNames.size() > 1; - for (int i = 1; i < serviceNames.size(); i++) { - if (serviceObjs.get(i) != serviceObjs.get(0) || - serviceProperties.get(i) != serviceProperties.get(0)) { - useSingleRegisterService = false; - break; - } - } - if (useSingleRegisterService) { - bundleContext.registerService(serviceNames.toArray(new String[serviceNames.size()]), - serviceObjs.get(0), serviceProperties.get(0)); - } - else { - for (int i = 0; i < serviceNames.size(); i++) { - bundleContext.registerService(serviceNames.get(i), serviceObjs.get(i), serviceProperties.get(i)); - } - } - - started(bc); - - for (int i = 0; i < references.length; i++) { - - try { - if (referenceFields[i].get(this) != null) - continue; - - ServiceReference[] refs = bundleContext.getServiceReferences(referenceClasses[i].getName(), referenceFilters[i]); - if (refs != null && refs.length > 0) { - Object obj = bundleContext.getService(refs[0]); - referenceFields[i].set(this, referenceClasses[i].cast(obj)); - } else { - String filter = "(objectclass=" + referenceClasses[i].getName() + ")"; - this.bundleContext.addServiceListener(this, filter); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - public void stop(BundleContext bc) { - System.out.println("Stop bundle " + name); - - } - - protected void started(BundleContext bc) { - - } - - public void serviceChanged(ServiceEvent event) { - try { - if (event.getType() == ServiceEvent.REGISTERED) { - - ServiceReference ref = event.getServiceReference(); - Object obj = bundleContext.getService(ref); - for (int i = 0; i < references.length; i++) { - if (referenceClasses[i].isAssignableFrom(obj.getClass())) { - referenceFields[i].set(this, referenceClasses[i].cast(obj)); - } - } - } - } catch (Throwable e) { - e.printStackTrace(); - } - } - - - public void registerService(Object serviceObject, String serviceName, Hashtable props) { - serviceObjs.add(serviceObject); - serviceNames.add(serviceName); - serviceProperties.add(props == null? new Hashtable() : props); - } -} - \ No newline at end of file diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/Customer.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/Customer.java deleted file mode 100644 index 2762bc62be..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/Customer.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 supplychain.customer; - -import org.osoa.sca.annotations.OneWay; - -/** - * This is the business interface of the Customer service component. - */ -public interface Customer { - - public void purchaseBooks(); - - public void purchaseGames(); - - public void purchaseGoods(); - - @OneWay - public void notifyShipment(String order); - - public boolean hasOutstandingOrders(); - -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java deleted file mode 100644 index 80346311b1..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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 supplychain.customer; - -import java.util.ArrayList; - -import org.osoa.sca.annotations.Reference; -import org.osoa.sca.annotations.Scope; -import org.osoa.sca.annotations.Service; - -import supplychain.retailer.Retailer; - -/** - * This class implements the Customer service component. - */ -@Service(Customer.class) -@Scope("COMPOSITE") -public class JavaCustomerComponentImpl implements Customer { - - private Retailer retailer1; - - private Retailer retailer2; - - private Retailer retailer3; - - private static ArrayList outstandingOrders = new ArrayList(); - - @Reference - public void setRetailer1(Retailer retailer1) { - this.retailer1 = retailer1; - } - - @Reference - public void setRetailer2(Retailer retailer2) { - this.retailer2 = retailer2; - } - - @Reference - public void setRetailer3(Retailer retailer3) { - this.retailer3 = retailer3; - } - - public void purchaseBooks() { - System.out.println("JavaCustomerComponentImpl.purchaseBooks"); - outstandingOrders.add("Order, submitted (amazon.com), fulfilled, shipped (ParcelForce)"); - retailer1.submitOrder("Order"); - } - - public void purchaseGames() { - System.out.println("JavaCustomerComponentImpl.purchaseGames"); - outstandingOrders.add("Order, submitted (play.com), fulfilled, shipped (ParcelForce)"); - - retailer2.submitOrder("Order"); - } - - public void purchaseGoods() { - retailer3.submitOrder("Order"); - } - - public void notifyShipment(String order) { - outstandingOrders.remove(order); - System.out.print("Work thread " + Thread.currentThread() + " - "); - System.out.println(order); - } - - public boolean hasOutstandingOrders() { - return outstandingOrders.size() != 0; - } - - - -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java deleted file mode 100644 index 9717025a4f..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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 supplychain.customer; - - -import java.util.ArrayList; - -import org.osgi.service.component.ComponentContext; - - -import supplychain.retailer.Retailer; - -/** - * This class implements the Customer service component. - */ -public class OSGiCustomerComponentImpl implements Customer { - - - private Retailer retailer1; - private Retailer retailer2; - private Retailer retailer3; - - private ArrayList outstandingOrders = new ArrayList(); - - public OSGiCustomerComponentImpl() { - System.out.println("Created OSGiCustomerComponentImpl " + this); - } - - protected void setRetailer1(Retailer retailer1) { - this.retailer1 = retailer1; - } - - protected void unsetRetailer1(Retailer retailer1) { - this.retailer1 = null; - } - - - protected void setRetailer2(Retailer retailer2) { - this.retailer2 = retailer2; - } - - protected void unsetRetailer2(Retailer retailer2) { - this.retailer2 = null; - } - - protected void setRetailer3(Retailer retailer2) { - this.retailer3 = retailer2; - } - - protected void unsetRetailer3(Retailer retailer2) { - this.retailer3 = null; - } - - public void purchaseBooks() { - System.out.println("OSGiCustomerComponentImpl.purchaseBooks"); - outstandingOrders.add("Order, submitted (amazon.com), fulfilled, shipped (ParcelForce)"); - retailer1.submitOrder("Order"); - } - - public void purchaseGames() { - System.out.println("OSGiCustomerComponentImpl.purchaseGames"); - outstandingOrders.add("Order, submitted (play.com), fulfilled, shipped (ParcelForce)"); - - retailer2.submitOrder("Order"); - } - - public void purchaseGoods() { - retailer3.submitOrder("Order"); - } - - public void notifyShipment(String order) { - outstandingOrders.remove(order); - System.out.print("Work thread " + Thread.currentThread() + " - "); - System.out.println(order); - } - - protected void activate(ComponentContext context){ - System.out.println("Activated OSGiCustomerComponentImpl bundle "); - } - - protected void deactivate(ComponentContext context){ - System.out.println("Deactivated OSGiCustomerComponentImpl bundle "); - } - - public boolean hasOutstandingOrders() { - return outstandingOrders.size() != 0; - } -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerFactoryImpl.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerFactoryImpl.java deleted file mode 100644 index c8cb522cf4..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerFactoryImpl.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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 supplychain.customer; - - -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceFactory; -import org.osgi.framework.ServiceRegistration; - -/** - * This class implements the Customer service component. - */ -public class OSGiCustomerFactoryImpl implements BundleActivator, ServiceFactory { - - private BundleContext bundleContext; - - public OSGiCustomerFactoryImpl() { - } - - - public void start(BundleContext bc) { - - this.bundleContext = bc; - bc.registerService(Customer.class.getName(), this, null); - } - - - - - public void stop(BundleContext context) throws Exception { - - } - - - public Object getService(Bundle bundle, ServiceRegistration registration) { - - OSGiCustomerImpl customer = new OSGiCustomerImpl(false); - customer.start(bundleContext); - return customer; - - } - - public void ungetService(Bundle bundle, ServiceRegistration registration, Object obj) { - } - - -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerImpl.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerImpl.java deleted file mode 100644 index 546971860e..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerImpl.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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 supplychain.customer; - - -import java.util.ArrayList; - -import org.osoa.sca.annotations.AllowsPassByReference; - -import supplychain.OSGiBundleImpl; -import supplychain.retailer.Retailer; - -/** - * This class implements the Customer service component. - */ -@AllowsPassByReference -public class OSGiCustomerImpl extends OSGiBundleImpl implements Customer { - - private ArrayList outstandingOrders = new ArrayList(); - - private Retailer retailer1; - private Retailer retailer2; - private Retailer retailer3; - - public OSGiCustomerImpl() { - super( new String[]{"retailer1", "retailer2", "retailer3"}, - new String[]{"(retailerName=amazon.com)", - "(retailerName=play.com)", - "(retailerName=ebay.com)" - }); - registerService(this, "supplychain.customer.Customer", null); - - } - - public OSGiCustomerImpl(boolean ignore) { // Used only to test service factories - super( new String[]{"retailer1", "retailer2", "retailer3"}, - new String[]{"(retailerName=amazon.com)", - "(retailerName=play.com)", - "(retailerName=ebay.com)" - }); - - } - - public void purchaseBooks() { - System.out.println("OSGiCustomerImpl.purchaseBooks, retailer is " + retailer1); - outstandingOrders.add("Order, submitted (amazon.com), fulfilled, shipped (ParcelForce)"); - - retailer1.submitOrder("Order"); - - } - - public void purchaseGames() { - System.out.println("OSGiCustomerImpl.purchaseGames, retailer is " + retailer2); - outstandingOrders.add("Order, submitted (play.com), fulfilled, shipped (ParcelForce)"); - - retailer2.submitOrder("Order"); - - } - - public void purchaseGoods() { - retailer3.submitOrder("Order"); - } - - public void notifyShipment(String order) { - - outstandingOrders.remove(order); - - System.out.print("Work thread " + Thread.currentThread() + " - "); - System.out.println(order); - } - - public boolean hasOutstandingOrders() { - return outstandingOrders.size() != 0; - } - -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryComponentImpl.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryComponentImpl.java deleted file mode 100644 index 02862bc5f6..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryComponentImpl.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * 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 supplychain.customer; - - -import java.util.ArrayList; - -import org.osgi.service.component.ComponentContext; - - -import supplychain.retailer.Retailer; -import supplychain.retailer.RetailerQuery; - -/** - * This class implements the Customer service component. - */ -public class OSGiCustomerWithQueryComponentImpl implements Customer { - - - private Retailer retailer; - private RetailerQuery retailerQuery; - - private static ArrayList outstandingOrders = new ArrayList(); - - public OSGiCustomerWithQueryComponentImpl() { - System.out.println("Created OSGiCustomerWithQueryComponentImpl " + this); - } - - protected void setRetailer(Retailer retailer) { - this.retailer = retailer; - } - - protected void unsetRetailer(Retailer retailer) { - this.retailer = null; - } - - - protected void setRetailerQuery(RetailerQuery retailerQuery) { - this.retailerQuery = retailerQuery; - } - - protected void unsetRetailerQuery(RetailerQuery retailerQuery) { - this.retailerQuery = null; - } - - public void purchaseBooks() { - System.out.println("OSGiCustomerWithQueryComponentImpl.purchaseBooks"); - outstandingOrders.add("Order, submitted (amazon.com), fulfilled, shipped (RoyalMail)"); - - if (retailerQuery.isAvailable("Order")) - retailer.submitOrder("Order"); - } - - public void purchaseGames() { - System.out.println("OSGiCustomerWithQueryComponentImpl.purchaseGames"); - outstandingOrders.add("Order, submitted (amazon.com), fulfilled, shipped (RoyalMail)"); - - if (retailerQuery.isAvailable("Order")) - retailer.submitOrder("Order"); - } - - public void purchaseGoods() { - if (retailerQuery.isAvailable("Order")) - retailer.submitOrder("Order"); - } - - public void notifyShipment(String order) { - outstandingOrders.remove(order); - System.out.print("Work thread " + Thread.currentThread() + " - "); - System.out.println(order); - } - - protected void activate(ComponentContext context){ - System.out.println("Activated OSGiCustomerWithQueryComponentImpl bundle "); - } - - protected void deactivate(ComponentContext context){ - System.out.println("Deactivated OSGiCustomerWithQueryComponentImpl bundle "); - } - - public boolean hasOutstandingOrders() { - return outstandingOrders.size() != 0; - } -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryImpl.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryImpl.java deleted file mode 100644 index 18483817ad..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryImpl.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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 supplychain.customer; - - -import java.util.ArrayList; - -import supplychain.OSGiBundleImpl; -import supplychain.retailer.Retailer; -import supplychain.retailer.RetailerQuery; - -/** - * This class implements the Customer service component. - */ -public class OSGiCustomerWithQueryImpl extends OSGiBundleImpl implements Customer { - - private static ArrayList outstandingOrders = new ArrayList(); - - private Retailer retailer; - private RetailerQuery retailerQuery; - - public OSGiCustomerWithQueryImpl() { - super( new String[]{"retailer", "retailerQuery"}, - new String[]{"(component.service.name=RetailerComponent/Retailer)", - "(component.service.name=RetailerComponent/RetailerQuery)" - }); - registerService(this, "supplychain.customer.Customer", null); - - } - - public void purchaseBooks() { - System.out.println("OSGiCustomerWithQueryImpl.purchaseBooks"); - outstandingOrders.add("Order, submitted (amazon.com), fulfilled, shipped (RoyalMail)"); - - if (retailerQuery.isAvailable("Order")) - retailer.submitOrder("Order"); - - } - - public void purchaseGames() { - System.out.println("OSGiCustomerWithQueryImpl.purchaseGames"); - outstandingOrders.add("Order, submitted (amazon.com), fulfilled, shipped (RoyalMail)"); - - if (retailerQuery.isAvailable("Order")) - retailer.submitOrder("Order"); - - } - - public void purchaseGoods() { - if (retailerQuery.isAvailable("Order")) - retailer.submitOrder("Order"); - } - - public void notifyShipment(String order) { - - outstandingOrders.remove(order); - - System.out.print("Work thread " + Thread.currentThread() + " - "); - System.out.println(order); - } - - public boolean hasOutstandingOrders() { - return outstandingOrders.size() != 0; - } - -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerComponentImpl.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerComponentImpl.java deleted file mode 100644 index 5ba42780f2..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerComponentImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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 supplychain.customer; - -import org.osoa.sca.annotations.Scope; - - -/** - * This class implements the Customer service component. - */ -@Scope("STATELESS") -public class OSGiStatelessCustomerComponentImpl extends OSGiCustomerComponentImpl { - -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerImpl.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerImpl.java deleted file mode 100644 index bc569d0ac0..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 supplychain.customer; - - -import org.osoa.sca.annotations.Scope; - - -/** - * This class implements the Customer service component. - */ -@Scope("STATELESS") -public class OSGiStatelessCustomerImpl extends OSGiCustomerImpl { - - public OSGiStatelessCustomerImpl(boolean ignore) { - super(ignore); - } - -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiVersionedCustomerImpl.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiVersionedCustomerImpl.java deleted file mode 100644 index 599ab51a50..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiVersionedCustomerImpl.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 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 supplychain.customer; - - -import java.util.ArrayList; -import java.util.Hashtable; - -import org.osgi.framework.BundleContext; - -import supplychain.OSGiBundleImpl; -import supplychain.retailer.Retailer; - -/** - * This class implements the Customer service component. - */ -public class OSGiVersionedCustomerImpl extends OSGiBundleImpl implements Customer { - - private static ArrayList outstandingOrders = new ArrayList(); - - private Retailer retailer1; - private Retailer retailer2; - private Retailer retailer3; - private int version; - - public OSGiVersionedCustomerImpl() { - super( new String[]{"retailer1", "retailer2", "retailer3"}, - new String[]{"(retailerName=amazon.com)", - "(retailerName=play.com)", - "(retailerName=ebay.com)" - }); - - } - - protected void started(BundleContext bc) { - - String jarFile = bc.getBundle().getLocation(); - if (jarFile.endsWith("1.jar")) version = 1; - else if (jarFile.endsWith("2.jar")) version = 2; - else version = 3; - - Hashtable props1 = new Hashtable(); - props1.put("component.name", "CustomerComponent" + version); - bc.registerService("supplychain.customer.Customer", this, props1); - - } - - public void purchaseBooks() { - System.out.println("OSGiVersionedCustomerImpl.purchaseBooks , retailer is " + retailer1); - outstandingOrders.add("Order, submitted (amazon.com v" + version + - "), fulfilled, shipped (ParcelForce)"); - - retailer1.submitOrder("Order"); - - } - - public void purchaseGames() { - System.out.println("OSGiCustomerImpl.purchaseGames"); - outstandingOrders.add("Order, submitted (play.com v" + version + - "), fulfilled, shipped (ParcelForce)"); - - retailer2.submitOrder("Order"); - - } - - public void purchaseGoods() { - retailer3.submitOrder("Order"); - } - - public void notifyShipment(String order) { - - outstandingOrders.remove(order); - - System.out.print("Work thread " + Thread.currentThread() + " - "); - System.out.println(order); - } - - public boolean hasOutstandingOrders() { - return outstandingOrders.size() != 0; - } - -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java deleted file mode 100644 index df52c6c760..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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 supplychain.retailer; - - -import org.osoa.sca.annotations.Property; -import org.osoa.sca.annotations.Reference; -import org.osoa.sca.annotations.Scope; -import org.osoa.sca.annotations.Service; - -import supplychain.warehouse.Warehouse; - -/** - * This class implements the Customer service component. - */ -@Service(Retailer.class) -@Scope("COMPOSITE") -public class JavaRetailerComponentImpl implements Retailer { - - private Warehouse warehouse; - - private String retailerName; - - public JavaRetailerComponentImpl() { - System.out.println("Created RetailerComponentImpl"); - } - - @Reference - public void setWarehouse(Warehouse warehouse) { - System.out.println("retailer setWarehouse " + warehouse); - - this.warehouse = warehouse; - } - - @Property - public void setRetailerName(String retailerName) { - this.retailerName = retailerName; - } - - - public void submitOrder(String order) { - - System.out.println("JavaRetailerComponentImpl.submitOrder " + warehouse); - warehouse.fulfillOrder(order + ", submitted (" + retailerName + ")"); - - } - - - - -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java deleted file mode 100644 index d4374e4315..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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 supplychain.retailer; - -import org.osgi.service.component.ComponentContext; - -import supplychain.warehouse.Warehouse; - -/** - * This class implements the Customer service component. - */ -public class OSGiRetailerComponentImpl implements Retailer { - - private Warehouse warehouse; - private String retailerName; - - - protected void setWarehouse(Warehouse warehouse) { - this.warehouse = warehouse; - } - - protected void unsetWarehouse(Warehouse warehouse) { - this.warehouse = null; - } - - public void submitOrder(String order) { - - System.out.println("OSGiRetailerComponentImpl.submitOrder , warehouse is " + warehouse); - warehouse.fulfillOrder(order + ", submitted (" + retailerName + ")"); - - } - - protected void activate(ComponentContext context){ - System.out.println("Activated OSGiRetailerComponentImpl bundle "); - - Object prop = context.getProperties().get("retailerName"); - if (prop instanceof String[]) - retailerName = ((String [])prop)[0]; - - - } - - protected void deactivate(ComponentContext context){ - System.out.println("Deactivated OSGiRetailerComponentImpl bundle "); - } - - -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerImpl.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerImpl.java deleted file mode 100644 index e71c624f49..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerImpl.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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 supplychain.retailer; - - -import java.util.Hashtable; - -import supplychain.OSGiBundleImpl; -import supplychain.warehouse.Warehouse; - -/** - * This class implements the Retailer service component. - */ -public class OSGiRetailerImpl extends OSGiBundleImpl { - - protected Warehouse warehouse; - - public OSGiRetailerImpl() { - - super(new String[]{"warehouse"}, - new String[]{"(component.service.name=WarehouseComponent1/Warehouse)"}); - - Hashtable props1 = new Hashtable(); - props1.put("retailerName", "amazon.com"); - registerService(new OSGiRetailerServiceImpl(this, "amazon.com"), - "supplychain.retailer.Retailer", props1); - - Hashtable props2 = new Hashtable(); - props2.put("retailerName", "play.com"); - registerService( - new OSGiRetailerServiceImpl(this, "play.com"), - "supplychain.retailer.Retailer", props2); - - Hashtable props3 = new Hashtable(); - props3.put("retailerName", "ebay.com"); - registerService( - new OSGiRetailerServiceImpl(this, "ebay.com"), - "supplychain.retailer.Retailer", props3); - } - - -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerServiceImpl.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerServiceImpl.java deleted file mode 100644 index a036ecfc76..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerServiceImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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 supplychain.retailer; - - -/** - * This class implements the Retailer service. - */ -public class OSGiRetailerServiceImpl implements Retailer { - - private OSGiRetailerImpl retailerImpl; - - private String retailerName; - - OSGiRetailerServiceImpl(OSGiRetailerImpl retailerImpl, String retailerName) { - this.retailerImpl = retailerImpl; - this.retailerName = retailerName; - - } - - public void submitOrder(String order) { - - System.out.println("Retailer.submitOrder, warehouse is " + retailerImpl.warehouse); - retailerImpl.warehouse.fulfillOrder(order + ", submitted (" - + retailerName + ")"); - - } - -} \ No newline at end of file diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerWithQueryComponentImpl.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerWithQueryComponentImpl.java deleted file mode 100644 index 278a439540..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerWithQueryComponentImpl.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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 supplychain.retailer; - -import org.osgi.service.component.ComponentContext; - -import supplychain.warehouse.Warehouse; -import supplychain.warehouse.WarehouseQuery; - -/** - * This class implements the Customer service component. - */ -public class OSGiRetailerWithQueryComponentImpl implements Retailer, RetailerQuery { - - private Warehouse warehouse; - private WarehouseQuery warehouseQuery; - private String retailerName; - - - protected void setWarehouse(Warehouse warehouse) { - this.warehouse = warehouse; - } - - protected void unsetWarehouse(Warehouse warehouse) { - this.warehouse = null; - } - - protected void setWarehouseQuery(WarehouseQuery warehouseQuery) { - this.warehouseQuery = warehouseQuery; - } - - protected void unsetWarehouseQuery(WarehouseQuery warehouse) { - this.warehouseQuery = null; - } - - public void submitOrder(String order) { - - System.out.println("OSGiRetailerComponentImpl.submitOrder , warehouse is " + warehouse); - warehouse.fulfillOrder(order + ", submitted (" + retailerName + ")"); - - } - - public boolean isAvailable(String order) { - return warehouseQuery.isAvailable(order); - } - - protected void activate(ComponentContext context){ - System.out.println("Activated OSGiRetailerComponentImpl bundle "); - - Object prop = context.getProperties().get("retailerName"); - if (prop instanceof String[]) - retailerName = ((String [])prop)[0]; - - - } - - protected void deactivate(ComponentContext context){ - System.out.println("Deactivated OSGiRetailerComponentImpl bundle "); - } - - -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerWithQueryImpl.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerWithQueryImpl.java deleted file mode 100644 index ee1f575e70..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerWithQueryImpl.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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 supplychain.retailer; - - -import java.util.Hashtable; - -import supplychain.OSGiBundleImpl; -import supplychain.warehouse.Warehouse; -import supplychain.warehouse.WarehouseQuery; - -/** - * This class implements the Retailer service component with query. - */ -public class OSGiRetailerWithQueryImpl extends OSGiBundleImpl implements Retailer, RetailerQuery { - - private Warehouse warehouse; - private WarehouseQuery warehouseQuery; - - public OSGiRetailerWithQueryImpl() { - - super(new String[]{"warehouse", "warehouseQuery"}, null); - - Hashtable props1 = new Hashtable(); - props1.put("retailerName", "amazon.com"); - registerService(this, - "supplychain.retailer.Retailer", props1); - - registerService(this, - "supplychain.retailer.RetailerQuery", props1); - - } - - public void submitOrder(String order) { - - System.out.println("Retailer.submitOrder, warehouse is " + warehouse); - warehouse.fulfillOrder(order + ", submitted (" - + "amazon.com" + ")"); - - } - - public boolean isAvailable(String order) { - return warehouseQuery.isAvailable(order); - } - - - -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiVersionedRetailerImpl.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiVersionedRetailerImpl.java deleted file mode 100644 index 09e60ca626..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiVersionedRetailerImpl.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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 supplychain.retailer; - - -import java.util.Hashtable; - -import org.osgi.framework.BundleContext; -import org.osgi.framework.InvalidSyntaxException; -import org.osgi.framework.ServiceReference; - -import supplychain.OSGiBundleImpl; -import supplychain.warehouse.Warehouse; - -/** - * This class implements the Retailer service component. - */ -public class OSGiVersionedRetailerImpl extends OSGiBundleImpl { - - protected Warehouse warehouse; - - private int version; - - public OSGiVersionedRetailerImpl() { - - super(new String[]{"warehouse"}, null); - - - } - - protected void started(BundleContext bc) { - String jarFile = bc.getBundle().getLocation(); - if (jarFile.endsWith("1.jar")) version = 1; - else if (jarFile.endsWith("2.jar")) version = 2; - else version = 3; - - Hashtable props1 = new Hashtable(); - props1.put("retailerName", "amazon.com"); - bc.registerService("supplychain.retailer.Retailer", - new OSGiVersionedRetailerServiceImpl(this, "amazon.com", version), - props1); - - Hashtable props2 = new Hashtable(); - props2.put("retailerName", "play.com"); - bc.registerService( - "supplychain.retailer.Retailer", - new OSGiVersionedRetailerServiceImpl(this, "play.com", version), - props2); - - try { - ServiceReference[] refs = bc.getServiceReferences(Warehouse.class.getName(), - "(component.service.name=WarehouseComponent" + version + "/Warehouse)"); - if (refs != null && refs.length > 0) { - warehouse = (Warehouse) bc.getService(refs[0]); - } - } catch (InvalidSyntaxException e) { - } - } -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiVersionedRetailerServiceImpl.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiVersionedRetailerServiceImpl.java deleted file mode 100644 index 7dd70889c7..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiVersionedRetailerServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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 supplychain.retailer; - - -/** - * This class implements the Retailer service. - */ -public class OSGiVersionedRetailerServiceImpl implements Retailer { - - private OSGiVersionedRetailerImpl retailerImpl; - - private String retailerName; - - private int version; - - OSGiVersionedRetailerServiceImpl(OSGiVersionedRetailerImpl retailerImpl, String retailerName, int version) { - this.retailerImpl = retailerImpl; - this.retailerName = retailerName; - this.version = version; - } - - public void submitOrder(String order) { - - System.out.println("Retailer.submitOrder, warehouse is " + retailerImpl.warehouse); - retailerImpl.warehouse.fulfillOrder(order + ", submitted (" - + retailerName + " v" + version + ")"); - - } - -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/Retailer.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/Retailer.java deleted file mode 100644 index 1e87d59af1..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/Retailer.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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 supplychain.retailer; - -/** - * This is the business interface of the Retailer service component. - */ -public interface Retailer { - - public void submitOrder(String order); - -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/RetailerQuery.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/RetailerQuery.java deleted file mode 100644 index 354f40a064..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/retailer/RetailerQuery.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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 supplychain.retailer; - -/** - * This is the business interface of the RetailerQuery service. - */ -public interface RetailerQuery { - - public boolean isAvailable(String order); - -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java deleted file mode 100644 index d0cf43a960..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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 supplychain.shipper; - - -import org.osoa.sca.annotations.Property; -import org.osoa.sca.annotations.Reference; -import org.osoa.sca.annotations.Scope; -import org.osoa.sca.annotations.Service; - -import supplychain.customer.Customer; - -/** - * This class implements the Shipper service component. - */ -@Service(Shipper.class) -@Scope("COMPOSITE") -public class JavaShipperComponentImpl implements Shipper { - - private Customer customer; - - private String shipperName; - - @Reference - public void setCustomer(Customer customer) { - this.customer = customer; - } - - @Property - public void setShipperName(String shipperName) { - this.shipperName = shipperName; - } - - - - public void processShipment(String order) { - System.out.println("JavaShipperComponentImpl.processShipment"); - customer.notifyShipment(order + ", shipped (" + shipperName + ")"); - } - - -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java deleted file mode 100644 index f3a98be77b..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 supplychain.shipper; - - -import org.osgi.service.component.ComponentContext; - -import supplychain.customer.Customer; - -/** - * This class implements the Shipper service component. - */ -public class OSGiShipperComponentImpl implements Shipper { - - private Customer customer; - private String shipperName; - - protected void setCustomer(Customer customer) { - this.customer = customer; - } - - protected void unsetCustomer(Customer customer) { - this.customer = null; - } - - public void processShipment(String order) { - System.out.println("OSGiShipperComponentImpl.processShipment, customer is " + customer); - customer.notifyShipment(order + ", shipped (" + shipperName + ")"); - } - - - protected void activate(ComponentContext context){ - System.out.println("Activated OSGiShipperComponentImpl bundle "); - - Object prop = context.getProperties().get("shipperName"); - if (prop instanceof String[]) - shipperName = ((String [])prop)[0]; - - } - - protected void deactivate(ComponentContext context){ - System.out.println("Deactivated OSGiShipperComponentImpl bundle "); - } - - -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperFactoryImpl.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperFactoryImpl.java deleted file mode 100644 index ef989d6fcf..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperFactoryImpl.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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 supplychain.shipper; - - -import java.util.Hashtable; - -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceFactory; -import org.osgi.framework.ServiceRegistration; - - -/** - * This class implements the Shipper service component. - */ -public class OSGiShipperFactoryImpl implements BundleActivator, ServiceFactory { - - private BundleContext bundleContext; - - public OSGiShipperFactoryImpl() { - - } - - - public void start(BundleContext bc) { - - this.bundleContext = bc; - - Hashtable props1 = new Hashtable(); - props1.put("shipperName", "RoyalMail"); - bc.registerService(Shipper.class.getName(), this, props1); - - Hashtable props2 = new Hashtable(); - props2.put("shipperName", "ParcelForce"); - bc.registerService(Shipper.class.getName(), this, props2); - } - - - - - public void stop(BundleContext context) throws Exception { - - } - - - public Object getService(Bundle bundle, ServiceRegistration reg) { - OSGiShipperImpl shipper = new OSGiShipperImpl(false); - shipper.start(bundleContext); - OSGiStatelessShipperServiceImpl shipperService = new OSGiStatelessShipperServiceImpl(shipper, - (String)reg.getReference().getProperty("shipperName")); - return shipperService; - } - - public void ungetService(Bundle arg0, ServiceRegistration arg1, Object arg2) { - - } - - - -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperImpl.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperImpl.java deleted file mode 100644 index effae8c246..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperImpl.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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 supplychain.shipper; - - -import java.util.Hashtable; - -import supplychain.OSGiBundleImpl; -import supplychain.customer.Customer; - -/** - * This class implements the Shipper service component. - */ -public class OSGiShipperImpl extends OSGiBundleImpl { - - protected Customer customer; - - - public OSGiShipperImpl() { - - super(new String[]{"customer"}, null); - - Hashtable props1 = new Hashtable(); - props1.put("shipperName", "RoyalMail"); - registerService(new OSGiShipperServiceImpl(this, "RoyalMail"), - "supplychain.shipper.Shipper", props1); - - Hashtable props2 = new Hashtable(); - props2.put("shipperName", "ParcelForce"); - registerService( - new OSGiShipperServiceImpl(this, "ParcelForce"), - "supplychain.shipper.Shipper", props2); - } - - // Used only by service factories - public OSGiShipperImpl(boolean ignore) { - - super(new String[]{"customer"}, null); - } - -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperServiceImpl.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperServiceImpl.java deleted file mode 100644 index 4effadf208..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperServiceImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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 supplychain.shipper; - - -/** - * This class implements the Shipper service. - */ -public class OSGiShipperServiceImpl implements Shipper { - - private OSGiShipperImpl shipperImpl; - - private String shipperName; - - OSGiShipperServiceImpl(OSGiShipperImpl shipperImpl, String shipperName) { - this.shipperImpl = shipperImpl; - this.shipperName = shipperName; - } - - public void processShipment(String order) { - - System.out.println("Shipper.submitOrder, warehouse is " + shipperImpl.customer); - shipperImpl.customer.notifyShipment(order + ", shipped (" + shipperName + ")"); - - } - -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiStatelessShipperComponentImpl.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiStatelessShipperComponentImpl.java deleted file mode 100644 index 13bce67bb4..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiStatelessShipperComponentImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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 supplychain.shipper; - -import org.osoa.sca.annotations.Scope; - - -/** - * This class implements the Shipper service component. - */ -@Scope("STATELESS") -public class OSGiStatelessShipperComponentImpl extends OSGiShipperComponentImpl { - -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiStatelessShipperServiceImpl.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiStatelessShipperServiceImpl.java deleted file mode 100644 index 071a131f40..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiStatelessShipperServiceImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 supplychain.shipper; - -import org.osoa.sca.annotations.Scope; - - -/** - * This class implements the Shipper service. - */ -@Scope("STATELESS") -public class OSGiStatelessShipperServiceImpl extends OSGiShipperServiceImpl { - - public OSGiStatelessShipperServiceImpl(OSGiShipperImpl shipperImpl, String shipperName) { - super(shipperImpl, shipperName); - } - - -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiVersionedShipperImpl.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiVersionedShipperImpl.java deleted file mode 100644 index 6ebd1f2894..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiVersionedShipperImpl.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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 supplychain.shipper; - - -import java.util.Hashtable; - -import org.osgi.framework.BundleContext; -import org.osgi.framework.InvalidSyntaxException; -import org.osgi.framework.ServiceReference; - -import supplychain.OSGiBundleImpl; -import supplychain.customer.Customer; - -/** - * This class implements the Shipper service component. - */ -public class OSGiVersionedShipperImpl extends OSGiBundleImpl { - - protected Customer customer; - - private int version; - - - public OSGiVersionedShipperImpl() { - - super(new String[]{"customer"}, null); - } - - protected void started(BundleContext bc) { - - String jarFile = bc.getBundle().getLocation(); - if (jarFile.endsWith("1.jar")) version = 1; - else if (jarFile.endsWith("2.jar")) version = 2; - - - Hashtable props1 = new Hashtable(); - props1.put("shipperName", "RoyalMail"); - props1.put("component.service.name", "ShipperComponent"+version+"/ShipperService1"); - bc.registerService("supplychain.shipper.Shipper", - new OSGiVersionedShipperServiceImpl(this, "RoyalMail", version), - props1); - - Hashtable props2 = new Hashtable(); - props2.put("shipperName", "ParcelForce"); - props2.put("component.service.name", "ShipperComponent"+version+"/ShipperService2"); - bc.registerService("supplychain.shipper.Shipper", - new OSGiVersionedShipperServiceImpl(this, "ParcelForce", version), - props2); - - try { - ServiceReference[] refs = bc.getServiceReferences(Customer.class.getName(), - "(component.service.name=CustomerComponent" + version + "/CustomerService)"); - if (refs != null && refs.length > 0) { - customer = (Customer) bc.getService(refs[0]); - } - } catch (InvalidSyntaxException e) { - } - } - - -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiVersionedShipperServiceImpl.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiVersionedShipperServiceImpl.java deleted file mode 100644 index b66961b1c2..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiVersionedShipperServiceImpl.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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 supplychain.shipper; - - -/** - * This class implements the Shipper service. - */ -public class OSGiVersionedShipperServiceImpl implements Shipper { - - private OSGiVersionedShipperImpl shipperImpl; - - private String shipperName; - - private int version; - - OSGiVersionedShipperServiceImpl(OSGiVersionedShipperImpl shipperImpl, String shipperName, int version) { - this.shipperImpl = shipperImpl; - this.shipperName = shipperName; - this.version = version; - } - - public void processShipment(String order) { - - System.out.println("Shipper.processShipment, version " + version + " customer is " + shipperImpl.customer); - shipperImpl.customer.notifyShipment(order + ", shipped (" + shipperName + ")"); - - } - -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/Shipper.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/Shipper.java deleted file mode 100644 index 2514928c10..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/shipper/Shipper.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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 supplychain.shipper; - -/** - * This is the business interface of the Shipper service component. - */ -public interface Shipper { - - public void processShipment(String order); - -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java deleted file mode 100644 index 9edf3567e5..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 supplychain.warehouse; - -import org.osoa.sca.annotations.Reference; -import org.osoa.sca.annotations.Scope; -import org.osoa.sca.annotations.Service; - -import supplychain.shipper.Shipper; - -/** - * This class implements the Warehouse service component. - */ -@Service(Warehouse.class) -@Scope("STATELESS") -public class JavaWarehouseComponentImpl implements Warehouse { - - private Shipper shipper; - - @Reference - public void setShipper(Shipper shipper) { - this.shipper = shipper; - } - - public void fulfillOrder(String order) { - System.out.println("JavaWarehouseComponentImpl.fulfillOrder : shipper is " + shipper); - - shipper.processShipment(order + ", fulfilled"); - } - - -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/warehouse/JavaWarehouseWithQueryComponentImpl.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/warehouse/JavaWarehouseWithQueryComponentImpl.java deleted file mode 100644 index 659f16be7f..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/warehouse/JavaWarehouseWithQueryComponentImpl.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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 supplychain.warehouse; - -import org.osoa.sca.annotations.Reference; -import org.osoa.sca.annotations.Scope; -import org.osoa.sca.annotations.Service; - -import supplychain.shipper.Shipper; - -/** - * This class implements the Warehouse service component. - */ -@Service(interfaces={Warehouse.class, WarehouseQuery.class}) -@Scope("COMPOSITE") -public class JavaWarehouseWithQueryComponentImpl implements Warehouse, WarehouseQuery { - - private Shipper shipper; - - @Reference - public void setShipper(Shipper shipper) { - this.shipper = shipper; - } - - public void fulfillOrder(String order) { - System.out.println("JavaWarehouseComponentImpl.fulfillOrder : shipper is " + shipper); - - shipper.processShipment(order + ", fulfilled"); - } - - public boolean isAvailable(String order) { - return true; - } - - -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java deleted file mode 100644 index dd283bf779..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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 supplychain.warehouse; - - -import org.osgi.service.component.ComponentContext; - -import supplychain.shipper.Shipper; - -/** - * This class implements the Warehouse service component. - */ - -public class OSGiWarehouseComponentImpl implements Warehouse { - - private Shipper shipper; - - protected void setShipper(Shipper shipper) { - this.shipper = shipper; - } - - protected void unsetShipper(Shipper shipper) { - this.shipper = null; - } - - public void fulfillOrder(String order) { - System.out.println("OSGiWarehouseComponentImpl.fulfillOrder : shipper is " + shipper); - - shipper.processShipment(order + ", fulfilled"); - - } - - protected void activate(ComponentContext context){ - System.out.println("Activated OSGiWarehouseComponentImpl "); - } - - protected void deactivate(ComponentContext context){ - System.out.println("Deactivated OSGiWarehouseComponentImpl "); - } - -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java deleted file mode 100644 index bb04ff42e0..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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 supplychain.warehouse; - - -import java.util.Hashtable; - -import org.osgi.framework.BundleContext; - -import supplychain.OSGiBundleImpl; -import supplychain.shipper.Shipper; - -/** - * This class implements the Warehouse service component. - */ - -public class OSGiWarehouseImpl extends OSGiBundleImpl implements Warehouse { - - protected Shipper shipper; - private OSGiWarehouseServiceImpl warehouseService1; - private OSGiWarehouseServiceImpl warehouseService2; - - public OSGiWarehouseImpl() { - super(new String[]{"shipper"}, null); - - Hashtable props1 = new Hashtable(); - props1.put("component.name", "WarehouseComponent1"); - warehouseService1 = new OSGiWarehouseServiceImpl(this, 2); - registerService(warehouseService1, - "supplychain.warehouse.Warehouse", props1); - - Hashtable props2 = new Hashtable(); - props2.put("component.name", "WarehouseComponent2"); - warehouseService2 = new OSGiWarehouseServiceImpl(this, 1); - registerService(warehouseService2, - "supplychain.warehouse.Warehouse", props2); - } - - protected void started(BundleContext bc) { - warehouseService1.started(bc); - warehouseService2.started(bc); - } - - public void fulfillOrder(String order) { - System.out.println("OSGiWarehouseImpl.fulfillOrder : shipper is " + shipper); - - shipper.processShipment(order + ", fulfilled"); - - } - - -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseServiceImpl.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseServiceImpl.java deleted file mode 100644 index 3317816557..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseServiceImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 supplychain.warehouse; - -import org.osgi.framework.BundleContext; -import org.osgi.framework.InvalidSyntaxException; -import org.osgi.framework.ServiceReference; - -import supplychain.shipper.Shipper; - - -/** - * This class implements the Warehouse service. - */ -public class OSGiWarehouseServiceImpl implements Warehouse { - - private OSGiWarehouseImpl warehouseImpl; - private Shipper shipper; - private int shipperNum; - - - OSGiWarehouseServiceImpl(OSGiWarehouseImpl warehouseImpl, int shipperNum) { - this.warehouseImpl = warehouseImpl; - this.shipperNum = shipperNum; - } - - - protected void started(BundleContext bc) { - try { - ServiceReference[] refs = bc.getServiceReferences(Shipper.class.getName(), - "(component.service.name=ShipperComponent" + shipperNum + "/Shipper)"); - if (refs != null && refs.length > 0) { - shipper = (Shipper) bc.getService(refs[0]); - } - } catch (InvalidSyntaxException e) { - } - } - - public void fulfillOrder(String order) { - System.out.println("OSGiWarehouseImpl.fulfillOrder : shipper is " + warehouseImpl.shipper); - - shipper.processShipment(order + ", fulfilled"); - - } - -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/warehouse/Warehouse.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/warehouse/Warehouse.java deleted file mode 100644 index 6f1f6b8730..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/warehouse/Warehouse.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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 supplychain.warehouse; - -/** - * This is the business interface of the Warehouse service component. - */ -public interface Warehouse { - - public void fulfillOrder(String order); - -} diff --git a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/warehouse/WarehouseQuery.java b/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/warehouse/WarehouseQuery.java deleted file mode 100644 index 6d1ad76796..0000000000 --- a/branches/sca-java-1.0.1/itest/osgi-implementation/src/main/java/supplychain/warehouse/WarehouseQuery.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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 supplychain.warehouse; - -/** - * This is the business interface of the RetailerQuery service. - */ -public interface WarehouseQuery { - - public boolean isAvailable(String order); - -} -- cgit v1.2.3