summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer')
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/Customer.java39
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java90
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java108
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerFactoryImpl.java65
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerImpl.java94
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryComponentImpl.java102
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryImpl.java84
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerComponentImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiVersionedCustomerImpl.java100
10 files changed, 747 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/Customer.java b/sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/Customer.java
new file mode 100644
index 0000000000..2762bc62be
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/Customer.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package 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/sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java b/sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java
new file mode 100644
index 0000000000..28353267aa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java
@@ -0,0 +1,90 @@
+/*
+ * 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.Collections;
+import java.util.List;
+
+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 List<String> outstandingOrders = Collections.synchronizedList(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/sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java b/sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java
new file mode 100644
index 0000000000..c273f7b174
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java
@@ -0,0 +1,108 @@
+/*
+ * 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.Collections;
+import java.util.List;
+
+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 List<String> outstandingOrders = Collections.synchronizedList(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/sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerFactoryImpl.java b/sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerFactoryImpl.java
new file mode 100644
index 0000000000..c8cb522cf4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerFactoryImpl.java
@@ -0,0 +1,65 @@
+/*
+ * 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/sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerImpl.java b/sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerImpl.java
new file mode 100644
index 0000000000..6d9b03a94d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerImpl.java
@@ -0,0 +1,94 @@
+/*
+ * 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.Collections;
+import java.util.List;
+
+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 List<String> outstandingOrders = Collections.synchronizedList(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/sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryComponentImpl.java b/sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryComponentImpl.java
new file mode 100644
index 0000000000..606f6b9684
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryComponentImpl.java
@@ -0,0 +1,102 @@
+/*
+ * 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.Collections;
+import java.util.List;
+
+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 List<String> outstandingOrders = Collections.synchronizedList(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/sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryImpl.java b/sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryImpl.java
new file mode 100644
index 0000000000..ef9dc8c16a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryImpl.java
@@ -0,0 +1,84 @@
+/*
+ * 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.Collections;
+import java.util.List;
+
+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 List<String> outstandingOrders = Collections.synchronizedList(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/sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerComponentImpl.java b/sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerComponentImpl.java
new file mode 100644
index 0000000000..5ba42780f2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerComponentImpl.java
@@ -0,0 +1,30 @@
+/*
+ * 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/sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerImpl.java b/sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerImpl.java
new file mode 100644
index 0000000000..bc569d0ac0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerImpl.java
@@ -0,0 +1,35 @@
+/*
+ * 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/sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiVersionedCustomerImpl.java b/sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiVersionedCustomerImpl.java
new file mode 100644
index 0000000000..ebb9bc56ef
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiVersionedCustomerImpl.java
@@ -0,0 +1,100 @@
+/*
+ * 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.Collections;
+import java.util.Hashtable;
+import java.util.List;
+
+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 List<String> outstandingOrders = Collections.synchronizedList(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;
+ }
+
+}