info.magnolia.cms.beans.config
Class ContentRepository

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

public final class ContentRepository
extends Object

TODO needs serious refactoring and cleanup.

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

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

See Also:
Constant Field Values

USERS

public static final String USERS
See Also:
Constant Field Values

USER_ROLES

public static final String USER_ROLES
See Also:
Constant Field Values

USER_GROUPS

public static final String USER_GROUPS
See Also:
Constant Field Values

CONFIG

public static final String CONFIG
See Also:
Constant Field Values

DEFAULT_WORKSPACE

public static final String DEFAULT_WORKSPACE
See Also:
Constant Field Values

VERSION_STORE

public static final String VERSION_STORE
See Also:
Constant Field Values

NAMESPACE_PREFIX

public static final String NAMESPACE_PREFIX
magnolia namespace.

See Also:
Constant Field Values

NAMESPACE_URI

public static final String NAMESPACE_URI
See Also:
Constant Field Values

REPOSITORY_USER

public static String REPOSITORY_USER
repository user.


REPOSITORY_PSWD

public static 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(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,
                                  InstantiationException,
                                  IllegalAccessException,
                                  ClassNotFoundException
This method initializes the repository. You must not call this method twice.

Parameters:
map -
Throws:
RepositoryNotInitializedException
InstantiationException
IllegalAccessException
ClassNotFoundException

loadWorkspace

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

getParentRepositoryName

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

Throws:
javax.jcr.RepositoryException

getMappedRepositoryName

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

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

getMappedWorkspaceName

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

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

addMappedRepositoryName

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

Parameters:
name -
repositoryName -

addMappedRepositoryName

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

Parameters:
name -
repositoryName -
workspaceName -

getDefaultWorkspace

public static String getDefaultWorkspace(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(String repositoryID)
Returns repository specified by the repositoryID as configured in repository config.


getRepositoryProvider

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


getRepositoryMapping

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


hasRepositoryMapping

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


getAllRepositoryNames

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

Returns:
repository names

getInternalWorkspaceName

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

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


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