Package calculator.dosgi

Examples of calculator.dosgi.CalculatorService


            ServiceReference ref =
                calculatorBundle.getBundleContext().getServiceReference(CalculatorService.class.getName());
            Assert.assertNotNull(ref);
            Object service = context.getService(ref);
            Assert.assertNotNull(service);
            CalculatorService calculator = OSGiTestBundles.cast(service, CalculatorService.class);
            System.out.println("2.0 + 1.0 = " + calculator.add(2.0, 1.0));
            System.out.println("2.0 - 1.0 = " + calculator.subtract(2.0, 1.0));
            System.out.println("2.0 * 1.0 = " + calculator.multiply(2.0, 1.0));
            System.out.println("2.0 / 1.0 = " + calculator.divide(2.0, 1.0));
        }
    }
View Full Code Here


        Dictionary<String, Object> props = new Hashtable<String, Object>();
        props.put("sca.service", "CalculatorComponent#service-name(Calculator)");
        props.put("calculator", "Calculator");

        logger.info("Registering " + CalculatorService.class.getName());
        CalculatorService calculator = new CalculatorServiceImpl(context);
        context.registerService(CalculatorService.class.getName(), calculator, props);

        getBundle(context, AddService.class);

    }
View Full Code Here

        ServiceReference ref =
            calculatorBundle.getBundleContext().getServiceReference(CalculatorService.class.getName());
        Assert.assertNotNull(ref);
        Object service = context.getService(ref);
        Assert.assertNotNull(service);
        CalculatorService calculator = OSGiTestUtils.cast(service, CalculatorService.class);
        System.out.println("2.0 + 1.0 = " + calculator.add(2.0, 1.0));
        System.out.println("2.0 - 1.0 = " + calculator.subtract(2.0, 1.0));
        System.out.println("2.0 * 1.0 = " + calculator.multiply(2.0, 1.0));
        System.out.println("2.0 / 1.0 = " + calculator.divide(2.0, 1.0));
    }
View Full Code Here

        logger.info("Starting " + context.getBundle());
        Dictionary<String, Object> props = new Hashtable<String, Object>();
        props.put("sca.service", "CalculatorComponent#service-name(Calculator)");
        props.put("calculator", "Calculator");
        logger.info("Registering " + CalculatorService.class.getName());
        CalculatorService calculator = new CalculatorServiceImpl(context);
        context.registerService(CalculatorService.class.getName(), calculator, props);

        getBundle(context, AddService.class);

    }
View Full Code Here

            // Use the DS version
            String filter = "(component.name=CalculatorComponent)";
            System.out.println(filter);
            ServiceReference ref =
                calculatorBundle.getBundleContext().getServiceReferences(CalculatorService.class.getName(), filter)[0];
            CalculatorService calculator = OSGiTestBundles.cast(context.getService(ref), CalculatorService.class);
            System.out.println("2.0 + 1.0 = " + calculator.add(2.0, 1.0));
            System.out.println("2.0 - 1.0 = " + calculator.subtract(2.0, 1.0));
            System.out.println("2.0 * 1.0 = " + calculator.multiply(2.0, 1.0));
            System.out.println("2.0 / 1.0 = " + calculator.divide(2.0, 1.0));
        } catch (Exception e) {
            e.printStackTrace();
            throw e;
        }
    }
View Full Code Here

            ServiceReference ref =
                calculatorBundle.getBundleContext().getServiceReference(CalculatorService.class.getName());
            Assert.assertNotNull(ref);
            Object service = context.getService(ref);
            Assert.assertNotNull(service);
            CalculatorService calculator = OSGiTestBundles.cast(service, CalculatorService.class);
            System.out.println("2.0 + 1.0 = " + calculator.add(2.0, 1.0));
            System.out.println("2.0 - 1.0 = " + calculator.subtract(2.0, 1.0));
            System.out.println("2.0 * 1.0 = " + calculator.multiply(2.0, 1.0));
            System.out.println("2.0 / 1.0 = " + calculator.divide(2.0, 1.0));
        }
    }
View Full Code Here

        ServiceReference ref =
            calculatorBundle.getBundleContext().getServiceReference(CalculatorService.class.getName());
        Assert.assertNotNull(ref);
        Object service = context.getService(ref);
        Assert.assertNotNull(service);
        CalculatorService calculator = OSGiTestUtils.cast(service, CalculatorService.class);
        System.out.println("2.0 + 1.0 = " + calculator.add(2.0, 1.0));
        System.out.println("2.0 - 1.0 = " + calculator.subtract(2.0, 1.0));
        System.out.println("2.0 * 1.0 = " + calculator.multiply(2.0, 1.0));
        System.out.println("2.0 / 1.0 = " + calculator.divide(2.0, 1.0));
    }
View Full Code Here

        props.put("calculator", "Calculator");
        props.put("service.exported.configs", new String[] {"org.osgi.sca"});
        props.put("org.osgi.sca.bindings", new String[] {"{http://sample}Calculator"});
        props.put("service.exported.interfaces", new String[] {"*"});
        logger.info("Registering " + CalculatorService.class.getName());
        CalculatorService calculator = new CalculatorServiceImpl(context);
        context.registerService(CalculatorService.class.getName(), calculator, props);

        getBundle(context, AddService.class);

    }
View Full Code Here

        ServiceReference ref =
            calculatorBundle.getBundleContext().getServiceReference(CalculatorService.class.getName());
        Assert.assertNotNull(ref);
        Object service = context.getService(ref);
        Assert.assertNotNull(service);
        CalculatorService calculator = OSGiTestUtils.cast(service, CalculatorService.class);
        System.out.println("2.0 + 1.0 = " + calculator.add(2.0, 1.0));
        System.out.println("2.0 - 1.0 = " + calculator.subtract(2.0, 1.0));
        System.out.println("2.0 * 1.0 = " + calculator.multiply(2.0, 1.0));
        System.out.println("2.0 / 1.0 = " + calculator.divide(2.0, 1.0));
    }
View Full Code Here

TOP

Related Classes of calculator.dosgi.CalculatorService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.