Red Hat Training

A Red Hat training course is available for Red Hat JBoss Data Virtualization

9.4. Configuring a DDL File Sequencer

  1. Include the relevant libraries

    Include modeshape-sequencer-ddl-VERSION.jar in your application.
  2. Choose one of the following for sequencing configuration

    • Define sequencing configuration based on standard example provided in SOA-ROOT/eds/modeshape/resources/modeshape-config-standard.xml:
      <mode:sequencer jcr:name="DDL File Sequencer" mode:classname="org.modeshape.sequencer.ddl.DdlSequencer">
        <mode:description>
          Sequences DDL files loaded under '/files', extracting the structured abstract syntax tree of the DDL commands and expressions.
        </mode:description>
        <mode:pathExpression>
          eds-store:default:/files(//(*.ddl[*]))/jcr:content[@jcr:data] => eds-store:default:/sequenced/ddl/$1
        </mode:pathExpression>
      </mode:sequencer>
      
    • Configure via org.modeshape.jcr.JcrConfiguration:
      JcrConfiguration config = ...
      
      config.sequencer("DDL File Sequencer")
            .usingClass("org.modeshape.sequencer.ddl.DdlSequencer")
            .loadedFromClasspath()
            .setDescription("Sequences DDL files loaded under '/files', extracting the structured abstract syntax tree of the DDL commands and expressions.")
            .sequencingFrom("/files(//(*.ddl[*]))/jcr:content[@jcr:data]")
            .andOutputtingTo("/sequenced/ddl/$1");
      This will use all of the built-in grammars (e.g., "standard", "oracle", "postgres", and "derby"). To specify a different order or subset of the grammars, use the setProperty(...) method. The following example uses the standard grammar followed by the PostgreSQL grammar:
      config.sequencer("DDL File Sequencer")
            .usingClass("org.modeshape.sequencer.ddl.DdlSequencer")
            .loadedFromClasspath()
            .setDescription("Sequences DDL files loaded under '/files', extracting the structured abstract syntax tree of the DDL commands and expressions.")
            .setProperty("grammar","standard","postgres")
            .sequencingFrom("/files(//(*.ddl[*]))/jcr:content[@jcr:data]")
            .andOutputtingTo("/sequenced/ddl/$1");
      To use a custom implementation of DdlParser , use the fully-qualified name of the implementation class (which must have a no-arg constructor) as the name of the grammar:
      config.sequencer("DDL File Sequencer")
            .usingClass("org.modeshape.sequencer.ddl.DdlSequencer")
            .loadedFromClasspath()
            .setDescription("Sequences DDL files loaded under '/files', extracting the structured abstract syntax tree of the DDL commands and expressions.")
            .setProperty("grammar","standard","postgres","org.example.ddl.MyCustomDdlParser")
            .sequencingFrom("/files(//(*.ddl[*]))/jcr:content[@jcr:data]")
            .andOutputtingTo("/sequenced/ddl/$1");

    Note

    Refer to SOA-ROOT/eds/modeshape/resources/modeshape-config-standard.xml for more information.