Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.1.0)

E17493-02

oracle.ide.migration
Class NodeMigrator

java.lang.Object
  extended by oracle.ide.migration.NodeMigrator
Direct Known Subclasses:
ProjectMigrator, 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.

Extensions 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.

Extensions 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.

Extensions can find out if migration is under way by calling the method getTraversableContext(). When this method returns a non-null value extensions can assume a migration operation is in progress.


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)
          Deprecated. declare NodeMigratorHelpers declaratively throught the node-migrator hook.
protected  void callHelperMigrate(NodeMigratorHelper helper, MigrationInfo info, TraversableContext context)
           
protected  void callHelpersMigrate(MigrationInfo info, TraversableContext context)
           
protected  boolean checkVersioning(MigrationInfo[] infos)
          Method called before migration is initiated to verify if migration can proceed or not dependning on the versioning status of each URL.
 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.
 NodeMigratorHelperReference[] getHelperReferences()
          Returns references to NodeMigratorHelpers.
protected  NodeMigratorHelperReference[] getHelperReferences(MigrationInfo info)
          Returns references to NodeMigratorHelpers that are newer than the version number stored in the project file.
 NodeMigratorHelper[] getHelpers()
          Deprecated. #getHelperReferences() instead.
protected  NodeMigratorHelper[] getHelpers(MigrationInfo info)
          Deprecated. use #getHelperReferences(MigrationInfo) instead.
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(Node node)
          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.
 TraversableContext getTraversableContext()
          Returns a non-null TraversableContext while migration is in progress, otherwise, the value returned is null.
protected  float getWeight()
          Returns the weight which we wish to give to the migrator when migrating it.
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.
 MigrationInfo[] migrate(MigrationInfo[] infos)
          Method called to migrate the nodes recorded in the specified MigrationInfo.
protected  NodeMigratorHook.MigratorType migratorType()
           
protected  void postMigrate(MigrationInfo[] infos, TraversableContext context)
          Method called after migration is complete.
protected  void preMigrate(MigrationInfo[] infos, TraversableContext context)
          Method called before migration is initiated.
 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.

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 final MigrationInfo[] migrate(MigrationInfo[] infos)
Method called to migrate the nodes recorded in the specified MigrationInfo.

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.

getTraversableContext

public TraversableContext getTraversableContext()
Returns a non-null TraversableContext while migration is in progress, otherwise, the value returned is null.


preMigrate

protected void preMigrate(MigrationInfo[] infos,
                          TraversableContext context)
Method called before migration is initiated. This method should be overriden if a migrator implementation needs to setup before migration starts. The default implementation does nothing.

Parameters:
infos - information about the nodes that may require migration. All nodes held in the MigrationInfo must be of the same type.
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.

checkVersioning

protected boolean checkVersioning(MigrationInfo[] infos)
Method called before migration is initiated to verify if migration can proceed or not dependning on the versioning status of each URL. This method should be overriden if a migrator implementation needs not perform this check.

Parameters:
infos - information about the nodes that may require migration. All nodes held in the MigrationInfo must be of the same type.
Returns:
true if migration can proceed, false otherwise.

postMigrate

protected void postMigrate(MigrationInfo[] infos,
                           TraversableContext context)
Method called after migration is complete. The default implementation does nothing.

Parameters:
infos - information about the nodes that may require migration. All nodes held in the MigrationInfo must be of the same type.
context - contains addin specific migration data that is passed on to the helpers such that they can use that information when migrating their data.

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 final 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.

callHelpersMigrate

protected void callHelpersMigrate(MigrationInfo info,
                                  TraversableContext context)

callHelperMigrate

protected final void callHelperMigrate(NodeMigratorHelper helper,
                                       MigrationInfo info,
                                       TraversableContext context)

addHelper

@Deprecated
public final void addHelper(NodeMigratorHelper helper)
Deprecated. declare NodeMigratorHelpers declaratively throught the node-migrator hook.

Add a NodeMigratorHelper.

Parameters:
helper - a node migration helper.

removeHelper

public final 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

@Deprecated
public NodeMigratorHelper[] getHelpers()
Deprecated. #getHelperReferences() instead.

Get registered NodeMigratorHelpers.


getHelperReferences

public NodeMigratorHelperReference[] getHelperReferences()
Returns references to NodeMigratorHelpers. These references point to actual NodeMigrationHelpers or NodeMigrationHelpers registered declaratively through the node-migrator hook.

Returns:
an empty array (default implementation.)

migratorType

protected NodeMigratorHook.MigratorType migratorType()

getHelpers

@Deprecated
protected NodeMigratorHelper[] getHelpers(MigrationInfo info)
Deprecated. use #getHelperReferences(MigrationInfo) instead.

Get the NodeMigratorHelpers that are newer than the version number stored in the project file.


getHelperReferences

protected NodeMigratorHelperReference[] getHelperReferences(MigrationInfo info)
Returns references to NodeMigratorHelpers that are newer than the version number stored in the project file. These references point to actual NodeMigrationHelpers or NodeMigrationHelpers registered declaratively through the node-migrator hook.

Returns:
an empty array (default implementation.)

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 final 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.

getWeight

protected float getWeight()
Returns the weight which we wish to give to the migrator when migrating it.

Returns:
a value in [0.00, 1.00] range. Lower values means "execute earlier". e.g. 0.00 means try to be the first, 1.00 means execute at the mercy of the migration scheduler.

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.1.0)

E17493-02

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