|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgov.nasa.pds.vtool.VTool
public class VTool
Class to perform automated validation to determine if a given data product is PDS compliant.
This replaces LVTool functionality.
Field Summary |
---|
Fields inherited from interface gov.nasa.pds.vtool.config.VToolConfigKeys |
---|
ALIASKEY, DICTKEY, FOLLOWKEY, FORCEKEY, IGNOREDIRKEY, IGNOREFILEKEY, INCLUDESKEY, LOGKEY, PROGRESSKEY, RECURSEKEY, REGEXPKEY, REPORTKEY, SHOWLOGKEY, STYLEKEY, TARGETKEY, VERBOSEKEY |
Fields inherited from interface gov.nasa.pds.vtool.flags.VToolFlags |
---|
ALIAS, FOLLOW, IGNOREDIR, IGNOREFILE, INCLUDES, LOCAL, LOG, PARTIAL, PROGRESS, REGEXP, RPTSTYLE, TARGET, VERBOSE, WHATIS_ALIAS, WHATIS_DICT, WHATIS_FOLLOW, WHATIS_IGNOREDIR, WHATIS_IGNOREFILE, WHATIS_INCLUDES, WHATIS_LOCAL, WHATIS_LOG, WHATIS_PARTIAL, WHATIS_PROGRESS, WHATIS_REGEXP, WHATIS_REPORT, WHATIS_RPTSTYLE, WHATIS_TARGET, WHATIS_VERBOSE |
Fields inherited from interface gov.nasa.pds.tools.flags.ToolsFlags |
---|
ARGNAME, CONFIG, DICT, HELP, LONG, REPORT, SHORT, VERSION, WHATIS_CONFIG, WHATIS_HELP, WHATIS_VERSION |
Fields inherited from interface gov.nasa.pds.tools.label.validate.Status |
---|
FAIL, PASS, SKIP, UNKNOWN |
Fields inherited from interface gov.nasa.pds.vtool.status.ExitStatusType |
---|
APPLICATION_ERROR, ERRORS_FOUND, SKIPPED_FILES, SUCCESS, SYSTEM_ERROR, WARNINGS_FOUND |
Fields inherited from interface gov.nasa.pds.tools.license.ToolsLicense |
---|
LICENSE |
Fields inherited from interface gov.nasa.pds.tools.report.StyleSheet |
---|
FULLXSL, MINXSL, SUMXSL |
Constructor Summary | |
---|---|
VTool()
Default constructor. |
Method Summary | |
---|---|
void |
closehandle()
Closes the handlers that were set for the logger. |
void |
logMessage(java.util.logging.Level level,
java.lang.String msg)
Routine to store a message into the logger. |
void |
logMessage(java.util.logging.Level level,
java.lang.String msg,
java.lang.String file)
Routine to store a message into the logger. |
void |
logRptHeader()
Logs report header information such as version of the tool, execution time, and flag settings. |
static void |
main(java.lang.String[] argv)
Implementation to perform automated PDS validation. |
org.apache.commons.cli.CommandLine |
parseLine(java.lang.String[] argv)
Parses the VTool command-line. |
gov.nasa.pds.tools.file.FileList |
processTarget(java.lang.String target,
boolean getSubDirs)
Processes a target. |
void |
queryCmdLine(org.apache.commons.cli.CommandLine cmd)
Queries the VTool command-line. |
void |
readConfigFile(java.net.URL file)
Reads a configuration file to set the default behaviors for VTool. |
gov.nasa.pds.tools.dict.Dictionary |
readDictionaries(java.util.List dictionary)
Parse the dictionary files. |
void |
setAlias(boolean a)
Set aliasing flag. |
void |
setDictionaries(java.util.List d)
Set the dictionary file names passed into VTool . |
void |
setFollowPtrs(boolean f)
Set the flag that determines whether to follow pointers found in a label. |
void |
setForcePartial(boolean f)
Set the flag that determines whether to validate standalone label. |
void |
setIncludePaths(java.util.List i)
Set the paths to search for files referenced by pointers. |
void |
setLogFile(java.io.File f)
Set the file name for the machine-readable log. |
void |
setNoDirs(java.util.List d)
Set the flag to ignore specified directories. |
void |
setNoFiles(java.util.List f)
Set the flag to ignore specified files. |
void |
setProgress(boolean p)
Set the progress reporting flag. |
void |
setRecursive(boolean r)
Set the recursive flag. |
void |
setRegexp(java.util.List e)
Set the patterns flag. |
void |
setRptFile(java.io.File f)
Set the file for the human-readable report. |
void |
setRptStyle(java.lang.String style)
Set the output style for the report. |
void |
setShowLog(boolean l)
Set the flag to write the log to standard out. |
void |
setTargets(java.util.List t)
Set the targets flag. |
void |
setupLogger()
Configures the logger appropriately. |
void |
setVerbose(short v)
Set the verbosity level and above to include in the reporting. |
void |
showHelp()
Display VTool usage and help information |
void |
showProgress(java.net.URL file)
Prints out the current directory being validated and represents each file being validated by an asterisk. |
void |
showVersion()
Show the version and disclaimer notice for VTool. |
ValidationRecord |
validateLabel(java.net.URL url,
gov.nasa.pds.tools.dict.Dictionary dict)
Validate a label file. |
ValidationRecord |
validateLabels(java.util.List targets)
Validate labels, performing only syntactic validation. |
ValidationRecord |
validateLabels(java.util.List targets,
gov.nasa.pds.tools.dict.Dictionary dict)
Validate labels, performing both syntactic and semantic validation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public VTool()
Method Detail |
---|
public void showVersion() throws java.io.IOException
java.io.IOException
public void showHelp()
public org.apache.commons.cli.CommandLine parseLine(java.lang.String[] argv) throws ApplicationException
argv
- arguments given on the command-line
ApplicationException
public void queryCmdLine(org.apache.commons.cli.CommandLine cmd) throws ApplicationException, java.net.MalformedURLException, SystemException
ApplicationException
java.net.MalformedURLException
SystemException
public void setAlias(boolean a)
a
- 'false' if aliasing should be turned off,
'true' otherwisepublic void setDictionaries(java.util.List d) throws ApplicationException
d
- a List object of dictionary files
ApplicationException
public void setFollowPtrs(boolean f)
f
- 'true' to follow, 'false' otherwisepublic void setForcePartial(boolean f)
f
- 'true' to enable, 'false' otherwisepublic void setIncludePaths(java.util.List i)
Default is to always look first in the same directory as the label, then search specified directories.
i
- List of pathspublic void setNoDirs(java.util.List d)
d
- a text file containing a list of directories and/or directory
patterns to ignore during validation. The names must be listed one
name per line.public void setNoFiles(java.util.List f)
f
- a list of files/file patterns to ignore during validation.public void setLogFile(java.io.File f)
f
- file name of the logpublic void setShowLog(boolean l)
l
- public void setRptFile(java.io.File f)
f
- file namepublic void setRptStyle(java.lang.String style) throws ApplicationException
style
- 'sum' for a summary report, 'min' for a minimal report,
and 'full' for a full report
ApplicationException
public void setProgress(boolean p)
p
- public void setRegexp(java.util.List e)
e
- a List of patterns to be matched when searching for files to
validate in a directorypublic void setRecursive(boolean r)
r
- 'true' to recursively traverse down a directory and all its
sub-directories, 'false' otherwisepublic void setTargets(java.util.List t)
t
- a List of files, URLs, and/or directories to be validatedpublic void setVerbose(short v) throws ApplicationException
v
- '1' for info, '2' for warnings, and '3' for errors
ApplicationException
public void readConfigFile(java.net.URL file) throws ApplicationException
Flags set on the command-line will override flags set in the configuration file
file
- a file containing keyword/value statements
ApplicationException
public void logMessage(java.util.logging.Level level, java.lang.String msg)
level
- The severity level of the message.msg
- The message to log.public void logMessage(java.util.logging.Level level, java.lang.String msg, java.lang.String file)
level
- The severity level of the message.msg
- The message to log.file
- The file name associated with the message being logged.public void logRptHeader() throws SystemException, java.io.IOException
SystemException
java.io.IOException
public void setupLogger() throws ApplicationException, SystemException
If a log file was specified on the command-line, the log will be written to that file. If the log flag was specified with no file spec, then the log will be written to standard out. Otherwise, the log will be written to memory (ByteArrayOutputStream).
SystemException
ApplicationException
public gov.nasa.pds.tools.dict.Dictionary readDictionaries(java.util.List dictionary) throws ApplicationException
dictionary
- a list of dictionary URLs
ApplicationException
gov.nasa.pds.tools.label.parser.ParseException
UnknownLabelStatusException
public gov.nasa.pds.tools.file.FileList processTarget(java.lang.String target, boolean getSubDirs) throws ApplicationException, SystemException
target
- The file or URL to processgetSubDirs
- 'True' to look for sub-directories, 'false' otherwise
ApplicationException
SystemException
public ValidationRecord validateLabels(java.util.List targets) throws java.net.MalformedURLException, ApplicationException, SystemException, UnknownLabelStatusException
targets
-
java.net.MalformedURLException
ApplicationException
SystemException
UnknownLabelStatusException
public ValidationRecord validateLabels(java.util.List targets, gov.nasa.pds.tools.dict.Dictionary dict) throws ApplicationException, SystemException, java.net.MalformedURLException, UnknownLabelStatusException
targets
- a list of files, directories, and/or URLs.dict
- the dictionary file.
SystemException
ApplicationException
java.net.MalformedURLException
UnknownLabelStatusException
public ValidationRecord validateLabel(java.net.URL url, gov.nasa.pds.tools.dict.Dictionary dict) throws ApplicationException, SystemException, UnknownLabelStatusException
url
- The URL of the file to be validateddict
- a Dictionary object needed for semantic validation. If null,
only syntactic validation will be performed.
ApplicationException
SystemException
UnknownLabelStatusException
public void showProgress(java.net.URL file) throws SystemException
file
- The URL being validated
SystemException
public void closehandle()
public static void main(java.lang.String[] argv)
The main calls the following methods (in this order):
To setup the flags and parse the command-line options:
To setup the logger and log the report header information:
To perform validation:
To create the final report:
Reporting is not generated if the log flag was specified with no file spec and the report file flag was not specified
VTool returns an appropriate exit status based on validation results.
argv
- Arguments passed on the command-line
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |