public class RepositoryConfig extends Object implements FileSystemFactory, DataStoreFactory, QueryHandlerFactory
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 and Description |
---|
RepositoryConfig(String home,
SecurityConfig sec,
FileSystemFactory fsf,
String workspaceDirectory,
String workspaceConfigDirectory,
String defaultWorkspace,
int workspaceMaxIdleTime,
Element template,
VersioningConfig vc,
QueryHandlerFactory qhf,
ClusterConfig cc,
DataStoreFactory dsf,
RepositoryLockMechanismFactory rlf,
DataSourceConfig dsc,
ConnectionFactory cf,
RepositoryConfigurationParser parser)
Creates a repository configuration object.
|
Modifier and Type | Method and Description |
---|---|
static RepositoryConfig |
create(File dir)
Returns the configuration of a repository in a given repository
directory.
|
static RepositoryConfig |
create(File xml,
File dir)
Returns the configuration of a repository with the given configuration
file and repository home directory.
|
static RepositoryConfig |
create(InputSource xml,
Properties variables)
Parses the given repository configuration document using the given
parser variables.
|
static RepositoryConfig |
create(InputSource xml,
String home)
Convenience method that invokes the
create(InputSource, Properties) method with the given
repository home home directory path set as the ${rep.home} parser
variable. |
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(RepositoryConfig config)
Creates a repository configuration object based on an existing configuration.
|
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.
|
ConnectionFactory |
getConnectionFactory()
Returns the
ConnectionFactory for this repository. |
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. |
QueryHandler |
getQueryHandler(QueryHandlerContext context)
Returns the initialized query handler, or
null if one
has not been configured. |
static File |
getRepositoryHome(Properties variables) |
RepositoryLockMechanism |
getRepositoryLockMechanism()
Creates and returns the configured repository lock mechanism.
|
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<WorkspaceConfig> |
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.
|
static RepositoryConfig |
install(File dir)
Returns the configuration of a repository in a given repository
directory.
|
static RepositoryConfig |
install(File xml,
File dir)
Returns the configuration of a repository with the given configuration
file and repository home directory.
|
static RepositoryConfig |
install(Properties variables)
Returns the configuration of a repository with the home directory,
configuration file, and other options as specified in the given
configuration parser variables.
|
boolean |
isSearchEnabled()
Checks whether search configuration is present.
|
public RepositoryConfig(String home, SecurityConfig sec, FileSystemFactory fsf, String workspaceDirectory, String workspaceConfigDirectory, String defaultWorkspace, int workspaceMaxIdleTime, Element template, VersioningConfig vc, QueryHandlerFactory qhf, ClusterConfig cc, DataStoreFactory dsf, RepositoryLockMechanismFactory rlf, DataSourceConfig dsc, ConnectionFactory cf, RepositoryConfigurationParser parser)
home
- repository home directorysec
- the security configurationfsf
- file system factoryworkspaceDirectory
- workspace root directoryworkspaceConfigDirectory
- optional workspace configuration directorydefaultWorkspace
- name of the default workspaceworkspaceMaxIdleTime
- maximum workspace idle time in secondstemplate
- workspace configuration templatevc
- versioning configurationqhf
- query handler factory for the system search managercc
- optional cluster configurationdsf
- data store factoryrlf
- the RepositoryLockMechanismFactorydsc
- the DataSource configurationcf
- the ConnectionFactory for all DatabasAware beansparser
- configuration parserpublic static RepositoryConfig install(File dir) throws IOException, ConfigurationException
The directory is created if it does not exist. If the repository configuration file does not exist, then it is created using the default Jackrabbit configuration settings.
dir
- repository home directoryConfigurationException
- on configuration errorsIOException
- If an error occurs.public static RepositoryConfig install(Properties variables) throws IOException, ConfigurationException
The directory is created if it does not exist. If the repository configuration file does not exist, then it is created using the default Jackrabbit configuration settings.
variables
- parser variablesConfigurationException
- on configuration errorsIOException
- If an error occurs.public static File getRepositoryHome(Properties variables)
public static RepositoryConfig install(File xml, File dir) throws IOException, ConfigurationException
The directory is created if it does not exist. If the repository configuration file does not exist, then it is created using the default Jackrabbit configuration settings.
xml
- the configuration file.dir
- repository home directoryConfigurationException
- on configuration errorsIOException
- If another error occurs.public static RepositoryConfig create(File dir) throws ConfigurationException
An exception is thrown if the directory does not exist or if the repository configuration file can not be read.
dir
- repository home directoryConfigurationException
- on configuration errorspublic static RepositoryConfig create(File xml, File dir) throws ConfigurationException
An exception is thrown if the directory does not exist or if the repository configuration file can not be read.
xml
- The configuration file.dir
- repository home directoryConfigurationException
- on configuration errorspublic static RepositoryConfig create(String file, String home) throws ConfigurationException
InputSource
and invokes the
create(InputSource, String)
method.file
- repository configuration file namehome
- repository home directoryConfigurationException
- on configuration errorscreate(InputSource, String)
public static RepositoryConfig create(URI uri, String home) throws ConfigurationException
InputSource
and invokes the
create(InputSource, String)
method.uri
- repository configuration URIhome
- repository home directoryConfigurationException
- on configuration errorscreate(InputSource, String)
public static RepositoryConfig create(InputStream input, String home) throws ConfigurationException
InputSource
and invokes the
create(InputSource, String)
method.input
- repository configuration input streamhome
- repository home directoryConfigurationException
- on configuration errorscreate(InputSource, String)
public static RepositoryConfig create(InputSource xml, String home) throws ConfigurationException
create(InputSource, Properties)
method with the given
repository home home directory path set as the ${rep.home} parser
variable. Also all system properties are used as parser variables.xml
- repository configuration documenthome
- repository home directoryConfigurationException
- on configuration errorspublic static RepositoryConfig create(InputSource xml, Properties variables) throws ConfigurationException
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.
xml
- repository configuration documentvariables
- parser variablesConfigurationException
- on configuration errorspublic static RepositoryConfig create(RepositoryConfig config) throws ConfigurationException
config
- repository configuration to create the new instance fromConfigurationException
- on configuration errorspublic void init() throws ConfigurationException, IllegalStateException
ConfigurationException
- on initialization errorsIllegalStateException
- if the repository configuration has already
been initializedpublic WorkspaceConfig createWorkspaceConfig(String name, StringBuffer configContent) throws ConfigurationException
name
- workspace nameconfigContent
- optional StringBuffer that will have the content
of workspace configuration file written inConfigurationException
- if creating the workspace configuration
failedpublic WorkspaceConfig createWorkspaceConfig(String name, InputSource template) throws ConfigurationException
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.
name
- workspace nametemplate
- the workspace templateConfigurationException
- if creating the workspace configuration
failedpublic String getHomeDir()
public FileSystem getFileSystem() throws javax.jcr.RepositoryException
getFileSystem
in interface FileSystemFactory
FileSystem
javax.jcr.RepositoryException
- if the file system can not be createdpublic String getAppName()
SecurityConfig.getAppName()
instead.public AccessManagerConfig getAccessManagerConfig()
SecurityConfig.getAccessManagerConfig()
instead.public LoginModuleConfig getLoginModuleConfig()
SecurityConfig.getLoginModuleConfig()
instead.null
if standard
JAAS mechanism should be used.public SecurityConfig getSecurityConfig()
public String getWorkspacesConfigRootDir()
public String getDefaultWorkspaceName()
public int getWorkspaceMaxIdleTime()
public Collection<WorkspaceConfig> getWorkspaceConfigs()
public WorkspaceConfig getWorkspaceConfig(String name)
name
- workspace namenull
if the named
workspace does not existpublic VersioningConfig getVersioningConfig()
public boolean isSearchEnabled()
true
if search is configured,
false
otherwisepublic QueryHandler getQueryHandler(QueryHandlerContext context) throws javax.jcr.RepositoryException
null
if one
has not been configured.getQueryHandler
in interface QueryHandlerFactory
null
javax.jcr.RepositoryException
public ClusterConfig getClusterConfig()
null
if clustering
has not been configured.null
if clustering
has not been configured.public ConnectionFactory getConnectionFactory()
ConnectionFactory
for this repository.
Please note that it must be closed explicitly.public DataStore getDataStore() throws javax.jcr.RepositoryException
null
if a data store has not been configured.getDataStore
in interface DataStoreFactory
null
javax.jcr.RepositoryException
- if the data store can not be createdpublic RepositoryLockMechanism getRepositoryLockMechanism() throws javax.jcr.RepositoryException
null
)javax.jcr.RepositoryException
- if the repository lock mechanism can not be createdCopyright © 2004-2020 The Apache Software Foundation. All Rights Reserved.