org.priha.core
Class WorkspaceImpl

java.lang.Object
  extended by org.priha.core.WorkspaceImpl
All Implemented Interfaces:
javax.jcr.Workspace

public class WorkspaceImpl
extends java.lang.Object
implements javax.jcr.Workspace

Implements a JCR Workspace. This class mostly functions as a facade for ProviderManager, which takes care of the actual repository management.


Constructor Summary
WorkspaceImpl(SessionImpl session, java.lang.String name, ProviderManager mgr)
          Create a new Workspace instance.
 
Method Summary
 void clone(java.lang.String srcWorkspace, java.lang.String srcAbsPath, java.lang.String destAbsPath, boolean removeExisting)
          
protected  void copy(SessionImpl srcSession, java.lang.String srcAbsPath, java.lang.String destAbsPath, boolean preserveUUIDs)
          Performs the actual copy, but does not save.
 void copy(java.lang.String srcAbsPath, java.lang.String destAbsPath)
          
 void copy(java.lang.String srcWorkspace, java.lang.String srcAbsPath, java.lang.String destAbsPath)
          
 PropertyImpl createPropertyImpl(Path path)
          Creates a new property implementation without a property definition.
 java.lang.String[] getAccessibleWorkspaceNames()
          
 org.xml.sax.ContentHandler getImportContentHandler(java.lang.String parentAbsPath, int uuidBehavior)
          
 java.lang.String getName()
          
 NamespaceRegistryImpl getNamespaceRegistry()
          
 QNodeTypeManager.Impl getNodeTypeManager()
          
 javax.jcr.observation.ObservationManager getObservationManager()
          Unsupported at the moment.
 PrihaQueryManager getQueryManager()
          
 SessionImpl getSession()
          
 void importXML(java.lang.String parentAbsPath, java.io.InputStream in, int uuidBehavior)
          
protected  boolean isCheckedIn(NodeImpl n)
          Checks if the node or any of its parents are checked in.
 void logout()
          Performs a logout; to be called by SessionImpl only.
 void move(java.lang.String srcAbsPath, java.lang.String destAbsPath)
          Implemented simply by starting a new Session, which then performs the copy, and then calling save() on it.
 boolean nodeExists(Path path)
          Checks directly from the repository if an item exists.
 void restore(javax.jcr.version.Version[] versions, boolean removeExisting)
          Unsupported at the moment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorkspaceImpl

public WorkspaceImpl(SessionImpl session,
                     java.lang.String name,
                     ProviderManager mgr)
              throws javax.jcr.RepositoryException
Create a new Workspace instance.

Parameters:
session - The SessionImpl to which this Workspace is tied to
name - The name of the Workspace
mgr - The ProviderManager instance which owns the repository.
Throws:
javax.jcr.RepositoryException - If a NodeTypeManager cannot be instantiated.
Method Detail

createPropertyImpl

public PropertyImpl createPropertyImpl(Path path)
                                throws javax.jcr.RepositoryException
Creates a new property implementation without a property definition. This is meant for providers to create an "empty" property definition, which the WorkspaceImpl will then update later on.

Parameters:
path -
Returns:
Throws:
javax.jcr.RepositoryException

clone

public void clone(java.lang.String srcWorkspace,
                  java.lang.String srcAbsPath,
                  java.lang.String destAbsPath,
                  boolean removeExisting)
           throws javax.jcr.NoSuchWorkspaceException,
                  javax.jcr.nodetype.ConstraintViolationException,
                  javax.jcr.version.VersionException,
                  javax.jcr.AccessDeniedException,
                  javax.jcr.PathNotFoundException,
                  javax.jcr.ItemExistsException,
                  javax.jcr.lock.LockException,
                  javax.jcr.RepositoryException

Specified by:
clone in interface javax.jcr.Workspace
Throws:
javax.jcr.NoSuchWorkspaceException
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

