com.ptc.windchill.upgrade.directives
Class ExecuteScript

java.lang.Object
  extended bycom.ptc.windchill.upgrade.directives.ExecuteScript
All Implemented Interfaces:
UpdateDirective

public class ExecuteScript
extends Object
implements UpdateDirective

This directive performs the task of executing an SQL script file located in >wt_home<\db\sql

     >ExecuteScript relativeFileName="...." <
 
The value assigned to relativeFileName is the SQL script file to be executed.


Field Summary
private static String CLASSNAME
           
private static boolean DEBUG
           
private static DebugWriter LOG
           
static String RELATIVE_SCRIPT_NAME
           
private  String scriptText_
           
 
Constructor Summary
ExecuteScript()
          Creates a new ExecuteScript object.
 
Method Summary
 void asDomOn(Element element)
          Writes the directive as a DOM element according to the class documentation above.
 void execute(DirectiveServices directive_services)
          This directive is executed by using the SQLScriptExecutor executeScript(String relative_path) to re-use code.
 void initializeFromDom(Element element)
          Reads the DOM element into this directive according to the class documentation above.
private  String modifyScriptPath(String relative_path)
          In case an IncrementalUpdate is written with backward slashes, this will convert them into forward slashes and can be executed on UNIX without any problems.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASSNAME

private static final String CLASSNAME
See Also:
Constant Field Values

DEBUG

private static final boolean DEBUG

LOG

private static final DebugWriter LOG

RELATIVE_SCRIPT_NAME

public static final String RELATIVE_SCRIPT_NAME
See Also:
Constant Field Values

scriptText_

private String scriptText_
Constructor Detail

ExecuteScript

public ExecuteScript()
Creates a new ExecuteScript object.

Method Detail

execute

public void execute(DirectiveServices directive_services)
             throws DirectiveExecutionException
This directive is executed by using the SQLScriptExecutor executeScript(String relative_path) to re-use code. The string is combined with the full path and formatted to be executed in a SQLPLUS session. If the SQLPLUS session is taking longer than expected, user's have the option of adding a property in the db.properties, called "wt.upgrade.executeScriptDirective.overallTimeOut" to increase the default timing-out value.

Specified by:
execute in interface UpdateDirective
Parameters:
directive_services - Is not used, but is required by the abstract UpdateDirective.
Throws:
DirectiveExecutionException - Is a re-throw of a SQLScriptExecutor.ExecutionException.

initializeFromDom

public void initializeFromDom(Element element)
                       throws DirectiveIOException
Reads the DOM element into this directive according to the class documentation above.

Specified by:
initializeFromDom in interface UpdateDirective
Parameters:
element - Is an element in the DOM tree.
Throws:
DirectiveIOException - If the element is null.

asDomOn

public void asDomOn(Element element)
             throws DirectiveIOException
Writes the directive as a DOM element according to the class documentation above.

Specified by:
asDomOn in interface UpdateDirective
Parameters:
element - Is an element in the DOM tree.
Throws:
DirectiveIOException - Is not used, but is required by the abstract UpdateDirective.

modifyScriptPath

private String modifyScriptPath(String relative_path)
In case an IncrementalUpdate is written with backward slashes, this will convert them into forward slashes and can be executed on UNIX without any problems.

Parameters:
relative_path - Defined by this class's constant RELATIVE_SCRIPT_NAME.
Returns:
Is the relative_path with all '\' converted to '/'.