info.magnolia.repository
Class DefaultRepositoryManager

java.lang.Object
  extended by info.magnolia.repository.DefaultRepositoryManager
All Implemented Interfaces:
RepositoryManager

@Singleton
public final class DefaultRepositoryManager
extends Object
implements RepositoryManager

Manages all used Repositories.

Version:
$Id$

Constructor Summary
DefaultRepositoryManager()
           
 
Method Summary
 void addWorkspaceMapping(WorkspaceMappingDefinition mapping)
           
 boolean checkIfInitialized()
          Verify the initialization state of all the workspaces.
 boolean checkIfInitialized(String logicalWorkspace)
          Verifies the initialization state of a workspace.
 javax.jcr.Repository getRepository(String repositoryId)
          Returns repository instance for a repository.
 RepositoryDefinition getRepositoryDefinition(String repositoryId)
          Returns repository mapping as configured, or null if not found.
 Provider getRepositoryProvider(String repositoryId)
          Returns the provider instance for a repository.
 javax.jcr.Session getSession(String logicalWorkspaceName, javax.jcr.Credentials credentials)
           
 javax.jcr.Session getSystemSession(String logicalWorkspaceName)
           
 WorkspaceMappingDefinition getWorkspaceMapping(String logicalWorkspaceName)
           
 Collection<WorkspaceMappingDefinition> getWorkspaceMappings()
           
 Collection<String> getWorkspaceNames()
          Returns workspace names.
 boolean hasRepository(String repositoryId)
           
 boolean hasWorkspace(String logicalWorkspaceName)
           
 void init()
          Initializes by loading configuration from repositories.xml.
 void loadRepository(RepositoryDefinition definition)
          Adds a repository definition and instantiates its provider.
 void loadWorkspace(String repositoryId, String physicalWorkspaceName)
          Loads a workspace by registering namespaces and node types on a workspace that has not previously been loaded.
 void reload()
          Re-load all configured repositories.
 void shutdown()
          Shuts down all repositories (through Provider instances) and clears all mappings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultRepositoryManager

public DefaultRepositoryManager()
Method Detail

init

public void init()
Description copied from interface: RepositoryManager
Initializes by loading configuration from repositories.xml.

Specified by:
init in interface RepositoryManager

shutdown

public void shutdown()
Description copied from interface: RepositoryManager
Shuts down all repositories (through Provider instances) and clears all mappings.

Specified by:
shutdown in interface RepositoryManager

checkIfInitialized

public boolean checkIfInitialized()
                           throws AccessDeniedException,
                                  javax.jcr.RepositoryException
Description copied from interface: RepositoryManager
Verify the initialization state of all the workspaces. This methods returns false only if all the workspaces are empty (no node else than the root one).

Specified by:
checkIfInitialized in interface RepositoryManager
Returns:
false if all the workspaces are empty, true if at least one of them has content.
Throws:
AccessDeniedException - repository authentication failed
javax.jcr.RepositoryException - exception while accessing the repository

checkIfInitialized

public boolean checkIfInitialized(String logicalWorkspace)
                           throws javax.jcr.RepositoryException,
                                  AccessDeniedException
Description copied from interface: RepositoryManager
Verifies the initialization state of a workspace.

Specified by:
checkIfInitialized in interface RepositoryManager
Throws:
javax.jcr.RepositoryException
AccessDeniedException

reload

public void reload()
Description copied from interface: RepositoryManager
Re-load all configured repositories.

Specified by:
reload in interface RepositoryManager
See Also:
RepositoryManager.init()

loadRepository

public void loadRepository(RepositoryDefinition definition)
                    throws RepositoryNotInitializedException,
                           InstantiationException,
                           IllegalAccessException,
                           ClassNotFoundException
Description copied from interface: RepositoryManager
Adds a repository definition and instantiates its provider. If the loadOnStartup property is true it also registers namespaces and node types. You must not call this method twice.

Specified by:
loadRepository in interface RepositoryManager
Throws:
RepositoryNotInitializedException
InstantiationException
IllegalAccessException
ClassNotFoundException

loadWorkspace

public void loadWorkspace(String repositoryId,
                          String physicalWorkspaceName)
                   throws javax.jcr.RepositoryException
Description copied from interface: RepositoryManager
Loads a workspace by registering namespaces and node types on a workspace that has not previously been loaded. Also adds a workspace mapping that maps the physical workspace name as a logical name.

Specified by:
loadWorkspace in interface RepositoryManager
Throws:
javax.jcr.RepositoryException

getSession

public javax.jcr.Session getSession(String logicalWorkspaceName,
                                    javax.jcr.Credentials credentials)
                             throws javax.jcr.RepositoryException
Specified by:
getSession in interface RepositoryManager
Throws:
javax.jcr.RepositoryException

getSystemSession

public javax.jcr.Session getSystemSession(String logicalWorkspaceName)
                                   throws javax.jcr.RepositoryException
Specified by:
getSystemSession in interface RepositoryManager
Throws:
javax.jcr.RepositoryException

hasRepository

public boolean hasRepository(String repositoryId)
Specified by:
hasRepository in interface RepositoryManager

getRepositoryDefinition

public RepositoryDefinition getRepositoryDefinition(String repositoryId)
Description copied from interface: RepositoryManager
Returns repository mapping as configured, or null if not found.

Specified by:
getRepositoryDefinition in interface RepositoryManager

getRepositoryProvider

public Provider getRepositoryProvider(String repositoryId)
Description copied from interface: RepositoryManager
Returns the provider instance for a repository.

Specified by:
getRepositoryProvider in interface RepositoryManager

getRepository

public javax.jcr.Repository getRepository(String repositoryId)
Description copied from interface: RepositoryManager
Returns repository instance for a repository.

Specified by:
getRepository in interface RepositoryManager

addWorkspaceMapping

public void addWorkspaceMapping(WorkspaceMappingDefinition mapping)
Specified by:
addWorkspaceMapping in interface RepositoryManager

hasWorkspace

public boolean hasWorkspace(String logicalWorkspaceName)
Specified by:
hasWorkspace in interface RepositoryManager

getWorkspaceMappings

public Collection<WorkspaceMappingDefinition> getWorkspaceMappings()
Specified by:
getWorkspaceMappings in interface RepositoryManager

getWorkspaceMapping

public WorkspaceMappingDefinition getWorkspaceMapping(String logicalWorkspaceName)
Specified by:
getWorkspaceMapping in interface RepositoryManager

getWorkspaceNames

public Collection<String> getWorkspaceNames()
Description copied from interface: RepositoryManager
Returns workspace names.

Specified by:
getWorkspaceNames in interface RepositoryManager
Returns:
repository names


Copyright © 2003-2013 Magnolia International Ltd.. All Rights Reserved.