org.jboss.dna.jcr
Class JcrConfiguration

java.lang.Object
  extended by org.jboss.dna.jcr.JcrConfiguration
All Implemented Interfaces:
Configurator.Builder<JcrEngine>, Configurator.Initializer<JcrConfiguration>, Configurator.MimeDetectorConfigurator<JcrConfiguration>, Configurator.RepositoryConfigurator<JcrConfiguration>

public class JcrConfiguration
extends Object
implements Configurator.Initializer<JcrConfiguration>, Configurator.RepositoryConfigurator<JcrConfiguration>, Configurator.MimeDetectorConfigurator<JcrConfiguration>, Configurator.Builder<JcrEngine>

A configuration builder for a JcrEngine. This class is an internal domain-specific language (DSL), and is designed to be used in a traditional way or in a method-chained manner:

 configuration.addRepository("Source1").usingClass(InMemoryRepositorySource.class).describedAs("description");
 configuration.addMimeTypeDetector("detector")
              .usingClass(ExtensionBasedMimeTypeDetector.class)
              .describedAs("default detector");
 configuration.addSequencer("MicrosoftDocs")
              .usingClass("org.jboss.dna.sequencer.msoffice.MSOfficeMetadataSequencer")
              .loadedFromClasspath()
              .named("Microsoft Document sequencer")
              .describedAs("Our primary sequencer for all .doc files")
              .sequencingFrom("/public//(*.(doc|xml|ppt)[*]/jcr:content[@jcr:data]")
              .andOutputtingTo("/documents/$1");
 configuration.save();
 


Constructor Summary
JcrConfiguration()
          Create a new configuration for DNA.
JcrConfiguration(ExecutionContext context)
          Specify a new ExecutionContext that should be used for this DNA instance.
 
Method Summary
 Configurator.ChooseClass<MimeTypeDetector,Configurator.MimeTypeDetectorDetails<JcrConfiguration>> addMimeTypeDetector(String id)
          Add a new MIME type detector to this configuration.
 JcrConfiguration addRepository(RepositorySource source)
          Add a new repository for this configuration.
 Configurator.ChooseClass<RepositorySource,Configurator.RepositoryDetails<JcrConfiguration>> addRepository(String id)
          Add a new repository for this configuration.
 JcrEngine build()
          Complete this configuration and create the corresponding engine.
 ExecutionContext getExecutionContext()
          Get the execution context used by this configurator.
 JcrConfiguration save()
          Save any changes that have been made so far to the configuration.
 Configurator.ChooseClass<RepositorySource,Configurator.ConfigRepositoryDetails<JcrConfiguration>> withConfigurationRepository()
          Specify that this configuration should use a particular RepositorySource for its configuration repository.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JcrConfiguration

public JcrConfiguration()
Create a new configuration for DNA.


JcrConfiguration

public JcrConfiguration(ExecutionContext context)
Specify a new ExecutionContext that should be used for this DNA instance.

Parameters:
context - the new context, or null if a default-constructed execution context should be used
Throws:
IllegalArgumentException - if the supplied context reference is null
Method Detail

getExecutionContext

public final ExecutionContext getExecutionContext()
Get the execution context used by this configurator.

Returns:
the execution context; never null

withConfigurationRepository

public Configurator.ChooseClass<RepositorySource,Configurator.ConfigRepositoryDetails<JcrConfiguration>> withConfigurationRepository()
Specify that this configuration should use a particular RepositorySource for its configuration repository. By default each configuration uses an internal transient repository for its configuration, but using this method will make the configuration use a different repository (that is perhaps shared with other processes).

Specified by:
withConfigurationRepository in interface Configurator.Initializer<JcrConfiguration>
Returns:
the interface for choosing the class, which returns the interface used to configure the repository source that will be used for the configuration repository; never null
See Also:
Configurator.Initializer.withConfigurationRepository()

addRepository

public Configurator.ChooseClass<RepositorySource,Configurator.RepositoryDetails<JcrConfiguration>> addRepository(String id)
Add a new repository for this configuration. The new repository will have the supplied name, and if the name of an existing repository is used, this will replace the existing repository configuration.

Specified by:
addRepository in interface Configurator.RepositoryConfigurator<JcrConfiguration>
Parameters:
id - the id of the new repository that is to be added
Returns:
the interface for choosing the class, which returns the interface used to configure the repository source; never null
See Also:
Configurator.RepositoryConfigurator.addRepository(java.lang.String)

addRepository

public JcrConfiguration addRepository(RepositorySource source)
Add a new repository for this configuration. The new repository will have the supplied name, and if the name of an existing repository is used, this will replace the existing repository configuration.

Specified by:
addRepository in interface Configurator.RepositoryConfigurator<JcrConfiguration>
Parameters:
source - the RepositorySource instance that should be used
Returns:
this configuration object, for method-chaining purposes
See Also:
Configurator.RepositoryConfigurator.addRepository(org.jboss.dna.graph.connector.RepositorySource)

addMimeTypeDetector

public Configurator.ChooseClass<MimeTypeDetector,Configurator.MimeTypeDetectorDetails<JcrConfiguration>> addMimeTypeDetector(String id)
Add a new MIME type detector to this configuration. The new detector will have the supplied name, and if the name of an existing detector is used, this will replace the existing detector configuration.

Specified by:
addMimeTypeDetector in interface Configurator.MimeDetectorConfigurator<JcrConfiguration>
Parameters:
id - the id of the new detector
Returns:
the interface for choosing the class, which returns the interface used to configure the detector; never null
See Also:
Configurator.MimeDetectorConfigurator.addMimeTypeDetector(java.lang.String)

save

public JcrConfiguration save()
Save any changes that have been made so far to the configuration. This method does nothing if no changes have been made.

Returns:
this configuration object for method chaining purposes; never null

build

public JcrEngine build()
                throws DnaConfigurationException
Complete this configuration and create the corresponding engine.

Specified by:
build in interface Configurator.Builder<JcrEngine>
Returns:
the new engine configured by this instance
Throws:
DnaConfigurationException - if the engine cannot be created from this configuration.
See Also:
Configurator.Builder.build()


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