Class JcrSession

  • All Implemented Interfaces:
    AutoCloseable, javax.jcr.Session

    public class JcrSession
    extends Object
    implements AutoCloseable, javax.jcr.Session
    A JCR session that wraps the actual opened session by adding it the auto-closeable property in order to facilitate its use.
    Author:
    mmoquillon
    • Constructor Detail

      • JcrSession

        protected JcrSession​(javax.jcr.Session actualSession)
    • Method Detail

      • getRepository

        public javax.jcr.Repository getRepository()
        Specified by:
        getRepository in interface javax.jcr.Session
      • exportSystemView

        public void exportSystemView​(String absPath,
                                     OutputStream out,
                                     boolean skipBinary,
                                     boolean noRecurse)
                              throws IOException,
                                     javax.jcr.PathNotFoundException,
                                     javax.jcr.RepositoryException
        Specified by:
        exportSystemView in interface javax.jcr.Session
        Throws:
        IOException
        javax.jcr.PathNotFoundException
        javax.jcr.RepositoryException
      • isLive

        public boolean isLive()
        Specified by:
        isLive in interface javax.jcr.Session
      • getAttributeNames

        public String[] getAttributeNames()
        Specified by:
        getAttributeNames in interface javax.jcr.Session
      • getImportContentHandler

        public ContentHandler getImportContentHandler​(String parentAbsPath,
                                                      int uuidBehavior)
                                               throws javax.jcr.PathNotFoundException,
                                                      javax.jcr.nodetype.ConstraintViolationException,
                                                      javax.jcr.version.VersionException,
                                                      javax.jcr.lock.LockException,
                                                      javax.jcr.RepositoryException
        Specified by:
        getImportContentHandler in interface javax.jcr.Session
        Throws:
        javax.jcr.PathNotFoundException
        javax.jcr.nodetype.ConstraintViolationException
        javax.jcr.version.VersionException
        javax.jcr.lock.LockException
        javax.jcr.RepositoryException
      • importXML

        public void importXML​(String parentAbsPath,
                              InputStream in,
                              int uuidBehavior)
                       throws IOException,
                              javax.jcr.PathNotFoundException,
                              javax.jcr.ItemExistsException,
                              javax.jcr.nodetype.ConstraintViolationException,
                              javax.jcr.version.VersionException,
                              javax.jcr.InvalidSerializedDataException,
                              javax.jcr.lock.LockException,
                              javax.jcr.RepositoryException
        Specified by:
        importXML in interface javax.jcr.Session
        Throws:
        IOException
        javax.jcr.PathNotFoundException
        javax.jcr.ItemExistsException
        javax.jcr.nodetype.ConstraintViolationException
        javax.jcr.version.VersionException
        javax.jcr.InvalidSerializedDataException
        javax.jcr.lock.LockException
        javax.jcr.RepositoryException
      • propertyExists

        public boolean propertyExists​(String absPath)
                               throws javax.jcr.RepositoryException
        Specified by:
        propertyExists in interface javax.jcr.Session
        Throws:
        javax.jcr.RepositoryException
      • getNodeByIdentifier

        public javax.jcr.Node getNodeByIdentifier​(String id)
                                           throws javax.jcr.ItemNotFoundException,
                                                  javax.jcr.RepositoryException
        Specified by:
        getNodeByIdentifier in interface javax.jcr.Session
        Throws:
        javax.jcr.ItemNotFoundException
        javax.jcr.RepositoryException
      • move

        public void move​(String srcAbsPath,
                         String destAbsPath)
                  throws javax.jcr.ItemExistsException,
                         javax.jcr.PathNotFoundException,
                         javax.jcr.version.VersionException,
                         javax.jcr.nodetype.ConstraintViolationException,
                         javax.jcr.lock.LockException,
                         javax.jcr.RepositoryException
        Specified by:
        move in interface javax.jcr.Session
        Throws:
        javax.jcr.ItemExistsException
        javax.jcr.PathNotFoundException
        javax.jcr.version.VersionException
        javax.jcr.nodetype.ConstraintViolationException
        javax.jcr.lock.LockException
        javax.jcr.RepositoryException
      • nodeExists

        public boolean nodeExists​(String absPath)
                           throws javax.jcr.RepositoryException
        Specified by:
        nodeExists in interface javax.jcr.Session
        Throws:
        javax.jcr.RepositoryException
      • getNamespacePrefixes

        public String[] getNamespacePrefixes()
                                      throws javax.jcr.RepositoryException
        Specified by:
        getNamespacePrefixes in interface javax.jcr.Session
        Throws:
        javax.jcr.RepositoryException
      • getNamespaceURI

        public String getNamespaceURI​(String prefix)
                               throws javax.jcr.NamespaceException,
                                      javax.jcr.RepositoryException
        Specified by:
        getNamespaceURI in interface javax.jcr.Session
        Throws:
        javax.jcr.NamespaceException
        javax.jcr.RepositoryException
      • impersonate

        public javax.jcr.Session impersonate​(javax.jcr.Credentials credentials)
                                      throws javax.jcr.LoginException,
                                             javax.jcr.RepositoryException
        Specified by:
        impersonate in interface javax.jcr.Session
        Throws:
        javax.jcr.LoginException
        javax.jcr.RepositoryException
      • getWorkspace

        public javax.jcr.Workspace getWorkspace()
        Specified by:
        getWorkspace in interface javax.jcr.Session
      • getAttribute

        public Object getAttribute​(String name)
        Specified by:
        getAttribute in interface javax.jcr.Session
      • getNodeByUUID

        public javax.jcr.Node getNodeByUUID​(String uuid)
                                     throws javax.jcr.ItemNotFoundException,
                                            javax.jcr.RepositoryException
        Specified by:
        getNodeByUUID in interface javax.jcr.Session
        Throws:
        javax.jcr.ItemNotFoundException
        javax.jcr.RepositoryException
      • save

        public void save()
                  throws javax.jcr.AccessDeniedException,
                         javax.jcr.ItemExistsException,
                         javax.jcr.ReferentialIntegrityException,
                         javax.jcr.nodetype.ConstraintViolationException,
                         javax.jcr.InvalidItemStateException,
                         javax.jcr.version.VersionException,
                         javax.jcr.lock.LockException,
                         javax.jcr.nodetype.NoSuchNodeTypeException,
                         javax.jcr.RepositoryException
        Specified by:
        save in interface javax.jcr.Session
        Throws:
        javax.jcr.AccessDeniedException
        javax.jcr.ItemExistsException
        javax.jcr.ReferentialIntegrityException
        javax.jcr.nodetype.ConstraintViolationException
        javax.jcr.InvalidItemStateException
        javax.jcr.version.VersionException
        javax.jcr.lock.LockException
        javax.jcr.nodetype.NoSuchNodeTypeException
        javax.jcr.RepositoryException
      • hasPermission

        public boolean hasPermission​(String absPath,
                                     String actions)
                              throws javax.jcr.RepositoryException
        Specified by:
        hasPermission in interface javax.jcr.Session
        Throws:
        javax.jcr.RepositoryException
      • logout

        public void logout()
        Specified by:
        logout in interface javax.jcr.Session
      • itemExists

        public boolean itemExists​(String absPath)
                           throws javax.jcr.RepositoryException
        Specified by:
        itemExists in interface javax.jcr.Session
        Throws:
        javax.jcr.RepositoryException
      • addLockToken

        public void addLockToken​(String lt)
        Specified by:
        addLockToken in interface javax.jcr.Session
      • removeLockToken

        public void removeLockToken​(String lt)
        Specified by:
        removeLockToken in interface javax.jcr.Session
      • removeItem

        public void removeItem​(String absPath)
                        throws javax.jcr.version.VersionException,
                               javax.jcr.lock.LockException,
                               javax.jcr.nodetype.ConstraintViolationException,
                               javax.jcr.AccessDeniedException,
                               javax.jcr.RepositoryException
        Specified by:
        removeItem in interface javax.jcr.Session
        Throws:
        javax.jcr.version.VersionException
        javax.jcr.lock.LockException
        javax.jcr.nodetype.ConstraintViolationException
        javax.jcr.AccessDeniedException
        javax.jcr.RepositoryException
      • getAccessControlManager

        public javax.jcr.security.AccessControlManager getAccessControlManager()
                                                                        throws javax.jcr.UnsupportedRepositoryOperationException,
                                                                               javax.jcr.RepositoryException
        Specified by:
        getAccessControlManager in interface javax.jcr.Session
        Throws:
        javax.jcr.UnsupportedRepositoryOperationException
        javax.jcr.RepositoryException
      • exportSystemView

        public void exportSystemView​(String absPath,
                                     ContentHandler contentHandler,
                                     boolean skipBinary,
                                     boolean noRecurse)
                              throws javax.jcr.PathNotFoundException,
                                     SAXException,
                                     javax.jcr.RepositoryException
        Specified by:
        exportSystemView in interface javax.jcr.Session
        Throws:
        javax.jcr.PathNotFoundException
        SAXException
        javax.jcr.RepositoryException
      • getItem

        public javax.jcr.Item getItem​(String absPath)
                               throws javax.jcr.PathNotFoundException,
                                      javax.jcr.RepositoryException
        Specified by:
        getItem in interface javax.jcr.Session
        Throws:
        javax.jcr.PathNotFoundException
        javax.jcr.RepositoryException
      • getRetentionManager

        public javax.jcr.retention.RetentionManager getRetentionManager()
                                                                 throws javax.jcr.UnsupportedRepositoryOperationException,
                                                                        javax.jcr.RepositoryException
        Specified by:
        getRetentionManager in interface javax.jcr.Session
        Throws:
        javax.jcr.UnsupportedRepositoryOperationException
        javax.jcr.RepositoryException
      • getProperty

        public javax.jcr.Property getProperty​(String absPath)
                                       throws javax.jcr.PathNotFoundException,
                                              javax.jcr.RepositoryException
        Specified by:
        getProperty in interface javax.jcr.Session
        Throws:
        javax.jcr.PathNotFoundException
        javax.jcr.RepositoryException
      • exportDocumentView

        public void exportDocumentView​(String absPath,
                                       OutputStream out,
                                       boolean skipBinary,
                                       boolean noRecurse)
                                throws IOException,
                                       javax.jcr.PathNotFoundException,
                                       javax.jcr.RepositoryException
        Specified by:
        exportDocumentView in interface javax.jcr.Session
        Throws:
        IOException
        javax.jcr.PathNotFoundException
        javax.jcr.RepositoryException
      • getNamespacePrefix

        public String getNamespacePrefix​(String uri)
                                  throws javax.jcr.NamespaceException,
                                         javax.jcr.RepositoryException
        Specified by:
        getNamespacePrefix in interface javax.jcr.Session
        Throws:
        javax.jcr.NamespaceException
        javax.jcr.RepositoryException
      • getUserID

        public String getUserID()
        Specified by:
        getUserID in interface javax.jcr.Session
      • setNamespacePrefix

        public void setNamespacePrefix​(String prefix,
                                       String uri)
                                throws javax.jcr.NamespaceException,
                                       javax.jcr.RepositoryException
        Specified by:
        setNamespacePrefix in interface javax.jcr.Session
        Throws:
        javax.jcr.NamespaceException
        javax.jcr.RepositoryException
      • getLockTokens

        public String[] getLockTokens()
        Specified by:
        getLockTokens in interface javax.jcr.Session
      • exportDocumentView

        public void exportDocumentView​(String absPath,
                                       ContentHandler contentHandler,
                                       boolean skipBinary,
                                       boolean noRecurse)
                                throws javax.jcr.PathNotFoundException,
                                       SAXException,
                                       javax.jcr.RepositoryException
        Specified by:
        exportDocumentView in interface javax.jcr.Session
        Throws:
        javax.jcr.PathNotFoundException
        SAXException
        javax.jcr.RepositoryException
      • hasPendingChanges

        public boolean hasPendingChanges()
                                  throws javax.jcr.RepositoryException
        Specified by:
        hasPendingChanges in interface javax.jcr.Session
        Throws:
        javax.jcr.RepositoryException
      • getValueFactory

        public javax.jcr.ValueFactory getValueFactory()
                                               throws javax.jcr.UnsupportedRepositoryOperationException,
                                                      javax.jcr.RepositoryException
        Specified by:
        getValueFactory in interface javax.jcr.Session
        Throws:
        javax.jcr.UnsupportedRepositoryOperationException
        javax.jcr.RepositoryException
      • getNode

        public javax.jcr.Node getNode​(String absPath)
                               throws javax.jcr.PathNotFoundException,
                                      javax.jcr.RepositoryException
        Specified by:
        getNode in interface javax.jcr.Session
        Throws:
        javax.jcr.PathNotFoundException
        javax.jcr.RepositoryException
      • refresh

        public void refresh​(boolean keepChanges)
                     throws javax.jcr.RepositoryException
        Specified by:
        refresh in interface javax.jcr.Session
        Throws:
        javax.jcr.RepositoryException
      • hasCapability

        public boolean hasCapability​(String methodName,
                                     Object target,
                                     Object[] arguments)
                              throws javax.jcr.RepositoryException
        Specified by:
        hasCapability in interface javax.jcr.Session
        Throws:
        javax.jcr.RepositoryException
      • getRootNode

        public javax.jcr.Node getRootNode()
                                   throws javax.jcr.RepositoryException
        Specified by:
        getRootNode in interface javax.jcr.Session
        Throws:
        javax.jcr.RepositoryException