|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jdo.impl.model.jdo.xml.XMLExists
This class allows to check whether there is JDO metadata for a class with a given class name. There must be a class file (enhanced or not enhanced) available in the classpath of the caller.
Usage: XMLExists <options> <arguments>...
Options:
-h
print usage message
-v
print verbose messages and JDO metadata
-q
do not print any output; just set the exit code
-xml
expected to find JDO XML metadata for the specified class(es)
-noxml
expected to find no JDO XML metadata for the specified class(es)
Arguments:
<classname>
the fully qualified name of a class to be checked
The following sample call checks whether there is JDO XML metadata for the
classes Emplyoe and Department from the com.xyz.hr package and dumps the
JDOClass instances:
java org.apache.jdo.impl.model.jdo.util.XMLExists -v
com.xyz.hr.Employee com.xyz.hr.Department
Method main will exit the JVM with an exit code 1 if the test fails for at least one class. Please note, the class dumps the JDOClass if the outputLevel is set to VERBOSE (e.g. by setting the -v option). This JDOClass info does NOT include runtime metadata, even if the class file is enhanced.
Field Summary | |
static int |
NORMAL
Normal output. |
static int |
QUIET
No messages, just set the exit code. |
static int |
VERBOSE
Print verbose messages. |
Constructor Summary | |
XMLExists()
No arg constructor. |
|
XMLExists(boolean xmlExpected,
int outputLevel)
Constructor taking checkXMLExists and outputLevel. |
Method Summary | |
void |
checkClass(java.lang.String className,
java.lang.ClassLoader classLoader,
JDOModel jdoModel,
boolean xmlExpected)
The method checks the class with the specified class name. |
static void |
main(java.lang.String[] args)
The main method checks all classes specified as argument. |
protected java.util.List |
processArgs(java.lang.String[] args)
Helper method to do command line argument processing. |
boolean |
run(java.util.List classNames)
This method checks all classes from the specified list of class names. |
void |
usage()
Print a usage message to System.err. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int VERBOSE
public static final int NORMAL
public static final int QUIET
Constructor Detail |
public XMLExists()
xmlExpected == true
outputLevel == NORMAL
public XMLExists(boolean xmlExpected, int outputLevel)
Method Detail |
public static void main(java.lang.String[] args)
args
- arguments which are options followed by class names.public boolean run(java.util.List classNames)
false
if there is at least one class that fails on checking.
classNames
- list of classes to be checked
true
if all classes are ok;
false
otherwise.public void checkClass(java.lang.String className, java.lang.ClassLoader classLoader, JDOModel jdoModel, boolean xmlExpected) throws java.lang.Exception
true
it expects to get a non-null
JDOClass instance. If the flag xmlExpected is false
it
expects to get a null JDOClass instance.
The method indicates any failure by throwing an exception. It dumps the JDOClass if the output level is VERBOSE.
className
- the name of the class to be checkedclassLoader
- the class loader to be used to load the classjdoModel
- JDOModel for type infoxmlExpected
- flag whether the class to be checked is expected to
have JDO XML metadata or not.
java.lang.Exception
protected java.util.List processArgs(java.lang.String[] args)
args
- the arguments passed to main.
public void usage()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |