Package org.apache.felix.prefs

Examples of org.apache.felix.prefs.PreferencesDescription


     * Get the node path for the preferences tree.
     * @param desc
     * @return
     */
    protected String getNodePath(PreferencesImpl prefs) {
        final PreferencesDescription desc = prefs.getDescription();
        final StringBuilder buffer = new StringBuilder(this.rootNodePath);
        buffer.append('/');
        buffer.append(desc.getBundleId());
        buffer.append('/');
        if ( desc.getIdentifier() != null ) {
            buffer.append("users");
            buffer.append('/');
            buffer.append(desc.getIdentifier());
        } else {
            buffer.append("system");
        }
        buffer.append('/');
        buffer.append("preferences");
View Full Code Here


    public PreferencesImpl[] loadAll(BackingStoreManager manager, Long bundleId) throws BackingStoreException {
        final Session session = this.checkInitialized();
        try {
            final List<PreferencesImpl> list = new ArrayList<PreferencesImpl>();
            // check for system preferences
            final PreferencesDescription systemDesc = new PreferencesDescription(bundleId, null);
            final String systemPath = this.getNodePath(systemDesc);
            if ( session.itemExists(systemPath) ) {
                final Node rootNode = (Node)session.getItem(systemPath);
                final PreferencesImpl root = new PreferencesImpl(systemDesc, manager);
                this.readTree(root, session, rootNode);
            }
            // user preferences
            final String userPath = this.rootNodePath + '/' + bundleId + '/' + "users";
            if ( session.itemExists(userPath) ) {
                final NodeIterator iterator = ((Node)session.getItem(userPath)).getNodes();
                while ( iterator.hasNext() ) {
                    final Node current = iterator.nextNode();
                    final PreferencesDescription desc = new PreferencesDescription(bundleId, current.getName());
                    final PreferencesImpl root = new PreferencesImpl(desc, manager);

                    this.readTree(root, session, current);

                    list.add(root);
View Full Code Here

    /**
     * @see org.osgi.service.prefs.PreferencesService#getSystemPreferences()
     */
    public synchronized Preferences getSystemPreferences() {
        if ( this.systemTree == null ) {
            this.systemTree = new PreferencesImpl(new PreferencesDescription(this.bundleId, null), this.storeManager);
        }
        // sync with latest version from store
        try {
            this.systemTree.sync();
        } catch (BackingStoreException ignore) {
View Full Code Here

     */
    public synchronized Preferences getUserPreferences(String name) {
        PreferencesImpl result = (PreferencesImpl) this.trees.get(name);
        // if the tree does not exist yet, create it
        if (result == null || !result.isValid()) {
            result = new PreferencesImpl(new PreferencesDescription(this.bundleId, name), this.storeManager);
            this.trees.put(name, result);
        }
        // sync with latest version from store
        try {
            result.sync();
View Full Code Here

TOP

Related Classes of org.apache.felix.prefs.PreferencesDescription

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.