org.eigenbase.xom
Class MetaGenerator

java.lang.Object
  extended by org.eigenbase.xom.MetaGenerator

public class MetaGenerator
extends 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
  MetaGenerator(String xmlFile, boolean testMode)
          Construct a MetaGenerator from an XML file.
protected MetaGenerator(String xmlFile, boolean testMode, String className)
           
 
Method Summary
 void debugDisplay()
          Display information about this generator for debug purposes.
 org.eigenbase.xom.MetaGenerator.TypeInfo getTypeInfo(String name, boolean fail)
          Return the TypeInfo class associated with the given name.
static void main(String[] args)
          Main function for MetaGenerator.
 void writeDtd(PrintWriter out)
           
 void writeFiles(String outputDirName, String dtdFileName)
          Create all files associated with the metamodel, including a Java class and a DTD file.
 void writeJava(PrintWriter out)
           
 void writeJavaDeclareAnyContent(PrintWriter out, boolean mixed)
           
 void writeJavaDeclareAttribute(PrintWriter out, MetaDef.Attribute attr)
           
 void writeJavaDeclareCDataContent(PrintWriter out)
           
 void writeJavaDeclareContent(PrintWriter out, MetaDef.Content content)
           
 void writeJavaDeclarePluginAttributes(PrintWriter out)
           
 void writeJavaDeclarePluginContent(PrintWriter out, boolean mixed)
           
 void writeJavaDisplayAnyContent(PrintWriter out)
           
 void writeJavaDisplayAttribute(PrintWriter out, MetaDef.Attribute attr)
           
 void writeJavaDisplayCDataContent(PrintWriter out)
           
 void writeJavaDisplayContent(PrintWriter out, MetaDef.Content content)
           
 void writeJavaDisplayDiffAnyContent(PrintWriter out, int[] diffCount)
           
 void writeJavaDisplayDiffAttribute(PrintWriter out, int[] diffCount, MetaDef.Attribute attr)
           
 void writeJavaDisplayDiffCDataContent(PrintWriter out, int[] diffCount)
           
 void writeJavaDisplayDiffContent(PrintWriter out, int[] diffCount, MetaDef.Content content)
           
 void writeJavaDisplayDiffPluginAttributes(PrintWriter out, int[] diffCount)
           
 void writeJavaDisplayDiffPluginContent(PrintWriter out, int[] diffCount)
           
 void writeJavaDisplayPluginAttributes(PrintWriter out)
           
 void writeJavaDisplayPluginContent(PrintWriter out)
           
 void writeJavaDisplayXMLAnyContent(PrintWriter out)
           
 void writeJavaDisplayXMLAttribute(PrintWriter out, MetaDef.Attribute attr)
           
 void writeJavaDisplayXMLCDataContent(PrintWriter out)
           
 void writeJavaDisplayXMLContent(PrintWriter out, MetaDef.Content content)
           
 void writeJavaDisplayXMLPluginAttributes(PrintWriter out)
           
 void writeJavaDisplayXMLPluginContent(PrintWriter out)
           
 void writeJavaGetAnyContent(PrintWriter out, boolean mixed)
           
 void writeJavaGetAttribute(PrintWriter out, MetaDef.Attribute attr)
           
 void writeJavaGetCDataContent(PrintWriter out)
           
 void writeJavaGetContent(PrintWriter out, MetaDef.Content content)
           
 void writeJavaGetPluginContent(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(String xmlFile,
                     boolean testMode)
              throws XOMException,
                     IOException
Construct a MetaGenerator from an XML file. The XML should meet the specifications of the XOM Meta Model.

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

MetaGenerator

protected MetaGenerator(String xmlFile,
                        boolean testMode,
                        String className)
                 throws XOMException,
                        IOException
Throws:
XOMException
IOException
Method Detail

getTypeInfo

public org.eigenbase.xom.MetaGenerator.TypeInfo getTypeInfo(String name,
                                                            boolean fail)
                                                     throws XOMException
Return the TypeInfo class associated with the given name.

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

writeFiles

public void writeFiles(String outputDirName,
                       String dtdFileName)
                throws XOMException,
                       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.

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

writeDtd

public void writeDtd(PrintWriter out)
              throws XOMException
Throws:
XOMException

writeJava

public void writeJava(PrintWriter out)
               throws XOMException
Throws:
XOMException

writeJavaGetAttribute

public void writeJavaGetAttribute(PrintWriter out,
                                  MetaDef.Attribute attr)
                           throws XOMException
Throws:
XOMException

writeJavaDeclareAttribute

public void writeJavaDeclareAttribute(PrintWriter out,
                                      MetaDef.Attribute attr)
                               throws XOMException
Throws:
XOMException

writeJavaDisplayAttribute

public void writeJavaDisplayAttribute(PrintWriter out,
                                      MetaDef.Attribute attr)
                               throws XOMException
Throws:
XOMException

writeJavaDisplayXMLAttribute

public void writeJavaDisplayXMLAttribute(PrintWriter out,
                                         MetaDef.Attribute attr)
                                  throws XOMException
Throws:
XOMException

writeJavaDisplayDiffAttribute

public void writeJavaDisplayDiffAttribute(PrintWriter out,
                                          int[] diffCount,
                                          MetaDef.Attribute attr)
                                   throws XOMException
Throws:
XOMException

writeJavaGetContent

public void writeJavaGetContent(PrintWriter out,
                                MetaDef.Content content)
                         throws XOMException
Throws:
XOMException

writeJavaGetAnyContent

public void writeJavaGetAnyContent(PrintWriter out,
                                   boolean mixed)

writeJavaGetCDataContent

public void writeJavaGetCDataContent(PrintWriter out)

writeJavaDeclareContent

public void writeJavaDeclareContent(PrintWriter out,
                                    MetaDef.Content content)
                             throws XOMException
Throws:
XOMException

writeJavaDeclareAnyContent

public void writeJavaDeclareAnyContent(PrintWriter out,
                                       boolean mixed)

writeJavaDeclareCDataContent

public void writeJavaDeclareCDataContent(PrintWriter out)

writeJavaDisplayContent

public void writeJavaDisplayContent(PrintWriter out,
                                    MetaDef.Content content)
                             throws XOMException
Throws:
XOMException

writeJavaDisplayAnyContent

public void writeJavaDisplayAnyContent(PrintWriter out)

writeJavaDisplayCDataContent

public void writeJavaDisplayCDataContent(PrintWriter out)

writeJavaDisplayXMLContent

public void writeJavaDisplayXMLContent(PrintWriter out,
                                       MetaDef.Content content)
                                throws XOMException
Throws:
XOMException

writeJavaDisplayXMLAnyContent

public void writeJavaDisplayXMLAnyContent(PrintWriter out)

writeJavaDisplayXMLCDataContent

public void writeJavaDisplayXMLCDataContent(PrintWriter out)

writeJavaDisplayDiffContent

public void writeJavaDisplayDiffContent(PrintWriter out,
                                        int[] diffCount,
                                        MetaDef.Content content)
                                 throws XOMException
Throws:
XOMException

writeJavaDisplayDiffAnyContent

public void writeJavaDisplayDiffAnyContent(PrintWriter out,
                                           int[] diffCount)

writeJavaDisplayDiffCDataContent

public void writeJavaDisplayDiffCDataContent(PrintWriter out,
                                             int[] diffCount)

writeJavaDeclarePluginAttributes

public void writeJavaDeclarePluginAttributes(PrintWriter out)

writeJavaDisplayPluginAttributes

public void writeJavaDisplayPluginAttributes(PrintWriter out)

writeJavaDisplayXMLPluginAttributes

public void writeJavaDisplayXMLPluginAttributes(PrintWriter out)

writeJavaDisplayDiffPluginAttributes

public void writeJavaDisplayDiffPluginAttributes(PrintWriter out,
                                                 int[] diffCount)

writeJavaGetPluginContent

public void writeJavaGetPluginContent(PrintWriter out,
                                      boolean mixed)

writeJavaDeclarePluginContent

public void writeJavaDeclarePluginContent(PrintWriter out,
                                          boolean mixed)

writeJavaDisplayPluginContent

public void writeJavaDisplayPluginContent(PrintWriter out)

writeJavaDisplayXMLPluginContent

public void writeJavaDisplayXMLPluginContent(PrintWriter out)

writeJavaDisplayDiffPluginContent

public void writeJavaDisplayDiffPluginContent(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(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.


SourceForge.net_Logo