public class XmlIdlCompiler
extends java.lang.Object
XmlEntityStruct
will be compiled into source code that contains a corresponding XML binding class.
In collaboration with the other classes from this package, this class performs the following steps for each IDL file specified:
org.openorb.compiler.parser.IdlParser). The intermediate
result is a tree of org.openorb.compiler.object.IdlObject nodes.typedefs for the type XmlEntityStruct,
e.g. the definition of the type SchedBlock.
(see IdlTreeManipulator#findXmlTypedefNodes)IdlTreeManipulator#findXmlEntityNodes).
This ensures that later we don't generate code that would be functionally identical
to the code generated by a standard IDL compiler.SchedBlock, then
both IDL structs will get marked.JavaGenerator#translateData).
ComponentHelperGeneratorProxy and
CompHelperGenerator.HelperInfo in the package
alma.acs.tools.comphelpergen.Parameters and properties:
org.openorb.compiler.IdlCompiler,
although some of them don't apply and will be ignored.-verbose.ACS.idl2jbind specifies the mappings from typedef'd
XmlEntityStructs to Java binding classes.SchedBlock=alma.xmljbind.test.schedblock.SchedBlock;
ObsProject=alma.xmljbind.test.obsproject.ObsProject"
instructs the compiler to use the Java class
alma.xmljbind.test.schedblock.SchedBlock
whereever an XmlEntityStruct typedef'd to SchedBlock
is found.alma.acs.tools.comphelpergen.doGenerate: if true,
the ACS IDL compiler will run the generator after compiling an IDL file.
See ComponentHelperGeneratorProxy.alma.acs.tools.comphelpergen.outRootDir specifies the directory under which
the component helper classes will be generated according to their Java packages.org.openorb.compiler.IdlCompiler and related classes)
whereever this is possible.
No OpenORB code is modified; this goal results in some less
intuitive handling of parse tree nodes, since new behavior could not be attached to the
existing classes. On the other hand, we won't have to insert our patches into any new version
of OpenORB that we might want to use in the future.
A half-inspired attempt has been made to pave the road for code generation for languages other than Java.
The tree manipulations could also be used by other code generators.
For Java we reused OpenORB's implementation of the IDL2Java mapping logic
(see JavaGenerator), but similar generators for other languages would be much more complex.
Remark on the proprietary code generation strategy used: Since OpenORB does not separate IDL2Java mapping logic from Java code generation, we can't use any standard code generation framework without reimplementing the IDL2Java logic ourselves. The choice was to accept being different from other ACS code generators, with the advantage of not writing lots of new code.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
PROP_COMP_HELPERS_OUTDIR |
static java.lang.String |
PROP_DO_GENERATE_COMP_HELPERS |
| Constructor and Description |
|---|
XmlIdlCompiler()
Constructor for XmlIdlCompiler.
|
| Modifier and Type | Method and Description |
|---|---|
static java.io.File |
createFile(java.lang.String jpackage,
java.lang.String className)
Utility method that creates a File object for code generation.
|
void |
generateCode(JacorbVisitor jacorbVisitor)
This operation is used to generate code for an IDL file that has been parsed already.
|
static void |
main(java.lang.String[] args)
The main method gets called from ACS/LGPL/Kit/acs/include/acsMakefileCore.mk
with the following JVM properties and application arguments:
-d <outputDir> with the root of the directory tree for the generated output. |
public static final java.lang.String PROP_DO_GENERATE_COMP_HELPERS
public static final java.lang.String PROP_COMP_HELPERS_OUTDIR
public void generateCode(JacorbVisitor jacorbVisitor) throws java.lang.Exception
java.lang.Exceptionpublic static java.io.File createFile(java.lang.String jpackage,
java.lang.String className)
throws java.io.IOException
java.io.IOExceptionpublic static void main(java.lang.String[] args)
-d <outputDir> with the root of the directory tree for the generated output.
ACS.idl2jbind that contains the ';'-separated bindings of XmlEntityStruct typedefs
to XML java binding classes as obtained from the Makefile directive XML_IDL; alma.acs.tools.comphelpergen.doGenerate and alma.acs.tools.comphelpergen.outRootDir
- The command line also contains
$(verboseDef) but it seems to be always empty.
externalArgs - -d <outdir> -I<myIdlIncludePath1> -I<myIdlIncludePath2> <myIdlFile>