Class GeneratePdus
java.lang.Object
edu.nps.moves.dis7.source.generator.pdus.GeneratePdus
A class that reads an XML file in a specific format, and spits out Java, C#, Objective-C, or C++ classes that do most of the work of the protocol.
This can rely on properties set in the XML file for the language. For example, the Java element in the XML file can specify whether Hibernate or JAXB support is included in the generated code.
There is a huge risk of using variable names that have ambiguous meaning here, as many of the terms such as "class" are also used by java or c++.
In effect this is reading an XML file and creating an abstract description of the protocol data units. That abstract description is written out as source code in various languages, such as C++, Java, etc.
- Author:
- Don McGregor, Mike Bailey and Don Brutzman
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
The language types we might generate, currently only supporting Javaclass
XML handler for recursively reading information and autogenerating code, namely an inner class that handles the SAX parsing of the XML file. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic String
String constantstatic String
String constantstatic String
String constantstatic String
String constantstatic String
String constantstatic String
String constantstatic String
String constantstatic String
String constantstatic String
String constantstatic String
String constantstatic String
String constantstatic String
String constantstatic String
String constantstatic String
String constantprotected Map<String,GeneratedClass>
Contains the database of all the classes described by the XML documentstatic String
String constantstatic String
String constantstatic String
String constantstatic String
String constantstatic String
String constantstatic String
String constantstatic String
String constantstatic String
String constantstatic String
String constantstatic String
String constantstatic String
String constantstatic String
String constantstatic String
String constantstatic String
String constantstatic String
String constantstatic String
String constantstatic String
String constantstatic String
String constantstatic String
String constantstatic String
String constantstatic String
String constantstatic String
String constantstatic String
String constantstatic String
String constant -
Constructor Summary
ConstructorsConstructorDescriptionGeneratePdus(String xmlDescriptionFileName, String languageToGenerate)
Create a new collection of Java objects by reading an XML file; these java objects can be used to generate code templates of any language, once you write the translator. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
checkArguments(String xmlFile, String language)
Does a sanity check on the args passed in: does the XML file exist, and is the language valid.static void
entry point.Pass in two arguments, the language you want to generate for and the XML file that describes the classes
-
Field Details
-
INHERITSFROM
String constant- See Also:
- Constant Field Values
-
ALIASFOR
String constant- See Also:
- Constant Field Values
-
IMPLEMENTS
String constant- See Also:
- Constant Field Values
-
XMLROOTELEMENT
String constant- See Also:
- Constant Field Values
-
SISOENUM
String constant- See Also:
- Constant Field Values
-
SISOBITFIELD
String constant- See Also:
- Constant Field Values
-
CLASS
String constant- See Also:
- Constant Field Values
-
ATTRIBUTE
String constant- See Also:
- Constant Field Values
-
COMMENT
String constant- See Also:
- Constant Field Values
-
INITIALVALUE
String constant- See Also:
- Constant Field Values
-
NAME
String constant- See Also:
- Constant Field Values
-
CLASSREF
String constant- See Also:
- Constant Field Values
-
COUNTFIELDNAME
String constant- See Also:
- Constant Field Values
-
TYPE
String constant- See Also:
- Constant Field Values
-
DEFAULTVALUE
String constant- See Also:
- Constant Field Values
-
PRIMITIVE
String constant- See Also:
- Constant Field Values
-
PRIMITIVELIST
String constant- See Also:
- Constant Field Values
-
OBJECTLIST
String constant- See Also:
- Constant Field Values
-
LENGTH
String constant- See Also:
- Constant Field Values
-
FIXEDLENGTH
String constant- See Also:
- Constant Field Values
-
COULDBESTRING
String constant- See Also:
- Constant Field Values
-
TRUE
String constant- See Also:
- Constant Field Values
-
FALSE
String constant- See Also:
- Constant Field Values
-
VALUE
String constant- See Also:
- Constant Field Values
-
SERIALIZE
String constant- See Also:
- Constant Field Values
-
HIDDEN
String constant- See Also:
- Constant Field Values
-
SPECIALCASE
String constant- See Also:
- Constant Field Values
-
PADTOBOUNDARY
String constant- See Also:
- Constant Field Values
-
ABSTRACT
String constant- See Also:
- Constant Field Values
-
JAVA
String constant- See Also:
- Constant Field Values
-
CPP
String constant- See Also:
- Constant Field Values
-
OBJC
String constant- See Also:
- Constant Field Values
-
CSHARP
String constant- See Also:
- Constant Field Values
-
JAVASCRIPT
String constant- See Also:
- Constant Field Values
-
PYTHON
String constant- See Also:
- Constant Field Values
-
FLAG
String constant- See Also:
- Constant Field Values
-
MASK
String constant- See Also:
- Constant Field Values
-
STATICIVAR
String constant- See Also:
- Constant Field Values
-
generatedClassNames
Contains the database of all the classes described by the XML document
-
-
Constructor Details
-
GeneratePdus
Create a new collection of Java objects by reading an XML file; these java objects can be used to generate code templates of any language, once you write the translator.- Parameters:
xmlDescriptionFileName
- file namelanguageToGenerate
- programming language (e.g. Java)
-
-
Method Details
-
main
entry point.Pass in two arguments, the language you want to generate for and the XML file that describes the classes- Parameters:
args
- arguments (xmlfile, language)
-
checkArguments
Does a sanity check on the args passed in: does the XML file exist, and is the language valid.- Parameters:
xmlFile
- output file namelanguage
- programming language
-