org.apache.jetspeed.prefs.impl
Class PersistenceBrokerPreferencesProvider

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.ojb.support.PersistenceBrokerDaoSupport
          extended by org.apache.jetspeed.components.dao.InitablePersistenceBrokerDaoSupport
              extended by org.apache.jetspeed.prefs.impl.PersistenceBrokerPreferencesProvider
All Implemented Interfaces:
PreferencesProvider, org.springframework.beans.factory.InitializingBean

public class PersistenceBrokerPreferencesProvider
extends InitablePersistenceBrokerDaoSupport
implements PreferencesProvider

PersistenceBrokerPreferencesProvider

Version:
$Id: PersistenceBrokerPreferencesProvider.java 605797 2007-12-20 03:39:09Z woonsan $
Author:
Scott T. Weaver

Field Summary
 
Fields inherited from class org.apache.jetspeed.components.dao.InitablePersistenceBrokerDaoSupport
repositoryPath
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
PersistenceBrokerPreferencesProvider(java.lang.String repositoryPath)
           
PersistenceBrokerPreferencesProvider(java.lang.String repositoryPath, JetspeedCache preferenceCache)
           
PersistenceBrokerPreferencesProvider(java.lang.String repositoryPath, JetspeedCache preferenceCache, java.util.List apps, boolean preloadEntities)
           
 
Method Summary
protected  void addToCache(org.apache.jetspeed.prefs.impl.PersistenceBrokerPreferencesProvider.NodeCache content)
           
 Node createNode(Node parent, java.lang.String nodeName, int nodeType, java.lang.String fullPath)
          Create a preferences node given the following parameters.
 Property createProperty(Node node, java.lang.String name, java.lang.Object value)
          Create a property on the given node.
 java.util.Collection getChildren(Node parentNode)
          Given a parent node, return a flat collection of immediate children of this node
 Node getNode(java.lang.String fullPath, int nodeType)
          Given the fullpath to a node, retrieve the node associated with the node path
 void init()
           init
protected  int loadNodeAndAllChildren(java.lang.String path)
           
 java.util.Collection lookupPreference(java.lang.String nodeName, java.lang.String propertyName, java.lang.String propertyValue)
          Lookup a preference node given the preference name, a property name and value.
 boolean nodeExists(java.lang.String fullPath, int nodeType)
          Check for the existence of a node given the full path to the node
 void preloadAllEntities()
           
 void preloadApplicationPreferences(java.lang.String portletApplicationName)
           
 void redoNode(NodeImplProxy proxy, java.lang.String fullPath, int nodeType)
           
 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.
 
Methods inherited from class org.springframework.orm.ojb.support.PersistenceBrokerDaoSupport
checkDaoConfig, closePersistenceBrokerIfNecessary, convertOjbAccessException, createPersistenceBrokerTemplate, getJcdAlias, getPersistenceBroker, getPersistenceBrokerTemplate, releasePersistenceBroker, setJcdAlias, setPersistenceBrokerTemplate
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistenceBrokerPreferencesProvider

public PersistenceBrokerPreferencesProvider(java.lang.String repositoryPath)
                                     throws java.lang.ClassNotFoundException
Parameters:
repositoryPath - Location of repository mapping file. Must be available within the classpath.
Throws:
java.lang.ClassNotFoundException - if the prefsFactoryImpl argument does not reperesent a Class that exists in the current classPath.

PersistenceBrokerPreferencesProvider

public PersistenceBrokerPreferencesProvider(java.lang.String repositoryPath,
                                            JetspeedCache preferenceCache)
                                     throws java.lang.ClassNotFoundException
Parameters:
repository - Location of repository mapping file. Must be available within the classpath.
prefsFactoryImpl - java.util.prefs.PreferencesFactory implementation to use.
enablePropertyManager - Whether or not we chould be suing the property manager.
Throws:
java.lang.ClassNotFoundException - if the prefsFactoryImpl argument does not reperesent a Class that exists in the current classPath.

PersistenceBrokerPreferencesProvider

public PersistenceBrokerPreferencesProvider(java.lang.String repositoryPath,
                                            JetspeedCache preferenceCache,
                                            java.util.List apps,
                                            boolean preloadEntities)
                                     throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException
