JBoss.orgCommunity Documentation

Chapter 24. Java Source File Sequencer

One of the sequencers that included in JBoss DNA is the dna-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.

To use this sequencer, simply include the dna-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.jboss.dna.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");