org.apache.jackrabbit.core
Class WorkspaceImpl

java.lang.Object
  extended by org.apache.jackrabbit.commons.AbstractWorkspace
      extended by org.apache.jackrabbit.core.WorkspaceImpl
All Implemented Interfaces:
Workspace, JackrabbitWorkspace, EventStateCollectionFactory

public class WorkspaceImpl
extends AbstractWorkspace
implements JackrabbitWorkspace, Workspace, EventStateCollectionFactory

A WorkspaceImpl ...


Field Summary
protected  SessionContext context
          The component context of this session.
protected  CachingHierarchyManager hierMgr
          The hierarchy mgr that reflects persistent state only (i.e. that is isolated from transient changes made through the session).
protected  LockManager lockMgr
          The LockManager for this Workspace
protected  ObservationManagerImpl obsMgr
          The ObservationManager instance for this session.
protected  QueryManagerImpl queryManager
          The QueryManager for this Workspace.
protected  SessionImpl session
          the session that was used to acquire this Workspace
protected  LocalItemStateManager stateMgr
          The persistent state mgr associated with the workspace represented by this Workspace instance.
protected  VersionManagerImpl versionMgr
          The API Version manager for this workspace
protected  WorkspaceConfig wspConfig
          The configuration of this Workspace
 
Fields inherited from interface javax.jcr.Workspace
NAME_ACTIVITIES_NODE, NAME_CONFIGURATIONS_NODE, NAME_JCR_XMLCHARACTERS, NAME_JCR_XMLTEXT, NAME_NODE_TYPES_NODE, NAME_SYSTEM_NODE, NAME_UNFILED_NODE, NAME_VERSION_STORAGE_NODE, NAME_WORKSPACE_ROOT, PATH_ACTIVITIES_NODE, PATH_CONFIGURATIONS_NODE, PATH_NODE_TYPES_NODE, PATH_SYSTEM_NODE, PATH_UNFILED_NODE, PATH_VERSION_STORAGE_NODE, PATH_WORKSPACE_ROOT, RELPATH_JCR_XMLCHARACTERS
 
Constructor Summary
WorkspaceImpl(SessionContext context, WorkspaceConfig wspConfig)
          Creates a new workspace instance
 
Method Summary
 void clone(String srcWorkspace, String srcAbsPath, String destAbsPath, boolean removeExisting)
          
 void copy(String srcAbsPath, String destAbsPath)
          
 void copy(String srcWorkspace, String srcAbsPath, String destAbsPath)
          
 EventStateCollection createEventStateCollection()
          Creates an EventStateCollection.
protected  LocalItemStateManager createItemStateManager()
          Create the persistent item state manager on top of the shared item state manager.
 void createWorkspace(String name)
          Creates a new Workspace with the specified name.
 void createWorkspace(String workspaceName, InputSource configTemplate)
          Creates a workspace with the given name and a workspace configuration template.
 void createWorkspace(String name, String srcWorkspace)
          
 void deleteWorkspace(String name)
          

Always throws UnsupportedRepositoryOperationException since removal of workspaces is currently not supported.

 String[] getAccessibleWorkspaceNames()
          Returns the names of all workspaces of this repository with respect of the access rights of this session.
 WorkspaceConfig getConfig()
          Returns the configuration of this workspace.
 HierarchyManager getHierarchyManager()
          The hierarchy manager that reflects workspace state only (i.e. that is isolated from transient changes made through the session)
 ContentHandler getImportContentHandler(String parentAbsPath, int uuidBehavior)
          
 LockManager getInternalLockManager()
          Return the lock manager for this workspace.
 LocalItemStateManager getItemStateManager()
          Returns the item state manager associated with the workspace represented by this WorkspaceImpl instance.
 LockManager getLockManager()
           
 String getName()
          
 NamespaceRegistry getNamespaceRegistry()
          
 NodeTypeManager getNodeTypeManager()
          
 ObservationManager getObservationManager()
          Returns the observation manager of this session.
 QueryManager getQueryManager()
          
 Session getSession()
          
protected  SharedItemStateManager getSharedItemStateManager()
          Returns the shared item state manager of this workspace.
 VersionManager getVersionManager()
           
 void move(String srcAbsPath, String destAbsPath)
          
 void restore(Version[] versions, boolean removeExisting)
          Deprecated. 
 void sanityCheck()
          Performs a sanity check on this workspace and the associated session.
 
Methods inherited from class org.apache.jackrabbit.commons.AbstractWorkspace
importXML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.jcr.Workspace
importXML
 

Field Detail

context

protected final SessionContext context
The component context of this session.


wspConfig

protected final WorkspaceConfig wspConfig
The configuration of this Workspace


stateMgr

