diff options
Diffstat (limited to 'branches/sca-java-20080910/itest/osgi-implementation/src/main/java/supplychain/customer')
10 files changed, 0 insertions, 735 deletions
diff --git a/branches/sca-java-20080910/itest/osgi-implementation/src/main/java/supplychain/customer/Customer.java b/branches/sca-java-20080910/itest/osgi-implementation/src/main/java/supplychain/customer/Customer.java deleted file mode 100644 index 2762bc62be..0000000000 --- a/branches/sca-java-20080910/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-20080910/itest/osgi-implementation/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java b/branches/sca-java-20080910/itest/osgi-implementation/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java deleted file mode 100644 index 80346311b1..0000000000 --- a/branches/sca-java-20080910/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<String> outstandingOrders = new ArrayList<String>(); - - @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-20080910/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java b/branches/sca-java-20080910/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java deleted file mode 100644 index a879505610..0000000000 --- a/branches/sca-java-20080910/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java +++ /dev/null @@ -1,106 +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 static ArrayList<String> outstandingOrders = new ArrayList<String>(); - - 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 retailer3) { - this.retailer3 = retailer3; - } - - protected void unsetRetailer3(Retailer retailer3) { - // this.retailer3 = null; - } - - - public void purchaseBooks() { - System.out.println("OSGiCustomerComponentImpl.purchaseBooks, retailer1 is " + retailer1); - outstandingOrders.add("Order, submitted (amazon.com), fulfilled, shipped (ParcelForce)"); - retailer1.submitOrder("Order"); - } - - public void purchaseGames() { - System.out.println("OSGiCustomerComponentImpl.purchaseGames, retailer2 is " + retailer2); - outstandingOrders.add("Order, submitted (play.com), fulfilled, shipped (ParcelForce)"); - - retailer2.submitOrder("Order"); - } - - public void purchaseGoods() { - System.out.println("OSGiCustomerComponentImpl.purchaseGames, retailer3 is " + retailer3); - 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-20080910/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerFactoryImpl.java b/branches/sca-java-20080910/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerFactoryImpl.java deleted file mode 100644 index c8cb522cf4..0000000000 --- a/branches/sca-java-20080910/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-20080910/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerImpl.java b/branches/sca-java-20080910/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerImpl.java deleted file mode 100644 index 546971860e..0000000000 --- a/branches/sca-java-20080910/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<String> outstandingOrders = new ArrayList<String>(); - - 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-20080910/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryComponentImpl.java b/branches/sca-java-20080910/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryComponentImpl.java deleted file mode 100644 index 593e55f3f5..0000000000 --- a/branches/sca-java-20080910/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<String> outstandingOrders = new ArrayList<String>(); - - 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-20080910/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryImpl.java b/branches/sca-java-20080910/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryImpl.java deleted file mode 100644 index 18483817ad..0000000000 --- a/branches/sca-java-20080910/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<String> outstandingOrders = new ArrayList<String>(); - - 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-20080910/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerComponentImpl.java b/branches/sca-java-20080910/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerComponentImpl.java deleted file mode 100644 index 5ba42780f2..0000000000 --- a/branches/sca-java-20080910/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-20080910/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerImpl.java b/branches/sca-java-20080910/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerImpl.java deleted file mode 100644 index bc569d0ac0..0000000000 --- a/branches/sca-java-20080910/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-20080910/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiVersionedCustomerImpl.java b/branches/sca-java-20080910/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiVersionedCustomerImpl.java deleted file mode 100644 index 599ab51a50..0000000000 --- a/branches/sca-java-20080910/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<String> outstandingOrders = new ArrayList<String>(); - - 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<String, Object> props1 = new Hashtable<String, Object>(); - 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; - } - -} |