org.springframework.extensions.jcr
Interface JcrOperations

All Superinterfaces:
JcrModel1Operations, JcrModel2Operations, JcrOptionalOperations
All Known Implementing Classes:
JcrTemplate

public interface JcrOperations
extends JcrOptionalOperations

Interface that specifies a basic set of JCR operations. Not often used, but a useful option to enhance testability, as it can easily be mocked or stubbed.

Provides JcrTemplate's data access methods that mirror various Session methods. See the JCR Session javadocs for details on those methods.

Author:
Costin Leau, Sergio Bossa, Salvatore Incandela

Method Summary
 java.lang.String dump(javax.jcr.Node node)
          Dump the contents of the given node in a String.
 java.lang.Object execute(JcrCallback callback)
          Execute the action specified by the given action object within a Session.
 java.lang.Object execute(JcrCallback action, boolean exposeNativeSession)
          Execute the action specified by the given action object within a Session.
 void rename(javax.jcr.Node node, java.lang.String newName)
          Renames a node (with the given name)
 
Methods inherited from interface org.springframework.extensions.jcr.JcrOptionalOperations
addLockToken, getLockTokens, removeLockToken
 
Methods inherited from interface org.springframework.extensions.jcr.JcrModel2Operations
hasPendingChanges, importXML, move, refresh, save, setNamespacePrefix
 
Methods inherited from interface org.springframework.extensions.jcr.JcrModel1Operations
getAttribute, getAttributeNames, getImportContentHandler, getItem, getNamespacePrefix, getNamespacePrefixes, getNamespaceURI, getNodeByUUID, getRootNode, getUserID, getValueFactory, isLive, itemExists, query, query, query, query, query
 

Method Detail

execute

java.lang.Object execute(JcrCallback action,
                         boolean exposeNativeSession)
                         throws org.springframework.dao.DataAccessException
Execute the action specified by the given action object within a Session.

Parameters:
action - callback object that specifies the Jcr action
exposeNativeSession - whether to expose the native Jcr Session to callback code
Returns:
a result object returned by the action, or null
Throws:
org.springframework.dao.DataAccessException - in case of Jcr errors

execute

java.lang.Object execute(JcrCallback callback)
                         throws org.springframework.dao.DataAccessException
Execute the action specified by the given action object within a Session. Application exceptions thrown by the action object get propagated to the caller (can only be unchecked). JCR exceptions are transformed into appropriate DAO ones. Allows for returning a result object, i.e. a domain object or a collection of domain objects. Note: Callback code does not need to explicitly log out of the Session; this method will handle that itself. The workspace logged into will be that named by the workspaceName property; if that property is null, the repository's default workspace will be used.

Parameters:
callback - the JCRCallback that executes the client operation
Throws:
org.springframework.dao.DataAccessException

dump

java.lang.String dump(javax.jcr.Node node)
Dump the contents of the given node in a String. This method parses the whole tree under the node and can generate a huge String.

Parameters:
node - node to be dumped (null is equivalent to the root node)
Returns:
node tree in a string representation.

rename

void rename(javax.jcr.Node node,
            java.lang.String newName)
Renames a node (with the given name)

Parameters:
node - node to rename
newName - new name for the node


Copyright © 2009. All Rights Reserved.