info.magnolia.cms.beans.config
Class ContentRepository

java.lang.Object
  extended by info.magnolia.cms.beans.config.ContentRepository

public final class ContentRepository
extends java.lang.Object

TODO needs serious refactoring and cleanup.

Author:
Sameer Charles $Id: ContentRepository.java 41137 2011-01-06 18:19:25Z gjoseph $

Field Summary
static java.lang.String CONFIG
           
static java.lang.String DEFAULT_WORKSPACE
           
static java.lang.String NAMESPACE_PREFIX
          magnolia namespace.
static java.lang.String NAMESPACE_URI
           
static java.lang.String REPOSITORY_PSWD
          repository default password.
static java.lang.String REPOSITORY_USER
          repository user.
static java.lang.String USER_GROUPS
           
static java.lang.String USER_ROLES
           
static java.lang.String USERS
           
static java.lang.String VERSION_STORE
           
static java.lang.String WEBSITE
          default repository ID's.
 
Method Summary
static void addMappedRepositoryName(java.lang.String name, java.lang.String repositoryName)
          Add a mapped repository name.
static void addMappedRepositoryName(java.lang.String name, java.lang.String repositoryName, java.lang.String workspaceName)
          Add a mapped repository name.
static boolean checkIfInitialized()
          Verify the initialization state of all the repositories.
static boolean checkIfInitialized(java.lang.String repository)
           
static java.util.Iterator getAllRepositoryNames()
          Gets repository names array as configured in repositories.xml.
static java.lang.String getDefaultWorkspace(java.lang.String repositoryId)
          Get default workspace name.
static java.lang.String getInternalWorkspaceName(java.lang.String workspaceName)
          get internal workspace name.
static java.lang.String getMappedRepositoryName(java.lang.String name)
          Get mapped repository name.
static java.lang.String getMappedWorkspaceName(java.lang.String name)
          Get mapped workspace name.
static java.lang.String getParentRepositoryName(java.lang.String workspaceName)
          Returns magnolia specific Repository name where this workspace is registered within .
static javax.jcr.Repository getRepository(java.lang.String repositoryID)
          Returns repository specified by the repositoryID as configured in repository config.
static RepositoryMapping getRepositoryMapping(java.lang.String repositoryID)
          returns repository mapping as configured.
static Provider getRepositoryProvider(java.lang.String repositoryID)
          Returns repository provider specified by the repositoryID as configured in repository config.
static boolean hasRepositoryMapping(java.lang.String repositoryID)
          Returns true if a mapping for the given repository name does exist.
static void init()
          loads all configured repository using ID as Key, as configured in repositories.xml.
static void loadRepository(RepositoryMapping map)
          This method initializes the repository.
static void loadWorkspace(java.lang.String repositoryId, java.lang.String workspaceId)
           
static void reload()
          Re-load all configured repositories.
static 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
 

Field Detail

WEBSITE

public static final java.lang.String WEBSITE
default repository ID's.

See Also:
Constant Field Values

USERS

public static final java.lang.String USERS
See Also:
Constant Field Values

USER_ROLES

public static final java.lang.String USER_ROLES
See Also:
Constant Field Values

USER_GROUPS

public static final java.lang.String USER_GROUPS
See Also:
Constant Field Values

CONFIG

public static final java.lang.String CONFIG
See Also:
Constant Field Values

DEFAULT_WORKSPACE

public static final java.lang.String DEFAULT_WORKSPACE
See Also:
Constant Field Values

VERSION_STORE

public static final java.lang.String VERSION_STORE
See Also:
Constant Field Values

NAMESPACE_PREFIX

public static final java.lang.String NAMESPACE_PREFIX
magnolia namespace.

See Also:
Constant Field Values

NAMESPACE_URI

public static final java.lang.String NAMESPACE_URI
See Also:
Constant Field Values

REPOSITORY_USER

public static java.lang.String REPOSITORY_USER
repository user.


REPOSITORY_PSWD

public static java.lang.String REPOSITORY_PSWD
repository default password.

Method Detail

init

