Package org.eigenbase.xom
Class MetaGenerator
java.lang.Object
org.eigenbase.xom.MetaGenerator
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
ConstructorsModifierConstructorDescriptionMetaGenerator(String xmlFile, boolean testMode) Construct a MetaGenerator from an XML file.protectedMetaGenerator(String xmlFile, boolean testMode, String className) -
Method Summary
Modifier and TypeMethodDescriptionvoidDisplay information about this generator for debug purposes.org.eigenbase.xom.MetaGenerator.TypeInfogetTypeInfo(String name, boolean fail) Return the TypeInfo class associated with the given name.static voidMain function for MetaGenerator.voidwriteDtd(PrintWriter out) voidwriteFiles(String outputDirName, String dtdFileName) Create all files associated with the metamodel, including a Java class and a DTD file.voidwriteJava(PrintWriter out) voidwriteJavaDeclareAnyContent(PrintWriter out, boolean mixed) voidvoidvoidwriteJavaDeclareContent(PrintWriter out, MetaDef.Content content) voidvoidwriteJavaDeclarePluginContent(PrintWriter out, boolean mixed) voidvoidvoidvoidwriteJavaDisplayContent(PrintWriter out, MetaDef.Content content) voidwriteJavaDisplayDiffAnyContent(PrintWriter out, int[] diffCount) voidwriteJavaDisplayDiffAttribute(PrintWriter out, int[] diffCount, MetaDef.Attribute attr) voidwriteJavaDisplayDiffCDataContent(PrintWriter out, int[] diffCount) voidwriteJavaDisplayDiffContent(PrintWriter out, int[] diffCount, MetaDef.Content content) voidwriteJavaDisplayDiffPluginAttributes(PrintWriter out, int[] diffCount) voidwriteJavaDisplayDiffPluginContent(PrintWriter out, int[] diffCount) voidvoidvoidvoidvoidvoidwriteJavaDisplayXMLContent(PrintWriter out, MetaDef.Content content) voidvoidvoidwriteJavaGetAnyContent(PrintWriter out, boolean mixed) voidwriteJavaGetAttribute(PrintWriter out, MetaDef.Attribute attr) voidvoidwriteJavaGetContent(PrintWriter out, MetaDef.Content content) voidwriteJavaGetPluginContent(PrintWriter out, boolean mixed) voidWrite the name of the dtd file and java class to standard output.
-
Constructor Details
-
MetaGenerator
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:
XOMExceptionIOException
-
MetaGenerator
protected MetaGenerator(String xmlFile, boolean testMode, String className) throws XOMException, IOException - Throws:
XOMExceptionIOException
-
-
Method Details
-
getTypeInfo
public org.eigenbase.xom.MetaGenerator.TypeInfo getTypeInfo(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
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:
XOMExceptionIOException
-
writeDtd
- Throws:
XOMException
-
writeJava
- Throws:
XOMException
-
writeJavaGetAttribute
- Throws:
XOMException
-
writeJavaDeclareAttribute
- Throws:
XOMException
-
writeJavaDisplayAttribute
- 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
- Throws:
XOMException
-
writeJavaGetAnyContent
-
writeJavaGetCDataContent
-
writeJavaDeclareContent
- Throws:
XOMException
-
writeJavaDeclareAnyContent
-
writeJavaDeclareCDataContent
-
writeJavaDisplayContent
- Throws:
XOMException
-
writeJavaDisplayAnyContent
-
writeJavaDisplayCDataContent
-
writeJavaDisplayXMLContent
public void writeJavaDisplayXMLContent(PrintWriter out, MetaDef.Content content) throws XOMException - Throws:
XOMException
-
writeJavaDisplayXMLAnyContent
-
writeJavaDisplayXMLCDataContent
-
writeJavaDisplayDiffContent
public void writeJavaDisplayDiffContent(PrintWriter out, int[] diffCount, MetaDef.Content content) throws XOMException - Throws:
XOMException
-
writeJavaDisplayDiffAnyContent
-
writeJavaDisplayDiffCDataContent
-
writeJavaDeclarePluginAttributes
-
writeJavaDisplayPluginAttributes
-
writeJavaDisplayXMLPluginAttributes
-
writeJavaDisplayDiffPluginAttributes
-
writeJavaGetPluginContent
-
writeJavaDeclarePluginContent
-
writeJavaDisplayPluginContent
-
writeJavaDisplayXMLPluginContent
-
writeJavaDisplayDiffPluginContent
-
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
Main function for MetaGenerator. Arguments:- Name of XML file describing input model.
- Name of output file directory.
-
debugDisplay
public void debugDisplay()Display information about this generator for debug purposes.
-