Method Detail

addToCache

protected void addToCache(org.apache.jetspeed.prefs.impl.PersistenceBrokerPreferencesProvider.NodeCache content)

getNode

public Node getNode(java.lang.String fullPath,
                    int nodeType)
             throws NodeDoesNotExistException
Description copied from interface: PreferencesProvider
Given the fullpath to a node, retrieve the node associated with the node path

Specified by:
getNode in interface PreferencesProvider
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

redoNode

public void redoNode(NodeImplProxy proxy,
                     java.lang.String fullPath,
                     int nodeType)
              throws NodeDoesNotExistException
Throws:
NodeDoesNotExistException
See Also:
PreferencesProvider.getNode(java.lang.String, int)

nodeExists

public boolean nodeExists(java.lang.String fullPath,
                          int nodeType)
Description copied from interface: PreferencesProvider
Check for the existence of a node given the full path to the node

Specified by:
nodeExists in interface PreferencesProvider
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
See Also:
PreferencesProvider.nodeExists(java.lang.String, int)

createNode

public Node createNode(Node parent,
                       java.lang.String nodeName,
                       int nodeType,
                       java.lang.String fullPath)
                throws FailedToCreateNodeException,
                       NodeAlreadyExistsException
Description copied from interface: PreferencesProvider
Create a preferences node given the following parameters. Will throw an exception if the node already exists.

Specified by:
createNode in interface PreferencesProvider
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
See Also:
PreferencesProvider.createNode(org.apache.jetspeed.prefs.om.Node, java.lang.String, int, java.lang.String)

getChildren

public java.util.Collection getChildren(Node parentNode)
Description copied from interface: PreferencesProvider
Given a parent node, return a flat collection of immediate children of this node

Specified by:
getChildren in interface PreferencesProvider
Parameters:
parentNode - the parent node to be searched for children
Returns:
a Java collection of immediate children of this node
See Also:
PreferencesProvider.getChildren(org.apache.jetspeed.prefs.om.Node)

storeNode

public void storeNode(Node node)
Description copied from interface: PreferencesProvider
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.

Specified by:
storeNode in interface PreferencesProvider
Parameters:
node - the node to be stored.
See Also:
PreferencesProvider.storeNode(org.apache.jetspeed.prefs.om.Node)

removeNode

public void removeNode(Node parentNode,
                       Node node)
Description copied from interface: PreferencesProvider
Removes a node from a given parent node, also removing the node from the preferences persistence store.

Specified by:
removeNode in interface PreferencesProvider
Parameters:
parentNode - the parent of the node to be deleted
node - the node to be deleted
See Also:
PreferencesProvider.removeNode(org.apache.jetspeed.prefs.om.Node, org.apache.jetspeed.prefs.om.Node)

lookupPreference

public java.util.Collection lookupPreference(java.lang.String nodeName,
                                             java.lang.String propertyName,
                                             java.lang.String propertyValue)
Description copied from interface: PreferencesProvider
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.

Specified by:
lookupPreference in interface PreferencesProvider
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
See Also:
PreferencesProvider.lookupPreference(java.lang.String, java.lang.String, java.lang.String)

createProperty

public Property createProperty(Node node,
                               java.lang.String name,
                               java.lang.Object value)
Description copied from interface: PreferencesProvider
Create a property on the given node.

Specified by:
createProperty in interface PreferencesProvider
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

init

public void init()
          throws java.lang.Exception
Description copied from class: InitablePersistenceBrokerDaoSupport

init

Loads the correct repository descriptor for InitablePersistenceBrokerDaoSupport

Specified by:
init in interface PreferencesProvider
Overrides:
init in class InitablePersistenceBrokerDaoSupport
Throws:
java.lang.Exception
See Also:
PersistenceBrokerDaoSupport

preloadApplicationPreferences

public void preloadApplicationPreferences(java.lang.String portletApplicationName)
                                   throws NodeDoesNotExistException
Throws:
NodeDoesNotExistException

loadNodeAndAllChildren

protected int loadNodeAndAllChildren(java.lang.String path)

preloadAllEntities

public void preloadAllEntities()
                        throws NodeDoesNotExistException
Throws:
NodeDoesNotExistException


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