Package org.apache.openjpa.meta
Class MetaDataTool
- java.lang.Object
-
- org.apache.openjpa.meta.MetaDataTool
-
- All Implemented Interfaces:
MetaDataModes
public class MetaDataTool extends java.lang.Object implements MetaDataModes
Tool for generating default metadata.- Since:
- 0.3.0
- Author:
- Abe White
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMetaDataTool.FlagsRun flags.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringACTION_ADDstatic java.lang.StringACTION_DROPstatic java.lang.String[]ACTIONS-
Fields inherited from interface org.apache.openjpa.meta.MetaDataModes
MODE_ALL, MODE_ANN_MAPPING, MODE_MAPPING, MODE_MAPPING_INIT, MODE_META, MODE_NONE, MODE_QUERY
-
-
Constructor Summary
Constructors Constructor Description MetaDataTool(OpenJPAConfiguration conf, java.lang.String action)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Reset state.java.lang.StringgetAction()The action supplied on construction.java.io.FilegetFile()The file to generate metadata to.MetaDataRepositorygetRepository()The repository to use to hold metadata.java.io.WritergetWriter()The writer to generate metadata to.static voidmain(java.lang.String[] args)Usage: java org.apache.openjpa.meta.MetaDataTool [option]* [-action/-a <add | drop>] <class name | .java file | .class file>+ Where the following options are recognized.protected MetaDataRepositorynewRepository()Create a new metadata repository.voidrecord()Record metadata changes.voidrun(java.lang.Class cls)Generate new metadata for the given class.static booleanrun(OpenJPAConfiguration conf, java.lang.String[] args, Options opts)Run the tool.static booleanrun(OpenJPAConfiguration conf, java.lang.String[] args, MetaDataTool.Flags flags, MetaDataRepository repos, java.lang.ClassLoader loader)Run the tool.voidsetFile(java.io.File file)The file to generate metadata to.voidsetRepository(MetaDataRepository repos)The repository to use to hold metadata.voidsetWriter(java.io.Writer writer)The writer to generate metadata to.
-
-
-
Field Detail
-
ACTION_ADD
public static final java.lang.String ACTION_ADD
- See Also:
- Constant Field Values
-
ACTION_DROP
public static final java.lang.String ACTION_DROP
- See Also:
- Constant Field Values
-
ACTIONS
public static final java.lang.String[] ACTIONS
-
-
Constructor Detail
-
MetaDataTool
public MetaDataTool(OpenJPAConfiguration conf, java.lang.String action)
Constructor. Supply configuration and action.
-
-
Method Detail
-
getAction
public java.lang.String getAction()
The action supplied on construction.
-
getFile
public java.io.File getFile()
The file to generate metadata to.
-
setFile
public void setFile(java.io.File file)
The file to generate metadata to.
-
getWriter
public java.io.Writer getWriter()
The writer to generate metadata to.
-
setWriter
public void setWriter(java.io.Writer writer)
The writer to generate metadata to.
-
getRepository
public MetaDataRepository getRepository()
The repository to use to hold metadata.
-
newRepository
protected MetaDataRepository newRepository()
Create a new metadata repository.
-
setRepository
public void setRepository(MetaDataRepository repos)
The repository to use to hold metadata.
-
clear
public void clear()
Reset state. This is called automatically after everyrecord().
-
run
public void run(java.lang.Class cls)
Generate new metadata for the given class.
-
record
public void record()
Record metadata changes.
-
main
public static void main(java.lang.String[] args) throws java.io.IOExceptionUsage: java org.apache.openjpa.meta.MetaDataTool [option]* [-action/-a <add | drop>] <class name | .java file | .class file>+ Where the following options are recognized.- -properties/-p <properties file or resource>: The path
or resource name of a OpenJPA properties file containing information
as outlined in
OpenJPAConfiguration. Optional. - -<property name> <property value>: All bean
properties of the OpenJPA
OpenJPAConfigurationcan be set by using their names and supplying a value. - -file/-f <stdout | output file or resource>: The path or resource name of a file the metadata should be generated to. If the given file already contains metadata, the generated metadata will be merged into the existing document.
- add: Generate default metadata for the given classes. This is the default action.
- drop: Remove existing metadata for the given classes.
- Throws:
java.io.IOException
- -properties/-p <properties file or resource>: The path
or resource name of a OpenJPA properties file containing information
as outlined in
-
run
public static boolean run(OpenJPAConfiguration conf, java.lang.String[] args, Options opts) throws java.io.IOException
Run the tool. Returns false if any invalid options were given.- Throws:
java.io.IOException
-
run
public static boolean run(OpenJPAConfiguration conf, java.lang.String[] args, MetaDataTool.Flags flags, MetaDataRepository repos, java.lang.ClassLoader loader) throws java.io.IOException
Run the tool. Return false if invalid options were given. The given repository may be null.- Throws:
java.io.IOException
-
-