org.apache.jetspeed.prefs
Interface PreferencesProvider


public interface PreferencesProvider

Utility component used to pass the PersistenceStoreContainer and store name to the Preferences SPI implementation.

Author:
David Le Strat

Method Summary
 Node createNode(Node parent, String nodeName, int nodeType, String fullPath)
          Create a preferences node given the following parameters.
 Property createProperty(Node node, String name, Object value)
          Create a property on the given node.
 Collection getChildren(Node parentNode)
          Given a parent node, return a flat collection of immediate children of this node
 Node getNode(String fullPath, int nodeType)
          Given the fullpath to a node, retrieve the node associated with the node path
 void init()
          Initializes the preferences node
 Collection lookupPreference(String nodeName, String propertyName, String propertyValue)
          Lookup a preference node given the preference name, a property name and value.
 boolean nodeExists(String fullPath, int nodeType)
          Check for the existence of a node given the full path to the node
 void removeNode(Node parentNode, Node node)
          Removes a node from a given parent node, also removing the node from the preferences persistence store.
 void storeNode(Node node)
          Stores a preference node to the backing preferences persistent storage.
 

Method Detail

getNode

Node getNode(String fullPath,
             int nodeType)
             throws NodeDoesNotExistException
Given the fullpath to a node, retrieve the node associated with the node path

Parameters:
fullPath - the full path to the node such as "/portlet_entity/dp-1/guest/preferences/mypref"
nodeType - either System or User node type. A value of 0 is User, a value of 1 is System
Returns:
The Preference Node found when found
Throws:
NodeDoesNotExistException - when a node is not found, an exception is thrown

nodeExists

boolean nodeExists(String fullPath,
                   int nodeType)
Check for the existence of a node given the full path to the node

Parameters:
fullPath - the full path to the node such as "/portlet_entity/dp-1/guest/preferences/mypref"
nodeType - either System or User node type. A value of 0 is User, a value of 1 is System
Returns:
true if the node exists, false if it does not exist

createNode

Node createNode(Node parent,
                String nodeName,
                int nodeType,
                String fullPath)
                throws FailedToCreateNodeException,
                       NodeAlreadyExistsException
Create a preferences node given the following parameters. Will throw an exception if the node already exists.

Parameters:
parent - the existing parent node of this node to be created
nodeName - the name of the node, which should be the same value as the last value of the full path for example when the full path is "/portlet_entity/dp-1", the nodeName will be "dp-1"
nodeType - either System or User node type. A value of 0 is User, a value of 1 is System
fullPath - the full path to the node such as "/portlet_entity/dp-1/guest/preferences/mypref"
Returns:
the newly created node on success
Throws:
FailedToCreateNodeException - thrown when the node fails to create
NodeAlreadyExistsException - thrown when a node already exists at the given full path

createProperty

Property createProperty(Node node,
                        String name,
                        Object value)
Create a property on the given node.

Parameters:
node - the node to have a property added to it
name - the name of the property to add to the node
value - the value of the property to add to the node
Returns:
the newly created property
Since:
2.1.2

getChildren

Collection getChildren(Node parentNode)
Given a parent node, return a flat collection of immediate children of this node

Parameters:
parentNode - the parent node to be searched for children
Returns:
a Java collection of immediate children of this node

storeNode

void storeNode(Node node)
Stores a preference node to the backing preferences persistent storage. If the node does not exist, it is created. If it does exist, the node is updated.

Parameters:
node - the node to be stored.

removeNode

void removeNode(Node parentNode,
                Node node)
Removes a node from a given parent node, also removing the node from the preferences persistence store.

Parameters:
parentNode - the parent of the node to be deleted
node - the node to be deleted

lookupPreference

Collection lookupPreference(String nodeName,
                            String propertyName,
                            String propertyValue)
Lookup a preference node given the preference name, a property name and value. Options can be set to null if you dont want them included in the query.

Parameters:
nodeName - the name of the node to lookup, such as 'userinfo'
propertyName - the name of the property, such as 'user.email'
propertyValue - the value of the property, such as 'taylor@apache.org'
Returns:
a collection of found matching elements of type Node

init

void init()
          throws Exception
Initializes the preferences node

Throws:
Exception


Copyright © 1999-2007 Apache Software Foundation. All Rights Reserved.