Interface JcrRepository


  • public interface JcrRepository
    This interface defines the serviceinterface to the JCR repository.
    Author:
    bramk
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      javax.jcr.nodetype.NodeTemplate createNodeTemplate()
      A factory method that returns an empty NodeTemplate to be used to define a child node and then attached to a NodeTypeTemplate.
      javax.jcr.nodetype.NodeTypeTemplate createNodeTypeTemplate()
      A factory method that returns an empty NodeTypeTemplate object to be used to define a new node.
      javax.jcr.nodetype.PropertyTemplate createPropertyTemplate()
      A factory method that returns an empty PropertyTemplate to be used to define a property and then attached to a NodeTypeTemplate.
      javax.jcr.Session createSystemSession()
      Creates a system session to the content repository.
      javax.jcr.Repository getRepository()
      Returns the repository.
      String getUUID​(javax.jcr.observation.Event event)
      The Event interface does not provide a means to get the UUID of the Node which was added, removed or modified (in case of a property added/removed/modified Event type).
      void initNamespaces​(javax.jcr.Session session)
      Initializes the namespaces in the JCR (like wo and wm)
      boolean isDataStoreActive()
      Returns whether this JCR uses a DataStore for storing blobs.
      boolean isEventLocal​(javax.jcr.observation.Event event)
      Returns whether the event originated in this JVM.
      boolean isReadOnly()
      Checks whether this JCR is read-only.
      javax.jcr.nodetype.NodeTypeDefinition mergeNodetype​(javax.jcr.nodetype.NodeTypeTemplate nodeTypeTemplate)
      Merge a collection of NodeTypeDefinitions with the corresponding registered NodeTypeDefinitions.
      void preloadQueryResult​(javax.jcr.NodeIterator nodeIter)
      The result set of a query result may not be loaded from the database immediately, but only when nodes are explicitly requested.
      void registerNodetypes​(Collection<javax.jcr.nodetype.NodeTypeDefinition> definitions, boolean force)
      Registers the specified Collection of NodeTypeDefinition objects.
      javax.jcr.Node sessionCopy​(javax.jcr.Session session, String srcAbsPath, String destAbsPath)
      Copy a node inside a session This method is the same as WorkSpace.copy() except that it opperates inside a given session.
      void unregisterNodetype​(String name, boolean force)
      Unregisters the specified node type.
    • Method Detail

      • registerNodetypes

        void registerNodetypes​(Collection<javax.jcr.nodetype.NodeTypeDefinition> definitions,
                               boolean force)
                        throws javax.jcr.RepositoryException
        Registers the specified Collection of NodeTypeDefinition objects. This method is used to register a set of node types with mutual dependencies. The effect of the method is ?all or nothing?; if an error occurs, no node types are registered.
        Parameters:
        definitions - the collection of nodettype definitions to register.
        force - If this is set to false, then the repository will not do anything which may result in content loss. If this is set to true then the repository will first delete any content as necessary to implement the requested node type changes.
        Throws:
        javax.jcr.RepositoryException - when an error occurs.
      • mergeNodetype

        javax.jcr.nodetype.NodeTypeDefinition mergeNodetype​(javax.jcr.nodetype.NodeTypeTemplate nodeTypeTemplate)
                                                     throws javax.jcr.RepositoryException
        Merge a collection of NodeTypeDefinitions with the corresponding registered NodeTypeDefinitions.
        Parameters:
        definitions - the collection of nodettype definitions to merge.
        Throws:
        javax.jcr.RepositoryException - when an error occurs.
      • unregisterNodetype

        void unregisterNodetype​(String name,
                                boolean force)
                         throws javax.jcr.RepositoryException
        Unregisters the specified node type.
        Parameters:
        name - The fully qualified nodetype name.
        force - If this is set to false, then the repository will not do anything which may result in content loss. If this is set to true then the repository will first delete any content stored in nodes of this nodetype.
        Throws:
        javax.jcr.RepositoryException
      • getRepository

        javax.jcr.Repository getRepository()
        Returns the repository.
        Returns:
        The repository.
      • createNodeTypeTemplate

        javax.jcr.nodetype.NodeTypeTemplate createNodeTypeTemplate()
        A factory method that returns an empty NodeTypeTemplate object to be used to define a new node.
        Returns:
        a new NodeTypeTemplate
      • createNodeTemplate

        javax.jcr.nodetype.NodeTemplate createNodeTemplate()
        A factory method that returns an empty NodeTemplate to be used to define a child node and then attached to a NodeTypeTemplate.
        Returns:
        a new empty NodeTemplate
      • createPropertyTemplate

        javax.jcr.nodetype.PropertyTemplate createPropertyTemplate()
        A factory method that returns an empty PropertyTemplate to be used to define a property and then attached to a NodeTypeTemplate.
        Returns:
        a new PropertyTemplate
      • createSystemSession

        javax.jcr.Session createSystemSession()
                                       throws javax.jcr.RepositoryException
        Creates a system session to the content repository.
        Returns:
        A new system session for accessing the content repository.
        Throws:
        javax.jcr.RepositoryException - If the session could not be created.
      • sessionCopy

        javax.jcr.Node sessionCopy​(javax.jcr.Session session,
                                   String srcAbsPath,
                                   String destAbsPath)
                            throws javax.jcr.nodetype.ConstraintViolationException,
                                   javax.jcr.version.VersionException,
                                   javax.jcr.AccessDeniedException,
                                   javax.jcr.PathNotFoundException,
                                   javax.jcr.ItemExistsException,
                                   javax.jcr.lock.LockException,
                                   javax.jcr.RepositoryException
        Copy a node inside a session This method is the same as WorkSpace.copy() except that it opperates inside a given session.
        Throws:
        javax.jcr.nodetype.ConstraintViolationException
        javax.jcr.version.VersionException
        javax.jcr.AccessDeniedException
        javax.jcr.PathNotFoundException
        javax.jcr.ItemExistsException
        javax.jcr.lock.LockException
        javax.jcr.RepositoryException
        See Also:
        Workspace.copy(java.lang.String,java.lang.String)
      • preloadQueryResult

        void preloadQueryResult​(javax.jcr.NodeIterator nodeIter)
        The result set of a query result may not be loaded from the database immediately, but only when nodes are explicitly requested. When all nodes are needed, then this causes a lot of small database queries. This method tries to load all nodes from the database with only a single query, which might improve performance.
        Parameters:
        nodeIter - the nodeIter result which should be preloaded
      • getUUID

        String getUUID​(javax.jcr.observation.Event event)
        The Event interface does not provide a means to get the UUID of the Node which was added, removed or modified (in case of a property added/removed/modified Event type). This method tries to retrieve the UUID for the given Event.
        Parameters:
        event - the Event for which to retrieve the UUID
        Returns:
        a String representing the UUID, or null if it doesn't exist or could not be retrieved
      • isReadOnly

        boolean isReadOnly()
        Checks whether this JCR is read-only.
        Returns:
        whether this JCR is read-only
      • isDataStoreActive

        boolean isDataStoreActive()
        Returns whether this JCR uses a DataStore for storing blobs.
        Returns:
        whether this JCR uses a DataStore for storing blobs
      • isEventLocal

        boolean isEventLocal​(javax.jcr.observation.Event event)
        Returns whether the event originated in this JVM.
        Parameters:
        event - Event to test.
        Returns:
        True if this event was caused by an action done on this JVM.
      • initNamespaces

        void initNamespaces​(javax.jcr.Session session)
                     throws javax.jcr.RepositoryException
        Initializes the namespaces in the JCR (like wo and wm)
        Parameters:
        session - The session needed for JCR access
        Throws:
        javax.jcr.RepositoryException - In case namespace registration failed