|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Migration of data in a new schema can occur in two ways. One is via SQL scripts the other is programatically. This interface can be implemented by programmatic migration applications and then be run in a controlled manner by the Update Tool.
Once you develop a Migrator consult the ADG or Development Library Cookbook for information on authoring incremental updates for the Update Tool.
... catch(SomeException ex) { ex.printStackTrace(log_writer); }
public boolean runMigration(Connection windchill_database_connection, PersistentObjectManager pom, PrintWriter log_writer) throws wt.pom.PersistenceException, wt.query.QueryException, wt.util.WTPropertyVetoException { // To use the POM you will need to instantiate an AccessController. // This one does no checks. wt.pds.AccessControllerAdapter aca = new wt.pds.AccessControllerAdapter(); // perform the work (e.g. query some objects and change them) wt.query.QuerySpec qs = new wt.query.QuerySpec(...); QueryResult result = pom.query(qs, aca); // notice the required use of aca while(result.hasMoreElements()) { ... // do the migration work } // return success return true; }
MigratorRunner
Method Summary | |
boolean |
runMigration(Connection windchill_database_connection,
PersistentObjectManager pom,
PrintWriter log_writer)
Run the migration. |
Method Detail |
public boolean runMigration(Connection windchill_database_connection, PersistentObjectManager pom, PrintWriter log_writer) throws Throwable
Migrators should log all output to the given PrintWriter. This is the log that is created by RunMigrators. It is an autoflush writer.
Migrators should return true if they successfully completed migration and false otherwise. It is the migrator's responsibility to log failure reasons to the log.
Migrators should not concern themselves with committing the work on the connection. The MigratorRunner will commit the connection work after running each Migrator.
windchill_database_connection
- an open connection to the Windchill databasepom
- a persistent object manager against the Windchill databaselog_writer
- an autoflush printwriter for logging any and all output
Throwable
- declared so that migrators can let exceptions contibuting to failure pass out of the method. The migrator runner will handle these by logging them.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |