Package org.osgi.service.prefs

Examples of org.osgi.service.prefs.Preferences.node()


            m_log.log(LogService.LOG_WARNING, "Could not store all preferences for " + workingNode.absolutePath());
            e.printStackTrace();
        }
       
        for (Map.Entry<RepositoryObject, WorkingState> entry : m_workingState.entrySet()) {
            workingNode.node(entry.getKey().getDefinition()).put(PREFS_LOCAL_WORKING_STATE_VALUE, entry.getValue().toString());
        }

        m_prefs.putLong(PREFS_LOCAL_FILE_VERSION, m_repository.getMostRecentVersion());
    }
View Full Code Here


        // First, get all nodes and their workingstate.
        try {
            String defaultWorkingState = WorkingState.Unchanged.toString();

            for (String node : workingNode.childrenNames()) {
                String state = workingNode.node(node).get(PREFS_LOCAL_WORKING_STATE_VALUE, defaultWorkingState);
                entries.put(node, WorkingState.valueOf(state));
            }
        }
        catch (BackingStoreException e) {
            // Something went wrong reading from the store, just work with whatever we have in the map.
View Full Code Here

    private void deleteRepositoryPrefs(String pid) {
        try {
            Preferences prefs = m_prefsService.getSystemPreferences();

            prefs.node(pid).removeNode();
            prefs.sync();
        }
        catch (BackingStoreException e) {
            // Not much we can do
        }
View Full Code Here

    }
   
    protected void saveState() {
        try {
            Preferences prefs = preferences.getUserPreferences("FeaturesServiceState");
            saveSet(prefs.node("repositories"), repositories.keySet());
            saveMap(prefs.node("features"), installed);
            prefs.flush();
        } catch (Exception e) {
            LOGGER.error("Error persisting FeaturesService state", e);
        }
View Full Code Here

   
    protected void saveState() {
        try {
            Preferences prefs = preferences.getUserPreferences("FeaturesServiceState");
            saveSet(prefs.node("repositories"), repositories.keySet());
            saveMap(prefs.node("features"), installed);
            prefs.flush();
        } catch (Exception e) {
            LOGGER.error("Error persisting FeaturesService state", e);
        }
    }
View Full Code Here

    protected boolean loadState() {
        try {
            Preferences prefs = preferences.getUserPreferences("FeaturesServiceState");
            if (prefs.nodeExists("repositories")) {
                Set<URI> repositories = loadSet(prefs.node("repositories"));
                for (URI repo : repositories) {
                    internalAddRepository(repo);
                }
                installed = loadMap(prefs.node("features"));
                return true;
View Full Code Here

            if (prefs.nodeExists("repositories")) {
                Set<URI> repositories = loadSet(prefs.node("repositories"));
                for (URI repo : repositories) {
                    internalAddRepository(repo);
                }
                installed = loadMap(prefs.node("features"));
                return true;
            }
        } catch (Exception e) {
            LOGGER.error("Error loading FeaturesService state", e);
        }
View Full Code Here

    private Preferences getRepositoryPrefs(Preferences userPrefs, URL location, String customer, String name) {
        // Note: we can only use the getAuthority part of the URL for indexing, because the full URL will contain
        // in the protocol part.
        Preferences repoPref = userPrefs.node(location.getAuthority() + location.getPath());
        Preferences customerPref = repoPref.node(customer);
        return customerPref.node(name);
    }

    /**
     * Helper method for login.
     * @throws IOException
View Full Code Here

            // cannot store the properties.
            m_log.log(LogService.LOG_WARNING, "Could not store all preferences for " + workingNode.absolutePath());
            e.printStackTrace();
        }
        for (Map.Entry<RepositoryObject, WorkingState> entry : m_workingState.entrySet()) {
            workingNode.node(entry.getKey().getDefinition()).put(PREFS_LOCAL_WORKING_STATE_VALUE, entry.getValue().toString());
        }

        m_prefs.putLong(PREFS_LOCAL_FILE_VERSION, m_repository.getMostRecentVersion());
    }
View Full Code Here

        Preferences workingNode = m_prefs.node(PREFS_LOCAL_WORKING_STATE);
        Map<String, WorkingState> entries = new HashMap<String, WorkingState>();
        // First, get all nodes and their workingstate.
        try {
            for (String node : workingNode.childrenNames()) {
                String state = workingNode.node(node).get(PREFS_LOCAL_WORKING_STATE_VALUE, WorkingState.Unchanged.toString());
                entries.put(node, WorkingState.valueOf(state));
            }
        }
        catch (BackingStoreException e) {
            // Something went wrong reading from the store, just work with whatever we have in the map.
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.