com.ptc.windchill.upgrade.modeldiff
Class AddConstraints

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

public class AddConstraints
extends Object


Nested Class Summary
 class AddConstraints.ExecutionException
           
private  class AddConstraints.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  AddConstraintsListener addConstraintsListener_
           
private  boolean blockExecutionWhileDecidingCancel_
           
private  BufferedLineReader bufferedLineReader_
           
private  CancellationMonitor cancellationMonitor_
           
private  CompareSchema compareSchema_
           
private  int completed1_
           
private  int completed2_
           
private  int completed3_
           
private  SimpleDateFormat dateFormatter
           
private  Date dateSQL
           
private  String dateSQLString
           
private  boolean fakeRerun_
           
private  long inactivityTimeout_
           
private  boolean isARunSQLPlusError_
           
private  boolean isCancelable_
           
private  int leadingActivities_
           
private  int leadingActivities1_
           
private  int leadingActivities2_
           
private  int leadingActivitiesSoFar_
           
private  String logInString_
           
private  String nextActivity_
           
private  int notNullActivityAndSubjectCountMax_
           
private  Vector notNullGuiDisplayedItems_
           
private  Vector notNullGuiDisplayedSubjectsCount_
           
private  int otherActivities_
           
private  int prePlannedActivityCountMax_
           
private  int prePlannedNotNullActivityCountMax_
           
private  int prePlannedTrailingActivityCountMax_
           
private  int prePlannedUniqueActivityCountMax_
           
private  SchemaResults schemaResults_
           
private  File script1File_
           
private  File script2File_
           
private  int started1_
           
private  int started2_
           
private  int started3_
           
private  int subjectCountMax_
           
private  boolean test_
           
private  int uniqueActivityAndSubjectCountMax_
           
private  Vector uniqueGuiDisplayedItems_
           
private  Vector uniqueGuiDisplayedSubjectsCount_
           
 
Constructor Summary
AddConstraints(CancellationMonitor cancellation_monitor)
          Used to support the use of the UpgradeTool GUI.
 
Method Summary
private  void cleanup()
           
private  void createInvalidObjectsSpool()
           
(package private)  PrintWriter createPrintWriter(String path_and_file_name)
           
private  File createScriptToCall(String sql_to_execute)
          Buffers the constructor's argument in a wt.temp file and executes the file using SQLPlus.
private  void executeAddConstraints(String[] args)
           
 boolean executeFromGui()
          A GUI initiates execution using this class method.
private  int executeSqlScriptFileToStream(File script_file, int activityAndSubjectCountMax, Vector guiDisplayedItems, Vector guiDisplayedSubjectsCount)
          Buffers the constructor's argument in a wt.temp file and executes the file using SQLPlus.
private  void getDBAccessCredentials()
          Parse the DSProperties for the USER/PASSWORD/SERVICE information, and maybe a connectString.
(package private)  void init()
           
private  void performLeadingActivities1()
           
private  void performLeadingActivities2()
           
private  void progressBarTest(int i, String str)
           
private  void reAddNonModeledPackages()
           
private  int readGuiDisplayedItems(String path_and_file_name, Vector guiDisplayedItems, Vector guiDisplayedSubjectsCount)
           
