Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha6
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.jcr
Class RepositoryConfiguration

    java.lang.Object
      org.modeshape.jcr.RepositoryConfiguration

    @Immutable
    public class RepositoryConfiguration

extends Object

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 except

Note 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.
`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()`
`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

### ROOT_NODE_ID

    public static final String ROOT_NODE_ID

  The standard identifier of the root node is '"/" '.

  See Also:
    Constant Field Values

### SYSTEM_WORKSPACE_NAME

    public static final String SYSTEM_WORKSPACE_NAME

  The name of the 'system' workspace.

  See Also:
    Constant Field Values

### DEFAULT_JNDI_PREFIX_OF_NAME

    public static final 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.

  See Also:
    Constant Field Values

### EMPTY

    protected static final Document EMPTY

### PROVIDER_ALIASES

    protected static final Map<String,String> PROVIDER_ALIASES

### SEQUENCER_ALIASES

    protected static final Map<String,String> SEQUENCER_ALIASES

### EXTRACTOR_ALIASES

    protected static final Map<String,String> EXTRACTOR_ALIASES

### SCHEMA_LIBRARY

    protected static SchemaLibrary SCHEMA_LIBRARY

### JSON_SCHEMA_URI

    public static final String JSON_SCHEMA_URI

See Also:
  Constant Field Values

### JSON_SCHEMA_RESOURCE_PATH

    public static final String JSON_SCHEMA_RESOURCE_PATH

See Also:
  Constant Field Values

### COMPONENT_SKIP_PROPERTIES

    protected static final Set<String> COMPONENT_SKIP_PROPERTIES

  The set of field names that should be skipped when `instantiating a component`.

### JGROUPS_PRESENT

    protected static final boolean JGROUPS_PRESENT

  Flag which is used to determine whether clustering should be enabled or not

### DEFAULT_CONFIGURATION

    public static final RepositoryConfiguration DEFAULT_CONFIGURATION

  An empty `RepositoryConfiguration` that uses all the defaults.

Constructor Detail

### RepositoryConfiguration

    public RepositoryConfiguration()

### RepositoryConfiguration

    public RepositoryConfiguration(String name)

### RepositoryConfiguration

    public RepositoryConfiguration(Document document,
                                   String documentName)

### RepositoryConfiguration

    public RepositoryConfiguration(String name,
                                   Environment environment)

### RepositoryConfiguration

    public RepositoryConfiguration(Document document,
                                   String documentName,
                                   Environment environment)

Method Detail

### replaceSystemPropertyVariables

    protected static Document replaceSystemPropertyVariables(Document doc)

  Utility method to replace all system property variables found within the specified document.

  Parameters:
    `doc` - the document; may not be null
  Returns:
    the modified document if system property variables were found, or the `doc` instance if no such variables were found

### read

    public static RepositoryConfiguration read(URL url)
                                        throws ParsingException

  Resolve the supplied URL to a JSON document, read the contents, and parse into a `RepositoryConfiguration`.

  Parameters:
    `url` - the URL; may not be null
  Returns:
    the parsed repository configuration; never null
  Throws:
    `ParsingException` - if the content could not be parsed as a valid JSON document

### read

    public static RepositoryConfiguration read(File file)
                                        throws ParsingException,
                                               FileNotFoundException

  Read the supplied JSON file and parse into a `RepositoryConfiguration`.

  Parameters:
    `file` - the file; may not be null
  Returns:
    the parsed repository configuration; never null
  Throws:
    `ParsingException` - if the content could not be parsed as a valid JSON document
    `FileNotFoundException` - if the file could not be found

### read

    public static RepositoryConfiguration read(InputStream stream,
                                               String name)
                                        throws ParsingException,
                                               FileNotFoundException

  Read the supplied stream containing a JSON file, and parse into a `RepositoryConfiguration`.

  Parameters:
    `stream` - the file; may not be null
    `name` - the name of the resource; may not be null
  Returns:
    the parsed repository configuration; never null
  Throws:
    `ParsingException` - if the content could not be parsed as a valid JSON document
    `FileNotFoundException` - if the file could not be found

### read

    public static RepositoryConfiguration read(String resourcePathOrJsonContentString)
                                        throws ParsingException,
                                               FileNotFoundException

  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.

  Parameters:
    `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
  Returns:
    the parsed repository configuration; never null
  Throws:
    `ParsingException` - if the content could not be parsed as a valid JSON document
    `FileNotFoundException` - if the file could not be found

### environment

    protected Environment environment()

