Skip navigation links

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

E13403-06


oracle.ide
Class ExtensionRegistry

java.lang.Object
  extended by javax.ide.Service
      extended by javax.ide.extension.ExtensionRegistry
          extended by oracle.ide.ExtensionRegistry


public abstract class ExtensionRegistry
extends ExtensionRegistry

The extension registry provides access to information about extensions loaded from JSR-198 extension manifests during initialization of the IDE.

This registry implementation provides information about extensions that is specific to the Oracle JSR-198 implementation.

Although it is not final, this class is not intended for subclassing by extension writers.

Obtain an instance of the extension registry like this:

   ExtensionRegistry registry = ExtensionRegistry.getExtensionRegistry();
 
Since:
10.1.3

Nested Class Summary
static class ExtensionRegistry.ClassFactory
          Factory for loading classes.

 

Field Summary
protected  java.util.logging.Logger _manifestLogger
           
static java.lang.String DEFAULT_PROCESSOR_PLUGINS_DIR
          The directory (relative to the oracle home) that contains default extension processor plugins.
static java.lang.String EDT_EXTENSION_ID
          This property is primarily intended for use by the extension design time.
static java.lang.String EDT_HOT_CLASSES
          This property is primarily intended for use by the extension design time.
static java.lang.String EDT_HOT_DEPLOY_DIR
          This property is primarily intended for use by the extension design time.
static java.lang.String EDT_HOT_MANIFEST
          This property is primarily intended for use by the extension design time.
protected static java.lang.String EXTENSIONS_DIR
          The name of the extensions directory.
static java.lang.String PRODUCT_PROCESSOR_PLUGINS_DIR
          The directory (relative to the product home) that contains product-specific extension processor plugins.

 

Constructor Summary
ExtensionRegistry()
           

 

Method Summary
protected  RoleManager createRoleManager()
          Creates the role manager.
abstract  Extension findExtensionEvenIfNotLoaded(java.lang.String id)
          Returns an extension by its id.
abstract  java.util.Collection<Extension> getAllExtensions()
          Returns all available extensions, whether or not they are currently loaded.
 java.util.Collection<ExtensionHook> getAllHooks()
          Returns all registered hooks.
 java.lang.ClassLoader getClassLoader(java.lang.String extensionId)
          Returns the class loader to use for the specified extension.
 java.util.Collection<java.lang.String> getDisabledExtensions()
          Returns a collection of all disabled extensions.
 java.io.File getExtensionJAR(Extension extension)
          Returns the JAR file for the specified extension.
 java.lang.String getExtensionJAR(java.lang.String extensionId, Version version)
          Deprecated. since 11.0 use getExtensionJAR( Extension ).
protected  java.lang.String getExtensionJAR(java.lang.String extensionId, Version version, boolean userDirOk)
          Deprecated. since 11.0 use getExtensionJAR( Extension ).
static ExtensionRegistry getExtensionRegistry()
          Returns the Oracle implementation of the JSR-198 extension registry.
abstract  java.util.Collection<java.io.File> getExtensionSearchPath()
          Returns the list of locations that should be searched for extensions.
 ExtensionHook getHook(ElementName elementName)
          Returns the hook for the specified element name.
 IdeHook getIdeHook(ElementName elementName)
          Deprecated. since 11.0. Use getHook(ElementName). This method is being maintained for backwards compatibility.
 java.io.File getInstallDirectory(Extension extension)
          Returns the install directory for an extension.
 java.lang.String getInstallDirectory(java.lang.String extensionId)
          Deprecated. since 11.0 use getInstallDirectory(Extension).
 java.lang.String getInstallDirectory(java.lang.String extensionId, Version version)
          Deprecated. since 11.0 use getInstallDirectory(Extension).
 java.net.URI getInstallRoot(Extension extension)
          Returns the install root of the specified extension.
 java.util.logging.Logger getLogger()
          Returns the logger that should be used to log messages of interest to extension developers.
 java.util.logging.Logger getManifestLogger()
          Returns the logger used to report problems in the extension manifest.
abstract  java.lang.String getNotLoadedReason(java.lang.String extensionId)
          Gets the reason why a particular extension was not loaded.
static ExtensionRegistry getOracleRegistry()
          Deprecated. since 11.1.1 use getExtensionRegistry().
 RoleManager getRoleManager()
          Returns the role manager.
abstract  java.net.URL getSystemDirectory(java.lang.String extensionId)
          Returns the system directory for the specified extension.
abstract  java.net.URL getSystemDirectory(java.lang.String extensionId, Version version)
          Returns the system directory for the specified extension.
