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

E17493-01

oracle.ide.migration
Class ExtensionMigrator

java.lang.Object
  extended by oracle.ide.migration.ExtensionMigrator
All Implemented Interfaces:
Migrator
Direct Known Subclasses:
AuditPreferencesMigrator, CodeEditorMigrator, ExcludeFilterSettingsMigrator, VCSPropertyMapMigrator

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

Migrator implementation for extensions. This implementation will attempt to fetch all extension specific settings values from previous releases of the product, and up date the extension specific settings file accordingly.


Nested Class Summary
protected static class ExtensionMigrator.AdjustedObject
           
 
Field Summary
protected  boolean isSelected
           
protected static java.lang.String ROOT_TAG
           
protected static int SETTINGS
           
 
Fields inherited from interface oracle.ide.migration.Migrator
JDEV_HOME_DIR, SYSTEM_DIR
 
Constructor Summary
ExtensionMigrator()
           
 
Method Summary
protected  boolean addToProductPreferences()
          Determines whether the migrated preferences should be added into the Preferences object or remain separate.
protected  ExtensionMigrator.AdjustedObject[] adjustObject(java.lang.String inKey, java.lang.Object inObject)
          Override to adjust an object in some way after it has been created by Object2Dom and before it's either saved in the Preferences or ClientSetting object.
 boolean canMigrate(int category, java.io.File sourceDir)
          No categories supported.
 java.lang.String[] copyPreferenceObject(java.io.File srcFile, java.io.File destFile, java.util.List settingKeys, java.lang.String extensionID)
           
static java.lang.String[] copyPreferenceObjectsAsIs(java.io.File srcFile, java.io.File destFile, java.util.List settingKeys, java.lang.String extensionID)
           
protected  java.util.Collection<java.lang.String> getClassNamesToIgnoreErrorsOn()
          Provides a way to suppress errors from Object2Dom when the preferences file is read and contains preferences that are not in the same class loader as the preferences you are migrating.
 java.lang.String getDescription(int category)
          No descriptions supported.
protected  java.io.File getDestFile(java.io.File destDir)
          Get the destination File from the given directory.
protected abstract  java.lang.String getExtensionID()
          Get the extension ID for which settings should be persisted.
protected  java.io.File getIde1013ExtensionDirectory(java.io.File sourceDir)
           
 int[] getMigrationCategories()
          No categories supported.
protected  java.lang.ClassLoader getMigratorClassLoader()
          Override to provide a class loader other than the one that supplies the subclass of ExtensionMigrator.
protected  java.lang.String getRootTag(java.net.URL sourceURL)
          Override this only if the file that's storing your preferences uses a different root tag than ROOT_TAG.
protected abstract  java.util.List getSettingKeys()
          Get a complete list of all key values for persisting in the ClientSetting object associated with an extension.
protected  java.io.File getSourceFile(java.io.File sourceDir)
          Get the source File from the given directory.
protected  java.io.File getSourceFileOrJDevExtrasFile(java.io.File sourceDir)
          Get the source File from the given directory with the name preferences.xml.
 boolean isSelected(int category)
          No categories supported.
protected  java.lang.Class loadClass(org.w3c.dom.Element element)
           
 java.lang.String[] migrate(java.io.File sourceDir, java.io.File destDir)
          Migrate all flagged categories, from a given source directory, to a given destination directory.
 void setSelected(int category, boolean selected)
          No categories supported.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SETTINGS

protected static final int SETTINGS
See Also:
Constant Field Values

isSelected

protected boolean isSelected

ROOT_TAG

protected static final java.lang.String ROOT_TAG
See Also:
Constant Field Values
Constructor Detail

ExtensionMigrator

public ExtensionMigrator()
Method Detail

getMigrationCategories

public int[] getMigrationCategories()
No categories supported.

Specified by:
getMigrationCategories in interface Migrator
Returns:
an empty array.

getDescription

public java.lang.String getDescription(int category)
No descriptions supported.

Specified by:
getDescription in interface Migrator
Parameters:
category - ignored.
Returns:
null.

canMigrate

public boolean canMigrate(int category,
                          java.io.File sourceDir)
No categories supported.

Specified by:
canMigrate in interface Migrator
Parameters:
category - ignored.
sourceDir - ignored.
Returns:
true.

setSelected

