com.ptc.windchill.upgrade.modeldiff
Class UpgradeSchema

java.lang.Object
  extended bycom.ptc.windchill.upgrade.modeldiff.UpgradeSchema

public class UpgradeSchema
extends Object


Nested Class Summary
 class UpgradeSchema.ExecutionException
           
private  class UpgradeSchema.RunSQLPlus
          Run the SQLPlus on a separate thread so that if there is an error, and execution hangs, a 'join(milliseconds)' will timeout.
 
Field Summary
private  boolean blockExecutionWhileDecidingCancel_
           
private  BufferedLineReader bufferedLineReader_
           
private  CancellationMonitor cancellationMonitor_
           
private  CompareSchema compareSchema_
           
private  int completed_
           
private  SimpleDateFormat dateFormatter
           
private  Date dateSQL
           
private  String dateSQLString
           
private  boolean fakeRerun_
           
private  Vector guiDisplayedItems_
           
private  Vector guiDisplayedSubjectsCount_
           
private  long inactivityTimeout_
           
private  boolean isARunSQLPlusError_
           
private  boolean isCancelable_
           
private  int leadingActivities_
           
private  String logInString_
           
private  String nextActivity_
           
private  int otherActivities_
           
private  int prePlannedActivityCountMax_
           
private  SchemaResults schemaResults_
           
private  int started_
           
private  int subjectCountMax_
           
private  boolean test_
           
private  int upgradeActivityAndSubjectCountMax_
           
private  UpgradeSchemaListener upgradeSchemaListener_
           
 
Constructor Summary
UpgradeSchema(CancellationMonitor cancellation_monitor)
          Used to support the use of the UpgradeTool GUI.
 
Method Summary
private  void cleanup()
           
private  File createScriptToCall(String sql_to_execute)
           
 boolean executeFromGui()
          A GUI initiates execution using this class method.
private  void executeSqlScriptFileToStream(File script_file)
          Buffers the constructor's argument in a wt.temp file and executes the file using SQLPlus.
private  void executeSqlScriptFileToStream2(File script_file)
          Buffers the constructor's argument in a wt.temp file and executes the file using SQLPlus.
private  void executeUpgradeSchema(String[] args)
           
private  void getDBAccessCredentials()
          Parse the DSProperties for the USER/PASSWORD/SERVICE information, and maybe a connectString.
(package private)  void init()
           
private  File performLeadingActivities()
           
private  void progressBarTest(int i, String str)
           
private  int readGuiDisplayedItems()
           
 void setListener(UpgradeSchemaListener x)
          Allows execution to know minimal details about the user.
private  void testGuiForACancel()
           
private  void updateGuiAsCompleted(int number_of_sql)
           
private  void updateGuiWithSchemaResults()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dateSQL

private Date dateSQL

dateFormatter

private SimpleDateFormat dateFormatter

dateSQLString

private String dateSQLString

cancellationMonitor_

private CancellationMonitor cancellationMonitor_

upgradeSchemaListener_

private UpgradeSchemaListener upgradeSchemaListener_

blockExecutionWhileDecidingCancel_

private boolean blockExecutionWhileDecidingCancel_

isCancelable_

private boolean isCancelable_

guiDisplayedItems_

private Vector guiDisplayedItems_

guiDisplayedSubjectsCount_

private Vector guiDisplayedSubjectsCount_

prePlannedActivityCountMax_

private int prePlannedActivityCountMax_

upgradeActivityAndSubjectCountMax_

private int upgradeActivityAndSubjectCountMax_

subjectCountMax_

private int subjectCountMax_

nextActivity_

private String nextActivity_

leadingActivities_

private int leadingActivities_

otherActivities_

private int otherActivities_

completed_

private int completed_

started_

private int started_

schemaResults_

private SchemaResults schemaResults_

logInString_

private String logInString_

compareSchema_

private CompareSchema compareSchema_

isARunSQLPlusError_

private boolean isARunSQLPlusError_

inactivityTimeout_

private long inactivityTimeout_

bufferedLineReader_

private BufferedLineReader bufferedLineReader_

test_

private boolean test_

fakeRerun_

private boolean fakeRerun_
Constructor Detail

UpgradeSchema

public UpgradeSchema(CancellationMonitor cancellation_monitor)
Used to support the use of the UpgradeTool GUI.

Parameters:
cancellation_monitor - Used to detect the user canceling all execution.
Method Detail

setListener

public void setListener(UpgradeSchemaListener x)
Allows execution to know minimal details about the user. Allows this code to compile first, without depending on the user's code.

Parameters:
x - UpgradeSchemaListener A contract for the user and this code to interact.

init

void init()

executeFromGui

public boolean executeFromGui()
                       throws UpgradeSchemaException,
                              Throwable
A GUI initiates execution using this class method. This is the GUI's replacement need for the main(...) or execute(...) methods.

Returns:
A true if execution was a success (not a cancel).
Throws:
UpgradeSchemaException - If a code error was detected.
Throwable - If there is an unknown exception.

executeUpgradeSchema

private void executeUpgradeSchema(String[] args)
                           throws UpgradeSchemaException,
                                  CancelException
Throws:
UpgradeSchemaException
CancelException

progressBarTest

private void progressBarTest(int i,
                             String str)

performLeadingActivities

private File performLeadingActivities()
                               throws UpgradeSchemaException,
                                      CancelException
Throws:
UpgradeSchemaException
CancelException

readGuiDisplayedItems

private int readGuiDisplayedItems()
                           throws UpgradeSchemaException
Throws:
UpgradeSchemaException

cleanup

private void cleanup()

updateGuiAsCompleted

private void updateGuiAsCompleted(int number_of_sql)
                           throws UpgradeSchemaException
Throws:
UpgradeSchemaException

testGuiForACancel

private void testGuiForACancel()
                        throws UpgradeSchemaException,
                               CancelException
Throws:
UpgradeSchemaException
CancelException

updateGuiWithSchemaResults

private void updateGuiWithSchemaResults()
                                 throws UpgradeSchemaException
Throws:
UpgradeSchemaException

executeSqlScriptFileToStream

private void executeSqlScriptFileToStream(File script_file)
                                   throws UpgradeSchemaException,
                                          CancelException
Buffers the constructor's argument in a wt.temp file and executes the file using SQLPlus.

Parameters:
script_file - Approximately used for: " sqlplus user/password&064;system &064;script_file ".
Throws:
UpgradeSchemaException - If the SQL could not be executed.
CancelException - If the user canceled during execution.

executeSqlScriptFileToStream2

private void executeSqlScriptFileToStream2(File script_file)
                                    throws UpgradeSchemaException,
                                           CancelException
Buffers the constructor's argument in a wt.temp file and executes the file using SQLPlus.

Parameters:
script_file - Approximately used for: " sqlplus user/password&064;system &064;script_file ".
Throws:
UpgradeSchemaException - If the SQL could not be executed.
CancelException - If the user canceled during execution.

createScriptToCall

private File createScriptToCall(String sql_to_execute)
                         throws UpgradeSchemaException
Throws:
UpgradeSchemaException

getDBAccessCredentials

private void getDBAccessCredentials()
                             throws IOException
Parse the DSProperties for the USER/PASSWORD/SERVICE information, and maybe a connectString. Set the timeout variables.

Throws:
IOException - If processing can not interpret or parse the strings in the db.properties file.