com.ptc.windchill.upgrade.directives
Class JavaMigratorDirective

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

public class JavaMigratorDirective
extends Object
implements UpdateDirective

Alters a table to redeclare a column as not null if it is not already.

Format

    >JavaMigrator className="..."/<
 
Component Description Required Parameterizable
Attribute className the fully qualified class name of a class implementing com.ptc.windchill.upgrade.directives.Migrator yes no

Example Usage

This example runs the Migrator wt.mypackage.MyMigrator.
    <JavaMigrator className="wt.mypackage.MyMigrator"/>
 


Field Summary
static String CLASS_NAME_ATTRIBUTE_NAME
           
private  String className_
           
static String MIGRATOR_VERBOSE
           
 
Constructor Summary
JavaMigratorDirective()
          Create an instance with empty table name and column name.
 
Method Summary
 void asDomOn(Element element)
           
 void execute(DirectiveServices directive_services)
          Instantiates and executes the Migrator specified in the attribute class.
private  String getDirectiveName()
          The name of the directive.
 void initializeFromDom(Element element)
          Reads from DOMs formatted as described in the class documentation above.
private  Object instantiateMigrator()
          Creates an instance of the migrator specified in the attribute class.
private  Class loadClass()
          Loads the class specified in the attribute class.
 void setClassName(String class_name)
          Sets the class name of the migrator to run.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_NAME_ATTRIBUTE_NAME

public static final String CLASS_NAME_ATTRIBUTE_NAME
See Also:
Constant Field Values

MIGRATOR_VERBOSE

public static final String MIGRATOR_VERBOSE
See Also:
Constant Field Values

className_

private String className_
Constructor Detail

JavaMigratorDirective

public JavaMigratorDirective()
Create an instance with empty table name and column name. These names must be set before executing the directive.

Method Detail

setClassName

public void setClassName(String class_name)
                  throws ParseException
Sets the class name of the migrator to run.

Throws:
ParseException

asDomOn

public void asDomOn(Element element)
Specified by:
asDomOn in interface UpdateDirective

initializeFromDom

public void initializeFromDom(Element element)
                       throws DirectiveIOException
Reads from DOMs formatted as described in the class documentation above.

Specified by:
initializeFromDom in interface UpdateDirective
Throws:
DirectiveIOException - if one(or both)of the attributes is missing or if it is written as a parameterized attribute and contains a syntax error

execute

public void execute(DirectiveServices directive_services)
             throws DirectiveExecutionException
Instantiates and executes the Migrator specified in the attribute class.

Specified by:
execute in interface UpdateDirective
Throws:
DirectiveExecutionException - if the class cannot be found, is not actually a Migrator, the instance cannot created due to visibility issues or because the class is abstract or an interface, or the migrator fails or returns a false return value
See Also:
JavaMigrator

instantiateMigrator

private Object instantiateMigrator()
                            throws DirectiveExecutionException
Creates an instance of the migrator specified in the attribute class.

Throws:
DirectiveExecutionException - if the class cannot be found, is not actually a Migrator, or the instance cannot created due to visibility issues or because the class is abstract or an interface

loadClass

private Class loadClass()
                 throws DirectiveExecutionException
Loads the class specified in the attribute class.

Throws:
DirectiveExecutionException - if the class cannot be found

getDirectiveName

private String getDirectiveName()
The name of the directive.