public void setSelected(int category,
                        boolean selected)
No categories supported.

Specified by:
setSelected in interface Migrator
Parameters:
category - ignored.
selected - ignored.

isSelected

public boolean isSelected(int category)
No categories supported.

Specified by:
isSelected in interface Migrator
Parameters:
category - ignored.
Returns:
true.

migrate

public java.lang.String[] migrate(java.io.File sourceDir,
                                  java.io.File destDir)
Description copied from interface: Migrator
Migrate all flagged categories, from a given source directory, to a given destination directory. Does nothing if no categories have been flagged for migration.

Specified by:
migrate in interface Migrator

copyPreferenceObjectsAsIs

public static java.lang.String[] copyPreferenceObjectsAsIs(java.io.File srcFile,
                                                           java.io.File destFile,
                                                           java.util.List settingKeys,
                                                           java.lang.String extensionID)

copyPreferenceObject

public java.lang.String[] copyPreferenceObject(java.io.File srcFile,
                                               java.io.File destFile,
                                               java.util.List settingKeys,
                                               java.lang.String extensionID)

getMigratorClassLoader

protected java.lang.ClassLoader getMigratorClassLoader()
Override to provide a class loader other than the one that supplies the subclass of ExtensionMigrator. Only need to do this if the class being migrated cannot be loaded by the same class loader.


adjustObject

protected ExtensionMigrator.AdjustedObject[] adjustObject(java.lang.String inKey,
                                                          java.lang.Object inObject)
Override to adjust an object in some way after it has been created by Object2Dom and before it's either saved in the Preferences or ClientSetting object. The return is an array of AdjustedObjects to support cases where what used to be one preference object needs to be split into multiple preference objects.


getSourceFile

protected java.io.File getSourceFile(java.io.File sourceDir)
Get the source File from the given directory. By default assumes a File located in sourceDir of the name ClientSetting.FILENAME, else IdeSettings.FILENAME

Parameters:
sourceDir - the source directory.
Returns:
the settings File located in the given directory.

getSourceFileOrJDevExtrasFile

protected java.io.File getSourceFileOrJDevExtrasFile(java.io.File sourceDir)
Get the source File from the given directory with the name preferences.xml. If not found falls back to get the file from the o.jdeveloper directory. This is useful for extensions that have to pull prefernces data from the jdeveloper-extras module.

Parameters:
sourceDir - the source directory.
Returns:
the settings File located in the given directory.

getDestFile

protected java.io.File getDestFile(java.io.File destDir)
Get the destination File from the given directory. By default assumes a File located in destDir of the name ClientSetting.FILENAME.

Parameters:
destDir - the destination directory.
Returns:
the settings File located in the given directory.

addToProductPreferences

protected boolean addToProductPreferences()
Determines whether the migrated preferences should be added into the Preferences object or remain separate. This can only be done for preferences which have been modified to use HashStructureAdapter. If the preferences are to be added into the preferences object override this method and return true.


getClassNamesToIgnoreErrorsOn

protected java.util.Collection<java.lang.String> getClassNamesToIgnoreErrorsOn()
Provides a way to suppress errors from Object2Dom when the preferences file is read and contains preferences that are not in the same class loader as the preferences you are migrating. For example the preferences file in o.jdeveloper contains preferences for Ant, Audit, Profiler, and others which are all in different extensions. No matter who tries to migrate this there will be failures as some of the classes may not be found. Override this to provide a list of class names that should not generate errors when your migrator is run


getRootTag

protected java.lang.String getRootTag(java.net.URL sourceURL)
Override this only if the file that's storing your preferences uses a different root tag than ROOT_TAG. The only known case of this current is IdeMigrator to handle migrating settings.xml and it needs to vary the root tag based on what URL it is trying to work with


loadClass

protected java.lang.Class loadClass(org.w3c.dom.Element element)
                             throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException

getSettingKeys

protected abstract java.util.List getSettingKeys()
Get a complete list of all key values for persisting in the ClientSetting object associated with an extension.

Returns:
a list of String keys.

getExtensionID

protected abstract java.lang.String getExtensionID()
Get the extension ID for which settings should be persisted.

Returns:
an extension ID. Must not return null.

getIde1013ExtensionDirectory

protected java.io.File getIde1013ExtensionDirectory(java.io.File sourceDir)

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

E17493-01

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