JBoss.orgCommunity Documentation
One of the sequencers that included in ModeShape is the modeshape-sequencer-java subproject. This sequencer parses Java source code added to the repository and extracts the basic structure of the classes and enumerations defined in the code. This structure includes: the package structures, class declarations, class and member attribute declarations, class and member method declarations with signature (but not implementation logic), enumerations with each enumeration literal value, annotations, and JavaDoc information for all of the above. After extracting this information from the source code, the sequencer then writes this structure into the repository, where it can be further processed, analyzed, searched, navigated, or referenced.
As noted previously, the JavaMetadataSequencer
class provides a pair of JavaBean properties that can be used to specify
a custom SourceFileRecorder
implementation to use to map the extracted metadata to an output location:
Table 25.1. JavaMetadataSequencer
properties
Property | Description |
---|---|
sourceFileRecorder |
Optional property that, if set, provides an instance of the SourceFileRecorder interface that will be used for all
subsequent sequencing activity for this sequencer. If this property is set to null, a default implementation will be used. The default
value of this property is null.
|
sourceFileRecorderClassName |
Optional property that, if set, provides the name of a class that provides a custom implementation of the SourceFileRecorder interface.
This class must have a no-argument, public constructor. If set, an instance of this class will be created immediately and reused for all
subsequent sequencing activity for this sequencer. If this property is set to null, a default implementation will be used. The default
value of this property is null.
|
The default SourceFileRecorder
generates output that is compatible with previous versions of the JavaMetadataSequencer
. To generated
sequenced output that is identical to the output generated by the ClassFileSequencer
, set the sourceFileRecorderClassName
property to "org.modeshape.sequencer.java.ClassSourceFileRecorder".
To use this sequencer, simply include the modeshape-sequencer-java
JAR (plus all of the JARs that it is dependent upon)
in your application and configure the JcrConfiguration
to use this sequencer using something similar to:
JcrConfiguration config = ...
config.sequencer("Java Sequencer")
.usingClass("org.modeshape.sequencer.java.JavaMetadataSequencer")
.loadedFromClasspath()
.setDescription("Sequences java files to extract the characteristics of the Java source")
.sequencingFrom("//(*.(java)[*])/jcr:content[@jcr:data]")
.andOutputtingTo("/java/$1");