public class AutoGeneration extends GenerationCore
Generate Java classes, interfaces and tests from meta dictionary extension descriptions. This command line utility generates a number of Java files from an XML meta dictionary description that can be compiled and used with the media engine and forge to create, serialize and deserialize values of the defined types.
The typical usage is described in the following steps:
Describe a meta dictionary in XML according to the registered data XML meta dictionary format. The namespace is:
http://www.smpte-ra.org/schemas/2001-1/2007/metadict(See the file AutoFramework.xml in the MAJ distribution for an example, or generate
some examples using the media engine's
meta dictionary generator.)
Run this java class as an application, providing a package name and the meta dictionary XML file:
java tv.amwa.maj.util.AutoGeneration <package_name> <meta_dictionary_file>
src and a folder called test in the current
working directory. These new folders contain the generated Java files according to the convention for turning a
Java package name into a directory hierarchy. (Better configuration of the location will be provided in a future
versions. Tests are not yet generated.)Compile the generated Java files according to your local build strategy. For example:
cd src/com/portability4media/frameworkjavac -classpath $MAJ_JAR -d $COMPILE_TARGET *.java impl/*.javaNote that this code has been tested with Java 6.
Initialize the compiled types and classes in your application. A factory is generated as part of the auto generation to enable you to safely initalize all the required components in the correct order. For example:
.Factory.initialize();Remember to initialize the AAF baseline classes first if these are required.
Create instances of the classes described in the meta dictionary. Either use the generic
factory methods in the media engine or the make
method provided in the newly created factory. For example, for a class with no required properties:
<class_name> firstInstance =
<package_name>.Factory.make("<class_name>");
Below is a brief summary of what this class does when it runs:
All type definitions result in a static instance to represent them in an interface called
TypeDefinitions. The following additional files are generated from these definitions:
enum. This allows an application developer to manipulate enumeration values in the
standard Java way.All record types result in the generation of an interface and a class that is an implementation of that interface. The interface has get and set methods for each member and the implementation provides basic equals, hash code, clone and to string methods.
The string representation provides an XML representation of the value. A static parse method to read a value represented that way and turn it back into a value of the record type is also provided.
At runtime, definitions of the types can be accessed through the warehouse.
A factory class is generated with convenience methods for initializing and creating instances of the defined classes and types. The process of initialization includes:
The factory also contains methods to create and parse values of the extension record types.
LINE_WIDTH| Constructor and Description |
|---|
AutoGeneration() |
| Modifier and Type | Method and Description |
|---|---|
static void |
main(String[] args) |
makeDirectoriespublic static final void main(String[] args)
(c)2007-2016 Richard Cartwright, all rights reserved. Licensed under Apache 2 license and subject to the AMWA IPR policy.