public class ReportDriver extends java.lang.Object implements DebugLevels, XmlConstants, ReportConstants
main(java.lang.String[])
for the syntax.
The report definitions are stored in an XML file with the following structure:
Report definition files have a .rpt
filename suffix and must reside in the pattern path.
Modifier and Type | Class and Description |
---|---|
private static class |
ReportDriver.Options
A structure grouping all options and additional information extracted from the first entry of the
command-line parameters.
|
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
APP_ADMIN_PASS
Default admin password system property key
|
private static boolean |
database
Database mode flag.
|
private static java.lang.String |
ruleset
Reporting rule-set.
|
MSG_DEBUG, MSG_NONE, MSG_STATUS, MSG_TRACE
ATTR_ADMIN, ATTR_COND, ATTR_DB, ATTR_DUMPEXPR, ATTR_DUMPLVL, ATTR_DUMPTYPE, ATTR_ID, ATTR_MULTIPLEX, ATTR_NAME, ATTR_PASS_CHANGED, ATTR_PASSWORD, ATTR_SALT, ATTR_SORT, ATTR_SPEC, ATTR_SUPPORT, ATTR_TAG, ATTR_TITLE, ATTR_USER, ATTR_WILD, AUTO_EXPORT_FILTER_PATH, AUTO_EXPORT_RPT_SPEC, AUTO_EXPORT_SRCH_PATH, AUTO_EXPORT_USER_PATH, ELEM_FILTER, ELEM_LIST, ELEM_PROFILE, ELEM_RPT, ELEM_SEARCH, ELEM_USER, RPT_PATH, RPT_SUFFIX
CVT_LVL_BASIC, CVT_LVL_FULL, CVT_LVL_FULL_RESTR, CVT_LVL_MASK, CVT_LVL_NONE, CVT_LVL_PARTIAL, LVL_UNKNOWN, RT_LVL_BASIC, RT_LVL_FULL, RT_LVL_FULL_RESTR, RT_LVL_MASK, RT_LVL_NONE, RT_LVL_PARTIAL, RT_LVL_STUB, RT_LVL_UNTESTED, SORT_ALL, SORT_NONE, SORT_NOT_LAST, SRC_CODE_BASE, SRC_CODE_CACHE, SRC_SCHEMA, SRC_UNKNOWN
Constructor and Description |
---|
ReportDriver() |
Modifier and Type | Method and Description |
---|---|
private static void |
doPass(int debugLevel,
java.lang.String rptDef,
java.lang.String[] files)
Does one of the passes.
|
private static java.util.List<ReportDefinition> |
loadReports(java.lang.String rptdef)
Read the given report definitions and store the list of reports for subsequent processing.
|
static void |
main(java.lang.String[] args)
Provides a command line interface for generating a list of reports using a list of ASTs and a report
definition.
|
private static void |
newSyntax(ReportDriver.Options opt)
Parse parameters according to new syntax and execute the two passes with appropriate parameters.
|
private static void |
oldSyntax(ReportDriver.Options opt,
java.lang.String[] args)
Parse parameters according to old syntax and execute the report accordingly.
|
static void |
patternEngine(FileList[] files,
int dbg,
java.util.Map<java.lang.String,java.lang.Object> init)
Run the pattern engine with the given input.
|
private static ReportDriver.Options |
processOptions(java.lang.String[] args)
Read and validates the options sent in command line.
|
private static void |
syntax(java.lang.String msg,
int rc)
Emit a syntax statement and optional error message to
stderr , then exit the process with the specified return
code. |
private static final java.lang.String APP_ADMIN_PASS
private static final java.lang.String ruleset
private static boolean database
public static void patternEngine(FileList[] files, int dbg, java.util.Map<java.lang.String,java.lang.Object> init) throws java.lang.Exception
files
- List of ASTs to process.dbg
- Debug level.init
- Variable initializers to enable.java.lang.Exception
private static java.util.List<ReportDefinition> loadReports(java.lang.String rptdef) throws ConfigurationException, javax.xml.parsers.ParserConfigurationException, java.io.IOException, org.xml.sax.SAXException
rptdef
- File name root of the XML file storing the list of report definitions.ConfigurationException
- if there is an error loading the project configuration.javax.xml.parsers.ParserConfigurationException
- if there is an error configuring the XML parser.org.xml.sax.SAXException
- if the XML SAX parser encounters an error.java.io.IOException
- if there is an error accessing the file.public static void main(java.lang.String[] args) throws ConfigurationException
Syntax:
java -DP2J_HOME=<home> ReportDriver [options]
Deprecated syntax:
Where:java -DP2J_HOME=<home> ReportDriver [options] <rptdef> <filelist>
java -DP2J_HOME=<home> ReportDriver -S[options] <rptdef> <directory> <filespec>
java -DP2J_HOME=<home> ReportDriver -T[options] <rptdef> <directory> <filespec> <filelist>
Dn
= set debug level 'n' (must be a numeric digit between
MSG_NONE
(0) and MSG_TRACE
(3) inclusive
S
= use filespecs
instead of an explicit file list
T
= use filespecs
with a trailing explicit file list (optional)
X
= use a filespec
plus an ignore_list
N
= no recursion in filespec
or ignore_list
mode
rptdef
is the name of a report definition file found via the pattern path
<filelist>
is arbitrary list of absolute and/or relative file names to scan
<filespec>
mode
<directory>
is the directory to search for files
<filespec>
is the file specification that will be used to create a list of files to
process, should be enclosed in double quotes if any of the wildcard characters '*' or '?'
are used
<filespec> + <ignore_list>
mode
<directory>
is the directory to search for files
<filespec>
is the file specification that will be used to create a list of files to
process, should be enclosed in double quotes if any of the wildcard characters '*' or '?'
are used
<ignore_list>
is the file name which includes the list of directories/files to ignore
For the new syntax form (first) the S
, X
and T
modes are unavailable. In this
case the full set of parameters are extracted from the configuration file (p2j.cfg.xml
). This is
the recommended form to be used because it is much cleaner.
The other forms are prone to errors when passing in the parameters, but they are the solution if a
partial report is needed.
args
- List of command line arguments.ConfigurationException
private static void syntax(java.lang.String msg, int rc)
stderr
, then exit the process with the specified return
code. This method is called from main(java.lang.String[])
when the user passes
command line parameters which are not viable.msg
- Optional error message; may be null
.rc
- Process return code used with System.exit()
.private static ReportDriver.Options processOptions(java.lang.String[] args)
args
- The command-line arguments.private static void oldSyntax(ReportDriver.Options opt, java.lang.String[] args)
opt
- The options as they were extracted from the first parameter.args
- The full set of parameters from command line.private static void newSyntax(ReportDriver.Options opt)
opt
- The options as they were extracted from the optional first parameter.private static void doPass(int debugLevel, java.lang.String rptDef, java.lang.String[] files)
debugLevel
- The debug level to be used.rptDef
- The report definition.files
- The list of files to be processed.