Extension SDK 10.1.2

oracle.ide.migration
Class NodeMigrator

java.lang.Object
  extended byoracle.ide.migration.NodeMigrator
Direct Known Subclasses:
JProjectMigrator, WorkspaceMigrator

public abstract class NodeMigrator
extends java.lang.Object

The NodeMigrator class is used for migrating nodes from previous versions of JDeveloper to a new JDeveloper version.

Addins should register NodeMigratorHelpers to handle customized migration of nodes they are interested in. That registration is done on the specific implementation of a node migrator. For example, workspace migration helpers are registered with the WorkspaceMigrator.

Addins access specific migrators by invoking the method getNodeMigrator(java.lang.String) specifying the appropriate migrator name identifier. For example, to get at the workspace migrator the identifier {link oracle.ide.model.WorkspaceMigrator#MIGRATOR_NAME} would be used. A migrator identifier is the name of the node class that migrator works on.


Field Summary
static java.lang.String MIGRATOR_MAP_DATA
          Constant identifying the migration data stored in the TraversableContext.
 
Constructor Summary
NodeMigrator()
           
 
Method Summary
 void addHelper(NodeMigratorHelper helper)
          Add a NodeMigratorHelper.
 MigrationInfo.MigrationStatus checkVersions(MigrationInfo[] infos)
          Verify if all nodes can be migrated.
 java.util.List doMigration(java.util.List list, TraversableContext context)
          This method invokes the NodeMigratorHelpers to carry out addin specific migrations.
 java.util.List doMigration(TraversableContext context)
          Do the actual migration of the nodes.
protected  void finishMigration(java.util.List infos)
          Conclude the migration process by saving the migrated objects and updating their migration status.
protected  void forceSave(Node node)
          Makes sure that the specified node is saved.
protected  NodeMigratorHelper[] getHelpers()
          Get registered NodeMigratorHelpers.
protected  java.util.Map getInfoToMigratorMap(TraversableContext context)
          Gets from the context the Map identified by the constant MIGRATOR_MAP_DATA.
static java.lang.String getLookupKey(java.lang.Class clazz)
          Build the key used to lookup a node migrator.
static java.lang.String getLookupKey(Node node)
          Build the key used to lookup a node migrator.
static java.lang.String getLookupKey(java.lang.String name)
          Build the key used to lookup a node migrator.
abstract  MigrationInfo getMigrationInfo(Node node)
          Get the current MigrationInfo for the specified node.
 MigrationInfo[] getMigrationInfos(Node[] nodes)
          Get the current MigrationInfos for the specified nodes.
protected abstract  java.lang.String getMsg(MigrationInfo[] infos)
          Get the wizard welcome page message.
static NodeMigrator getNodeMigrator(java.lang.String name)
          Use this method to access the migrator specified by the name.
 java.util.List getPages(MigrationInfo[] infos, TraversableContext context)
          Get the list of wizard pages associated with the specified infos.
protected abstract  java.lang.String getSummaryMsg(MigrationInfo[] infos)
          Get the message for the wizard summary page.
protected abstract  java.lang.String getTitle()
          Get the wizard title.
protected  MigrationInfo.MigrationStatus invokeWizard(TraversableContext context, java.util.List pages, MigrationInfo[] infos)
          Invoke the migration wizard.
protected  void mapInfoToMigrator(NodeMigrator key, MigrationInfo info, java.util.Map map)
          Associate the NodeMigrator specified with the given MigrationInfo by storing these in the specified map.
 MigrationInfo migrate(MigrationInfo info)
          Migrate the node whose migration information is given.
abstract  MigrationInfo[] migrate(MigrationInfo[] infos)
          Method called to migrate the nodes recorded in the specified MigrationInfo.
protected  void recache(MigrationInfo[] infos, boolean cacheCopy)
          Tells the NodeFactory to recache the copy or original node as dictated by the cacheCopy parameter.
 void removeHelper(NodeMigratorHelper helper)
          Remove the specified NodeMigratorHelper.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIGRATOR_MAP_DATA

public static final java.lang.String MIGRATOR_MAP_DATA
Constant identifying the migration data stored in the TraversableContext. This information is a Map associating a NodeMigrator with the list of MigrationInfos.

See Also:
Constant Field Values
Constructor Detail

NodeMigrator

public NodeMigrator()
Method Detail

getNodeMigrator

public static NodeMigrator getNodeMigrator(java.lang.String name)
Use this method to access the migrator specified by the name.

Parameters:
name - a unique name identifying a node migrator. This name must be the class name of the nodes the migrator requested is responsible for migrating.
Returns:
an instance of the node migrator identified by name.

getLookupKey

public static java.lang.String getLookupKey(Node node)
Build the key used to lookup a node migrator. The key is built using the class of the node.

Parameters:
node - the node whose class is used to build the key.

getLookupKey

public static java.lang.String getLookupKey(java.lang.String name)
Build the key used to lookup a node migrator. The name should be the class of the node.

Parameters:
name - the class name of a node.

getLookupKey

public static java.lang.String getLookupKey(java.lang.Class clazz)
Build the key used to lookup a node migrator.


getMigrationInfo

public abstract MigrationInfo getMigrationInfo(Node node)
Get the current MigrationInfo for the specified node.

Parameters:
node - the target node for which migration information is being requested.

migrate

public abstract MigrationInfo[] migrate(MigrationInfo[] infos)
Method called to migrate the nodes recorded in the specified MigrationInfo. This method should do the migration without popping-up an end user graphical user interface.

Parameters:
infos - information about the nodes that may require migration. All nodes held in the MigrationInfo must be of the same type.
Returns:
migration information indicating if requested migration happened.

getMigrationInfos

public MigrationInfo[] getMigrationInfos(Node[] nodes)
Get the current MigrationInfos for the specified nodes.

Parameters:
nodes - the target nodes for which migration information is being requested. All nodes must be of the same type.

getPages

public java.util.List getPages(MigrationInfo[] infos,
                               TraversableContext context)
Get the list of wizard pages associated with the specified infos. Clients must use the context object to store the data diplayed in these pages.

Parameters:
infos - migration information about the nodes to migrate. All nodes must be of the same type.
context - use the context to store the data gathered from the pages.
Returns:
a list of migration pages that the migration wizard displays.

migrate

public MigrationInfo migrate(MigrationInfo info)
Migrate the node whose migration information is given. Implementations may popup an end user graphical user interface to help users with the migration process.

Parameters:
info - migration information.
Returns:
migration information indicating if requested migration happened.

doMigration

public java.util.List doMigration(TraversableContext context)
Do the actual migration of the nodes. The information about what nodes need migration is kept in the context.

Parameters:
context - contains a Map that can be obtained from the context using the name identifier: MIGRATOR_MAP_DATA. The information needed to do the migration is held by this map.

doMigration

public java.util.List doMigration(java.util.List list,
                                  TraversableContext context)
This method invokes the NodeMigratorHelpers to carry out addin specific migrations.

Parameters:
list - migration information about the nodes to migrate.
context - contains addin specific migration data that is passed on to the helpers such that they can use that information when migrating their data.

addHelper

public void addHelper(NodeMigratorHelper helper)
Add a NodeMigratorHelper.

Parameters:
helper - a node migration helper.

removeHelper

public void removeHelper(NodeMigratorHelper helper)
Remove the specified NodeMigratorHelper.

Parameters:
helper - the node migrator helper to be removed.

checkVersions

public MigrationInfo.MigrationStatus checkVersions(MigrationInfo[] infos)
Verify if all nodes can be migrated. If any node cannot be migrated migration will be canceled. This methods checks the version information to determine if the nodes need to be migrated or not.

Returns:
returns MIGRATION_PENDING if all nodes need to be migrated. MIGRATION_NOT_POSSIBLE if any node in the list cannot be migrated. A node cannot be migrated its version is newer. MIGRATION_NOT_NEEDED if all nodes don't need it.

getTitle

protected abstract java.lang.String getTitle()
Get the wizard title. Subclasses must implement this method to define the wizard title.

Returns:
the wizard title.

getMsg

protected abstract java.lang.String getMsg(MigrationInfo[] infos)
Get the wizard welcome page message. Subclasses must implement this method to define the welcome page message.

Returns:
the welcome page message.

getSummaryMsg

protected abstract java.lang.String getSummaryMsg(MigrationInfo[] infos)
Get the message for the wizard summary page. Subclasses must implement this method to define the summary page message.

Returns:
the summary page message.

invokeWizard

protected MigrationInfo.MigrationStatus invokeWizard(TraversableContext context,
                                                     java.util.List pages,
                                                     MigrationInfo[] infos)
Invoke the migration wizard.


getHelpers

protected NodeMigratorHelper[] getHelpers()
Get registered NodeMigratorHelpers.


getInfoToMigratorMap

protected java.util.Map getInfoToMigratorMap(TraversableContext context)
Gets from the context the Map identified by the constant MIGRATOR_MAP_DATA.


mapInfoToMigrator

protected void mapInfoToMigrator(NodeMigrator key,
                                 MigrationInfo info,
                                 java.util.Map map)
Associate the NodeMigrator specified with the given MigrationInfo by storing these in the specified map.

Parameters:
key - the node migrator.
info - the migration information.
map - map associating the migrator with the migration information.

finishMigration

protected void finishMigration(java.util.List infos)
Conclude the migration process by saving the migrated objects and updating their migration status.

Parameters:
infos - a list of objects that may have been migrated.

forceSave

protected void forceSave(Node node)
Makes sure that the specified node is saved.

Parameters:
node - the node to save.

recache

protected void recache(MigrationInfo[] infos,
                       boolean cacheCopy)
Tells the NodeFactory to recache the copy or original node as dictated by the cacheCopy parameter. This is done before calling out to the NodeMigratorHelpers in order to allow migrator helpers to access the node copy when looking for the node in the node factory.


Extension SDK

 

Copyright © 1997, 2004, Oracle. All rights reserved.