Package org.apache.jackrabbit.core
Class WorkspaceImpl
- java.lang.Object
-
- org.apache.jackrabbit.commons.AbstractWorkspace
-
- org.apache.jackrabbit.core.WorkspaceImpl
-
- All Implemented Interfaces:
Workspace,JackrabbitWorkspace,EventStateCollectionFactory
public class WorkspaceImpl extends AbstractWorkspace implements JackrabbitWorkspace, Workspace, EventStateCollectionFactory
AWorkspaceImpl...
-
-
Field Summary
Fields Modifier and Type Field Description protected SessionContextcontextThe component context of this session.protected CachingHierarchyManagerhierMgrThe hierarchy mgr that reflects persistent state only (i.e.protected LockManagerlockMgrTheLockManagerfor thisWorkspaceprotected ObservationManagerImplobsMgrTheObservationManagerinstance for this session.protected QueryManagerImplqueryManagerTheQueryManagerfor thisWorkspace.protected SessionImplsessionthe session that was used to acquire thisWorkspaceprotected LocalItemStateManagerstateMgrThe persistent state mgr associated with the workspace represented by thisWorkspaceinstance.protected VersionManagerImplversionMgrThe API Version manager for this workspaceprotected WorkspaceConfigwspConfigThe configuration of thisWorkspace-
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
Constructors Constructor Description WorkspaceImpl(SessionContext context, WorkspaceConfig wspConfig)Creates a new workspace instance
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclone(String srcWorkspace, String srcAbsPath, String destAbsPath, boolean removeExisting)voidcopy(String srcAbsPath, String destAbsPath)voidcopy(String srcWorkspace, String srcAbsPath, String destAbsPath)EventStateCollectioncreateEventStateCollection()Creates anEventStateCollection.protected LocalItemStateManagercreateItemStateManager()Create the persistent item state manager on top of the shared item state manager.voidcreateWorkspace(String name)Creates a newWorkspacewith the specifiedname.voidcreateWorkspace(String name, String srcWorkspace)voidcreateWorkspace(String workspaceName, InputSource configTemplate)Creates a workspace with the given name and a workspace configuration template.voiddeleteWorkspace(String name)String[]getAccessibleWorkspaceNames()Returns the names of all workspaces of this repository with respect of the access rights of this session.WorkspaceConfiggetConfig()Returns the configuration of this workspace.HierarchyManagergetHierarchyManager()The hierarchy manager that reflects workspace state only (i.e.ContentHandlergetImportContentHandler(String parentAbsPath, int uuidBehavior)LockManagergetInternalLockManager()Return the lock manager for this workspace.LocalItemStateManagergetItemStateManager()Returns the item state manager associated with the workspace represented by thisWorkspaceImplinstance.LockManagergetLockManager()StringgetName()NamespaceRegistrygetNamespaceRegistry()NodeTypeManagergetNodeTypeManager()ObservationManagergetObservationManager()Returns the observation manager of this session.PrivilegeManagergetPrivilegeManager()Return thePrivilegeManager.QueryManagergetQueryManager()SessiongetSession()protected SharedItemStateManagergetSharedItemStateManager()Returns the shared item state manager of this workspace.VersionManagergetVersionManager()voidmove(String srcAbsPath, String destAbsPath)voidrestore(Version[] versions, boolean removeExisting)Deprecated.voidsanityCheck()Performs a sanity check on this workspace and the associated session.-
Methods inherited from class org.apache.jackrabbit.commons.AbstractWorkspace
importXML
-
-
-
-
Field Detail
-
context
protected final SessionContext context
The component context of this session.
-
wspConfig
protected final WorkspaceConfig wspConfig
The configuration of thisWorkspace
-
stateMgr
protected final LocalItemStateManager stateMgr
The persistent state mgr associated with the workspace represented by thisWorkspaceinstance.
-
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
TheObservationManagerinstance for this session.
-
queryManager
protected QueryManagerImpl queryManager
TheQueryManagerfor thisWorkspace.
-
session
protected final SessionImpl session
the session that was used to acquire thisWorkspace
-
lockMgr
protected LockManager lockMgr
TheLockManagerfor thisWorkspace
-
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 sessionwspConfig- 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 thisWorkspaceImplinstance.- Returns:
- the item state manager of this workspace
-
sanityCheck
public void sanityCheck() throws RepositoryExceptionPerforms 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:
createWorkspacein interfaceWorkspace- Throws:
AccessDeniedExceptionRepositoryException
-
deleteWorkspace
public void deleteWorkspace(String name) throws AccessDeniedException, UnsupportedRepositoryOperationException, RepositoryException
Always throws
UnsupportedRepositoryOperationExceptionsince removal of workspaces is currently not supported.- Specified by:
deleteWorkspacein interfaceWorkspace- Throws:
AccessDeniedExceptionUnsupportedRepositoryOperationExceptionRepositoryException
-
getLockManager
public LockManager getLockManager() throws UnsupportedRepositoryOperationException, RepositoryException
- Specified by:
getLockManagerin interfaceWorkspace- Throws:
UnsupportedRepositoryOperationExceptionRepositoryException- See Also:
Workspace.getLockManager(),LockManager
-
getVersionManager
public VersionManager getVersionManager()
- Specified by:
getVersionManagerin interfaceWorkspace- See Also:
Workspace.getVersionManager()
-
createWorkspace
public void createWorkspace(String name) throws AccessDeniedException, RepositoryException
Creates a newWorkspacewith the specifiedname. The new workspace is empty, meaning it contains only root node.The new workspace can be accessed through a
loginspecifying its name.Throws an
AccessDeniedExceptionif the session through which thisWorkspaceobject was acquired does not have permission to create the new workspace.Throws an
UnsupportedRepositoryOperationExceptionif the repository does not support the creation of workspaces.A
RepositoryExceptionis thrown if another error occurs.- Specified by:
createWorkspacein interfaceJackrabbitWorkspace- Specified by:
createWorkspacein interfaceWorkspace- Parameters:
name- AString, the name of the new workspace.- Throws:
AccessDeniedException- if the session through which thisWorkspaceobject was acquired does not have permission to create the new workspace.RepositoryException- if another error occurs.- Since:
- JCR 2.0
-
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:
createWorkspacein interfaceJackrabbitWorkspace- Parameters:
workspaceName- name of the new workspaceconfigTemplate- the configuration template of the new workspace- Throws:
AccessDeniedException- if the current session is not allowed to create the workspaceRepositoryException- if a workspace with the given name already exists or if another error occurs- See Also:
getAccessibleWorkspaceNames()
-
getPrivilegeManager
public PrivilegeManager getPrivilegeManager() throws RepositoryException
Return thePrivilegeManager.- Specified by:
getPrivilegeManagerin interfaceJackrabbitWorkspace- Returns:
- Throws:
RepositoryException- See Also:
JackrabbitWorkspace.getPrivilegeManager()
-
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
-
getSession
public Session getSession()
- Specified by:
getSessionin interfaceWorkspace
-
getNamespaceRegistry
public NamespaceRegistry getNamespaceRegistry() throws RepositoryException
- Specified by:
getNamespaceRegistryin interfaceWorkspace- Throws:
RepositoryException
-
getNodeTypeManager
public NodeTypeManager getNodeTypeManager() throws RepositoryException
- Specified by:
getNodeTypeManagerin interfaceWorkspace- 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:
clonein interfaceWorkspace- Throws:
NoSuchWorkspaceExceptionConstraintViolationExceptionVersionExceptionAccessDeniedExceptionPathNotFoundExceptionItemExistsExceptionLockExceptionRepositoryException
-
copy
public void copy(String srcAbsPath, String destAbsPath) throws ConstraintViolationException, VersionException, AccessDeniedException, PathNotFoundException, ItemExistsException, LockException, RepositoryException
- Specified by:
copyin interfaceWorkspace- Throws:
ConstraintViolationExceptionVersionExceptionAccessDeniedExceptionPathNotFoundExceptionItemExistsExceptionLockExceptionRepositoryException
-
copy
public void copy(String srcWorkspace, String srcAbsPath, String destAbsPath) throws NoSuchWorkspaceException, ConstraintViolationException, VersionException, AccessDeniedException, PathNotFoundException, ItemExistsException, LockException, RepositoryException
- Specified by:
copyin interfaceWorkspace- Throws:
NoSuchWorkspaceExceptionConstraintViolationExceptionVersionExceptionAccessDeniedExceptionPathNotFoundExceptionItemExistsExceptionLockExceptionRepositoryException
-
move
public void move(String srcAbsPath, String destAbsPath) throws ConstraintViolationException, VersionException, AccessDeniedException, PathNotFoundException, ItemExistsException, LockException, RepositoryException
- Specified by:
movein interfaceWorkspace- Throws:
ConstraintViolationExceptionVersionExceptionAccessDeniedExceptionPathNotFoundExceptionItemExistsExceptionLockExceptionRepositoryException
-
getObservationManager
public ObservationManager getObservationManager()
Returns the observation manager of this session.- Specified by:
getObservationManagerin interfaceWorkspace- Returns:
- the observation manager of this session
-
getQueryManager
public QueryManager getQueryManager() throws RepositoryException
- Specified by:
getQueryManagerin interfaceWorkspace- Throws:
RepositoryException
-
restore
@Deprecated public void restore(Version[] versions, boolean removeExisting) throws ItemExistsException, UnsupportedRepositoryOperationException, VersionException, LockException, InvalidItemStateException, RepositoryException
Deprecated.- Specified by:
restorein interfaceWorkspace- Throws:
ItemExistsExceptionUnsupportedRepositoryOperationExceptionVersionExceptionLockExceptionInvalidItemStateExceptionRepositoryException
-
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:
getAccessibleWorkspaceNamesin interfaceWorkspace- 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:
getImportContentHandlerin interfaceWorkspace- Throws:
PathNotFoundExceptionConstraintViolationExceptionVersionExceptionLockExceptionRepositoryException
-
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 anEventStateCollection.Implemented in this object and forwarded rather than
obsMgrsince creation of the latter is lazy.- Specified by:
createEventStateCollectionin interfaceEventStateCollectionFactory- Returns:
- a new
EventStateCollection - Throws:
RepositoryException- if creation fails for some reason
-
-