public void copy(java.lang.String srcAbsPath,
                 java.lang.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

Specified by:
copy in interface javax.jcr.Workspace
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

public void copy(java.lang.String srcWorkspace,
                 java.lang.String srcAbsPath,
                 java.lang.String destAbsPath)
          throws javax.jcr.NoSuchWorkspaceException,
                 javax.jcr.nodetype.ConstraintViolationException,
                 javax.jcr.version.VersionException,
                 javax.jcr.AccessDeniedException,
                 javax.jcr.PathNotFoundException,
                 javax.jcr.ItemExistsException,
                 javax.jcr.lock.LockException,
                 javax.jcr.RepositoryException

Specified by:
copy in interface javax.jcr.Workspace
Throws:
javax.jcr.NoSuchWorkspaceException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.version.VersionException
javax.jcr.AccessDeniedException
javax.jcr.PathNotFoundException
javax.jcr.ItemExistsException
javax.jcr.lock.LockException
javax.jcr.RepositoryException

isCheckedIn

protected boolean isCheckedIn(NodeImpl n)
                       throws javax.jcr.RepositoryException
Checks if the node or any of its parents are checked in.

Parameters:
n -
Returns:
Throws:
javax.jcr.RepositoryException

copy

protected void copy(SessionImpl srcSession,
                    java.lang.String srcAbsPath,
                    java.lang.String destAbsPath,
                    boolean preserveUUIDs)
             throws javax.jcr.NoSuchWorkspaceException,
                    javax.jcr.nodetype.ConstraintViolationException,
                    javax.jcr.version.VersionException,
                    javax.jcr.AccessDeniedException,
                    javax.jcr.PathNotFoundException,
                    javax.jcr.ItemExistsException,
                    javax.jcr.lock.LockException,
                    javax.jcr.RepositoryException
Performs the actual copy, but does not save.

Parameters:
srcSession -
srcAbsPath -
destAbsPath -
Throws:
javax.jcr.NoSuchWorkspaceException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.version.VersionException
javax.jcr.AccessDeniedException
javax.jcr.PathNotFoundException
javax.jcr.ItemExistsException
javax.jcr.lock.LockException
javax.jcr.RepositoryException

getAccessibleWorkspaceNames

public java.lang.String[] getAccessibleWorkspaceNames()
                                               throws javax.jcr.RepositoryException

Specified by:
getAccessibleWorkspaceNames in interface javax.jcr.Workspace
Throws:
javax.jcr.RepositoryException

getImportContentHandler

public org.xml.sax.ContentHandler getImportContentHandler(java.lang.String parentAbsPath,
                                                          int uuidBehavior)
                                                   throws javax.jcr.PathNotFoundException,
                                                          javax.jcr.nodetype.ConstraintViolationException,
                                                          javax.jcr.version.VersionException,
                                                          javax.jcr.lock.LockException,
                                                          javax.jcr.AccessDeniedException,
                                                          javax.jcr.RepositoryException

Specified by:
getImportContentHandler in interface javax.jcr.Workspace
Throws:
javax.jcr.PathNotFoundException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.version.VersionException
javax.jcr.lock.LockException
javax.jcr.AccessDeniedException
javax.jcr.RepositoryException

getName

public java.lang.String getName()

Specified by:
getName in interface javax.jcr.Workspace

getNamespaceRegistry

public NamespaceRegistryImpl getNamespaceRegistry()
                                           throws javax.jcr.RepositoryException

Specified by:
getNamespaceRegistry in interface javax.jcr.Workspace
Throws:
javax.jcr.RepositoryException

getNodeTypeManager

public QNodeTypeManager.Impl getNodeTypeManager()
                                         throws javax.jcr.RepositoryException

Specified by:
getNodeTypeManager in interface javax.jcr.Workspace
Throws:
javax.jcr.RepositoryException

getObservationManager

public javax.jcr.observation.ObservationManager getObservationManager()
                                                               throws javax.jcr.UnsupportedRepositoryOperationException,
                                                                      javax.jcr.RepositoryException
Unsupported at the moment.

Specified by:
getObservationManager in interface javax.jcr.Workspace
Throws:
javax.jcr.UnsupportedRepositoryOperationException
javax.jcr.RepositoryException

getQueryManager

public PrihaQueryManager getQueryManager()
                                  throws javax.jcr.RepositoryException

Specified by:
getQueryManager in interface javax.jcr.Workspace
Throws:
javax.jcr.RepositoryException

getSession

public SessionImpl getSession()

Specified by:
getSession in interface javax.jcr.Workspace

importXML

public void importXML(java.lang.String parentAbsPath,
                      java.io.InputStream in,
                      int uuidBehavior)
               throws java.io.IOException,
                      javax.jcr.PathNotFoundException,
                      javax.jcr.ItemExistsException,
                      javax.jcr.nodetype.ConstraintViolationException,
                      javax.jcr.InvalidSerializedDataException,
                      javax.jcr.lock.LockException,
                      javax.jcr.AccessDeniedException,
                      javax.jcr.RepositoryException

Specified by:
importXML in interface javax.jcr.Workspace
Throws:
java.io.IOException
javax.jcr.PathNotFoundException
javax.jcr.ItemExistsException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.InvalidSerializedDataException
javax.jcr.lock.LockException
javax.jcr.AccessDeniedException
javax.jcr.RepositoryException

move

public void move(java.lang.String srcAbsPath,
                 java.lang.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
Implemented simply by starting a new Session, which then performs the copy, and then calling save() on it.

Specified by:
move in interface javax.jcr.Workspace
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

restore

public void restore(javax.jcr.version.Version[] versions,
                    boolean removeExisting)
             throws javax.jcr.ItemExistsException,
                    javax.jcr.UnsupportedRepositoryOperationException,
                    javax.jcr.version.VersionException,
                    javax.jcr.lock.LockException,
                    javax.jcr.InvalidItemStateException,
                    javax.jcr.RepositoryException
Unsupported at the moment.

Specified by:
restore in interface javax.jcr.Workspace
Throws:
javax.jcr.ItemExistsException
javax.jcr.UnsupportedRepositoryOperationException
javax.jcr.version.VersionException
javax.jcr.lock.LockException
javax.jcr.InvalidItemStateException
javax.jcr.RepositoryException

logout

public void logout()
Performs a logout; to be called by SessionImpl only.


nodeExists

public boolean nodeExists(Path path)
                   throws javax.jcr.RepositoryException
Checks directly from the repository if an item exists.

Parameters:
path -
Returns:
Throws:
InvalidPathException
javax.jcr.RepositoryException