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

## org.modeshape.repository
Class ModeShapeEngine

    java.lang.Object
      org.modeshape.repository.ModeShapeEngine

Direct Known Subclasses:
  JcrEngine

    @Immutable
    public class ModeShapeEngine

extends Object

A single instance of the ModeShape services, which is obtained after setting up the `configuration`.

See Also:
  `ModeShapeConfiguration`

Nested Class Summary
`protected class` | `ModeShapeEngine.ConfigurationScanner` The component responsible for reading the configuration repository and (eventually) for propagating changes in the configuration repository into the services.

Field Summary
`protected ModeShapeConfiguration.ConfigurationDefinition` | `configuration`
`static String` | `CONFIGURATION_REPOSITORY_NAME`
`protected ExecutionContext` | `context`
`static int` | `DEFAULT_GARBAGE_COLLECTION_INTERVAL_IN_SECONDS` The default interval (in seconds) for running the garbage collection sweeps, if there are sources require it.
`protected Problems` | `problems`
`protected ModeShapeEngine.ConfigurationScanner` | `scanner`

Constructor Summary
`protected` | `ModeShapeEngine(ExecutionContext context, ModeShapeConfiguration.ConfigurationDefinition configuration)`

Method Summary
`boolean` | `awaitTermination(long timeout, TimeUnit unit)` Blocks until the shutdown has completed, or the timeout occurs, or the current thread is interrupted, whichever happens first.
`protected void` | `checkConfiguration(Subgraph configuration)` Check the configuration given by the supplied graph.
`protected void` | `checkProblemsOnStartup()` Check whether there are any problems that would prevent startup.
`protected boolean` | `checkRunning()`
`protected Graph` | `getConfigurationGraph()`
`protected Subgraph` | `getConfigurationSubgraph(boolean refresh)` Get a subgraph containing the configuration content.
`ExecutionContext` | `getExecutionContext()` Get the context in which this engine is executing.
`Graph` | `getGraph(ExecutionContext context, String sourceName)` Get a graph to the underlying source, using the supplied context.
`Graph` | `getGraph(String sourceName)` Get a graph to the underlying source.
`protected MimeTypeDetector` | `getMimeTypeDetector()` Return the component that is able to detect MIME types given the name of a stream and a stream.
`Problems` | `getProblems()` Get the problems that were encountered when setting up this engine from the configuration.
`RepositoryConnectionFactory` | `getRepositoryConnectionFactory()` Get a factory of connections, backed by the RepositorySor
`RepositoryService` | `getRepositoryService()` Get the repository service.
`RepositorySource` | `getRepositorySource(String repositoryName)` Get the `RepositorySource` instance used by this engine.
`SequencingService` | `getSequencingService()` Get the sequencing service.
`protected TextExtractor` | `getTextExtractor()` Return the component that is able to extract text given content and its MIME type.
`protected Logger` | `logger()`
`protected ModeShapeConfigurationException` | `newConfigurationException(String msg)` Construct a new ModeShapeConfigurationException.
`protected ModeShapeEngine.ConfigurationScanner` | `newConfigurationScanner(Problems problems, ExecutionContext context, ModeShapeConfiguration.ConfigurationDefinition configuration)`
`protected void` | `postShutdown()`
`protected void` | `preShutdown()`
`void` | `shutdown()` Shutdown this engine to close all connections, terminate any ongoing background operations (such as sequencing), and reclaim any resources that were acquired by this engine.
`void` | `start()` Start this engine to make it available for use.
`protected void` | `startGcService()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_GARBAGE_COLLECTION_INTERVAL_IN_SECONDS

    public static final int DEFAULT_GARBAGE_COLLECTION_INTERVAL_IN_SECONDS

  The default interval (in seconds) for running the garbage collection sweeps, if there are sources require it. The default value is 600 seconds, or 10 minutes.

  See Also:
    Constant Field Values

### CONFIGURATION_REPOSITORY_NAME

    public static final String CONFIGURATION_REPOSITORY_NAME

See Also:
  Constant Field Values

### configuration

    protected final ModeShapeConfiguration.ConfigurationDefinition configuration

### scanner

    protected final ModeShapeEngine.ConfigurationScanner scanner

### problems

    protected final Problems problems

### context

    protected final ExecutionContext context

Constructor Detail

### ModeShapeEngine

    protected ModeShapeEngine(ExecutionContext context,
                              ModeShapeConfiguration.ConfigurationDefinition configuration)

Method Detail

### newConfigurationScanner

    protected ModeShapeEngine.ConfigurationScanner newConfigurationScanner(Problems problems,
                                                                           ExecutionContext context,
                                                                           ModeShapeConfiguration.ConfigurationDefinition configuration)

### logger

    protected Logger logger()

### getProblems

    public Problems getProblems()

  Get the problems that were encountered when setting up this engine from the configuration.

  Returns:
    the problems, which may be empty but will never be null

### getExecutionContext

    public final ExecutionContext getExecutionContext()

  Get the context in which this engine is executing.

  Returns:
    the execution context; never null

### getRepositorySource

    public final RepositorySource getRepositorySource(String repositoryName)

  Get the `RepositorySource` instance used by this engine.

  Parameters:
    `repositoryName` - the name of the repository source
  Returns:
    the source, or null if no source with the given name exists
  Throws:
    `IllegalStateException` - if this engine was not `started`

### getRepositoryConnectionFactory

    public final RepositoryConnectionFactory getRepositoryConnectionFactory()

  Get a factory of connections, backed by the RepositorySor

  Returns:
    the connection factory; never null
  Throws:
    `IllegalStateException` - if this engine was not `started`

### getRepositoryService

    public final RepositoryService getRepositoryService()

  Get the repository service.

  Returns:
    the repository service owned by this engine; never null
  Throws:
    `IllegalStateException` - if this engine was not `started`

### getGraph

    public final Graph getGraph(String sourceName)

  Get a graph to the underlying source.

  Parameters:
    `sourceName` - the name of the source
  Returns:
    the graph
  Throws:
    `IllegalArgumentException` - if the source name is null
    `RepositorySourceException` - if a source with the supplied name does not exist
    `IllegalStateException` - if this engine was not `started`

### getGraph

    public final Graph getGraph(ExecutionContext context,
                                String sourceName)

  Get a graph to the underlying source, using the supplied context. Note that the supplied context should be a derivative of the engine's `context`.

  Parameters:
    `context` - the context of execution for this graph; may not be null
    `sourceName` - the name of the source
  Returns:
    the graph
  Throws:
    `IllegalArgumentException` - if the context or source name are null
    `RepositorySourceException` - if a source with the supplied name does not exist
    `IllegalStateException` - if this engine was not `started`

### getSequencingService

    public final SequencingService getSequencingService()

  Get the sequencing service.

  Returns:
    the sequencing service owned by this engine; never null
  Throws:
    `IllegalStateException` - if this engine was not `started`

### getMimeTypeDetector

    protected final MimeTypeDetector getMimeTypeDetector()

  Return the component that is able to detect MIME types given the name of a stream and a stream.

  Returns:
    the MIME type detector used by this engine; never null
  Throws:
    `IllegalStateException` - if this engine was not `started`

### getTextExtractor

    protected final TextExtractor getTextExtractor()

  Return the component that is able to extract text given content and its MIME type.

  Returns:
    the text extractor used by this engine; never null
  Throws:
    `IllegalStateException` - if this engine was not `started`

### checkRunning

    protected final boolean checkRunning()

### checkProblemsOnStartup

    protected void checkProblemsOnStartup()
                                   throws ModeShapeConfigurationException

  Check whether there are any problems that would prevent startup. Any warnings or errors will be logged, and this method will throw a `ModeShapeConfigurationException` if there is at least one error.

  Throws:
    `ModeShapeConfigurationException` - if there is at least one error

### newConfigurationException

    protected ModeShapeConfigurationException newConfigurationException(String msg)

  Construct a new ModeShapeConfigurationException. This method can be overridden by subclasses when a subclass of `ModeShapeConfigurationException` is to be thrown from `start()`.

  Parameters:
    `msg` - the message
  Returns:
    the exception; may not be null

### checkConfiguration

    protected void checkConfiguration(Subgraph configuration)

  Check the configuration given by the supplied graph.

  Parameters:
    `configuration` - the configuration subgraph

### start

    public void start()

  Start this engine to make it available for use.

  Throws:
    `IllegalStateException` - if this method is called when already shut down.
    `ModeShapeConfigurationException` - if there is an error in the configuration or any of the services that prevents proper startup
  See Also:
    `shutdown()`

### startGcService

    protected void startGcService()

### shutdown

    public void shutdown()

  Shutdown this engine to close all connections, terminate any ongoing background operations (such as sequencing), and reclaim any resources that were acquired by this engine. This method may be called multiple times, but only the first time has an effect.

  See Also:
    `start()`

### preShutdown

    protected void preShutdown()

### postShutdown

    protected void postShutdown()

### awaitTermination

    public boolean awaitTermination(long timeout,
                                    TimeUnit unit)
                             throws InterruptedException

  Blocks until the shutdown has completed, or the timeout occurs, or the current thread is interrupted, whichever happens first.

  Parameters:
    `timeout` - the maximum time to wait for each component in this engine
    `unit` - the time unit of the timeout argument
  Returns:
    `true` if this service complete shut down and `false` if the timeout elapsed before it was shut down completely
  Throws:
    `InterruptedException` - if interrupted while waiting

### getConfigurationGraph

    protected Graph getConfigurationGraph()

### getConfigurationSubgraph

    protected Subgraph getConfigurationSubgraph(boolean refresh)

  Get a subgraph containing the configuration content.

  Parameters:
    `refresh` - true if the subgraph should be re-read, or false if the last cached version can be used
  Returns:
    a graph to the configuration content

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

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