public class Validate extends CommonShell implements UpgConstants, ReportCollector
This runs independently of MXServer. However, it is not injurious to run this program while MXServer is in use.
This program is also run as part of the upgrade process, when called by Upgrade
.
The username/password/alias for the database are taken from the maximo.properties file in the MXServer root directory, as is the driver.
The commandline parameters for Validate are as follows, in addition to those in the superclass
CommonShell
.
Parameter ID | Parameter Value | Description |
---|---|---|
-i | (none) | Integrity - Run the integrity checker. |
-v | (none) | Validation - Run the validation routines. |
-r | (none) | Repair - Run the integrity checker in repair mode. |
-s | (none) | Special Version - Do not perform any version-specific checks. |
-m | (none) | Name of file containing metadata changes (Validation only). |
-n | (none) | Name of file containing meta doc changes (Validation only). |
-x | Directory for index file | Directory where the list of required indexes resides. |
-y | Directory for metadata structure changes. | This is optional. |
CommonShell
,
Util
,
psdi.upgrade.Upgrade
listStream
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() |
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.
|
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.jdom.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 |
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.
|
createOutfile, doCall, doDB2TextSearchCall, doSql, doSql, doSql, doSql, doWait, endSetup, execRuntime, getDisplayMessage, getOutfile, getOutstream, getProperty, getRootDirName, logSql, reformatForDB2, reformatForSqlsvr, setConnection, setDB2TextOutput, setupFromPropfile, setupNested, setupNestedInstance, setUserLangCode, showMsg, showMXException, showMXException
public void process() throws java.lang.Exception
process
in class CommonShell
java.lang.Exception
integrityChecks()
,
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
- 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).
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).
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.jdom.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 void endProcess(boolean errors) throws java.lang.Exception
endProcess
in class CommonShell
errors
- True if ended with errorsjava.lang.Exception
endProcessInstance()
public static void main(java.lang.String[] argv)
Array
- of command line parameters passed to the utility.
CommonShell.setup(java.util.HashMap)
,
process()
,
CommonShell.endProcess(boolean)
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