Package org.eigenbase.xom

## Class MetaGenerator

- java.lang.Object
- - org.eigenbase.xom.MetaGenerator

    public class MetaGenerator
    extends java.lang.Object

`MetaGenerator` is a utility class which reads a XOM Meta Model description in XML and generates the corresponding .dtd and .java definition files. MetaGenerator is invoked during the build process to help generate files for the build.

### Constructor Summary

Constructors
`` `MetaGenerator​(java.lang.String xmlFile, boolean testMode)` Construct a MetaGenerator from an XML file.
`protected` `MetaGenerator​(java.lang.String xmlFile, boolean testMode, java.lang.String className)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `debugDisplay()` Display information about this generator for debug purposes.
`org.eigenbase.xom.MetaGenerator.TypeInfo` `getTypeInfo​(java.lang.String name, boolean fail)` Return the TypeInfo class associated with the given name.
`static void` `main​(java.lang.String[] args)` Main function for MetaGenerator.
`void` `writeDtd​(java.io.PrintWriter out)`
`void` `writeFiles​(java.lang.String outputDirName, java.lang.String dtdFileName)` Create all files associated with the metamodel, including a Java class and a DTD file.
`void` `writeJava​(java.io.PrintWriter out)`
`void` `writeJavaDeclareAnyContent​(java.io.PrintWriter out, boolean mixed)`
`void` `writeJavaDeclareAttribute​(java.io.PrintWriter out, MetaDef.Attribute attr)`
`void` `writeJavaDeclareCDataContent​(java.io.PrintWriter out)`
`void` `writeJavaDeclareContent​(java.io.PrintWriter out, MetaDef.Content content)`
`void` `writeJavaDeclarePluginAttributes​(java.io.PrintWriter out)`
`void` `writeJavaDeclarePluginContent​(java.io.PrintWriter out, boolean mixed)`
`void` `writeJavaDisplayAnyContent​(java.io.PrintWriter out)`
`void` `writeJavaDisplayAttribute​(java.io.PrintWriter out, MetaDef.Attribute attr)`
`void` `writeJavaDisplayCDataContent​(java.io.PrintWriter out)`
`void` `writeJavaDisplayContent​(java.io.PrintWriter out, MetaDef.Content content)`
`void` `writeJavaDisplayDiffAnyContent​(java.io.PrintWriter out, int[] diffCount)`
`void` `writeJavaDisplayDiffAttribute​(java.io.PrintWriter out, int[] diffCount, MetaDef.Attribute attr)`
`void` `writeJavaDisplayDiffCDataContent​(java.io.PrintWriter out, int[] diffCount)`
`void` `writeJavaDisplayDiffContent​(java.io.PrintWriter out, int[] diffCount, MetaDef.Content content)`
`void` `writeJavaDisplayDiffPluginAttributes​(java.io.PrintWriter out, int[] diffCount)`
`void` `writeJavaDisplayDiffPluginContent​(java.io.PrintWriter out, int[] diffCount)`
`void` `writeJavaDisplayPluginAttributes​(java.io.PrintWriter out)`
`void` `writeJavaDisplayPluginContent​(java.io.PrintWriter out)`
`void` `writeJavaDisplayXMLAnyContent​(java.io.PrintWriter out)`
`void` `writeJavaDisplayXMLAttribute​(java.io.PrintWriter out, MetaDef.Attribute attr)`
`void` `writeJavaDisplayXMLCDataContent​(java.io.PrintWriter out)`
`void` `writeJavaDisplayXMLContent​(java.io.PrintWriter out, MetaDef.Content content)`
`void` `writeJavaDisplayXMLPluginAttributes​(java.io.PrintWriter out)`
`void` `writeJavaDisplayXMLPluginContent​(java.io.PrintWriter out)`
`void` `writeJavaGetAnyContent​(java.io.PrintWriter out, boolean mixed)`
`void` `writeJavaGetAttribute​(java.io.PrintWriter out, MetaDef.Attribute attr)`
`void` `writeJavaGetCDataContent​(java.io.PrintWriter out)`
`void` `writeJavaGetContent​(java.io.PrintWriter out, MetaDef.Content content)`
`void` `writeJavaGetPluginContent​(java.io.PrintWriter out, boolean mixed)`
`void` `writeOutputs()` Write the name of the dtd file and java class to standard output.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### MetaGenerator

    public MetaGenerator​(java.lang.String xmlFile,
                         boolean testMode)
                  throws XOMException,
                         java.io.IOException

Construct a MetaGenerator from an XML file. The XML should meet the specifications of the XOM Meta Model.

Parameters:
  `xmlFile` - a filename for the xml description of the model to be processed.
Throws:
  `XOMException`
  `java.io.IOException`

#### MetaGenerator

    protected MetaGenerator​(java.lang.String xmlFile,
                            boolean testMode,
                            java.lang.String className)
                     throws XOMException,
                            java.io.IOException

Throws:
  `XOMException`
  `java.io.IOException`

### Method Detail

#### getTypeInfo

    public org.eigenbase.xom.MetaGenerator.TypeInfo getTypeInfo​(java.lang.String name,
                                                                boolean fail)
                                                         throws XOMException

Return the TypeInfo class associated with the given name.

Throws:
  `XOMException` - if the type has not been defined
Post-condition:
  fail == false || return != null

#### writeFiles

    public void writeFiles​(java.lang.String outputDirName,
                           java.lang.String dtdFileName)
                    throws XOMException,
                           java.io.IOException

Create all files associated with the metamodel, including a Java class and a DTD file. The DTD is primarily for reference--it will not work if any advanced features (plugins, includes) are used.

Parameters:
  `outputDirName` - the output directory in which to generate the files.
Throws:
  `XOMException`
  `java.io.IOException`

#### writeDtd

    public void writeDtd​(java.io.PrintWriter out)
                  throws XOMException

Throws:
  `XOMException`

#### writeJava

    public void writeJava​(java.io.PrintWriter out)
                   throws XOMException

Throws:
  `XOMException`

#### writeJavaGetAttribute

    public void writeJavaGetAttribute​(java.io.PrintWriter out,
                                      MetaDef.Attribute attr)
                               throws XOMException

Throws:
  `XOMException`

#### writeJavaDeclareAttribute

    public void writeJavaDeclareAttribute​(java.io.PrintWriter out,
                                          MetaDef.Attribute attr)
                                   throws XOMException

Throws:
  `XOMException`

#### writeJavaDisplayAttribute

    public void writeJavaDisplayAttribute​(java.io.PrintWriter out,
                                          MetaDef.Attribute attr)
                                   throws XOMException

Throws:
  `XOMException`

#### writeJavaDisplayXMLAttribute

    public void writeJavaDisplayXMLAttribute​(java.io.PrintWriter out,
                                             MetaDef.Attribute attr)
                                      throws XOMException

Throws:
  `XOMException`

#### writeJavaDisplayDiffAttribute

    public void writeJavaDisplayDiffAttribute​(java.io.PrintWriter out,
                                              int[] diffCount,
                                              MetaDef.Attribute attr)
                                       throws XOMException

Throws:
  `XOMException`

#### writeJavaGetContent

    public void writeJavaGetContent​(java.io.PrintWriter out,
                                    MetaDef.Content content)
                             throws XOMException

Throws:
  `XOMException`

#### writeJavaGetAnyContent

    public void writeJavaGetAnyContent​(java.io.PrintWriter out,
                                       boolean mixed)

#### writeJavaGetCDataContent

    public void writeJavaGetCDataContent​(java.io.PrintWriter out)

#### writeJavaDeclareContent

    public void writeJavaDeclareContent​(java.io.PrintWriter out,
                                        MetaDef.Content content)
                                 throws XOMException

Throws:
  `XOMException`

#### writeJavaDeclareAnyContent

    public void writeJavaDeclareAnyContent​(java.io.PrintWriter out,
                                           boolean mixed)

#### writeJavaDeclareCDataContent

    public void writeJavaDeclareCDataContent​(java.io.PrintWriter out)

#### writeJavaDisplayContent

    public void writeJavaDisplayContent​(java.io.PrintWriter out,
                                        MetaDef.Content content)
                                 throws XOMException

Throws:
  `XOMException`

#### writeJavaDisplayAnyContent

    public void writeJavaDisplayAnyContent​(java.io.PrintWriter out)

#### writeJavaDisplayCDataContent

    public void writeJavaDisplayCDataContent​(java.io.PrintWriter out)

#### writeJavaDisplayXMLContent

    public void writeJavaDisplayXMLContent​(java.io.PrintWriter out,
                                           MetaDef.Content content)
                                    throws XOMException

Throws:
  `XOMException`

#### writeJavaDisplayXMLAnyContent

    public void writeJavaDisplayXMLAnyContent​(java.io.PrintWriter out)

#### writeJavaDisplayXMLCDataContent

    public void writeJavaDisplayXMLCDataContent​(java.io.PrintWriter out)

#### writeJavaDisplayDiffContent

    public void writeJavaDisplayDiffContent​(java.io.PrintWriter out,
                                            int[] diffCount,
                                            MetaDef.Content content)
                                     throws XOMException

Throws:
  `XOMException`

#### writeJavaDisplayDiffAnyContent

    public void writeJavaDisplayDiffAnyContent​(java.io.PrintWriter out,
                                               int[] diffCount)

#### writeJavaDisplayDiffCDataContent

    public void writeJavaDisplayDiffCDataContent​(java.io.PrintWriter out,
                                                 int[] diffCount)

#### writeJavaDeclarePluginAttributes

    public void writeJavaDeclarePluginAttributes​(java.io.PrintWriter out)

#### writeJavaDisplayPluginAttributes

    public void writeJavaDisplayPluginAttributes​(java.io.PrintWriter out)

#### writeJavaDisplayXMLPluginAttributes

    public void writeJavaDisplayXMLPluginAttributes​(java.io.PrintWriter out)

#### writeJavaDisplayDiffPluginAttributes

    public void writeJavaDisplayDiffPluginAttributes​(java.io.PrintWriter out,
                                                     int[] diffCount)

#### writeJavaGetPluginContent

    public void writeJavaGetPluginContent​(java.io.PrintWriter out,
                                          boolean mixed)

#### writeJavaDeclarePluginContent

    public void writeJavaDeclarePluginContent​(java.io.PrintWriter out,
                                              boolean mixed)

#### writeJavaDisplayPluginContent

    public void writeJavaDisplayPluginContent​(java.io.PrintWriter out)

#### writeJavaDisplayXMLPluginContent

    public void writeJavaDisplayXMLPluginContent​(java.io.PrintWriter out)

#### writeJavaDisplayDiffPluginContent

    public void writeJavaDisplayDiffPluginContent​(java.io.PrintWriter out,
                                                  int[] diffCount)

#### writeOutputs

    public void writeOutputs()

Write the name of the dtd file and java class to standard output. This output is used by shell scripts to grab these values. The output is only produced in test mode.

#### main

    public static void main​(java.lang.String[] args)

Main function for MetaGenerator. Arguments:

1. Name of XML file describing input model.
2. Name of output file directory.

#### debugDisplay

    public void debugDisplay()

Display information about this generator for debug purposes.