public static void init()
loads all configured repository using ID as Key, as configured in repositories.xml.
 <Repository name="website"
                id="website"
                provider="info.magnolia.jackrabbit.ProviderImpl"
                loadOnStartup="true" >
   <param name="configFile"
             value="WEB-INF/config/repositories/website.xml"/>
   <param name="repositoryHome"
             value="repositories/website"/>
   <param name="contextFactoryClass"
             value="org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory"/>
   <param name="providerURL"
             value="localhost"/>
   <param name="id" value="website"/>
 </Repository>


shutdown

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


checkIfInitialized

public static boolean checkIfInitialized()
                                  throws AccessDeniedException,
                                         javax.jcr.RepositoryException
Verify the initialization state of all the repositories. This methods returns false only if all the repositories are empty (no node else than the root one).

Returns:
false if all the repositories 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 static boolean checkIfInitialized(java.lang.String repository)
                                  throws javax.jcr.RepositoryException,
                                         AccessDeniedException
Parameters:
repository -
Throws:
javax.jcr.RepositoryException
AccessDeniedException

reload

public static void reload()
Re-load all configured repositories.

See Also:
init()

loadRepository

public static void loadRepository(RepositoryMapping map)
                           throws RepositoryNotInitializedException,
                                  java.lang.InstantiationException,
                                  java.lang.IllegalAccessException,
                                  java.lang.ClassNotFoundException
This method initializes the repository. You must not call this method twice.

Parameters:
map -
Throws:
RepositoryNotInitializedException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.ClassNotFoundException

loadWorkspace

public static void loadWorkspace(java.lang.String repositoryId,
                                 java.lang.String workspaceId)
                          throws javax.jcr.RepositoryException
Parameters:
repositoryId -
workspaceId -
Throws:
javax.jcr.RepositoryException

getParentRepositoryName

public static java.lang.String getParentRepositoryName(java.lang.String workspaceName)
                                                throws javax.jcr.RepositoryException
Returns magnolia specific Repository name where this workspace is registered within .

Throws:
javax.jcr.RepositoryException

getMappedRepositoryName

public static java.lang.String getMappedRepositoryName(java.lang.String name)
Get mapped repository name.

Parameters:
name -
Returns:
mapped name as in repositories.xml RepositoryMapping element

getMappedWorkspaceName

public static java.lang.String getMappedWorkspaceName(java.lang.String name)
Get mapped workspace name.

Parameters:
name -
Returns:
mapped name as in repositories.xml RepositoryMapping element

addMappedRepositoryName

public static void addMappedRepositoryName(java.lang.String name,
                                           java.lang.String repositoryName)
Add a mapped repository name.

Parameters:
name -
repositoryName -

addMappedRepositoryName

public static void addMappedRepositoryName(java.lang.String name,
                                           java.lang.String repositoryName,
                                           java.lang.String workspaceName)
Add a mapped repository name.

Parameters:
name -
repositoryName -
workspaceName -

getDefaultWorkspace

public static java.lang.String getDefaultWorkspace(java.lang.String repositoryId)
Get default workspace name.

Returns:
default name if there are no workspaces defined or there is no workspace present with name "default", otherwise return same name as repository name.

getRepository

public static javax.jcr.Repository getRepository(java.lang.String repositoryID)
Returns repository specified by the repositoryID as configured in repository config.


getRepositoryProvider

public static Provider getRepositoryProvider(java.lang.String repositoryID)
Returns repository provider specified by the repositoryID as configured in repository config.


getRepositoryMapping

public static RepositoryMapping getRepositoryMapping(java.lang.String repositoryID)
returns repository mapping as configured.


hasRepositoryMapping

public static boolean hasRepositoryMapping(java.lang.String repositoryID)
Returns true if a mapping for the given repository name does exist.


getAllRepositoryNames

public static java.util.Iterator getAllRepositoryNames()
Gets repository names array as configured in repositories.xml.

Returns:
repository names

getInternalWorkspaceName

public static java.lang.String getInternalWorkspaceName(java.lang.String workspaceName)
get internal workspace name.

Parameters:
workspaceName -
Returns:
workspace name as configured in magnolia repositories.xml


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