|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.dna.repository.DnaConfiguration
@NotThreadSafe public class DnaConfiguration
A configuration builder for a DnaEngine
. 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.repositorySource("Source1").setClass(InMemoryRepositorySource.class).setDescription("description"); configuration.mimeTypeDetector("detector").setClass(ExtensionBasedMimeTypeDetector.class).setDescription("default detector"); configuration.sequencer("MicrosoftDocs") .setClass("org.jboss.dna.sequencer.msoffice.MSOfficeMetadataSequencer") .setDescription("Our primary sequencer for all .doc files") .sequencingFrom("/public//(*.(doc|xml|ppt)[*]/jcr:content[@jcr:data]") .andOutputtingTo("/documents/$1"); configuration.save();
Nested Class Summary | |
---|---|
static interface |
DnaConfiguration.ChooseClass<ComponentClassType,ReturnType>
The interface used to configure the class used for a component. |
static class |
DnaConfiguration.ConfigurationDefinition
Representation of the current configuration content. |
static interface |
DnaConfiguration.HasName
Interface for a component that has a name. |
static interface |
DnaConfiguration.LoadedFrom<ReturnType>
Interface for specifying from where the component's class is to be loaded. |
static interface |
DnaConfiguration.MimeTypeDetectorDefinition<ReturnType>
Interface used to set up and define a MIME type detector instance. |
static interface |
DnaConfiguration.PathExpressionOutput<ReturnType>
Interface used to specify the output path expression for a sequencer configuration . |
static interface |
DnaConfiguration.Removable<ReturnType>
Interface that defines the ability to remove the configuration component. |
static interface |
DnaConfiguration.RepositorySourceDefinition<ReturnType>
Interface used to set up and define a RepositorySource instance. |
static interface |
DnaConfiguration.Returnable<ReturnType>
Interface that defines the ability to obtain the configuration component. |
static interface |
DnaConfiguration.SequencerDefinition<ReturnType>
Interface used to set up and define a sequencer instance. |
static interface |
DnaConfiguration.SetDescription<ReturnType>
The interface used to set a description on a component. |
static interface |
DnaConfiguration.SetProperties<ReturnType>
Interface for configuring the JavaBean-style properties of an object. |
Field Summary | |
---|---|
static String |
DEFAULT_CONFIGURATION_SOURCE_NAME
|
static String |
DEFAULT_PATH
|
static String |
DEFAULT_WORKSPACE_NAME
|
Constructor Summary | |
---|---|
DnaConfiguration()
Create a new configuration, using a default-constructed ExecutionContext . |
|
DnaConfiguration(ExecutionContext context)
Create a new configuration using the supplied ExecutionContext . |
Method Summary | |
---|---|
DnaConfiguration |
and()
Convenience method to make the code that sets up this configuration easier to read. |
DnaEngine |
build()
Construct an engine that reflects the current state of this configuration. |
DnaConfiguration.ConfigurationDefinition |
getConfigurationDefinition()
Get the immutable representation of the information defining where the configuration content can be found. |
Problems |
getProblems()
Get the problems (if any) that are associated with this configuration. |
boolean |
hasChanges()
Determine if there are any unsaved changes to this configuration that must be saved before they take
effect. |
DnaConfiguration |
loadFrom(File configurationFile)
Load the configuration from a file. |
DnaConfiguration |
loadFrom(File configurationFile,
String path)
Load the configuration from a file. |
DnaConfiguration |
loadFrom(InputStream configurationFileInputStream)
Load the configuration from a file at the supplied URL. |
DnaConfiguration |
loadFrom(InputStream configurationFileInputStream,
String path)
Load the configuration from a file at the supplied URL. |
DnaConfiguration |
loadFrom(RepositorySource source)
Load the configuration from the repository content using the supplied repository source. |
DnaConfiguration |
loadFrom(RepositorySource source,
String workspaceName)
Load the configuration from the repository content using the workspace in the supplied repository source. |
DnaConfiguration |
loadFrom(RepositorySource source,
String workspaceName,
String pathInWorkspace)
Load the configuration from the repository content at the supplied path in the workspace in the supplied repository source. |
DnaConfiguration |
loadFrom(String pathToConfigurationFile)
Load the configuration from a file at the given path. |
DnaConfiguration |
loadFrom(String pathToConfigurationFile,
String path)
Load the configuration from a file at the given path. |
DnaConfiguration |
loadFrom(URL urlToConfigurationFile)
Load the configuration from a file at the supplied URL. |
DnaConfiguration |
loadFrom(URL urlToConfigurationFile,
String path)
Load the configuration from a file at the supplied URL. |
DnaConfiguration.MimeTypeDetectorDefinition<? extends DnaConfiguration> |
mimeTypeDetector(String name)
Obtain or create a definition for the MIME type detector with the supplied name or identifier. |
Set<DnaConfiguration.MimeTypeDetectorDefinition<? extends DnaConfiguration>> |
mimeTypeDetectors()
Get the list of MIME type detector definitions. |
DnaConfiguration.RepositorySourceDefinition<? extends DnaConfiguration> |
repositorySource(String name)
Obtain or create a definition for the RepositorySource with the supplied name or identifier. |
Set<DnaConfiguration.RepositorySourceDefinition<? extends DnaConfiguration>> |
repositorySources()
Get the list of repository source definitions. |
DnaConfiguration |
save()
Persist any unsaved changes that have been made to this configuration. |
DnaConfiguration.SequencerDefinition<? extends DnaConfiguration> |
sequencer(String name)
Obtain or create a definition for the sequencer with the supplied name or identifier. |
Set<DnaConfiguration.SequencerDefinition<? extends DnaConfiguration>> |
sequencers()
Get the list of sequencer definitions. |
DnaConfiguration |
withClassLoaderFactory(ClassLoaderFactory classLoaderFactory)
Specify the ClassLoaderFactory that should be used to load the classes for the various components. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_WORKSPACE_NAME
public static final String DEFAULT_PATH
public static final String DEFAULT_CONFIGURATION_SOURCE_NAME
Constructor Detail |
---|
public DnaConfiguration()
ExecutionContext
.
public DnaConfiguration(ExecutionContext context)
ExecutionContext
.
context
- the execution context
IllegalArgumentException
- if the path is null or emptyMethod Detail |
---|
public DnaConfiguration loadFrom(String pathToConfigurationFile) throws IOException, SAXException
pathToConfigurationFile
- the path the file containing the configuration information
IOException
- if there is an error or problem reading the file at the supplied location
SAXException
- if the file is not a valid XML format
IllegalArgumentException
- if the path is null or emptypublic DnaConfiguration loadFrom(String pathToConfigurationFile, String path) throws IOException, SAXException
pathToConfigurationFile
- the path the file containing the configuration informationpath
- path within the content to the parent containing the configuration information, or null if the
default path
should be used
IOException
- if there is an error or problem reading the file at the supplied location
SAXException
- if the file is not a valid XML format
IllegalArgumentException
- if the path is null or emptypublic DnaConfiguration loadFrom(File configurationFile) throws IOException, SAXException
configurationFile
- the file containing the configuration information
IOException
- if there is an error or problem reading the supplied file
SAXException
- if the file is not a valid XML format
IllegalArgumentException
- if the file reference is nullpublic DnaConfiguration loadFrom(File configurationFile, String path) throws IOException, SAXException
configurationFile
- the file containing the configuration informationpath
- path within the content to the parent containing the configuration information, or null if the
default path
should be used
IOException
- if there is an error or problem reading the supplied file
SAXException
- if the file is not a valid XML format
IllegalArgumentException
- if the file reference is nullpublic DnaConfiguration loadFrom(URL urlToConfigurationFile) throws IOException, SAXException
urlToConfigurationFile
- the URL of the file containing the configuration information
IOException
- if there is an error or problem reading the file at the supplied URL
SAXException
- if the file is not a valid XML format
IllegalArgumentException
- if the URL is nullpublic DnaConfiguration loadFrom(URL urlToConfigurationFile, String path) throws IOException, SAXException
urlToConfigurationFile
- the URL of the file containing the configuration informationpath
- path within the content to the parent containing the configuration information, or null if the
default path
should be used
IOException
- if there is an error or problem reading the file at the supplied URL
SAXException
- if the file is not a valid XML format
IllegalArgumentException
- if the URL is nullpublic DnaConfiguration loadFrom(InputStream configurationFileInputStream) throws IOException, SAXException
configurationFileInputStream
- the stream with the configuration information
IOException
- if there is an error or problem reading the file at the supplied URL
SAXException
- if the file is not a valid XML format
IllegalArgumentException
- if the stream is nullpublic DnaConfiguration loadFrom(InputStream configurationFileInputStream, String path) throws IOException, SAXException
configurationFileInputStream
- the stream with the configuration informationpath
- path within the content to the parent containing the configuration information, or null if the
default path
should be used
IOException
- if there is an error or problem reading the file at the supplied URL
SAXException
- if the file is not a valid XML format
IllegalArgumentException
- if the stream is nullpublic DnaConfiguration loadFrom(RepositorySource source)
create connections
.
Also, the default workspace of the source will be used, and the configuration content may be found directly under the root
node.
source
- the source that defines the repository with the configuration content
IllegalArgumentException
- if the source is nullpublic DnaConfiguration loadFrom(RepositorySource source, String workspaceName)
create
connections
. Also, the configuration content may be found directly under the root node.
source
- the source that defines the repository with the configuration contentworkspaceName
- the name of the workspace with the configuration content, or null if the source's default workspace
should be used
IllegalArgumentException
- if the source is nullpublic DnaConfiguration loadFrom(RepositorySource source, String workspaceName, String pathInWorkspace)
create connections
.
source
- the source that defines the repository with the configuration contentworkspaceName
- the name of the workspace with the configuration content, or null if the source's default workspace
should be usedpathInWorkspace
- the path to the parent node under which the configuration content may be found, or null if the
content may be found under the root node
IllegalArgumentException
- if the source is nullpublic DnaConfiguration.ConfigurationDefinition getConfigurationDefinition()
public Problems getProblems()
public boolean hasChanges()
saved
before they take
effect.
save()
is required, or false no changes have been made to the configuration since the last
save()
public DnaConfiguration save()
no unsaved changes
.
public DnaConfiguration withClassLoaderFactory(ClassLoaderFactory classLoaderFactory)
ClassLoaderFactory
that should be used to load the classes for the various components. Most of the
definitions can specify the classpath
that should be used, and that classpath is
passed to the supplied ClassLoaderFactory instance to obtain a ClassLoader
for the class.
If not called, this configuration will use the class loader that loaded this configuration's class.
classLoaderFactory
- the class loader factory implementation, or null if the classes should be loaded using the class
loader of this object
public Set<DnaConfiguration.MimeTypeDetectorDefinition<? extends DnaConfiguration>> mimeTypeDetectors()
public Set<DnaConfiguration.RepositorySourceDefinition<? extends DnaConfiguration>> repositorySources()
public Set<DnaConfiguration.SequencerDefinition<? extends DnaConfiguration>> sequencers()
public DnaConfiguration.MimeTypeDetectorDefinition<? extends DnaConfiguration> mimeTypeDetector(String name)
MIME type detector
with the supplied name or identifier. A
new definition will be created if there currently is no MIME type detector defined with the supplied name.
name
- the name or identifier of the detector
public DnaConfiguration.RepositorySourceDefinition<? extends DnaConfiguration> repositorySource(String name)
RepositorySource
with the supplied name or identifier. A new definition will
be created if there currently is no repository source defined with the supplied name.
name
- the name or identifier of the repository source
public DnaConfiguration.SequencerDefinition<? extends DnaConfiguration> sequencer(String name)
sequencer
with the supplied name or identifier. A new
definition will be created if there currently is no sequencer defined with the supplied name.
name
- the name or identifier of the sequencer
public DnaConfiguration and()
public DnaEngine build()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |