Package com.volantis.osgi.cm

Examples of com.volantis.osgi.cm.InternalConfiguration


        //   Test Expectations
        // =====================================================================
        FileManager fileManager = new FileManagerImpl(bundleRootDir, 10, 10);
        ConfigurationStore store = new ConfigurationStoreImpl(fileManager);

        InternalConfiguration written1 = storeServiceConfiguration(
                store, "pid1", null);
        InternalConfiguration written2 = storeServiceConfiguration(
                store, "pid2", "location");

        // Load the objects back in.
        Collection loaded = new HashSet(Arrays.asList(store.load()));
        Collection expected =
View Full Code Here


        //   Test Expectations
        // =====================================================================
        FileManager fileManager = new FileManagerImpl(bundleRootDir, 10, 10);
        ConfigurationStore store = new ConfigurationStoreImpl(fileManager);

        InternalConfiguration written1 = storeServiceConfiguration(
                store, "pid1", null);
        InternalConfiguration written2 = storeServiceConfiguration(
                store, "pid2", "location");

        // Load the objects back in.
        Collection loaded = new HashSet(Arrays.asList(store.load()));
        Collection expected =
View Full Code Here

            throws IOException {

        // Store an object.
        CaseInsensitiveDictionary properties = new CaseInsensitiveDictionary();
        properties.put("a", "1");
        InternalConfiguration configuration = store.createConfiguration(
                pid, bundleLocation);
        configuration.replaceProperties(properties);

        store.update(configuration);
        return configuration;
    }
View Full Code Here

        ConfigurationStore store = new ConfigurationStoreImpl(fileManagerMock);

        File file = new File("/0/0/a");
        fileManagerMock.expects.allocateFile().returns(file);

        InternalConfiguration configuration =
                store.createConfiguration("pid", null);

        assertEquals(file, configuration.getPersistentFile());
        assertEquals("pid", configuration.getPid());
    }
View Full Code Here

        fileManagerMock.expects.allocateFile().returns(file);
        fileManagerMock.expects.getRelativePath(file).returns("0/0/a");

        ConfigurationStore store = new ConfigurationStoreImpl(fileManagerMock);

        InternalConfiguration configuration =
                store.createFactoryConfiguration("factoryPid", null);

        assertEquals(file, configuration.getPersistentFile());
        assertEquals("factoryPid", configuration.getFactoryPid());
        assertTrue(configuration.getPid().endsWith(".0.0.a"));
    }
View Full Code Here

     *
     * @param pid The pid of the configuration to remove.
     */
    public void removeConfiguration(String pid) {
        for (int i = 0; i < configurations.size(); i++) {
            InternalConfiguration configuration =
                    (InternalConfiguration) configurations.get(i);
            if (configuration.getPid().equals(pid)) {
                configurations.remove(i);
                return;
            }
        }

View Full Code Here

     * @return The snapshots.
     */
    public ConfigurationSnapshot[] createSnapshots(ServiceReference reference) {
        Collection snapshots = new ArrayList();
        for (int i = 0; i < configurations.size(); i++) {
            InternalConfiguration configuration =
                    (InternalConfiguration) configurations.get(i);

            String configurationLocation =
                    configuration.getBundleLocation();
            if (bundleLocation.equals(configurationLocation)) {
                snapshots.add(configuration.createSnapshot());
            }
        }

        ConfigurationSnapshot[] array =
                new ConfigurationSnapshot[snapshots.size()];
View Full Code Here

            return false;
        }

        // Bind all the configurations that have not been explicitly bound.
        for (int i = 0; i < configurations.size(); i++) {
            InternalConfiguration configuration =
                    (InternalConfiguration) configurations.get(i);

            String configurationLocation =
                    configuration.getBundleLocation();
            if (configurationLocation == null) {
                // The configuration should be bound to the bundle of the
                // first service that registers.
                configuration.setSpecifiedLocation(bundleLocation);
            } else if (!bundleLocation.equals(configurationLocation)) {
                log.log(reference, LogService.LOG_WARNING,
                        "Configuration with pid '" + configuration.getPid() +
                                "' for factory '" + servicePid +
                                "' is bound to '" + configurationLocation +
                                "' instead of '" + bundleLocation +
                                "' and so will be ignored");
            }
View Full Code Here

        }

        // Unbind the configurations, which means revert to the specified
        // bundle location.
        for (int i = 0; i < configurations.size(); i++) {
            InternalConfiguration configuration =
                    (InternalConfiguration) configurations.get(i);

            configuration.unbindFromLocation();
        }

        return true;
    }
View Full Code Here

        List files = fileManager.listFiles();
        List configurations = new ArrayList();
        for (Iterator i = files.iterator(); i.hasNext();) {
            File file = (File) i.next();

            InternalConfiguration configuration =
                    createConfigurationFromFile(file);
            if (configuration != null) {
                configurations.add(configuration);
            }
        }
View Full Code Here

TOP

Related Classes of com.volantis.osgi.cm.InternalConfiguration

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.