org.apache.jackrabbit.core.config
Class RepositoryConfig

java.lang.Object
  extended by org.apache.jackrabbit.core.config.RepositoryConfig
All Implemented Interfaces:
DataStoreFactory, FileSystemFactory

public class RepositoryConfig
extends Object
implements FileSystemFactory, DataStoreFactory

Repository configuration. This configuration class is used to create configured repository objects.

The contained configuration information are: the home directory and name of the repository, the access manager, file system and versioning configuration, repository index configuration, the workspace directory, the default workspace name, and the workspace configuration template. In addition the workspace configuration object keeps track of all configured workspaces.


Constructor Summary
RepositoryConfig(String home, SecurityConfig sec, FileSystemFactory fsf, String workspaceDirectory, String workspaceConfigDirectory, String defaultWorkspace, int workspaceMaxIdleTime, Element template, VersioningConfig vc, SearchConfig sc, ClusterConfig cc, DataStoreFactory dsf, RepositoryConfigurationParser parser)
          Creates a repository configuration object.
 
Method Summary
static RepositoryConfig create(InputSource xml, String home)
          Parses the given repository configuration document and returns the parsed and initialized repository configuration.
static RepositoryConfig create(InputStream input, String home)
          Convenience method that wraps the configuration input stream into an InputSource and invokes the create(InputSource, String) method.
static RepositoryConfig create(String file, String home)
          Convenience method that wraps the configuration file name into an InputSource and invokes the create(InputSource, String) method.
static RepositoryConfig create(URI uri, String home)
          Convenience method that wraps the configuration URI into an InputSource and invokes the create(InputSource, String) method.
 WorkspaceConfig createWorkspaceConfig(String name, InputSource template)
          Creates a new workspace configuration with the specified name.
 WorkspaceConfig createWorkspaceConfig(String name, StringBuffer configContent)
          Creates a new workspace configuration with the specified name.
 AccessManagerConfig getAccessManagerConfig()
          Deprecated. Use SecurityConfig.getAccessManagerConfig() instead.
 String getAppName()
          Deprecated. Use SecurityConfig.getAppName() instead.
 ClusterConfig getClusterConfig()
          Returns the cluster configuration.
 DataStore getDataStore()
          Creates and returns the configured data store.
 String getDefaultWorkspaceName()
          Returns the name of the default workspace.
 FileSystem getFileSystem()
          Creates and returns the configured repository file system.
 String getHomeDir()
          Returns the repository home directory.
 LoginModuleConfig getLoginModuleConfig()
          Deprecated. Use SecurityConfig.getLoginModuleConfig() instead.
 SearchConfig getSearchConfig()
          Returns the system search index configuration.
 SecurityConfig getSecurityConfig()
          Returns the repository security configuration.
 VersioningConfig getVersioningConfig()
          Returns the repository versioning configuration.
 WorkspaceConfig getWorkspaceConfig(String name)
          Returns the configuration of the specified workspace.
 Collection getWorkspaceConfigs()
          Returns all workspace configurations.
 int getWorkspaceMaxIdleTime()
          Returns the amount of time in seconds after which an idle workspace is automatically shutdown.
 String getWorkspacesConfigRootDir()
          Returns the workspace root directory.
 void init()
          Initializes the repository configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RepositoryConfig

public RepositoryConfig(String home,
                        SecurityConfig sec,
                        FileSystemFactory fsf,
                        String workspaceDirectory,
                        String workspaceConfigDirectory,
                        String defaultWorkspace,
                        int workspaceMaxIdleTime,
                        Element template,
                        VersioningConfig vc,
                        SearchConfig sc,
                        ClusterConfig cc,
                        DataStoreFactory dsf,
                        RepositoryConfigurationParser parser)
Creates a repository configuration object.

Parameters:
home - repository home directory
sec - the security configuration
fsf - file system factory
workspaceDirectory - workspace root directory
workspaceConfigDirectory - optional workspace configuration directory
defaultWorkspace - name of the default workspace
workspaceMaxIdleTime - maximum workspace idle time in seconds
template - workspace configuration template
vc - versioning configuration
sc - search configuration for system search manager.
cc - optional cluster configuration
dsf - data store factory
parser - configuration parser
Method Detail

create

public static RepositoryConfig create(String file,
                                      String home)
                               throws ConfigurationException
Convenience method that wraps the configuration file name into an InputSource and invokes the create(InputSource, String) method.

Parameters:
file - repository configuration file name
home - repository home directory
Returns:
repository configuration
Throws:
ConfigurationException - on configuration errors
See Also:
create(InputSource, String)

create

public static RepositoryConfig create(URI uri,
                                      String home)
                               throws ConfigurationException
Convenience method that wraps the configuration URI into an InputSource and invokes the create(InputSource, String) method.

Parameters:
uri - repository configuration URI
home - repository home directory
Returns:
repository configuration
Throws:
ConfigurationException - on configuration errors
See Also:
create(InputSource, String)

create

public static RepositoryConfig create(InputStream input,
                                      String home)
                               throws ConfigurationException
