diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-11 23:08:20 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-11 23:08:20 +0000 |
commit | 61c9466ff91ca40f4b1ebbe670d7848e521131d7 (patch) | |
tree | d41cd727b04a6146533cc3ad97182e715cd61e32 /branches/sca-java-1.3.3/itest/osgi-implementation/src/main/java/supplychain/retailer | |
parent | 0cc8ed2208c9d04057bcb00859490290e3aa948c (diff) |
Moving 1.x branches
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835130 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.3.3/itest/osgi-implementation/src/main/java/supplychain/retailer')
10 files changed, 0 insertions, 554 deletions
diff --git a/branches/sca-java-1.3.3/itest/osgi-implementation/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java b/branches/sca-java-1.3.3/itest/osgi-implementation/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java deleted file mode 100644 index df52c6c760..0000000000 --- a/branches/sca-java-1.3.3/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.3.3/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java b/branches/sca-java-1.3.3/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java deleted file mode 100644 index aca5943552..0000000000 --- a/branches/sca-java-1.3.3/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.3.3/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerImpl.java b/branches/sca-java-1.3.3/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerImpl.java deleted file mode 100644 index e71c624f49..0000000000 --- a/branches/sca-java-1.3.3/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<String, Object> props1 = new Hashtable<String, Object>(); - props1.put("retailerName", "amazon.com"); - registerService(new OSGiRetailerServiceImpl(this, "amazon.com"), - "supplychain.retailer.Retailer", props1); - - Hashtable<String, Object> props2 = new Hashtable<String, Object>(); - props2.put("retailerName", "play.com"); - registerService( - new OSGiRetailerServiceImpl(this, "play.com"), - "supplychain.retailer.Retailer", props2); - - Hashtable<String, Object> props3 = new Hashtable<String, Object>(); - props3.put("retailerName", "ebay.com"); - registerService( - new OSGiRetailerServiceImpl(this, "ebay.com"), - "supplychain.retailer.Retailer", props3); - } - - -} diff --git a/branches/sca-java-1.3.3/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerServiceImpl.java b/branches/sca-java-1.3.3/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerServiceImpl.java deleted file mode 100644 index a036ecfc76..0000000000 --- a/branches/sca-java-1.3.3/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.3.3/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerWithQueryComponentImpl.java b/branches/sca-java-1.3.3/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerWithQueryComponentImpl.java deleted file mode 100644 index db877bb366..0000000000 --- a/branches/sca-java-1.3.3/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.3.3/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerWithQueryImpl.java b/branches/sca-java-1.3.3/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerWithQueryImpl.java deleted file mode 100644 index ee1f575e70..0000000000 --- a/branches/sca-java-1.3.3/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<String, Object> props1 = new Hashtable<String, Object>(); - 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.3.3/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiVersionedRetailerImpl.java b/branches/sca-java-1.3.3/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiVersionedRetailerImpl.java deleted file mode 100644 index 09e60ca626..0000000000 --- a/branches/sca-java-1.3.3/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<String, Object> props1 = new Hashtable<String, Object>(); - props1.put("retailerName", "amazon.com"); - bc.registerService("supplychain.retailer.Retailer", - new OSGiVersionedRetailerServiceImpl(this, "amazon.com", version), - props1); - - Hashtable<String, Object> props2 = new Hashtable<String, Object>(); - 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.3.3/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiVersionedRetailerServiceImpl.java b/branches/sca-java-1.3.3/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiVersionedRetailerServiceImpl.java deleted file mode 100644 index 7dd70889c7..0000000000 --- a/branches/sca-java-1.3.3/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.3.3/itest/osgi-implementation/src/main/java/supplychain/retailer/Retailer.java b/branches/sca-java-1.3.3/itest/osgi-implementation/src/main/java/supplychain/retailer/Retailer.java deleted file mode 100644 index 1e87d59af1..0000000000 --- a/branches/sca-java-1.3.3/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.3.3/itest/osgi-implementation/src/main/java/supplychain/retailer/RetailerQuery.java b/branches/sca-java-1.3.3/itest/osgi-implementation/src/main/java/supplychain/retailer/RetailerQuery.java deleted file mode 100644 index 354f40a064..0000000000 --- a/branches/sca-java-1.3.3/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); - -} |