Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-04

oracle.ide.migration
Class XMLMigrator

java.lang.Object
  extended by oracle.ide.migration.XMLMigrator
All Implemented Interfaces:
Migrator
Direct Known Subclasses:
DTCacheMigrator, IdeSettingsMigrator, IdeSystemMigrator, LibraryMigrator

public abstract class XMLMigrator
extends java.lang.Object
implements Migrator

The XMLMigrator is a base implementation of a first phase Migrator which operates upon an XML file. First phase Migrator subclasses need only provide implementations for the abstract methods. If desired, a second phase Migrator subclass may be written by additionally overriding the migrate method to register an IdeListener and immediately return without doing anything more (i.e. do not invoke the migrate implmentation provided here). The second phase Migrator subclass would then perform its migration tasks upon notification of the addinsLoaded event of the IdeListener registered in its migrate implementation. Note that second phase migration only manipulates live objects already initialized from sources migrated by a first phase Migrator implementation.


Nested Class Summary
static class XMLMigrator.MigrationLogger
           
 
Field Summary
 
Fields inherited from interface oracle.ide.migration.Migrator
JDEV_HOME_DIR, SYSTEM_DIR
 
Constructor Summary
protected XMLMigrator(int[] categories)
           
 
Method Summary
protected  java.lang.Object adjustObject(java.io.File sourceDir, java.io.File destDir, java.lang.Object obj)
          Perform any postprocessing necessary before migrating the file.
 boolean canMigrate(int category, java.io.File sourceDir)
          Determine whether the settings can be migrated from the given directory.
protected  int categoryToIndex(int category)
          Get the internal index of the given category.
protected  java.io.File getDestFile(java.io.File sourceDir, java.io.File destDir)
          Get the File to hold the information being migrated.
protected abstract  java.lang.String getFileName()
          Get the filename to migrate.
protected  XMLMigrator.MigrationLogger getLogger()
           
 int[] getMigrationCategories()
          Get an array of unique id values representing available categories to migrate.
protected abstract  java.lang.String getNamespaceURI()
          Get the XML namespace URI.
protected  Object2Dom getObjectStore()
           
protected abstract  java.lang.String getRootTag()
          Get the XML root element tag.
protected  java.io.File getSourceFile(java.io.File sourceDir, java.io.File destDir)
          Get the File containing the information to be migrated.
protected  boolean isAnyCategorySelected()
          Determine whether any categories are selected.
 boolean isSelected(int category)
          Determine whether a category has been flagged for migration.
protected  boolean isValidCategory(int category)
          Determine whether the given category is valid for this Migrator.
 java.lang.String[] migrate(java.io.File sourceDir, java.io.File destDir)
          Migrate the settings from a given source directory to a given destination directory.
protected  void prepareToMigrate()
          Perform any preprocessing necessary before migrating the file.
protected  java.lang.Object readObject(java.io.File sourceDir, java.io.File destDir)
          Read in the settings.
 void setSelected(int category, boolean selected)
          Flag a category as selected for migration.
protected  void writeObject(java.io.File sourceDir, java.io.File destDir, java.lang.Object settings)
          Write out the settings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface oracle.ide.migration.Migrator
getDescription
 

Constructor Detail

XMLMigrator

protected XMLMigrator(int[] categories)
Method Detail

getMigrationCategories

public final int[] getMigrationCategories()
Get an array of unique id values representing available categories to migrate.

Specified by:
getMigrationCategories in interface Migrator

setSelected

public void setSelected(int category,
                        boolean selected)
Flag a category as selected for migration.

Specified by:
setSelected in interface Migrator

isSelected

public final boolean isSelected(int category)
Determine whether a category has been flagged for migration.

Specified by:
isSelected in interface Migrator

canMigrate

public boolean canMigrate(int category,
                          java.io.File sourceDir)
Determine whether the settings can be migrated from the given directory.

Specified by:
canMigrate in interface Migrator

migrate

public java.lang.String[] migrate(java.io.File sourceDir,
                                  java.io.File destDir)
Migrate the settings from a given source directory to a given destination directory.

Specified by:
migrate in interface Migrator

getFileName

protected abstract java.lang.String getFileName()
Get the filename to migrate.


getNamespaceURI

protected abstract java.lang.String getNamespaceURI()
Get the XML namespace URI.


getRootTag

protected abstract java.lang.String getRootTag()
Get the XML root element tag.


isValidCategory

protected final boolean isValidCategory(int category)
Determine whether the given category is valid for this Migrator.


categoryToIndex

protected final int categoryToIndex(int category)
Get the internal index of the given category.


isAnyCategorySelected

protected final boolean isAnyCategorySelected()
Determine whether any categories are selected.


prepareToMigrate

protected void prepareToMigrate()
Perform any preprocessing necessary before migrating the file. For subclasses of XMLMigrator, this would typically include making the necessary Object2Dom registrations.


readObject

protected java.lang.Object readObject(java.io.File sourceDir,
                                      java.io.File destDir)
                               throws java.lang.Exception
Read in the settings.

Throws:
java.lang.Exception

writeObject

protected void writeObject(java.io.File sourceDir,
                           java.io.File destDir,
                           java.lang.Object settings)
                    throws java.lang.Exception
Write out the settings.

Throws:
java.lang.Exception

adjustObject

protected java.lang.Object adjustObject(java.io.File sourceDir,
                                        java.io.File destDir,
                                        java.lang.Object obj)
                                 throws java.lang.Exception
Perform any postprocessing necessary before migrating the file.

Throws:
java.lang.Exception

getSourceFile

protected java.io.File getSourceFile(java.io.File sourceDir,
                                     java.io.File destDir)
Get the File containing the information to be migrated. Typically this would be equivalent to new File(sourceDir, getFileName()), though might be dependant upon individual category settings in a multi category Migrator.


getDestFile

protected java.io.File getDestFile(java.io.File sourceDir,
                                   java.io.File destDir)
Get the File to hold the information being migrated. Typically this would be equivalent to new File(destDir, getFileName()), though might be dependant upon individual category settings in a multi category Migrator.


getLogger

protected final XMLMigrator.MigrationLogger getLogger()

getObjectStore

protected final Object2Dom getObjectStore()

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-04

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