Convenience method that wraps the configuration input stream into an InputSource and invokes the create(InputSource, String) method.

Parameters:
input - repository configuration input stream
home - repository home directory
Returns:
repository configuration
Throws:
ConfigurationException - on configuration errors
See Also:
create(InputSource, String)

create

public static RepositoryConfig create(InputSource xml,
                                      String home)
                               throws ConfigurationException
Parses the given repository configuration document and returns the parsed and initialized repository configuration. The given repository home directory path will be used as the ${rep.home} parser variable.

Note that in addition to parsing the repository configuration, this method also initializes the configuration (creates the configured directories, etc.). The ConfigurationParser class should be used directly to just parse the configuration.

Parameters:
xml - repository configuration document
home - repository home directory
Returns:
repository configuration
Throws:
ConfigurationException - on configuration errors

init

public void init()
          throws ConfigurationException,
                 IllegalStateException
Initializes the repository configuration. This method loads the configurations for all available workspaces.

Throws:
ConfigurationException - on initialization errors
IllegalStateException - if the repository configuration has already been initialized

createWorkspaceConfig

public WorkspaceConfig createWorkspaceConfig(String name,
                                             StringBuffer configContent)
                                      throws ConfigurationException
Creates a new workspace configuration with the specified name. This method creates a workspace configuration subdirectory, copies the workspace configuration template into it, and finally adds the created workspace configuration to the repository. The initialized workspace configuration object is returned to the caller.

Parameters:
name - workspace name
configContent - optional StringBuffer that will have the content of workspace configuration file written in
Returns:
created workspace configuration
Throws:
ConfigurationException - if creating the workspace configuration failed

createWorkspaceConfig

public WorkspaceConfig createWorkspaceConfig(String name,
                                             InputSource template)
                                      throws ConfigurationException
Creates a new workspace configuration with the specified name. This method uses the provided workspace template to create the repository config instead of the template that is present in the repository configuration.

This method creates a workspace configuration subdirectory, copies the workspace configuration template into it, and finally adds the created workspace configuration to the repository. The initialized workspace configuration object is returned to the caller.

Parameters:
name - workspace name
template - the workspace template
Returns:
created workspace configuration
Throws:
ConfigurationException - if creating the workspace configuration failed

getHomeDir

public String getHomeDir()
Returns the repository home directory.

Returns:
repository home directory

getFileSystem

public FileSystem getFileSystem()
                         throws RepositoryException
Creates and returns the configured repository file system.

Specified by:
getFileSystem in interface FileSystemFactory
Returns:
the configured FileSystem
Throws:
RepositoryException - if the file system can not be created

getAppName

public String getAppName()
Deprecated. Use SecurityConfig.getAppName() instead.

Returns the repository name. The repository name can be used for JAAS app-entry configuration.

Returns:
repository name

getAccessManagerConfig

public AccessManagerConfig getAccessManagerConfig()
Deprecated. Use SecurityConfig.getAccessManagerConfig() instead.

Returns the repository access manager configuration.

Returns:
access manager configuration

getLoginModuleConfig

public LoginModuleConfig getLoginModuleConfig()
Deprecated. Use SecurityConfig.getLoginModuleConfig() instead.

Returns the repository login module configuration.

Returns:
login module configuration, or null if standard JAAS mechanism should be used.

getSecurityConfig

public SecurityConfig getSecurityConfig()
Returns the repository security configuration.

Returns:
security configutation

getWorkspacesConfigRootDir

public String getWorkspacesConfigRootDir()
Returns the workspace root directory.

Returns:
workspace root directory

getDefaultWorkspaceName

public String getDefaultWorkspaceName()
Returns the name of the default workspace.

Returns:
name of the default workspace

getWorkspaceMaxIdleTime

public int getWorkspaceMaxIdleTime()
Returns the amount of time in seconds after which an idle workspace is automatically shutdown. If zero then idle workspaces will never be automatically shutdown.

Returns:
maximum workspace idle time in seconds

getWorkspaceConfigs

public Collection getWorkspaceConfigs()
Returns all workspace configurations.

Returns:
workspace configurations

getWorkspaceConfig

public WorkspaceConfig getWorkspaceConfig(String name)
Returns the configuration of the specified workspace.

Parameters:
name - workspace name
Returns:
workspace configuration, or null if the named workspace does not exist

getVersioningConfig

public VersioningConfig getVersioningConfig()
Returns the repository versioning configuration.

Returns:
versioning configuration

getSearchConfig

public SearchConfig getSearchConfig()
Returns the system search index configuration. Returns null if no search index has been configured.

Returns:
search index configuration, or null

getClusterConfig

public ClusterConfig getClusterConfig()
Returns the cluster configuration. Returns null if clustering has not been configured.


getDataStore

public DataStore getDataStore()
                       throws RepositoryException
Creates and returns the configured data store. Returns null if a data store has not been configured.

Specified by:
getDataStore in interface DataStoreFactory
Returns:
the configured data store, or null
Throws:
RepositoryException - if the data store can not be created


Copyright © 2004-2008 The Apache Software Foundation. All Rights Reserved.