info.magnolia.repository
Interface RepositoryManager

All Known Implementing Classes:
DefaultRepositoryManager

public interface RepositoryManager

Manages JCR repositories. Initialization of a repository is handled by Providers. Magnolia can be configured to have its workspaces in more than one repository. This is abstracted through this class which maps a set of "logical" workspace names to their actual "physical" workspace names in a repository. Configuration of providers and workspace mappings are done in repositories.xml.

Version:
$Id$
See Also:
Provider, RepositoryMappingDefinitionReader

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.
 

Method Detail

init

void init()
Initializes by loading configuration from repositories.xml.


shutdown

void shutdown()
Shuts down all repositories (through Provider instances) and clears all mappings.


reload

void reload()
Re-load all configured repositories.

See Also:
init()

getSession

javax.jcr.Session getSession(String logicalWorkspaceName,
                             javax.jcr.Credentials credentials)
                             throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

getSystemSession

javax.jcr.Session getSystemSession(String logicalWorkspaceName)
                                   throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

checkIfInitialized

boolean checkIfInitialized()
                           throws AccessDeniedException,
                                  javax.jcr.RepositoryException
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).

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

boolean checkIfInitialized(String logicalWorkspace)
                           throws javax.jcr.RepositoryException,
                                  AccessDeniedException
Verifies the initialization state of a workspace.

Throws:
javax.jcr.RepositoryException
AccessDeniedException

loadRepository

void loadRepository(RepositoryDefinition definition)
                    throws RepositoryNotInitializedException,
                           InstantiationException,
                           IllegalAccessException,
                           ClassNotFoundException
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.

Throws:
RepositoryNotInitializedException
InstantiationException
IllegalAccessException
ClassNotFoundException

loadWorkspace

void loadWorkspace(String repositoryId,
                   String physicalWorkspaceName)
                   throws javax.jcr.RepositoryException
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.

Throws:
javax.jcr.RepositoryException

hasRepository

boolean hasRepository(String repositoryId)

getRepositoryDefinition

RepositoryDefinition getRepositoryDefinition(String repositoryId)
Returns repository mapping as configured, or null if not found.


getRepositoryProvider

Provider getRepositoryProvider(String repositoryId)
Returns the provider instance for a repository.

Throws:
IllegalArgumentException - if there is no such repository

getRepository

javax.jcr.Repository getRepository(String repositoryId)
Returns repository instance for a repository.

Throws:
IllegalArgumentException - if there is no such repository

addWorkspaceMapping

void addWorkspaceMapping(WorkspaceMappingDefinition mapping)

hasWorkspace

boolean hasWorkspace(String logicalWorkspaceName)

getWorkspaceMappings

Collection<WorkspaceMappingDefinition> getWorkspaceMappings()

getWorkspaceMapping

WorkspaceMappingDefinition getWorkspaceMapping(String logicalWorkspaceName)

getWorkspaceNames

Collection<String> getWorkspaceNames()
Returns workspace names.

Returns:
repository names


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