Extension SDK 10.1.3.36.73

oracle.ide
Class ExtensionRegistry

java.lang.Object
  extended byjavax.ide.Service
      extended byjavax.ide.extension.ExtensionRegistry
          extended byoracle.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.

Normally, it is not necessary to use this class directly. Instead, the javax.ide.extension.ExtensionRegistry class provides an API for getting extension information that will work across all JSR-198 IDEs.

This registry implementation provides information about extensions that is specific to JDeveloper. Obtain an instance of the extension registry like this: import javax.ide.extension.ExtensionRegistry; ExtensionRegistry registry = ExtensionRegistry.getExtensionRegistry();

If the JDeveloper specific extension registry is required, you can either cast the returned instance like so: import javax.ide.extension.ExtensionRegistry; oracle.ide.ExtensionRegistry jdevRegistry = (oracle.ide.ExtensionRegistry) ExtensionRegistry.getExtensionRegistry(); or alternatively, use the convenience getOracleRegistry() method: import oracle.ide.ExtensionRegistry; ExtensionRegistry registry = ExtensionRegistry.getOracleRegistry();


Field Summary
protected  java.util.logging.Logger _manifestLogger
           
protected static java.lang.String EXTENSIONS_DIR
          The name of the extensions directory.
 
Constructor Summary
ExtensionRegistry()
           
 
Method Summary
abstract  Extension findExtensionEvenIfNotLoaded(java.lang.String id)
          Get an extension by its id even if the extension is not loaded.
abstract  java.util.Collection getAllExtensions()
          Get all available extensions, whether or not they are currently loaded.
 java.lang.String getExtensionJAR(java.lang.String extensionId, Version version)
          Get the JAR file for the specified extension.
 IdeHook getIdeHook(ElementName elementName)
          Get an IDE hook by its element name.
 java.lang.String getInstallDirectory(java.lang.String extensionId)
          Get the install directory for an extension.
 java.lang.String getInstallDirectory(java.lang.String extensionId, Version version)
          Get the install directory for an extension.
 java.net.URI getInstallRoot(Extension extension)
          Get the install root of the specified extension.
 java.util.logging.Logger getLogger()
          Get the logger that should be used to log messages of interest to extension developers.
 java.util.logging.Logger getManifestLogger()
          Get the logger used to report problems in the extension manifest.
static ExtensionRegistry getOracleRegistry()
          Get the Oracle implementation of the JSR-198 extension registry.
abstract  java.net.URL getSystemDirectory(java.lang.String extensionId)
          Get the system directory for the specified extension.
abstract  java.net.URL getSystemDirectory(java.lang.String extensionId, Version version)
          Get the system directory for the specified extension.
abstract  boolean isLoaded(java.lang.String extensionId)
          Gets whether a specified extension is loaded.
abstract  boolean isNewlyInstalled(java.lang.String extensionId)
          Gets whether the specified extension is newly installed.
abstract  boolean isUserExtension(java.lang.String extensionId)
          Gets whether a specified extension is located in the user specific extensions directory.
protected  void registerIdeHook(ElementName elementName, IdeHook hook)
          Register an ide hook.
 
Methods inherited from class javax.ide.extension.ExtensionRegistry
addToClassPath, createExtensionLogger, createExtensionVisitor, createHookVisitorFactory, createInitialContext, cycleEncountered, findAllExtensionSources, findExtension, getExtensionRegistry, getExtensions, getHook, initialize, isExtensionEnabled, loadExtension, loadExtensions, loadExtensions, unsatisfiedExtensionDependencies
 
Methods inherited from class javax.ide.Service
getService
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXTENSIONS_DIR

protected static final java.lang.String EXTENSIONS_DIR
The name of the extensions directory.

See Also:
Constant Field Values

_manifestLogger

protected java.util.logging.Logger _manifestLogger
Constructor Detail

ExtensionRegistry

public ExtensionRegistry()
Method Detail

getOracleRegistry

public static final ExtensionRegistry getOracleRegistry()
Get 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.

getLogger

public final java.util.logging.Logger getLogger()
Get 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.

getManifestLogger

public final java.util.logging.Logger getManifestLogger()
Get the logger used to report problems in the extension manifest.

Returns:
the logger for extension manifest messages

isLoaded

public abstract boolean isLoaded(java.lang.String extensionId)
Gets whether 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)
Gets whether a specified extension is located in the user specific extensions directory. This property is only relevant in multi user setups of JDeveloper (where JDEV_USER_DIR has been configured to allow per-user settings, or on multiuser operating systems like Linux).

Parameters:
extensionId - the id of an extension. Must not be null.
Returns:
true if the extension was loaded from the user specific extensions directory. If false, the extension was loaded from the central jdeveloper install directory.

isNewlyInstalled

public abstract boolean isNewlyInstalled(java.lang.String extensionId)
Gets whether the specified extension is newly installed. True if, during initialization of the extension registry, the system directory for the extension did not exist.

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)
Get 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.

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.

getSystemDirectory

public abstract java.net.URL getSystemDirectory(java.lang.String extensionId,
                                                Version version)
Get 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 version of the 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.

getInstallRoot

public final java.net.URI getInstallRoot(Extension extension)
Get 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 does the same thing as 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. Must not return null.

getInstallDirectory

public final java.lang.String getInstallDirectory(java.lang.String extensionId)
Get the install directory for an extension. The install directory is in jdev_home/extensions/extension.id.version or jdev_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)
Get the install directory for an extension. The install directory is in jdev_home/extensions/extension.id.version or jdev_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 yet.

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.

getExtensionJAR

public java.lang.String getExtensionJAR(java.lang.String extensionId,
                                        Version version)
Get the JAR file for the specified extension. This method will only find JAR files that follow the JSR-198 standard naming conventions (i.e. extension.id-version.jar or extension.id.version.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.

getIdeHook

public IdeHook getIdeHook(ElementName elementName)
Get an IDE hook by its element name.

Parameters:
elementName - the name of an Oracle IDE specific manifest element. Must not be null.
Returns:
the IdeHook for the specified element name. Null if there is no such ide hook.

registerIdeHook

protected final void registerIdeHook(ElementName elementName,
                                     IdeHook hook)
Register an ide hook.

Parameters:
elementName - the element name to register this ide hook for.
hook - the hook.

getAllExtensions

public abstract java.util.Collection getAllExtensions()
Get 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:
a collection of javax.ide.extension.Extension instances, one for each extension available to the IDE.

findExtensionEvenIfNotLoaded

public abstract Extension findExtensionEvenIfNotLoaded(java.lang.String id)
Get an extension by its id even if the extension is 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.

Extension SDK 10.1.3.36.73

 

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