@Immutable public class RepositoryConfiguration extends Object
JCR Repository
.
Each repository configuration is loaded from a JSON document. A valid
repository configuration requires
that the JSON document validates using the ModeShape repository configuration JSON Schema.
Variables may appear anywhere within the document's string field values. If a variable is to be used within a non-string field,
simply use a string field within the JSON document. When a RepositoryConfiguration instance is created from a JSON document,
these variables will be replaced with the System properties of the same name, and any resulting fields that are expected to be
non-string values will be converted into the expected field type. As expected, use validate()
to ensure the
configuration is valid.
Variables take the form:
variable := '${' variableNames [ ':' defaultValue ] '}' variableNames := variableName [ ',' variableNames ] variableName := /* any characters except ',' and ':' and '}' defaultValue := /* any characters exceptNote that variableName is the name used to look up a System property via
System.getProperty(String)
.
Notice that the syntax supports multiple variables. The logic will process the variables from let to right, until
an existing System property is found. And at that point, it will stop and will not attempt to find values for the other
variables.
Modifier and Type | Class and Description |
---|---|
class |
RepositoryConfiguration.AnonymousSecurity
The configuration of the use of the built-in anonymous authentication and authorization provider.
|
class |
RepositoryConfiguration.BinaryStorage
The binary-storage-related configuration information.
|
class |
RepositoryConfiguration.Clustering
Class holding the clustering configuration for a repository.
|
class |
RepositoryConfiguration.Component |
static class |
RepositoryConfiguration.Default |
class |
RepositoryConfiguration.DocumentOptimization |
class |
RepositoryConfiguration.Federation
The federation-related configuration information.
|
static class |
RepositoryConfiguration.FieldName |
static class |
RepositoryConfiguration.FieldValue |
class |
RepositoryConfiguration.GarbageCollection |
class |
RepositoryConfiguration.Indexes
The index-related configuration information.
|
class |
RepositoryConfiguration.InitialContent |
class |
RepositoryConfiguration.JaasSecurity
The configuration of the use of the built-in JAAS authentication and authorization provider.
|
class |
RepositoryConfiguration.Journaling |
class |
RepositoryConfiguration.MonitoringSystem
The query-related configuration information.
|
class |
RepositoryConfiguration.ProjectionConfiguration
Object representation of a projection configuration within an external source
|
class |
RepositoryConfiguration.Reindexing
The reindexing configuration information.
|
static class |
RepositoryConfiguration.ReindexingMode
Possible reindexing modes.
|
class |
RepositoryConfiguration.Security
The security-related configuration information.
|
class |
RepositoryConfiguration.Sequencing
The security-related configuration information.
|
class |
RepositoryConfiguration.TextExtraction |
Modifier and Type | Field and Description |
---|---|
protected static Pattern |
COLUMN_DEFN_PATTERN |
protected static String |
COLUMN_DEFN_PATTERN_STRING
The regular expression used to capture the index column definition property name and type.
|
protected static Set<String> |
COMPONENT_SKIP_PROPERTIES
The set of field names that should be skipped when
RepositoryConfiguration.Component.createInstance() instantiating a component}. |
protected static Map<String,String> |
CONNECTOR_ALIASES |
static String |
DEFAULT_JNDI_PREFIX_OF_NAME
The default JNDI location for repositories is "java:jcr/local/<name>", where "<name>" is the name of the repository.
|
protected static Set<List<String>> |
DEPRECATED_FIELDS |
protected static Document |
EMPTY |
protected static Map<String,String> |
EXTRACTOR_ALIASES |
static Pattern |
INDEX_COLUMN_DEFINITIONS_PATTERN |
protected static Map<String,String> |
INDEX_PROVIDER_ALIASES |
protected static Set<String> |
INDEX_PROVIDER_FIELDS |
static String |
JSON_SCHEMA_RESOURCE_PATH |
static String |
JSON_SCHEMA_URI |
static Pattern |
PROJECTION_PATH_EXPRESSION_PATTERN |
protected static Map<String,String> |
PROVIDER_ALIASES |
static String |
ROOT_NODE_ID
The standard identifier of the root node is '"/" '.
|
protected static SchemaLibrary |
SCHEMA_LIBRARY |
protected static Map<String,String> |
SEQUENCER_ALIASES |
static String |
SYSTEM_WORKSPACE_NAME
The name of the 'system' workspace.
|
Constructor and Description |
---|
RepositoryConfiguration() |
RepositoryConfiguration(Document document,
String documentName) |
RepositoryConfiguration(Document document,
String documentName,
Environment environment) |
RepositoryConfiguration(String name) |
RepositoryConfiguration(String name,
Environment environment) |
Modifier and Type | Method and Description |
---|---|
Editor |
edit()
Make a clone of this configuration and return an editor for changing that clone.
|
protected Environment |
environment() |
Set<String> |
getAllWorkspaceNames()
Obtain all of the workspace names specified by this repository, including the
predefined workspaces and the default workspace . |
RepositoryConfiguration.BinaryStorage |
getBinaryStorage() |
static String |
getBuiltInIndexProviderClassName(String alias)
Returns a fully qualified built-in index provider class name mapped to the given alias, or
null if there isn't such
a mapping |
static String |
getBuiltInSequencerClassName(String alias)
Returns a fully qualified built-in sequencer class name mapped to the given alias, or
null if there isn't such a
mapping |
static String |
getBuiltInTextExtractorClassName(String alias)
Returns a fully qualified built-in text extractor class name mapped to the given alias, or
null if there isn't such
a mapping |
RepositoryConfiguration.Clustering |
getClustering() |
String |
getDefaultWorkspaceName()
Get the name of the workspace that should be used for sessions where the client does not specify the name of the workspace.
|
Document |
getDocument() |
RepositoryConfiguration.DocumentOptimization |
getDocumentOptimization()
Get the configuration for the document optimization for this repository.
|
int |
getEventBusSize() |
RepositoryConfiguration.Federation |
getFederation()
Get the configuration for the federation-related aspects of this repository.
|
RepositoryConfiguration.GarbageCollection |
getGarbageCollection()
Get the configuration for the garbage collection aspects of this repository.
|
RepositoryConfiguration.Indexes |
getIndexes()
Get the configuration for the indexes used by this repository.
|
List<RepositoryConfiguration.Component> |
getIndexProviders()
Get the ordered list of index providers defined in the configuration.
|
RepositoryConfiguration.InitialContent |
getInitialContent()
Returns the initial content configuration for this repository configuration
|
String |
getJndiName() |
RepositoryConfiguration.Journaling |
getJournaling()
Returns the journaling configuration
|
long |
getLockTimeoutMillis() |
RepositoryConfiguration.MonitoringSystem |
getMonitoring()
Get the configuration for the monitoring-related aspects of this repository.
|
String |
getName() |
List<String> |
getNodeTypes()
Returns a list with the cnd files which should be loaded at startup.
|
Document |
getPersistenceConfiguration() |
Set<String> |
getPredefinedWorkspaceNames()
Obtain the names of the workspaces that were listed as being predefined.
|
RepositoryConfiguration.Reindexing |
getReindexing()
Returns the reindexing configuration.
|
RepositoryConfiguration.Security |
getSecurity()
Get the configuration for the security-related aspects of this repository.
|
RepositoryConfiguration.Sequencing |
getSequencing()
Get the configuration for the sequencing-related aspects of this repository.
|
RepositoryConfiguration.TextExtraction |
getTextExtraction()
Get the configuration for the text extraction aspects of this repository.
|
TransactionManagerLookup |
getTransactionManagerLookup() |
int |
getWorkspaceCacheSize() |
protected boolean |
hasIndexProvider(String name) |
boolean |
isCreatingWorkspacesAllowed() |
static RepositoryConfiguration |
read(File file)
Read the supplied JSON file and parse into a
RepositoryConfiguration . |
static RepositoryConfiguration |
read(InputStream stream,
String name)
Read the supplied stream containing a JSON file, and parse into a
RepositoryConfiguration . |
static RepositoryConfiguration |
read(String resourcePathOrJsonContentString)
Read the repository configuration given by the supplied path to a file on the file system, the path a classpath resource
file, or a string containg the actual JSON content.
|
static RepositoryConfiguration |
read(URL url)
Resolve the supplied URL to a JSON document, read the contents, and parse into a
RepositoryConfiguration . |
protected List<RepositoryConfiguration.Component> |
readComponents(Document doc,
String fieldName,
String aliasFieldName,
Map<String,String> classnamesByAlias,
Problems problems) |
protected static Document |
replaceSystemPropertyVariables(Document doc)
Utility method to replace all system property variables found within the specified document.
|
String |
toString() |
Problems |
validate()
Validate this configuration against the JSON Schema.
|
Problems |
validate(Changes changes)
Validate this configuration if the supplied changes were made to this.
|
protected void |
validateIndexProviders(Problems problems) |
protected void |
warnUseOfDeprecatedFields(SimpleProblems problems) |
RepositoryConfiguration |
with(Environment environment)
Create a copy of this configuration that uses the supplied environment.
|
RepositoryConfiguration |
withName(String docName)
Create a copy of this configuration that uses the supplied document name.
|
public static final String ROOT_NODE_ID
public static final String SYSTEM_WORKSPACE_NAME
public static final String DEFAULT_JNDI_PREFIX_OF_NAME
public static final Pattern PROJECTION_PATH_EXPRESSION_PATTERN
public static final Pattern INDEX_COLUMN_DEFINITIONS_PATTERN
protected static final Document EMPTY
protected static SchemaLibrary SCHEMA_LIBRARY
public static final String JSON_SCHEMA_URI
public static final String JSON_SCHEMA_RESOURCE_PATH
protected static final Set<String> COMPONENT_SKIP_PROPERTIES
RepositoryConfiguration.Component.createInstance()
instantiating a component}.protected static final String COLUMN_DEFN_PATTERN_STRING
([^(,]+)[(]([^),]+)[)]
".protected static final Pattern COLUMN_DEFN_PATTERN
public RepositoryConfiguration()
public RepositoryConfiguration(String name)
public RepositoryConfiguration(String name, Environment environment)
public RepositoryConfiguration(Document document, String documentName, Environment environment)
protected static Document replaceSystemPropertyVariables(Document doc)
doc
- the document; may not be nulldoc
instance if no such
variables were foundpublic static RepositoryConfiguration read(URL url) throws ParsingException
RepositoryConfiguration
.url
- the URL; may not be nullParsingException
- if the content could not be parsed as a valid JSON documentpublic static RepositoryConfiguration read(File file) throws ParsingException, FileNotFoundException
RepositoryConfiguration
.file
- the file; may not be nullParsingException
- if the content could not be parsed as a valid JSON documentFileNotFoundException
- if the file could not be foundpublic static RepositoryConfiguration read(InputStream stream, String name) throws ParsingException, FileNotFoundException
RepositoryConfiguration
.stream
- the file; may not be nullname
- the name of the resource; may not be nullParsingException
- if the content could not be parsed as a valid JSON documentFileNotFoundException
- if the file could not be foundpublic static RepositoryConfiguration read(String resourcePathOrJsonContentString) throws ParsingException, FileNotFoundException
resourcePathOrJsonContentString
- the path to a file on the file system, the path to a classpath resource file or the
JSON content string; may not be nullParsingException
- if the content could not be parsed as a valid JSON documentFileNotFoundException
- if the file could not be foundprotected Environment environment()
public String getName()
public Document getDocument()
public String getJndiName()
public Document getPersistenceConfiguration()
public long getLockTimeoutMillis()
public TransactionManagerLookup getTransactionManagerLookup()
public int getWorkspaceCacheSize()
public RepositoryConfiguration.Clustering getClustering()
public RepositoryConfiguration.BinaryStorage getBinaryStorage()
public RepositoryConfiguration.Journaling getJournaling()
RepositoryConfiguration.Journaling
instance, never null
public RepositoryConfiguration.InitialContent getInitialContent()
non-null
RepositoryConfiguration.InitialContent
public RepositoryConfiguration.Reindexing getReindexing()
RepositoryConfiguration.Reindexing
instance, never null
.public List<String> getNodeTypes()
non-null
string listpublic static String getBuiltInSequencerClassName(String alias)
null
if there isn't such a
mappingalias
- the aliaspublic static String getBuiltInIndexProviderClassName(String alias)
null
if there isn't such
a mappingalias
- the aliaspublic static String getBuiltInTextExtractorClassName(String alias)
null
if there isn't such
a mappingalias
- the aliaspublic boolean isCreatingWorkspacesAllowed()
public int getEventBusSize()
public String getDefaultWorkspaceName()
public Set<String> getPredefinedWorkspaceNames()
default workspace
.public Set<String> getAllWorkspaceNames()
predefined workspaces
and the default workspace
. The result does not contain the
names of any dynamically-created workspaces (e.g., those not specified in the configuration).public RepositoryConfiguration.Security getSecurity()
public RepositoryConfiguration.MonitoringSystem getMonitoring()
public List<RepositoryConfiguration.Component> getIndexProviders()
protected void validateIndexProviders(Problems problems)
public RepositoryConfiguration.Indexes getIndexes()
protected boolean hasIndexProvider(String name)
public RepositoryConfiguration.TextExtraction getTextExtraction()
public RepositoryConfiguration.Sequencing getSequencing()
public RepositoryConfiguration.Federation getFederation()
public RepositoryConfiguration.GarbageCollection getGarbageCollection()
public RepositoryConfiguration.DocumentOptimization getDocumentOptimization()
protected List<RepositoryConfiguration.Component> readComponents(Document doc, String fieldName, String aliasFieldName, Map<String,String> classnamesByAlias, Problems problems)
public String toString()
toString
in class Object
Object.toString()
public Editor edit()
changes
. After all changes are completed, the editor (which
represents the newly modified configuration) can be used to create a
new RepositoryConfiguration
, or the
editor's changes
can be used to update an already deployed (and running) repository.
For example, the following code shows how an existing RepositoryConfiguration instance can be used to create a second configuration that is a slightly-modified copy of the original.
Also, the following code shows how an existing RepositoryConfiguration instance for a deployed repository can be updated:
ModeShapeEngine engine = ... Repository deployed = engine.getRepository("repo"); RepositoryConfiguration deployedConfig = deployed.getConfiguration(); // Create an editor ... Editor editor = deployedConfig.edit(); // Modify the copy of the configuration (we'll do something trivial here) ... editor.setNumber(FieldName.LARGE_VALUE_SIZE_IN_BYTES,8096); // Get the changes and validate them ... Changes changes = editor.getChanges(); Results validationResults = deployedConfig.validate(changes); if ( validationResults.hasErrors() ) { // do something } else { // Update the deployed repository's configuration with these changes ... engine.update("repo",changes); }
validate(Changes)
public Problems validate()
validate(Changes)
public Problems validate(Changes changes)
changes
- the proposed changes to this configuration's underlying document; never nulledit()
,
validate()
public RepositoryConfiguration with(Environment environment)
environment
- the environment that should be used for the repository; may be nullpublic RepositoryConfiguration withName(String docName)
docName
- the new document name; may be nullprotected void warnUseOfDeprecatedFields(SimpleProblems problems)
Copyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.