|
ModeShape Distribution 3.0.0.Beta4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.modeshape.jcr.RepositoryConfiguration
@Immutable public class RepositoryConfiguration
A representation of the configuration for a 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.
Nested Class Summary | |
---|---|
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
|
static class |
RepositoryConfiguration.FieldName
|
static class |
RepositoryConfiguration.FieldValue
|
static class |
RepositoryConfiguration.FileSystemAccessType
|
static class |
RepositoryConfiguration.FileSystemLockingStrategy
|
static class |
RepositoryConfiguration.IndexingMode
|
static class |
RepositoryConfiguration.IndexReaderStrategy
|
class |
RepositoryConfiguration.JaasSecurity
The configuration of the use of the built-in JAAS authentication and authorization provider. |
class |
RepositoryConfiguration.MonitoringSystem
The query-related configuration information. |
static class |
RepositoryConfiguration.QueryRebuild
Possible options for rebuilding the indexes upon startup. |
class |
RepositoryConfiguration.QuerySystem
The query-related configuration information. |
class |
RepositoryConfiguration.Security
The security-related configuration information. |
class |
RepositoryConfiguration.Sequencing
The security-related configuration information. |
class |
RepositoryConfiguration.TextExtracting
|
static class |
RepositoryConfiguration.TransactionMode
Possible options for rebuilding the indexes upon startup. |
Field Summary | |
---|---|
protected static Set<String> |
COMPONENT_SKIP_PROPERTIES
The set of field names that should be skipped when instantiating a component . |
static RepositoryConfiguration |
DEFAULT_CONFIGURATION
An empty RepositoryConfiguration that uses all the defaults. |
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 Document |
EMPTY
|
protected static Map<String,String> |
EXTRACTOR_ALIASES
|
protected static boolean |
JGROUPS_PRESENT
Flag which is used to determine whether clustering should be enabled or not |
static String |
JSON_SCHEMA_RESOURCE_PATH
|
static String |
JSON_SCHEMA_URI
|
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 Summary | |
---|---|
RepositoryConfiguration()
|
|
RepositoryConfiguration(Document document,
String documentName)
|
|
RepositoryConfiguration(Document document,
String documentName,
Environment environment)
|
|
RepositoryConfiguration(String name)
|
|
RepositoryConfiguration(String name,
Environment environment)
|
Method Summary | |
---|---|
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 |
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 |
String |
getCacheConfiguration()
|
protected org.infinispan.manager.CacheContainer |
getCacheContainer(String config)
|
String |
getCacheName()
|
protected Class<? extends org.infinispan.transaction.lookup.TransactionManagerLookup> |
getCacheTransactionManagerLookupClass()
|
String |
getCacheTransactionManagerLookupClassName()
|
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()
|
String |
getJndiName()
|
RepositoryConfiguration.MonitoringSystem |
getMonitoring()
Get the configuration for the monitoring-related aspects of this repository. |
String |
getName()
|
Set<String> |
getPredefinedWorkspaceNames()
Obtain the names of the workspaces that were listed as being predefined. |
RepositoryConfiguration.QuerySystem |
getQuery()
Get the configuration for the query-related aspects of this repository. |
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. |
String |
getStoreName()
|
RepositoryConfiguration.TransactionMode |
getTransactionMode()
|
String |
getWorkspaceCacheConfiguration()
|
boolean |
isCreatingWorkspacesAllowed()
|
protected Context |
jndiContext()
|
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 Map<String,Object> |
readProperties(Document document,
String... skipFieldNames)
|
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. |
RepositoryConfiguration |
with(Environment environment)
Create a copy of this configuration that uses the supplied Infinispan CacheContainer instance. |
RepositoryConfiguration |
withName(String docName)
Create a copy of this configuration that uses the supplied document name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String ROOT_NODE_ID
public static final String SYSTEM_WORKSPACE_NAME
public static final String DEFAULT_JNDI_PREFIX_OF_NAME
protected static final Document EMPTY
protected static final Map<String,String> PROVIDER_ALIASES
protected static final Map<String,String> SEQUENCER_ALIASES
protected static final Map<String,String> EXTRACTOR_ALIASES
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
instantiating a component
.
protected static final boolean JGROUPS_PRESENT
public static final RepositoryConfiguration DEFAULT_CONFIGURATION
RepositoryConfiguration
that uses all the defaults.
Constructor Detail |
---|
public RepositoryConfiguration()
public RepositoryConfiguration(String name)
public RepositoryConfiguration(Document document, String documentName)
public RepositoryConfiguration(String name, Environment environment)
public RepositoryConfiguration(Document document, String documentName, Environment environment)
Method Detail |
---|
protected static Document replaceSystemPropertyVariables(Document doc)
doc
- the document; may not be null
doc
instance if no such
variables were foundpublic static RepositoryConfiguration read(URL url) throws ParsingException
RepositoryConfiguration
.
url
- the URL; may not be null
ParsingException
- 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 null
ParsingException
- if the content could not be parsed as a valid JSON document
FileNotFoundException
- 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 null
ParsingException
- if the content could not be parsed as a valid JSON document
FileNotFoundException
- 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 null
ParsingException
- if the content could not be parsed as a valid JSON document
FileNotFoundException
- if the file could not be foundprotected Environment environment()
public String getName()
public Document getDocument()
public String getJndiName()
public String getStoreName()
public String getCacheName()
public String getCacheConfiguration()
public String getCacheTransactionManagerLookupClassName()
public String getWorkspaceCacheConfiguration()
protected org.infinispan.manager.CacheContainer getCacheContainer(String config) throws IOException, NamingException
IOException
NamingException
protected Class<? extends org.infinispan.transaction.lookup.TransactionManagerLookup> getCacheTransactionManagerLookupClass()
public RepositoryConfiguration.BinaryStorage getBinaryStorage()
public RepositoryConfiguration.Clustering getClustering()
public static String getBuiltInSequencerClassName(String alias)
null
if there isn't such a
mapping
alias
- the alias
public static String getBuiltInTextExtractorClassName(String alias)
null
if there isn't such
a mapping
alias
- the alias
public boolean isCreatingWorkspacesAllowed()
public RepositoryConfiguration.TransactionMode getTransactionMode()
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 RepositoryConfiguration.QuerySystem getQuery()
public RepositoryConfiguration.Sequencing getSequencing()
protected List<RepositoryConfiguration.Component> readComponents(Document doc, String fieldName, String aliasFieldName, Map<String,String> classnamesByAlias, Problems problems)
protected Map<String,Object> readProperties(Document document, String... skipFieldNames)
protected Context jndiContext() throws NamingException
NamingException
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 null
edit()
,
validate()
public RepositoryConfiguration with(Environment environment)
CacheContainer
instance.
environment
- the environment that should be used for the repository; may be null
public RepositoryConfiguration withName(String docName)
docName
- the new document name; may be null
|
ModeShape Distribution 3.0.0.Beta4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |