@NotThreadSafe public class DdlSequencer extends Sequencer
Sequencer.Context
Modifier and Type | Field and Description |
---|---|
protected static URL[] |
DEFAULT_CLASSPATH |
protected static List<String> |
DEFAULT_GRAMMARS |
protected static Map<String,DdlParser> |
STANDARD_PARSERS_BY_NAME |
Constructor and Description |
---|
DdlSequencer() |
Modifier and Type | Method and Description |
---|---|
protected DdlParsers |
createParsers(List<DdlParser> parsers)
Method that creates the DdlParsers instance.
|
boolean |
execute(Property inputProperty,
Node outputNode,
Sequencer.Context context)
Execute the sequencing operation on the specified property, which has recently been created or changed.
|
URL[] |
getClasspath()
Get the names of the classloaders that should be used to load any non-standard DdlParser implementations specified in the
list of grammars.
|
String[] |
getGrammars()
Get the names of the grammars that should be considered during processing.
|
protected List<DdlParser> |
getParserList() |
void |
initialize(NamespaceRegistry registry,
NodeTypeManager nodeTypeManager)
Initialize the sequencer.
|
void |
setClasspath(URL[] classpath)
Set the names of the classloaders that should be used to load any non-standard DdlParser implementations specified in the
list of grammars.
|
void |
setGrammars(String[] grammarNamesOrClasses)
Set the names of the grammars that should be considered during processing.
|
getAcceptedMimeTypes, getLogger, getName, getPathExpressions, getRepositoryName, getUniqueId, hasAcceptedMimeTypes, isAccepted, registerDefaultMimeTypes, registerNamespace, registerNodeTypes, registerNodeTypes, toString
protected static final URL[] DEFAULT_CLASSPATH
public String[] getGrammars()
identifier
of a built-in grammar, or the name of a DdlParser
implementation class.public void setGrammars(String[] grammarNamesOrClasses)
identifier
of a built-in grammar, or the name of a DdlParser
implementation class.grammarNamesOrClasses
- the names; may be null if the default grammar list should be usedpublic URL[] getClasspath()
public void setClasspath(URL[] classpath)
classpath
- the classloader names that make up the classpath; may be null or empty if the default classpath should be
usedprotected DdlParsers createParsers(List<DdlParser> parsers)
parsers
- the list of DdlParser instances to use; may be empty or nullpublic void initialize(NamespaceRegistry registry, NodeTypeManager nodeTypeManager) throws RepositoryException, IOException
Sequencer
By default this method does nothing, so it should be overridden by implementations to do a one-time initialization of any
internal components. For example, sequencers can use the supplied registry
and nodeTypeManager
objects to register custom namesapces and node types required by the generated content.
initialize
in class Sequencer
registry
- the namespace registry that can be used to register custom namespaces; never nullnodeTypeManager
- the node type manager that can be used to register custom node types; never nullRepositoryException
- if operations on the NamespaceRegistry
or NodeTypeManager
failIOException
- if any stream based operations fail (like importing cnd files)public boolean execute(Property inputProperty, Node outputNode, Sequencer.Context context) throws Exception
Sequencer
Each sequencer is expected to process the value of the property, extract information from the value, and write a structured representation (in the form of a node or a subgraph of nodes) using the supplied output node. Note that the output node will either be:
Node.setPrimaryType(String)
)The implementation is expected to always clean up all resources that it acquired, even in the case of exceptions.
Note: This method must be threadsafe: ModeShape will likely invoke this method concurrently in separate threads,
and the method should never modify the state or fields of the Sequencer implementation class. All initialization should be
performed in Sequencer.initialize(NamespaceRegistry, NodeTypeManager)
.
execute
in class Sequencer
inputProperty
- the property that was changed and that should be used as the input; never nulloutputNode
- the node that represents the output for the derived information; never null, and will either be
new
if the output is being placed outside of the selected node, or will not be new when the
output is to be placed on the selected input nodecontext
- the context in which this sequencer is executing, and which may contain additional parameters useful when
generating the output structure; never nullException
- if there was a problem with the sequencer that could not be handled. All exceptions will be logged
automatically as errors by ModeShape.Copyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.