### getName

    public String getName()

### getDocument

    public Document getDocument()

### getJndiName

    public String getJndiName()

### getStoreName

    public String getStoreName()

### getCacheName

    public String getCacheName()

### getCacheConfiguration

    public String getCacheConfiguration()

### getCacheTransactionManagerLookupClassName

    public String getCacheTransactionManagerLookupClassName()

### getCacheContainer

    protected org.infinispan.manager.CacheContainer getCacheContainer(String config)
                                                               throws IOException,
                                                                      NamingException

  Throws:
    `IOException`
    `NamingException`

### getCacheTransactionManagerLookupClass

    protected Class<? extends org.infinispan.transaction.lookup.TransactionManagerLookup> getCacheTransactionManagerLookupClass()

### getBinaryStorage

    public RepositoryConfiguration.BinaryStorage getBinaryStorage()

### getClustering

    public RepositoryConfiguration.Clustering getClustering()

### getBuiltInSequencerClassName

    public 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

  Parameters:
    `alias` - the alias
  Returns:
    the name of the sequencer class, or null if the alias did not correspond to a built-in class

### getBuiltInTextExtractorClassName

    public 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

  Parameters:
    `alias` - the alias
  Returns:
    the name of the text extractor class, or null if the alias did not correspond to a built-in class

### isCreatingWorkspacesAllowed

    public boolean isCreatingWorkspacesAllowed()

### getTransactionMode

    public RepositoryConfiguration.TransactionMode getTransactionMode()

### getDefaultWorkspaceName

    public 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.

  Returns:
    the default workspace name; never null

### getPredefinedWorkspaceNames

    public Set<String> getPredefinedWorkspaceNames()

  Obtain the names of the workspaces that were listed as being predefined. This includes the name `default workspace`.

  Returns:
    the set of predefined (non-system) workspace names; never null

### getAllWorkspaceNames

    public Set<String> getAllWorkspaceNames()

  Obtain all of the workspace names specified by this repository, including the `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).

  Returns:
    the set of all workspace names defined by the configuration; never null

### getSecurity

    public RepositoryConfiguration.Security getSecurity()

  Get the configuration for the security-related aspects of this repository.

  Returns:
    the security configuration; never null

### getMonitoring

    public RepositoryConfiguration.MonitoringSystem getMonitoring()

  Get the configuration for the monitoring-related aspects of this repository.

  Returns:
    the monitoring configuration; never null

### getQuery

    public RepositoryConfiguration.QuerySystem getQuery()

  Get the configuration for the query-related aspects of this repository.

  Returns:
    the query configuration; never null

### getSequencing

    public RepositoryConfiguration.Sequencing getSequencing()

  Get the configuration for the sequencing-related aspects of this repository.

  Returns:
    the sequencing configuration; never null

### readComponents

    protected List<RepositoryConfiguration.Component> readComponents(Document doc,
                                                                     String fieldName,
                                                                     String aliasFieldName,
                                                                     Map<String,String> classnamesByAlias,
                                                                     Problems problems)

### readProperties

    protected Map<String,Object> readProperties(Document document,
                                                String... skipFieldNames)

### jndiContext

    protected Context jndiContext()
                           throws NamingException

  Throws:
    `NamingException`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`
  See Also:
    `Object.toString()`

### edit

    public Editor edit()

  Make a clone of this configuration and return an editor for changing that clone. As the editor is used to alter the cloned configuration, the editor records the `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);
         }

  Returns:
    an editor for modifying a copy of this repository configuration.
  See Also:
    `validate(Changes)`

### validate

    public Problems validate()

  Validate this configuration against the JSON Schema.

  Returns:
    the validation results; never null
  See Also:
    `validate(Changes)`

### validate

    public Problems validate(Changes changes)

  Validate this configuration if the supplied changes were made to this. Note that this does not actually change this configuration.

  Parameters:
    `changes` - the proposed changes to this configuration's underlying document; never null
  Returns:
    the validation results; never null
  See Also:
    `edit()`, `validate()`

### with

    public RepositoryConfiguration with(Environment environment)

  Create a copy of this configuration that uses the supplied Infinispan `CacheContainer` instance.

  Parameters:
    `environment` - the environment that should be used for the repository; may be null
  Returns:
    the new configuration; never null

### withName

    public RepositoryConfiguration withName(String docName)

  Create a copy of this configuration that uses the supplied document name.

  Parameters:
    `docName` - the new document name; may be null
  Returns:
    the new configuration; never null

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha6
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.