protected final LocalItemStateManager stateMgr
The persistent state mgr associated with the workspace represented by this Workspace instance.


hierMgr

protected final CachingHierarchyManager hierMgr
The hierarchy mgr that reflects persistent state only (i.e. that is isolated from transient changes made through the session).


obsMgr

protected ObservationManagerImpl obsMgr
The ObservationManager instance for this session.


queryManager

protected QueryManagerImpl queryManager
The QueryManager for this Workspace.


session

protected final SessionImpl session
the session that was used to acquire this Workspace


lockMgr

protected LockManager lockMgr
The LockManager for this Workspace


versionMgr

protected VersionManagerImpl versionMgr
The API Version manager for this workspace

Constructor Detail

WorkspaceImpl

public WorkspaceImpl(SessionContext context,
                     WorkspaceConfig wspConfig)
              throws RepositoryException
Creates a new workspace instance

Parameters:
context - component context of this session
wspConfig - The workspace configuration
Throws:
RepositoryException - if the workspace can not be accessed
Method Detail

getHierarchyManager

public HierarchyManager getHierarchyManager()
The hierarchy manager that reflects workspace state only (i.e. that is isolated from transient changes made through the session)

Returns:
the hierarchy manager of this workspace

getItemStateManager

public LocalItemStateManager getItemStateManager()
Returns the item state manager associated with the workspace represented by this WorkspaceImpl instance.

Returns:
the item state manager of this workspace

sanityCheck

public void sanityCheck()
                 throws RepositoryException
Performs a sanity check on this workspace and the associated session.

Throws:
RepositoryException - if this workspace has been rendered invalid for some reason

createWorkspace

public void createWorkspace(String name,
                            String srcWorkspace)
                     throws AccessDeniedException,
                            RepositoryException

Specified by:
createWorkspace in interface Workspace
Throws:
AccessDeniedException
RepositoryException

deleteWorkspace

public void deleteWorkspace(String name)
                     throws AccessDeniedException,
                            UnsupportedRepositoryOperationException,
                            RepositoryException

Always throws UnsupportedRepositoryOperationException since removal of workspaces is currently not supported.

Specified by:
deleteWorkspace in interface Workspace
Throws:
AccessDeniedException
UnsupportedRepositoryOperationException
RepositoryException

getLockManager

public LockManager getLockManager()
                           throws UnsupportedRepositoryOperationException,
                                  RepositoryException
Specified by:
getLockManager in interface Workspace
Throws:
UnsupportedRepositoryOperationException
RepositoryException
See Also:
Workspace.getLockManager(), LockManager

getVersionManager

public VersionManager getVersionManager()
Specified by:
getVersionManager in interface Workspace
See Also:
Workspace.getVersionManager()

createWorkspace

public void createWorkspace(String name)
                     throws AccessDeniedException,
                            RepositoryException
Creates a new Workspace with the specified name. The new workspace is empty, meaning it contains only root node.

The new workspace can be accessed through a login specifying its name.

Throws an AccessDeniedException if the session through which this Workspace object was acquired does not have permission to create the new workspace.

Throws an UnsupportedRepositoryOperationException if the repository does not support the creation of workspaces.

A RepositoryException is thrown if another error occurs.

Specified by:
createWorkspace in interface Workspace
Specified by:
createWorkspace in interface JackrabbitWorkspace
Parameters:
name - A String, the name of the new workspace.
Throws:
AccessDeniedException - if the session through which this Workspace object was acquired does not have permission to create the new workspace.
RepositoryException - if another error occurs.
Since:
JCR 2.0
See Also:
Workspace.getAccessibleWorkspaceNames()

createWorkspace

public void createWorkspace(String workspaceName,
                            InputSource configTemplate)
                     throws AccessDeniedException,
                            RepositoryException
Creates a workspace with the given name and a workspace configuration template.

Specified by:
createWorkspace in interface JackrabbitWorkspace
Parameters:
workspaceName - name of the new workspace
configTemplate - the configuration template of the new workspace
Throws:
AccessDeniedException - if the current session is not allowed to create the workspace
RepositoryException - if a workspace with the given name already exists or if another error occurs
See Also:
getAccessibleWorkspaceNames()

getConfig

public WorkspaceConfig getConfig()
Returns the configuration of this workspace.

Returns:
the workspace configuration

getInternalLockManager

public LockManager getInternalLockManager()
                                   throws RepositoryException
Return the lock manager for this workspace. If not already done, creates a new instance.

Returns:
lock manager for this workspace
Throws:
RepositoryException - if an error occurs

getName

public String getName()

Specified by:
getName in interface Workspace

getSession

public Session getSession()

Specified by:
getSession in interface Workspace

getNamespaceRegistry

public NamespaceRegistry getNamespaceRegistry()
                                       throws RepositoryException

Specified by:
getNamespaceRegistry in interface Workspace
Throws:
RepositoryException

getNodeTypeManager

public NodeTypeManager getNodeTypeManager()
                                   throws RepositoryException

Specified by:
getNodeTypeManager in interface Workspace
Throws:
RepositoryException

clone

public void clone(String srcWorkspace,
                  String srcAbsPath,
                  String destAbsPath,
                  boolean removeExisting)
           throws NoSuchWorkspaceException,
                  ConstraintViolationException,
                  VersionException,
                  AccessDeniedException,
                  PathNotFoundException,
                  ItemExistsException,
                  LockException,
                  RepositoryException

Specified by:
clone in interface Workspace
Throws:
NoSuchWorkspaceException
ConstraintViolationException
VersionException
AccessDeniedException
PathNotFoundException
ItemExistsException
LockException
RepositoryException

copy

public void copy(String srcAbsPath,
                 String destAbsPath)
          throws ConstraintViolationException,
                 VersionException,
                 AccessDeniedException,
                 PathNotFoundException,
                 ItemExistsException,
                 LockException,
                 RepositoryException

Specified by:
copy in interface Workspace
Throws:
ConstraintViolationException
VersionException
AccessDeniedException
PathNotFoundException
ItemExistsException
LockException
RepositoryException

copy

public void copy(String srcWorkspace,
                 String srcAbsPath,
                 String destAbsPath)
          throws NoSuchWorkspaceException,
                 ConstraintViolationException,
                 VersionException,
                 AccessDeniedException,
                 PathNotFoundException,
                 ItemExistsException,
                 LockException,
                 RepositoryException

Specified by:
copy in interface Workspace
Throws:
NoSuchWorkspaceException
ConstraintViolationException
VersionException
AccessDeniedException
PathNotFoundException
ItemExistsException
LockException
RepositoryException

move

public void move(String srcAbsPath,
                 String destAbsPath)
          throws ConstraintViolationException,
                 VersionException,
                 AccessDeniedException,
                 PathNotFoundException,
                 ItemExistsException,
                 LockException,
                 RepositoryException

Specified by:
move in interface Workspace
Throws:
ConstraintViolationException
VersionException
AccessDeniedException
PathNotFoundException
ItemExistsException
LockException
RepositoryException

getObservationManager

public ObservationManager getObservationManager()
Returns the observation manager of this session.

Specified by:
getObservationManager in interface Workspace
Returns:
the observation manager of this session

getQueryManager

public QueryManager getQueryManager()
                             throws RepositoryException

Specified by:
getQueryManager in interface Workspace
Throws:
RepositoryException

restore

@Deprecated
public void restore(Version[] versions,
                               boolean removeExisting)
             throws ItemExistsException,
                    UnsupportedRepositoryOperationException,
                    VersionException,
                    LockException,
                    InvalidItemStateException,
                    RepositoryException
Deprecated. 

Specified by:
restore in interface Workspace
Throws:
ItemExistsException
UnsupportedRepositoryOperationException
VersionException
LockException
InvalidItemStateException
RepositoryException

getAccessibleWorkspaceNames

public String[] getAccessibleWorkspaceNames()
                                     throws RepositoryException
Returns the names of all workspaces of this repository with respect of the access rights of this session.

Specified by:
getAccessibleWorkspaceNames in interface Workspace
Returns:
the names of all accessible workspaces
Throws:
RepositoryException - if an error occurs

getImportContentHandler

public ContentHandler getImportContentHandler(String parentAbsPath,
                                              int uuidBehavior)
                                       throws PathNotFoundException,
                                              ConstraintViolationException,
                                              VersionException,
                                              LockException,
                                              RepositoryException

Specified by:
getImportContentHandler in interface Workspace
Throws:
PathNotFoundException
ConstraintViolationException
VersionException
LockException
RepositoryException

getSharedItemStateManager

protected SharedItemStateManager getSharedItemStateManager()
                                                    throws RepositoryException
Returns the shared item state manager of this workspace.

Returns:
shared item state manager
Throws:
RepositoryException - if the workspace can not be accessed

createItemStateManager

protected LocalItemStateManager createItemStateManager()
                                                throws RepositoryException
Create the persistent item state manager on top of the shared item state manager.

Returns:
local item state manager
Throws:
RepositoryException - if the workspace can not be accessed

createEventStateCollection

public EventStateCollection createEventStateCollection()
                                                throws RepositoryException
Creates an EventStateCollection.

Implemented in this object and forwarded rather than obsMgr since creation of the latter is lazy.

Specified by:
createEventStateCollection in interface EventStateCollectionFactory
Returns:
a new EventStateCollection
Throws:
RepositoryException - if creation fails for some reason


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.