Package org.osgi.service.cm

Examples of org.osgi.service.cm.ConfigurationAdmin


    /**
     * Check creation.
     */
    @Test
    public void testCreation() throws IOException, InterruptedException {
        ConfigurationAdmin admin = osgiHelper.getServiceObject(ConfigurationAdmin.class, null);
        Configuration conf = admin.createFactoryConfiguration("Factories-FooProviderType-2", "?");

        Dictionary<String, Object> p = new Hashtable<String, Object>();
        p.put("int", 3);
        p.put("long", (long) 42);
        p.put("string", "absdir");
View Full Code Here


    /**
     * Check creation (push String).
     */
    @Test
    public void testCreationString() throws IOException, InterruptedException {
        ConfigurationAdmin admin = osgiHelper.getServiceObject(ConfigurationAdmin.class, null);
        Configuration conf = admin.createFactoryConfiguration("Factories-FooProviderType-2", "?");

        Dictionary<String, Object> p = new Hashtable<String, Object>();
        p.put("int", "3");
        p.put("long", "42");
        p.put("string", "absdir");
View Full Code Here

    /**
     * Check update and delete.
     */
    @Test
    public void testUpdate() throws IOException, InterruptedException {
        ConfigurationAdmin admin = osgiHelper.getServiceObject(ConfigurationAdmin.class, null);
        Configuration conf = admin.createFactoryConfiguration("Factories-FooProviderType-2", "?");

        Dictionary<String, Object> p = new Hashtable<String, Object>();
        p.put("int", 3);
        p.put("long", (long) 42);
        p.put("string", "absdir");
View Full Code Here

     * Check update and delete.
     * (Push String).
     */
    @Test
    public void testUpdateString() throws IOException, InterruptedException {
        ConfigurationAdmin admin = osgiHelper.getServiceObject(ConfigurationAdmin.class, null);
        Configuration conf = admin.createFactoryConfiguration("Factories-FooProviderType-2", "?");

        Dictionary<String, Object> p = new Hashtable<String, Object>();
        p.put("int", "3");
        p.put("long", "42");
        p.put("string", "absdir");
View Full Code Here

                @Override
                public Object addingService(ServiceReference reference) {
                    Object svc = super.addingService(reference);
                    if (svc instanceof ConfigurationAdmin) {
                        try {
                            ConfigurationAdmin cadmin = (ConfigurationAdmin) svc;
                            org.osgi.service.cm.Configuration zkServerCfg =
                                cadmin.getConfiguration("org.apache.cxf.dosgi.discovery.zookeeper.server", null);
                            Hashtable<String, Object> svrProps = new Hashtable<String, Object>();
                            svrProps.put("clientPort", zkPort);
                            zkServerCfg.update(svrProps);                           
                           
                            org.osgi.service.cm.Configuration zkClientCfg =
                                cadmin.getConfiguration("org.apache.cxf.dosgi.discovery.zookeeper", null);
                            Hashtable<String, Object> cliProps = new Hashtable<String, Object>();
                            cliProps.put("zookeeper.host", "127.0.0.1");
                            cliProps.put("zookeeper.port", "" + zkPort);
                            zkClientCfg.update(cliProps);
                        } catch (IOException e) {
View Full Code Here

            @Override
            public Object addingService(ServiceReference reference) {
                Object svc = super.addingService(reference);
                if (svc instanceof ConfigurationAdmin) {
                    try {
                        ConfigurationAdmin cadmin = (ConfigurationAdmin) svc;
                        Configuration cfg = cadmin.getConfiguration(PID, null);
                        Hashtable<String, Object> props = new Hashtable<String, Object>();
                        String zp = System.getProperty(ZOOKEEPER_PORT);
                        props.put("clientPort", zp);
                        cfg.update(props);
                        System.out.println("Set zookeeper client port to " + zp);
View Full Code Here

        MSF managedFactory = (MSF) trackerMSF.getService();
        assertNotNull(managedFactory);
       
        ServiceTracker tracker = new ServiceTracker(bundleContext, ConfigurationAdmin.class.getName(), null);
        tracker.open();
        ConfigurationAdmin configAdmin = (ConfigurationAdmin) tracker.getService();
        assertNotNull(configAdmin);
       
        // ManagedService operations
       
        assertNull(managedServiceA.getConfig());
View Full Code Here

        ServiceReference ref = getBundleContext().getServiceReference(ConfigurationAdmin.class.getName());
        if (ref == null) {
            System.out.println("ConfigurationAdmin service is unavailable.");
            return null;
        }
        ConfigurationAdmin admin = getConfigurationAdmin();
        if (admin == null) {
            System.out.println("ConfigAdmin service is unavailable.");
            return null;
        }
View Full Code Here

        ServiceReference ref = getBundleContext().getServiceReference(ConfigurationAdmin.class.getName());
        if (ref == null) {
            return null;
        }
        try {
            ConfigurationAdmin admin = (ConfigurationAdmin) getBundleContext().getService(ref);
            if (admin == null) {
                return null;
            } else {
                return admin;
            }
View Full Code Here

        MSF managedFactory = (MSF) trackerMSF.getService();
        assertNotNull(managedFactory);
       
        ServiceTracker tracker = new ServiceTracker(bundleContext, ConfigurationAdmin.class.getName(), null);
        tracker.open();
        ConfigurationAdmin configAdmin = (ConfigurationAdmin) tracker.getService();
        assertNotNull(configAdmin);
       
        // ManagedService operations
       
        assertNull(managedServiceA.getConfig());
View Full Code Here

TOP

Related Classes of org.osgi.service.cm.ConfigurationAdmin

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.