static boolean isCustomizationContext(ElementContext context)
          Returns true if the specified context is one in which it is valid to register customization hooks.
abstract  boolean isLoaded(java.lang.String extensionId)
          Returns true if a specified extension is loaded.
abstract  boolean isNewlyInstalled(java.lang.String extensionId)
          Returns true if the specified extension is newly installed.
abstract  boolean isUserExtension(java.lang.String extensionId)
          Returns true if a specified extension is located in the user specific extensions directory.
protected  void registerIdeHook(ElementName elementName, ExtensionHook hook)
          Registers an ide hook.

 

Methods inherited from class javax.ide.extension.ExtensionRegistry
addToClassPath, createExtensionLogger, createExtensionVisitor, createHookVisitorFactory, createInitialContext, cycleEncountered, findAllExtensionSources, findExtension, getExtensions, initialize, isExtensionEnabled, loadExtension, loadExtensions, loadExtensions, unsatisfiedExtensionDependencies

 

Methods inherited from class javax.ide.Service
getService, resetAllServices

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

EDT_HOT_CLASSES

public static final java.lang.String EDT_HOT_CLASSES
This property is primarily intended for use by the extension design time.
See Also:
Constant Field Values

EDT_HOT_MANIFEST

public static final java.lang.String EDT_HOT_MANIFEST
This property is primarily intended for use by the extension design time.
See Also:
Constant Field Values

EDT_HOT_DEPLOY_DIR

public static final java.lang.String EDT_HOT_DEPLOY_DIR
This property is primarily intended for use by the extension design time.
See Also:
Constant Field Values

EDT_EXTENSION_ID

public static final java.lang.String EDT_EXTENSION_ID
This property is primarily intended for use by the extension design time.
See Also:
Constant Field Values

EXTENSIONS_DIR

protected static final java.lang.String EXTENSIONS_DIR
The name of the extensions directory.
See Also:
Constant Field Values

DEFAULT_PROCESSOR_PLUGINS_DIR

public static final java.lang.String DEFAULT_PROCESSOR_PLUGINS_DIR
The directory (relative to the oracle home) that contains default extension processor plugins. See ExtensionProcessorPlugin for more details.
Since:
11.1.1
See Also:
Constant Field Values

PRODUCT_PROCESSOR_PLUGINS_DIR

public static final java.lang.String PRODUCT_PROCESSOR_PLUGINS_DIR
The directory (relative to the product home) that contains product-specific extension processor plugins. See ExtensionProcessorPlugin for more details.
Since:
11.1.1
See Also:
Constant Field Values

_manifestLogger

protected java.util.logging.Logger _manifestLogger

Constructor Detail

ExtensionRegistry

public ExtensionRegistry()

Method Detail

isCustomizationContext

public static boolean isCustomizationContext(ElementContext context)
Returns true if the specified context is one in which it is valid to register customization hooks. It is generally only valid to do so in the product extension, or in a role.

Customization hook implementations may test this method to determine whether a customization hook usage is valid in the given context. If it is not valid, then the hook should silently ignore the customization.

Parameters:
context - a manifest processing context.
Returns:
true if the specified context represents a context in which customization is acceptable.
Throws:
java.lang.NullPointerException - if context is null.
Since:
11.0

getExtensionSearchPath

public abstract java.util.Collection<java.io.File> getExtensionSearchPath()
Returns the list of locations that should be searched for extensions.
Returns:
a list of directories, each of which will be searched for extensions.
Since:
11.0

getExtensionRegistry

public static final ExtensionRegistry getExtensionRegistry()
Returns the Oracle implementation of the JSR-198 extension registry. This method is just a convenience implementation of:
 (ExtensionRegistry) javax.ide.extensionExtensionRegistry.getExtensionRegistry()
 
Returns:
the extension registry.

getOracleRegistry

public static final ExtensionRegistry getOracleRegistry()
Deprecated. since 11.1.1 use getExtensionRegistry().
Returns the Oracle implementation of the JSR-198 extension registry. This method is just a convenience implementation of:
 (ExtensionRegistry) javax.ide.extensionExtensionRegistry.getExtensionRegistry()
 
Returns:
the extension registry.

getRoleManager

public RoleManager getRoleManager()
Returns the role manager.
Returns:
the role manager. Never returns null.
Since:
11.0

createRoleManager

protected RoleManager createRoleManager()
Creates the role manager.

This implementation returns a role manager that always returns RoleManager.NO_ROLE from RoleManager.getActiveRole().

Returns:
a newly created role manager implementation.

getNotLoadedReason

