public class XMLExists
extends java.lang.Object
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.
Modifier and Type | Field and Description |
---|---|
static int |
NORMAL
Normal output.
|
static int |
QUIET
No messages, just set the exit code.
|
static int |
VERBOSE
Print verbose messages.
|
Constructor and Description |
---|
XMLExists()
No arg constructor.
|
XMLExists(boolean xmlExpected,
int outputLevel)
Constructor taking checkXMLExists and outputLevel.
|
Modifier and Type | Method and Description |
---|---|
void |
checkClass(java.lang.String className,
java.lang.ClassLoader classLoader,
org.apache.jdo.model.jdo.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.
|
public static final int VERBOSE
public static final int NORMAL
public static final int QUIET
public XMLExists()
xmlExpected == true
outputLevel == NORMAL
public XMLExists(boolean xmlExpected, int outputLevel)
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 checkedtrue
if all classes are ok;
false
otherwise.public void checkClass(java.lang.String className, java.lang.ClassLoader classLoader, org.apache.jdo.model.jdo.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()
Copyright © 2005-2012 Apache Software Foundation. All Rights Reserved.