View Javadoc

1   package no.sesat.mojo.modes;
2   
3   /**
4    * Common class for Schema Generators.
5    *
6    */
7   public abstract class GenerateSchemaFile extends GenerateFile implements Runnable {
8       protected final ConfigElement root;
9       protected final String id;
10  
11      private final String fileName;
12  
13      /**
14       * @param element
15       *            Root element
16       * @param name
17       *            File name
18       * @param idString
19       *            Id for this schema
20       */
21      public GenerateSchemaFile(final ConfigElement element, final String name, final String idString) {
22          fileName = name;
23          id = idString;
24          root = element;
25      }
26  
27      /**
28       *
29       * @see java.lang.Runnable#run()
30       */
31      public final void run() {
32          init(fileName);
33          runImpl();
34          done();
35      }
36  
37      /**
38       * This will be called when this runnable is run, and should generate the
39       * expected schema file.
40       */
41      protected abstract void runImpl();
42  }