public abstract java.lang.String getNotLoadedReason(java.lang.String extensionId)
Gets the reason why a particular extension was not loaded. For extensions which are loaded, this method returns an empty string. For extensions which are not loaded, it returns a (human readable) explanation of why the extension could not be loaded.
Parameters:
extensionId - the id of an extension. Must not be null.
Returns:
the reason the extension was not loaded.
Since:
11.0

getLogger

public final java.util.logging.Logger getLogger()
Returns the logger that should be used to log messages of interest to extension developers. Generally, this is used when errors occur at runtime that are hidden from normal users of the product but are vital to extension developers for debugging purposes.
Returns:
the logger to use for logging extension messages. Will never return null.

getManifestLogger

public final java.util.logging.Logger getManifestLogger()
Returns the logger used to report problems in the extension manifest.
Returns:
the logger for extension manifest messages. Will never return null.

isLoaded

public abstract boolean isLoaded(java.lang.String extensionId)
Returns true if a specified extension is loaded. An extension may not be loaded if the user has turned off a feature which owns the extension or the extension is disabled because its dependencies have not been loaded.
Parameters:
extensionId - the id of an extension. Must not be null.
Returns:
true if the extension is loaded.

isUserExtension

public abstract boolean isUserExtension(java.lang.String extensionId)
Returns true if a specified extension is located in the user specific extensions directory. This property is only relevant in multi user environments.
Parameters:
extensionId - the id of an extension. Must not be null.
Returns:
true if the extension was loaded from a user specific extensions directory. If false, the extension was loaded from the central extensions directory.

isNewlyInstalled

public abstract boolean isNewlyInstalled(java.lang.String extensionId)
Returns true if the specified extension is newly installed. An extension is considered newly installed if this is the first time the product has been launched with the specified extension present and enabled.
Parameters:
extensionId - the id of an extension
Returns:
true if the system directory for an extension did not exist during initialization of the extension registry.

getSystemDirectory

public abstract java.net.URL getSystemDirectory(java.lang.String extensionId)
Returns the system directory for the specified extension. The system directory is a storage location for settings specific to an extension. All extension specific settings and configuration files should be stored in the correct system directory for the extension.

This method requires that the extension be loaded (i.e. that isLoaded(String) on the extension returns true). If the extension is not loaded, you can retrieve the system directory using the version of this method that also takes a version number ( getSystemDirectory(String,javax.ide.util.Version)).

Parameters:
extensionId - the id of an extension. Must not be null.
Returns:
the URL of a directory to be used for settings for the specified extension.
Throws:
java.lang.NullPointerException - if extensionId is null.
java.lang.IllegalArgumentException - if the extension cannot be found.
java.lang.IllegalStateException - if the extension registry has not finished initializing extensions.

getSystemDirectory

public abstract java.net.URL getSystemDirectory(java.lang.String extensionId,
                                                Version version)
Returns the system directory for the specified extension. The system directory is a storage location for settings specific to an extension. All extension specific settings and configuration files should be stored in the correct system directory for the extension.

This method will work even if the extension has not yet been loaded.

Parameters:
extensionId - the id of the extension. Must not be null.
version - the version of the extension. Must not be null.
Returns:
the URL of the directory to be used for settings for the specified extension.
Throws:
java.lang.NullPointerException - if extensionId or version are null.

getInstallRoot

public final java.net.URI getInstallRoot(Extension extension)
Returns the install root of the specified extension. The install root is a directory containing extension specific files. It is conventionally in the same location as the extension jar and named after the extension id.

This method is provided for compatibility with JSR-198 and is functionaly equivalent to getInstallDirectory(String).

Specified by:
getInstallRoot in class ExtensionRegistry
Parameters:
extension - an extension to get the install root for. Must not be null.
Returns:
the URI of the install root for the specified extension. This URI may or may not exist - callers should use VirtualFileSystem.getVirtualFileSystem().isDirectory() on the returned URI to verify that it exists. Will not return null.

getInstallDirectory

public final java.lang.String getInstallDirectory(java.lang.String extensionId)
Deprecated. since 11.0 use getInstallDirectory(Extension).
Returns the install directory for an extension. The install directory is in ide_home/extensions/extension.id or ide_user_home/extensions/extension.id.version. The return value of this method corresponds to the ${ide.extension.install.home} macro in the extension manifest.
Parameters:
extensionId - the id of an installed extension. Must not be null.
Returns:
the path of the extension's install directory, or an empty string if no installation directory was found.

getInstallDirectory

public final java.lang.String getInstallDirectory(java.lang.String extensionId,
                                                  Version version)
Deprecated. since 11.0 use getInstallDirectory(Extension).
Returns the install directory for an extension. The install directory is in ide_home/extensions/extension.id.version or ide_user_home/extensions/extension.id.version. The return value of this method corresponds to the ${ide.extension.install.home} macro in the extension manifest.

