diff options
Diffstat (limited to 'branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper')
10 files changed, 0 insertions, 515 deletions
diff --git a/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java b/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java deleted file mode 100644 index d0cf43a960..0000000000 --- a/branches/sca-android/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-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java b/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java deleted file mode 100644 index ff40a7ae36..0000000000 --- a/branches/sca-android/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-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperFactoryImpl.java b/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperFactoryImpl.java deleted file mode 100644 index ef989d6fcf..0000000000 --- a/branches/sca-android/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<String, Object> props1 = new Hashtable<String, Object>(); - props1.put("shipperName", "RoyalMail"); - bc.registerService(Shipper.class.getName(), this, props1); - - Hashtable<String, Object> props2 = new Hashtable<String, Object>(); - 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-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperImpl.java b/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperImpl.java deleted file mode 100644 index effae8c246..0000000000 --- a/branches/sca-android/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<String, Object> props1 = new Hashtable<String, Object>(); - props1.put("shipperName", "RoyalMail"); - registerService(new OSGiShipperServiceImpl(this, "RoyalMail"), - "supplychain.shipper.Shipper", props1); - - Hashtable<String, Object> props2 = new Hashtable<String, Object>(); - 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-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperServiceImpl.java b/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperServiceImpl.java deleted file mode 100644 index 4effadf208..0000000000 --- a/branches/sca-android/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-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiStatelessShipperComponentImpl.java b/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiStatelessShipperComponentImpl.java deleted file mode 100644 index 13bce67bb4..0000000000 --- a/branches/sca-android/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-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiStatelessShipperServiceImpl.java b/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiStatelessShipperServiceImpl.java deleted file mode 100644 index 071a131f40..0000000000 --- a/branches/sca-android/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-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiVersionedShipperImpl.java b/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiVersionedShipperImpl.java deleted file mode 100644 index 6ebd1f2894..0000000000 --- a/branches/sca-android/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<String, Object> props1 = new Hashtable<String, Object>(); - props1.put("shipperName", "RoyalMail"); - props1.put("component.service.name", "ShipperComponent"+version+"/ShipperService1"); - bc.registerService("supplychain.shipper.Shipper", - new OSGiVersionedShipperServiceImpl(this, "RoyalMail", version), - props1); - - Hashtable<String, Object> props2 = new Hashtable<String, Object>(); - 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-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiVersionedShipperServiceImpl.java b/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiVersionedShipperServiceImpl.java deleted file mode 100644 index b66961b1c2..0000000000 --- a/branches/sca-android/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-android/itest/osgi-implementation/src/main/java/supplychain/shipper/Shipper.java b/branches/sca-android/itest/osgi-implementation/src/main/java/supplychain/shipper/Shipper.java deleted file mode 100644 index 2514928c10..0000000000 --- a/branches/sca-android/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); - -} |