public class Validate extends CommonShell implements UpgConstants, ReportCollector
CommonShell
,
Util
,
psdi.upgrade.Upgrade
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
indexDir
The directory containing the default Maximo index definition files.
|
protected java.lang.String |
inFileNameDefault
The input filename for metadata and system data changes, MetaDoc.xml.
|
protected java.lang.String |
inMetaFileNameDefault
The input filename for metadata structure changes, MetaFormat.sql.
|
protected java.io.File |
inputFile
The input file for metadata and system data changes (MetaDoc.xml).
|
protected java.io.File |
inputMetaFile
The fully qualified filename for metadata structure changes, MetaFormat.sql.
|
protected java.io.File |
msgFile
The input file for metadata and system data changes (MetaDoc.xml).
|
protected java.lang.String |
promptDir
Top-level directory for any user input files
|
protected java.lang.String |
upgMessageFile
The input filename for the Upgrade Messages, MaxMessages.xliff.
|
protected java.lang.String |
xmlfile
The xml file for metadata and system data changes (MetaDoc.xml).
|
classShortName, con, conKey, conService, dbIn, driver, execute, externalConnection, forceCreateOutfile, hostname, lastSqlIssued, listStream, log, mxs, myLogger, out, outFileNameDefault, outputFile, port, propFileNameDefault, schemaOwner, servername, session, sNo, sYes, thisIsNested, url, userLangCode, userName, util
DB2, doNotUpdateACTION, doNotUpdateALNDOMAIN, doNotUpdateAPPLICATIONAUTH, doNotUpdateAUTOKEY, doNotUpdateCONDITION, doNotUpdateCONTRACTPROPERTY, doNotUpdateCONTRACTTYPE, doNotUpdateCROSSOVERDOMAIN, doNotUpdateDOCTYPES, doNotUpdateLANGUAGE, doNotUpdateMAXAPPS, doNotUpdateMAXCONDDETAIL, doNotUpdateMAXCONTROLVALUE, doNotUpdateMAXDOMAIN, doNotUpdateMAXLOGAPPENDER, doNotUpdateMAXLOGGER, doNotUpdateMAXMENU, doNotUpdateMAXMESSAGES, doNotUpdateMAXMODULES, doNotUpdateMAXPROP, doNotUpdateMAXPROPVALUE, doNotUpdateMAXROLE, doNotUpdateMAXSEQUENCE, doNotUpdateMAXSERSECURITY, doNotUpdateMAXSERVICE, doNotUpdateMAXTABLEDOMAIN, doNotUpdateMAXVARS, doNotUpdateMAXVARTYPE, doNotUpdateMXCOLLAB, doNotUpdateMXCOLLABREF, doNotUpdateNUMERICDOMAIN, doNotUpdateNUMRANGEDOMAIN, doNotUpdatePORTLET, doNotUpdatePRICALC, doNotUpdateSECURITYRESTRICT, doNotUpdateSIGOPTION, doNotUpdateSYNONYMDOMAIN, doNotUpdateTAXTYPE, doNotUpdateWORKPRIORITY, doNotUpdateWORKTYPE, doNotUpdateWPEDITSETTING, messageCache, NEWONLY, OLDANDNEW, OLDONLY, ORACLE, SQLINET, SQLMICROSOFT, SQLSERVER, SYSDATATABLES, SYSTEMTABLES, UNKNOWN
Constructor and Description |
---|
Validate() |
Validate(MXServer server)
This constructor accepts parameter for MXServer and
sets value for
mxs . |
Modifier and Type | Method and Description |
---|---|
void |
doSql(java.util.AbstractList list)
Traverse an array and execute each sql statement in sequence.
|
int |
doSqlCount(java.lang.String sql)
Executes the SQL statement and returns the number of records updated.
|
void |
doSqlTruncate(java.lang.String tableName)
Delete all rows in a database table.
|
void |
endProcess(boolean errors)
Close the connection, deregister the driver.
|
void |
endProcessInstance()
Called from
endProcess for any additional end-process functionality. |
void |
endSetupInstance(java.lang.String outdir,
java.lang.String outfile,
java.util.HashMap params)
Finish setup tasks specific to Validate.
|
boolean |
errorsFound()
Identifies whether errors were found by the integrity and/or validation checker.
|
java.lang.String |
getDisplayMessage(java.lang.String errorkey)
Call
getDisplayMessage with null second param. |
boolean |
getIntRepair()
Return true if running the Integrity Checker in Repair mode.
|
java.io.PrintStream |
getListStream() |
ValidateLogger |
getValidateLogger() |
protected void |
loadMessageCacheSub(java.lang.String msggroup)
Load {#messageCache messageCache} with messages from database
using msggroup provided in the parameter.
|
void |
logError(java.lang.String msg,
java.util.AbstractList list)
Display an error message followed by a list of offending objects.
|
void |
logWarning(java.lang.String msg)
Display a one-line warning message to the console and to the logfile.
|
void |
logWarning(java.lang.String msg,
java.util.AbstractList list)
Display a warning message followed by a list of offending objects.
|
static void |
main(java.lang.String[] argv)
Main.
|
void |
process()
Main processing method for this program.
|
void |
report(Report report)
Called when there is some issue to report.
|
static boolean |
sameVersion(java.lang.String needVersion,
java.lang.String haveVersion)
Verify the version of the database is correct.
|
void |
setRoot(org.jdom2.Element root)
Set the XML root to the passed value.
|
void |
setup(java.util.HashMap params)
Overwrite CommonShell#setup.
|
void |
setUpgradeCallout(java.lang.String val)
This is called from
Upgrade so that
upgradeCallout can determine which subdirectory
contains the class files that indicate special processing for this upgrade. |
void |
setupInstance(java.util.HashMap params)
Finish setup tasks specific to Validate.
|
void |
setValidateLogger(java.io.PrintStream os,
java.io.PrintStream ls) |
void |
validateCallout(java.lang.String methodName,
java.lang.String methodPlace,
java.lang.String objectname)
Various points provide hooks for calling specialized methods to perform any
version-specific validation checks or processing.
|
boolean |
warningsFound()
Identifies whether warnings were found by the integrity and/or validation checker.
|
auditProcess, createOutfile, doCall, doDB2TextSearchCall, doSql, doSql, doSql, doSql, doWait, endSetup, execRuntime, getDisplayMessage, getMessage, getOutfile, getOutstream, getProperty, getRootDirName, isXmlOut, loadMessageCache, logMessage, logSql, reformatForDB2, reformatForSqlsvr, reformatForSqlsvrMaxSequence, setConnection, setDB2TextOutput, setupFromMXServer, setupFromPropfile, setupNested, setupNestedInstance, setUserLangCode, setXmlOut, showMsg, showMXException, showMXException
protected java.lang.String upgMessageFile
protected java.lang.String inFileNameDefault
protected java.io.File inputFile
protected java.lang.String xmlfile
protected java.io.File msgFile
protected java.lang.String inMetaFileNameDefault
protected java.io.File inputMetaFile
protected java.lang.String indexDir
protected java.lang.String promptDir
public void process() throws java.lang.Exception
process
in class CommonShell
java.lang.Exception
Validate.integrityChecks()
,
Validate.validationChecks()
public final boolean getIntRepair()
public void doSql(java.util.AbstractList list) throws java.sql.SQLException
list
- List of SQL statements to execute.java.sql.SQLException
- Validate.doSql(java.util.AbstractList)
public int doSqlCount(java.lang.String sql) throws java.lang.Exception
sql
- The Sql statementjava.lang.Exception
CommonShell.doSql(java.util.List)
public void logWarning(java.lang.String msg, java.util.AbstractList list)
msg
- The warning message to be displayed.list
- The list of errant objects (Names of tables, columns, etc).
Validate.logWarning(java.lang.String, java.lang.String)
public void logError(java.lang.String msg, java.util.AbstractList list)
msg
- The error message to be displayed.list
- The list of errant objects (Names of tables, columns, etc).
Validate.logError(java.lang.String, java.lang.String)
public void doSqlTruncate(java.lang.String tableName) throws java.lang.Exception
tableName
- The name of the database table to truncate.java.lang.Exception
public static boolean sameVersion(java.lang.String needVersion, java.lang.String haveVersion)
sameVersion
needVersion
- Version stamp in MetaDoc.xmlhaveVersion
- Version stamp of this databasetrue
if the versions match numericallypublic boolean errorsFound()
true
if any errors were detected.public boolean warningsFound()
true
if any warnings were generated.public void setUpgradeCallout(java.lang.String val)
Upgrade
so that
upgradeCallout
can determine which subdirectory
contains the class files that indicate special processing for this upgrade.
Sets value of calloutSubdir
.val
- name of the subdirectory (ie, database version)public void setRoot(org.jdom2.Element root) throws java.lang.Exception
root
- the root Element in the XML file.java.lang.Exception
public void validateCallout(java.lang.String methodName, java.lang.String methodPlace, java.lang.String objectname) throws java.lang.Exception
The name of the class being called is "Valid" + methodName + methodPlace + tbname.
For example, if this is called from method rebuildTable
, place 01
,
table Item
, then the name of this class would be:
ValidRebuildTable01ITEM
The subdirectory containing these classes is identified by calloutSubdir
.
The class should be extended from UpgTemplate. If the class is not found, there is no error. If the class needs to exit the validation process, it should throw an error.
methodName
- The name of the method that is invoking this hook. Required.methodPlace
- If the method provides more than one hook, each hook
needs an identifier. If the method provides only one hook,
this will be null.objectname
- The object name currently being processed.
If object name is not relevant to the calling method, this
will be null.java.lang.Exception
UpgTemplate
public final void logWarning(java.lang.String msg)
msg
- The warning message to be displayed.public void endSetupInstance(java.lang.String outdir, java.lang.String outfile, java.util.HashMap params) throws java.lang.Exception
endSetup
process -m, -n
parameters,
set values for inputFile
, inputMetaFile
.
endSetupInstance
in class CommonShell
outdir
- Directory from -d
parameter, used when instantiating
files inputFile
and inputMetaFile
.outfile
- Output filename - not usedparams
- HashMap of input parameters - not used (see class javadocs).java.lang.Exception
public void endProcessInstance() throws java.lang.Exception
endProcess
for any additional end-process functionality.
Close the lis output.endProcessInstance
in class CommonShell
java.lang.Exception
public void setupInstance(java.util.HashMap params) throws java.lang.Exception
setupInstance
Until we find a reason for execute mode off, force execute mode onsetupInstance
in class CommonShell
params
- HashMap of input parameters, where key = the parameter identifier
(for example, -u
) and value = the value of the parameter
(for example, SMITH
). If there is no value, it should equal
the empty string "". See javadocs for the list of parameters for this class.java.lang.Exception
public void setup(java.util.HashMap params) throws java.lang.Exception
setup
in class CommonShell
HashMap
- of parameters passed to the class.java.lang.Exception
CommonShell.setup(java.util.HashMap)
public java.io.PrintStream getListStream() throws java.lang.Exception
java.lang.Exception
public void setValidateLogger(java.io.PrintStream os, java.io.PrintStream ls) throws java.lang.Exception
java.lang.Exception
public ValidateLogger getValidateLogger()
public void endProcess(boolean errors) throws java.lang.Exception
endProcess
in class CommonShell
errors
- True if ended with errorsjava.lang.Exception
Validate.endProcessInstance()
public static void main(java.lang.String[] argv)
Array
- of command line parameters passed to the utility.
CommonShell.setup(java.util.HashMap)
,
Validate.process()
,
CommonShell.endProcess(boolean)
protected void loadMessageCacheSub(java.lang.String msggroup) throws java.lang.Exception
loadMessageCacheSub
in class CommonShell
msggroup
- The value to use for maxmessages.msggroup when reading from this table.java.lang.Exception
public java.lang.String getDisplayMessage(java.lang.String errorkey)
getDisplayMessage
with null second param.
Error group is assumed to be "configdb".getDisplayMessage
in class CommonShell
errorkey
- public void report(Report report) throws java.lang.Exception
ReportCollector
report
in interface ReportCollector
java.lang.Exception