Package org.hippoecm.repository.api
Interface HippoSession
-
- All Superinterfaces:
javax.jcr.Session
public interface HippoSession extends javax.jcr.Session
An extension of a plainSession
based session. Any JCR Session obtained from the Hippo Repository also implements HippoSession allowing access to the extensions to the JCR API.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description javax.jcr.Node
copy(javax.jcr.Node srcNode, String destAbsNodePath)
Deprecated.UseJcrUtils.copy(javax.jcr.Session, String, String)
insteadjavax.jcr.Session
createSecurityDelegate(javax.jcr.Session session, DomainRuleExtension... domainExtensions)
Create a new Session that contains the union of access control rules of this Session and the provided session, with the optional addition of custom domain rules.void
disableVirtualLayers()
Disable virtual layers.void
exportDereferencedView(String absPath, OutputStream out, boolean binaryAsLink, boolean noRecurse)
Export a dereferenced view of a node.void
exportDereferencedView(String absPath, ContentHandler contentHandler, boolean binaryAsLink, boolean noRecurse)
Export a dereferenced view of a node.File
exportEnhancedSystemViewPackage(String parentAbsPath, boolean recurse)
ClassLoader
getSessionClassLoader()
This call is not (yet) part of the API, but under evaluation. Probably it will change into getSessionClassLoader(Node) or similar.SessionUser
getUser()
Get theUser
object identified by this session's user id.HippoWorkspace
getWorkspace()
Convenient return type override for getting the HippoWorkspace without needing to typecastXAResource
getXAResource()
Retrieves anXAResource
object that the transaction manager will use to manage this XASession object's participation in a distributed transaction.ImportResult
importEnhancedSystemViewXML(String parentAbsPath, InputStream in, int uuidBehavior, int referenceBehavior, ContentResourceLoader referredResourceLoader)
Import an enhanced system view xml file.boolean
isSystemSession()
If this is a JCR System Session, having all privileges everywhere.boolean
isUserInRole(String userRoleName)
Check if a user has the specified userRole assigned, or is implied by one of the userRoles assigned.void
localRefresh()
This method discards all pending changes currently recorded in thisSession
, including the built-up virtual node states.javax.jcr.NodeIterator
pendingChanges()
Largely a conveniance method forpendingChanges(Session.getRootNode(), "nt:base", false)
however will also return the root node if modified.javax.jcr.NodeIterator
pendingChanges(javax.jcr.Node node, String nodeType)
Conveniance method forpendingChanges(node,nodeType,false)
javax.jcr.NodeIterator
pendingChanges(javax.jcr.Node node, String nodeType, boolean prune)
Obtains an iterator over the set of nodes that potentially contain changes, starting (and not including) the indicated node.-
Methods inherited from interface javax.jcr.Session
addLockToken, checkPermission, exportDocumentView, exportDocumentView, exportSystemView, exportSystemView, getAccessControlManager, getAttribute, getAttributeNames, getImportContentHandler, getItem, getLockTokens, getNamespacePrefix, getNamespacePrefixes, getNamespaceURI, getNode, getNodeByIdentifier, getNodeByUUID, getProperty, getRepository, getRetentionManager, getRootNode, getUserID, getValueFactory, hasCapability, hasPendingChanges, hasPermission, impersonate, importXML, isLive, itemExists, logout, move, nodeExists, propertyExists, refresh, removeItem, removeLockToken, save, setNamespacePrefix
-
-
-
-
Method Detail
-
copy
javax.jcr.Node copy(javax.jcr.Node srcNode, String destAbsNodePath) throws javax.jcr.RepositoryException
Deprecated.UseJcrUtils.copy(javax.jcr.Session, String, String)
insteadConvenience function to copy a node to a destination path in the same workspace. Unlike the copy method in the javax.jcr.Workspace class, this copy method does not immediately persist (i.e. requires a save operation on the session, or ancestor node of the destination path) and it does return the produced copy. The latter makes this the preferred method to copy a node as the method on the Workspace makes it impossible to know for sure which node is produced in case of same-name siblings. It also provides a save method for copying node types that are extensions of the Hippo repository.- Parameters:
srcNode
- the node to copydestAbsNodePath
- the absolute path of the to be created target node which will be a copy of srcNode- Returns:
- the resulting copy
- Throws:
javax.jcr.RepositoryException
- a generic error while accessing the repository
-
pendingChanges
javax.jcr.NodeIterator pendingChanges(javax.jcr.Node node, String nodeType, boolean prune) throws javax.jcr.NamespaceException, javax.jcr.nodetype.NoSuchNodeTypeException, javax.jcr.RepositoryException
Obtains an iterator over the set of nodes that potentially contain changes, starting (and not including) the indicated node. Only nodes for whichNode.isNodeType(nodeType)
returns true are included in the resulting set. If the prune boolean value is true, then the nodes matching in the hierarchy first are returned. If matching modified node exists beneath the nodes, these are not included.- Parameters:
node
- The starting node for which to look for changes, will not be included in result, may be null to indicate to search whole treenodeType
- Only nodes that are (derived) of this nodeType are included in the result, may be null to indicate no filtering on nodeTypeprune
- Wheter only to return the first matching modified node in a subtree (true), or provide a depth search for all modified nodes (false)- Returns:
- A NodeIterator instance which iterates over all modified nodes, not including the passed node
- Throws:
javax.jcr.NamespaceException
- an invalid nodeType was passedjavax.jcr.RepositoryException
- a generic error while accessing the repositoryjavax.jcr.nodetype.NoSuchNodeTypeException
- an invalid nodeType was passed
-
pendingChanges
javax.jcr.NodeIterator pendingChanges(javax.jcr.Node node, String nodeType) throws javax.jcr.NamespaceException, javax.jcr.nodetype.NoSuchNodeTypeException, javax.jcr.RepositoryException
Conveniance method forpendingChanges(node,nodeType,false)
- Parameters:
node
- The starting node for which to look for changes, will not be included in result, may be null to indicate to search whole treenodeType
- Only nodes that are (derived) of this nodeType are included in the result, may be null to indicate no filtering on nodeType- Returns:
- A NodeIterator instance which iterates over all modified nodes, not including the passed node
- Throws:
javax.jcr.NamespaceException
- an invalid nodeType was passedjavax.jcr.RepositoryException
- a generic error while accessing the repositoryjavax.jcr.nodetype.NoSuchNodeTypeException
- an invalid nodeType was passed- See Also:
pendingChanges(Node,String,boolean)
-
pendingChanges
javax.jcr.NodeIterator pendingChanges() throws javax.jcr.RepositoryException
Largely a conveniance method forpendingChanges(Session.getRootNode(), "nt:base", false)
however will also return the root node if modified.- Returns:
- A NodeIterator instance which iterates over all modified nodes, including the root
- Throws:
javax.jcr.RepositoryException
- See Also:
pendingChanges(Node,String,boolean)
-
exportDereferencedView
void exportDereferencedView(String absPath, OutputStream out, boolean binaryAsLink, boolean noRecurse) throws IOException, javax.jcr.PathNotFoundException, javax.jcr.RepositoryException
Export a dereferenced view of a node.- Parameters:
absPath
- the absolute path to the subtree to be exportedout
- the output stream to which the resulting XML should be outputtedbinaryAsLink
- whether to include binariesnoRecurse
- whether to output just a single node or the whole subtree- Throws:
IOException
- in case of an error writing to the output streamjavax.jcr.RepositoryException
- a generic error while accessing the repositoryjavax.jcr.PathNotFoundException
- in case the absPath parameter does not point to a valid node- See Also:
Session.exportSystemView(String,OutputStream,boolean,boolean)
-
exportDereferencedView
void exportDereferencedView(String absPath, ContentHandler contentHandler, boolean binaryAsLink, boolean noRecurse) throws javax.jcr.PathNotFoundException, SAXException, javax.jcr.RepositoryException
Export a dereferenced view of a node.- Parameters:
absPath
- the absolute path to the subtree to be exportedcontentHandler
- Theorg.xml.sax.ContentHandler
to which the SAX events representing the XML serialization of the subgraph will be output.binaryAsLink
- whether to include binariesnoRecurse
- whether to output just a single node or the whole subtree- Throws:
javax.jcr.RepositoryException
- a generic error while accessing the repositoryjavax.jcr.PathNotFoundException
- in case the absPath parameter does not point to a valid nodeSAXException
- See Also:
Session.exportSystemView(String,OutputStream,boolean,boolean)
-
importEnhancedSystemViewXML
ImportResult importEnhancedSystemViewXML(String parentAbsPath, InputStream in, int uuidBehavior, int referenceBehavior, ContentResourceLoader referredResourceLoader) throws IOException, javax.jcr.RepositoryException
Import an enhanced system view xml file.- Parameters:
parentAbsPath
- the parent node below which to inin
- the input stream from which to read the XMLuuidBehavior
- how to handle deserialized UUIDs in the input streamImportUUIDBehavior
referenceBehavior
- an options flag containing one of the values ofImportReferenceBehavior
indicating how to handle referencesreferredResourceLoader
- the content resouce loader to load the referred imported content resources- Throws:
IOException
- if incoming stream is not a valid XML document.javax.jcr.RepositoryException
- a generic error while accessing the repository- See Also:
exportDereferencedView(String,OutputStream,boolean,boolean)
,Session.importXML(java.lang.String, java.io.InputStream, int)
,ImportReferenceBehavior
-
exportEnhancedSystemViewPackage
File exportEnhancedSystemViewPackage(String parentAbsPath, boolean recurse) throws IOException, javax.jcr.RepositoryException
- Throws:
IOException
javax.jcr.RepositoryException
-
getXAResource
XAResource getXAResource()
Retrieves anXAResource
object that the transaction manager will use to manage this XASession object's participation in a distributed transaction.- Returns:
- the
XAResource
object.
-
getSessionClassLoader
ClassLoader getSessionClassLoader() throws javax.jcr.RepositoryException
This call is not (yet) part of the API, but under evaluation. Probably it will change into getSessionClassLoader(Node) or similar. Get a classloader which uses the JCR repository to load the classes from.- Returns:
- a classloader instance that will load class definitions stored in the JCR repository
- Throws:
javax.jcr.RepositoryException
- a generic error while accessing the repository
-
isSystemSession
boolean isSystemSession()
If this is a JCR System Session, having all privileges everywhere.For a JCR System Session
isUserInRole(String)
andSession.hasPermission(String, String)
will always return true!This should NOT be confused with
User.isSystemUser()
which indicates a required and non-human type of user necessary for the running system itself.A JCR System Session also does NOT have a
User
representation and callinggetUser()
for a JCR Session Session will result in aItemNotFoundException
!- Returns:
- true if this a JCR System Session, having all privileges everywhere.
-
getUser
SessionUser getUser() throws javax.jcr.ItemNotFoundException
Get theUser
object identified by this session's user id.- Returns:
- the
User
object identified by this session's user id. - Throws:
javax.jcr.ItemNotFoundException
- when {isSystemSession()
} returns true
-
isUserInRole
boolean isUserInRole(String userRoleName)
Check if a user has the specified userRole assigned, or is implied by one of the userRoles assigned.For a
isSystemSession()
this always returns true.- Parameters:
userRoleName
- the user role name to check- Returns:
- true if the user has the specified directly or indirectly assigned
-
createSecurityDelegate
javax.jcr.Session createSecurityDelegate(javax.jcr.Session session, DomainRuleExtension... domainExtensions) throws javax.jcr.RepositoryException
Create a new Session that contains the union of access control rules of this Session and the provided session, with the optional addition of custom domain rules. Those rules will be added to existing domain rules, imposing additional restrictions on the session.- Throws:
javax.jcr.RepositoryException
-
localRefresh
void localRefresh()
This method discards all pending changes currently recorded in thisSession
, including the built-up virtual node states. The difference withSession.refresh(boolean)
is that after this method returns, the state of the items is not guaranteed to reflect the current persistent storage because in a clustered environment, the cluster node is not synced as a result of this call.
-
disableVirtualLayers
void disableVirtualLayers()
Disable virtual layers.
-
getWorkspace
HippoWorkspace getWorkspace()
Convenient return type override for getting the HippoWorkspace without needing to typecast- Specified by:
getWorkspace
in interfacejavax.jcr.Session
- Returns:
- HippoWorkspace
-
-