private  void reBuildReCompileInvalidObjects()
           
 void setListener(AddConstraintsListener 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_

addConstraintsListener_

private AddConstraintsListener addConstraintsListener_

blockExecutionWhileDecidingCancel_

private boolean blockExecutionWhileDecidingCancel_

isCancelable_

private boolean isCancelable_

uniqueGuiDisplayedItems_

private Vector uniqueGuiDisplayedItems_

uniqueGuiDisplayedSubjectsCount_

private Vector uniqueGuiDisplayedSubjectsCount_

notNullGuiDisplayedItems_

private Vector notNullGuiDisplayedItems_

notNullGuiDisplayedSubjectsCount_

private Vector notNullGuiDisplayedSubjectsCount_

prePlannedUniqueActivityCountMax_

private int prePlannedUniqueActivityCountMax_

prePlannedNotNullActivityCountMax_

private int prePlannedNotNullActivityCountMax_

prePlannedTrailingActivityCountMax_

private int prePlannedTrailingActivityCountMax_

prePlannedActivityCountMax_

private int prePlannedActivityCountMax_

uniqueActivityAndSubjectCountMax_

private int uniqueActivityAndSubjectCountMax_

notNullActivityAndSubjectCountMax_

private int notNullActivityAndSubjectCountMax_

subjectCountMax_

private int subjectCountMax_

nextActivity_

private String nextActivity_

leadingActivitiesSoFar_

private int leadingActivitiesSoFar_

leadingActivities1_

private int leadingActivities1_

leadingActivities2_

private int leadingActivities2_

leadingActivities_

private int leadingActivities_

otherActivities_

private int otherActivities_

completed1_

private int completed1_

started1_

private int started1_

completed2_

private int completed2_

started2_

private int started2_

completed3_

private int completed3_

started3_

private int started3_

schemaResults_

private SchemaResults schemaResults_

logInString_

private String logInString_

compareSchema_

private CompareSchema compareSchema_

isARunSQLPlusError_

private boolean isARunSQLPlusError_

inactivityTimeout_

private long inactivityTimeout_

script1File_

private File script1File_

script2File_

private File script2File_

bufferedLineReader_

private BufferedLineReader bufferedLineReader_

test_

private boolean test_

fakeRerun_

private boolean fakeRerun_
Constructor Detail

AddConstraints

public AddConstraints(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(AddConstraintsListener 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 - AddConstraintsListener A contract for the user and this code to interact.

init

void init()

executeFromGui

public boolean executeFromGui()
                       throws AddConstraintsException,
                              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:
AddConstraintsException - If a code error was detected.
Throwable - If there is an unknown exception.

executeAddConstraints

private void executeAddConstraints(String[] args)
                            throws AddConstraintsTestException,
                                   AddConstraintsException,
                                   CancelException
Throws:
AddConstraintsTestException
AddConstraintsException
CancelException

progressBarTest

private void progressBarTest(int i,
                             String str)

performLeadingActivities1

private void performLeadingActivities1()
                                throws AddConstraintsTestException,
                                       AddConstraintsException,
                                       CancelException
Throws:
AddConstraintsTestException
AddConstraintsException
CancelException

performLeadingActivities2

private void performLeadingActivities2()
                                throws AddConstraintsException,
                                       CancelException
Throws:
AddConstraintsException
CancelException

reAddNonModeledPackages

private void reAddNonModeledPackages()
                              throws AddConstraintsException,
                                     CancelException
Throws:
AddConstraintsException
CancelException

reBuildReCompileInvalidObjects

private void reBuildReCompileInvalidObjects()
                                     throws AddConstraintsException,
                                            CancelException
Throws:
AddConstraintsException
CancelException

createInvalidObjectsSpool

private void createInvalidObjectsSpool()
                                throws AddConstraintsException,
                                       CancelException
Throws:
AddConstraintsException
CancelException

readGuiDisplayedItems

private int readGuiDisplayedItems(String path_and_file_name,
                                  Vector guiDisplayedItems,
                                  Vector guiDisplayedSubjectsCount)
                           throws AddConstraintsException
Throws:
AddConstraintsException

createPrintWriter

PrintWriter createPrintWriter(String path_and_file_name)
                        throws AddConstraintsException
Throws:
AddConstraintsException

cleanup

private void cleanup()

updateGuiAsCompleted

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

testGuiForACancel

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

updateGuiWithSchemaResults

private void updateGuiWithSchemaResults()
                                 throws AddConstraintsException
Throws:
AddConstraintsException

executeSqlScriptFileToStream

private int executeSqlScriptFileToStream(File script_file,
                                         int activityAndSubjectCountMax,
                                         Vector guiDisplayedItems,
                                         Vector guiDisplayedSubjectsCount)
                                  throws AddConstraintsException,
                                         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:
AddConstraintsException - If the SQL could not be executed.
CancelException - If the user canceled during execution.

createScriptToCall

private File createScriptToCall(String sql_to_execute)
                         throws AddConstraintsException
Buffers the constructor's argument in a wt.temp file and executes the file using SQLPlus.

Throws:
AddConstraintsException - If the SQL could not be executed.
CancelException - If the user canceled during execution.

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.