This method can be used even if an extension has not been loaded.

Parameters:
extensionId - the id of an installed extension. Must not be null.
version - the version of the extension. May be null, in which case the currently loaded version of the extension is used.
Returns:
the path of the extension's install directory, or an empty string if no installation directory was found.

getInstallDirectory

public final java.io.File getInstallDirectory(Extension extension)
Returns the install directory for an extension. The install directory is in ide_home/extensions/extension.id.version or ide_user_home/extensions/extension.id.version. The return value of this method corresponds to the ${ide.extension.install.home} macro in the extension manifest.

This method can be used even if an extension has not been loaded.

Parameters:
extension - an extension to find the install directory for. Must not be null.
Returns:
the install directory for the specified extension, or null if no directory exists.

getExtensionJAR

protected java.lang.String getExtensionJAR(java.lang.String extensionId,
                                           Version version,
                                           boolean userDirOk)
Deprecated. since 11.0 use getExtensionJAR( Extension ).

getExtensionJAR

public java.lang.String getExtensionJAR(java.lang.String extensionId,
                                        Version version)
Deprecated. since 11.0 use getExtensionJAR( Extension ).
Returns the JAR file for the specified extension. This method will only find JAR files that follow the JSR-198 standard naming conventions (i.e. extensionid.jar).
Parameters:
extensionId - the id of the extension to find.
version - the version of the extension. If null, the currently loaded version of the extension is used.
Returns:
the path of the extension's JAR file, or null if no JAR was found.

getExtensionJAR

public final java.io.File getExtensionJAR(Extension extension)
Returns the JAR file for the specified extension. The extension does not have to be loaded.

This method may return null for some types of extension that are not loaded from JAR files (for example, roles).

Parameters:
extension - an extension. May be an extension that is not loaded. Must not be null.
Returns:
the JAR file providing the extension, if known. If the extension is unrecognized or does not have a JAR file, returns null.
Throws:
java.lang.NullPointerException - if the extension is null.
Since:
11.0

getIdeHook

public IdeHook getIdeHook(ElementName elementName)
Deprecated. since 11.0. Use getHook(ElementName). This method is being maintained for backwards compatibility.
Returns an IDE hook by its element name.
Parameters:
elementName - the name of an Oracle IDE specific manifest element. Must not be null.
Returns:
the hook for the specified element name. Null if there is no such ide hook.

getHook

public ExtensionHook getHook(ElementName elementName)
Returns the hook for the specified element name.
Overrides:
getHook in class ExtensionRegistry
Parameters:
elementName - the element name of a hook to retrieve. Must not be null.
Returns:
the hook for the specified element, or null if no such hook is defined.

registerIdeHook

protected final void registerIdeHook(ElementName elementName,
                                     ExtensionHook hook)
Registers an ide hook.
Parameters:
elementName - the element name to register this ide hook for.
hook - the hook.

getAllExtensions

public abstract java.util.Collection<Extension> getAllExtensions()
Returns all available extensions, whether or not they are currently loaded.

A minimal amount of information will be available for unloaded extensions. Use isLoaded(String) to determine whether a given extension id is loaded.

Returns:
an unmodifiable collection of javax.ide.extension.Extension instances, one for each extension available to the IDE.

getDisabledExtensions

public java.util.Collection<java.lang.String> getDisabledExtensions()
Returns a collection of all disabled extensions.
Returns:
a collection of ids of all disabled extensions.

findExtensionEvenIfNotLoaded

public abstract Extension findExtensionEvenIfNotLoaded(java.lang.String id)
Returns an extension by its id. Will return an Extension instance, even for extensions that are not loaded.
Parameters:
id - the id of any extension returned by getAllExtensions().
Returns:
the Extension, even if it is a disabled extension. Returns null if no such extension exists.

getClassLoader

public java.lang.ClassLoader getClassLoader(java.lang.String extensionId)
Returns the class loader to use for the specified extension. The global extension classloader is returned for all non-isolated extensions.
Parameters:
extensionId - the id of an extension.
Returns:
the class loader for the specified extension.
Since:
11.0

getAllHooks

public java.util.Collection<ExtensionHook> getAllHooks()
Returns all registered hooks. This method is generally provided to support extension design time. To obtain a specific hook, extension writers should use the getHook(ElementName) method rather than iterating the whole list of hooks.
Returns:
an unmodifiable collection of registered hooks. This only includes hooks which are registered using the JSR-198 hook-handler-hook element, not hooks registered as children of jdeveloper-hook.
Since:
11.0

Skip navigation links

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

E13403-06


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