org.apache.jackrabbit.core
Class WorkspaceImpl

java.lang.Object
  extended byorg.apache.jackrabbit.core.WorkspaceImpl
All Implemented Interfaces:
EventStateCollectionFactory, JackrabbitWorkspace, Workspace
Direct Known Subclasses:
XAWorkspace

public class WorkspaceImpl
extends Object
implements JackrabbitWorkspace, EventStateCollectionFactory

A WorkspaceImpl ...


Field Summary
protected  HierarchyManagerImpl hierMgr
          The hierarchy mgr that reflects persistent state only (i.e.
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  RepositoryImpl rep
          The repository that created this workspace instance
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  WorkspaceConfig wspConfig
          The configuration of this Workspace
 
Constructor Summary
protected WorkspaceImpl(WorkspaceConfig wspConfig, SharedItemStateManager stateMgr, RepositoryImpl rep, SessionImpl session)
          Protected constructor.
 
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.

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

protected  LocalItemStateManager createItemStateManager(SharedItemStateManager shared)
          Create the persistent item state manager on top of the shared item state manager.
 void createWorkspace(String workspaceName)
          Creates a workspace with the given name.
 void createWorkspace(String workspaceName, InputSource configTemplate)
          Creates a workspace with the given name and a workspace configuration template.
 String[] getAccessibleWorkspaceNames()
          
 WorkspaceConfig getConfig()
          Returns the configuration of this workspace.
 HierarchyManager getHierarchyManager()
          The hierarchy manager that reflects workspace state only (i.e.
 ContentHandler getImportContentHandler(String parentAbsPath, int uuidBehavior)
          
 LocalItemStateManager getItemStateManager()
          Returns the item state manager associated with the workspace represented by this WorkspaceImpl instance.
 LockManager getLockManager()
          Return the lock manager for this workspace.
 String getName()
          
 NamespaceRegistry getNamespaceRegistry()
          
 NodeTypeManager getNodeTypeManager()
          
 ObservationManager getObservationManager()
          
 QueryManager getQueryManager()
          
 Session getSession()
          
 void importXML(String parentAbsPath, InputStream in, int uuidBehavior)
          
 void move(String srcAbsPath, String destAbsPath)
          
 void restore(Version[] versions, boolean removeExisting)
          
 void sanityCheck()
          Performs a sanity check on this workspace and the associated session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

wspConfig

protected final WorkspaceConfig wspConfig
The configuration of this Workspace


rep

protected final RepositoryImpl rep
The repository that created this workspace instance


stateMgr

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


hierMgr

protected final HierarchyManagerImpl 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

Constructor Detail

WorkspaceImpl

protected WorkspaceImpl(WorkspaceConfig wspConfig,
                        SharedItemStateManager stateMgr,
                        RepositoryImpl rep,
                        SessionImpl session)
Protected constructor.

Parameters:
wspConfig - The workspace configuration
stateMgr - The shared item state manager
rep - The repository
session - The session
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 workspaceName)
                     throws AccessDeniedException,
                            RepositoryException
Creates a workspace with the given name.

Specified by:
createWorkspace in interface JackrabbitWorkspace
Parameters:
workspaceName - name 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()

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

getLockManager

public LockManager getLockManager()
                           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()
                                         throws UnsupportedRepositoryOperationException,
                                                RepositoryException

Specified by:
getObservationManager in interface Workspace
Throws:
UnsupportedRepositoryOperationException
RepositoryException

getQueryManager

public QueryManager getQueryManager()
                             throws RepositoryException

Specified by:
getQueryManager in interface Workspace
Throws:
RepositoryException

restore

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

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

getAccessibleWorkspaceNames

public String[] getAccessibleWorkspaceNames()
                                     throws RepositoryException

Specified by:
getAccessibleWorkspaceNames in interface Workspace
Throws:
RepositoryException

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

importXML

public void importXML(String parentAbsPath,
                      InputStream in,
                      int uuidBehavior)
               throws IOException,
                      PathNotFoundException,
                      ItemExistsException,
                      ConstraintViolationException,
                      InvalidSerializedDataException,
                      LockException,
                      RepositoryException

Specified by:
importXML in interface Workspace
Throws:
IOException
PathNotFoundException
ItemExistsException
ConstraintViolationException
InvalidSerializedDataException
LockException
RepositoryException

createItemStateManager

protected LocalItemStateManager createItemStateManager(SharedItemStateManager shared)
Create the persistent item state manager on top of the shared item state manager. May be overridden by subclasses.

Parameters:
shared - shared item state manager
Returns:
local item state manager

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-2006 The Apache Software Foundation. All Rights Reserved.