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.protected
MetaGenerator
(String xmlFile, boolean testMode, String className) -
Method Summary
Modifier and TypeMethodDescriptionvoid
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 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
void
void
writeJavaDeclareContent
(PrintWriter out, MetaDef.Content content) void
void
writeJavaDeclarePluginContent
(PrintWriter out, boolean mixed) void
void
void
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
void
void
void
void
void
writeJavaDisplayXMLContent
(PrintWriter out, MetaDef.Content content) void
void
void
writeJavaGetAnyContent
(PrintWriter out, boolean mixed) void
writeJavaGetAttribute
(PrintWriter out, MetaDef.Attribute attr) void
void
writeJavaGetContent
(PrintWriter out, MetaDef.Content content) void
writeJavaGetPluginContent
(PrintWriter out, boolean mixed) void
Write 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:
XOMException
IOException
-
MetaGenerator
protected MetaGenerator(String xmlFile, boolean testMode, String className) throws XOMException, IOException - Throws:
XOMException
IOException
-
-
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:
XOMException
IOException
-
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.
-