org.jboss.dna.repository
Class DnaEngine

java.lang.Object
  extended by org.jboss.dna.repository.DnaEngine
Direct Known Subclasses:
JcrEngine

@Immutable
public class DnaEngine
extends Object

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

See Also:
DnaConfiguration

Field Summary
static String CONFIGURATION_REPOSITORY_NAME
           
 
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.
 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.
 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.
 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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIGURATION_REPOSITORY_NAME

public static final String CONFIGURATION_REPOSITORY_NAME
See Also:
Constant Field Values
Method Detail

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

start

public void start()
Start this engine to make it available for use.

Throws:
IllegalStateException - if this method is called when already shut down.
See Also:
shutdown()

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()

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


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