com.esri.arcgis.system
Class ExtensionManager

java.lang.Object
  extended by com.esri.arcgis.system.ExtensionManager
All Implemented Interfaces:
com.esri.arcgis.interop.RemoteObjRef, IExtensionManager, IExtensionManagerAdmin, IJITExtensionManager, ISupportErrorInfo, Serializable

public class ExtensionManager
extends Object
implements com.esri.arcgis.interop.RemoteObjRef, IExtensionManager, IExtensionManagerAdmin, ISupportErrorInfo, IJITExtensionManager

Extension Manager - a singleton.

Description

The ExtensionManager is designed to allow you to enable licensed extensions, such as ArcGIS 3D Analyst, within your standalone application.

Being a singleton object, ExtensionManager is the one and only instance of its class. An application can have only one ExtensionManager object. You could cocreate and use ExtensionManager from within ArcMap, but there is no real need as the IExtensionManager interface is also available on the Application object.

See the About Extensions topics for more details.

Remarks

If you are building an application that makes use of licensed extension functionality like ArcGIS Spatial Analyst, ArcGIS 3D Analyst, or ArcPress for ArcGIS, you need to take responsibility for enabling the extension you're using.

The ExtensionManager was designed for this purpose. The model is that you create the ExtensionManager and hold onto it for the life of your application. Before you use a licensed extension, you need to load it and enable it. You load the extension using IExtensionManagerAdmin::AddExtension and passing in the CLSID of the extension. Then before you use the extension, you need to enable it.

To enable the extension, find the extension using IExtensionManager::FindExtension , QI for IExtensionConfig on the extension, and then set the State property to esriESEnabled. Keep in mind that setting this property may fail, so be prepared to handle that in your application. If enabling the extension succeeds, that means that the license was checked out. If not, then the license could not be acquired.

If during the life of your application, you want to give the license back, simply set the state to esriESDisabled. If that succeeds the license was checked back in. If it failed that means there are outstanding objects (from the extension) that are still using the license.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Singleton:

This type is a singleton.

See Also:
IExtension, IExtensionManager, IExtensionConfig, IExtensionManagerAdmin, Serialized Form

Constructor Summary
ExtensionManager()
          Constructs a ExtensionManager using ArcGIS Engine.
ExtensionManager(Object obj)
          Deprecated. As of ArcGIS 9.2, replaced by normal Java casts.
ExtensionManager theExtensionManager = (ExtensionManager) obj;
 
Method Summary
 void addExtension(IUID extensionCLSID, Object initializationData)
          Creates a single extension given the CLSID, then passes initializationData to IExtension::Startup.
 boolean equals(Object o)
          Compare this object with another
 IExtension findExtension(Object nameOrID)
          Finds the extension by CLSID (IUID) or name (String).
static String getClsid()
          getClsid.
 IExtension getExtension(int index)
          The extension at the specified index.
 IUID getExtensionCLSID(int index)
          The CLSID of the extension at the specified index.
 int getExtensionCount()
          The number of extensions loaded in the application.
 IUID getJITExtensionCLSID(int index)
          Retrieves the CLSID of the JIT Extension at index.
 int getJITExtensionCount()
          The number of just in time extensions registered with the application.
 int hashCode()
          the hashcode for this object
 void insertExtension(IUID pExtCLSID, IExtension pExtension)
          Adds an extension to the manager without initialization.
 void interfaceSupportsErrorInfo(GUID riid)
          interfaceSupportsErrorInfo
 boolean isExtensionEnabled(IUID pExtCLSID)
          Returns whether the extension is currently checked on.
 boolean isLoaded(IUID pID)
          Returns whether the extension is currently loaded.
 void removeExtension(IExtension pExtension)
          Removes a just in time extension from the manager.
 void shutdownExtensions()
          Shuts down and releases the extensions that are loaded and calls IExtension::Shutdown.
 void startupExtensions(IUID componentCategory, IUID jitCategory, Object initializationData)
          Creates and starts the extensions for the given component category, passing initializationData to each in IExtension::Startup.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.esri.arcgis.interop.RemoteObjRef
getJintegraDispatch, release
 

Constructor Detail

ExtensionManager

public ExtensionManager()
                 throws IOException,
                        UnknownHostException
Constructs a ExtensionManager using ArcGIS Engine.

Throws:
IOException - if there are interop problems
UnknownHostException - if there are interop problems

ExtensionManager

public ExtensionManager(Object obj)
                 throws IOException
Deprecated. As of ArcGIS 9.2, replaced by normal Java casts.
ExtensionManager theExtensionManager = (ExtensionManager) obj;

Construct a ExtensionManager using a reference to such an object returned from ArcGIS Engine or Server. This is semantically equivalent to casting obj to ExtensionManager.

Parameters:
obj - an object returned from ArcGIS Engine or Server
Throws:
IOException - if there are interop problems
Method Detail

getClsid

public static String getClsid()
getClsid.


equals

public boolean equals(Object o)
Compare this object with another

Overrides:
equals in class Object

hashCode

public int hashCode()
the hashcode for this object

Overrides:
hashCode in class Object

getExtensionCount

public int getExtensionCount()
                      throws IOException,
                             AutomationException
The number of extensions loaded in the application.

Description

Returns the number of extensions currently loaded in the application.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getExtensionCount in interface IExtensionManager
Returns:
The count
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getExtension

public IExtension getExtension(int index)
                        throws IOException,
                               AutomationException
The extension at the specified index.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
getExtension in interface IExtensionManager
Parameters:
index - The index (in)
Returns:
A reference to a com.esri.arcgis.system.IExtension
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getExtensionCLSID

public IUID getExtensionCLSID(int index)
                       throws IOException,
                              AutomationException
The CLSID of the extension at the specified index.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
getExtensionCLSID in interface IExtensionManager
Parameters:
index - The index (in)
Returns:
A reference to a com.esri.arcgis.system.IUID
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

findExtension

public IExtension findExtension(Object nameOrID)
                         throws IOException,
                                AutomationException
Finds the extension by CLSID (IUID) or name (String).

Description

The FindExtension method will get an extension by either its name string or by its CLSID. Using IExtensionManager is not the only way to get a reference to an extension; the IApplication interface has FindExtensionByCLSID and FindExtensionByName methods.

nameOrID is a variant representing the identifier of the extension. This can either be the UID of the extension or the name string.

Remarks

COM coclasses are identified by a globally unique identifier (GUID). There two formats for the GUID for a coclass: a class ID (CLSID) and a ProgID. The ProgID is a text alias for a CLSID. The UID coclass can be used to represent the GUID of an extension object. You can set the IUID.Value property to either the CLSID or the ProgID.

To find the Name, CLSID, and ProgID of an ESRI extension, refer to the following technical document:

ArcObjects Developer Help > Technical Documents > Names and IDs > Extensions

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
findExtension in interface IExtensionManager
Parameters:
nameOrID - A Variant (in)
Returns:
A reference to a com.esri.arcgis.system.IExtension
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

startupExtensions

public void startupExtensions(IUID componentCategory,
                              IUID jitCategory,
                              Object initializationData)
                       throws IOException,
                              AutomationException
Creates and starts the extensions for the given component category, passing initializationData to each in IExtension::Startup.

Description

The StartupExtensions method is similar to AddExtension, except that it operates on all the extensions in the specified component category (for example, ESRI Mx Extensions).

Remarks

It is okay to add extensions to your Application using the AddExtension method after extensions were added with the StartupExtensions method.

You cannot add extensions to your Application using the StartupExtensions method after extensions were added with the AddExtension method. It evokes the "Automation error Catastrophic failure" (-2147418113).

The StartupExtensions method needs to be called before the AddExtensions method or used solely.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
startupExtensions in interface IExtensionManagerAdmin
Parameters:
componentCategory - A reference to a com.esri.arcgis.system.IUID (in)
jitCategory - A reference to a com.esri.arcgis.system.IUID (in)
initializationData - A Variant (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

shutdownExtensions

public void shutdownExtensions()
                        throws IOException,
                               AutomationException
Shuts down and releases the extensions that are loaded and calls IExtension::Shutdown.

Description

The ShutdownExtensions method unloads all the extensions from your application and releases the licenses.

Remarks

There is no way to add extensions to your application using the same method, with which extensions were added to it, after the ShutdownExtensions method has been called in the same application lifetime.

Example 1:

Extensions were added with the AddExtension method.

The ShutdownExtensions has been called.

You cannot add extensions using the AddExtension method.

You can add extensions using the StartupExtensions method.

Example 2:

Extensions were added with the StartupExtensions method.

The ShutdownExtensions has been called.

You cannot add extensions using the StartupExtensions method.

You can add extensions using the AddExtension method.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
shutdownExtensions in interface IExtensionManagerAdmin
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

addExtension

public void addExtension(IUID extensionCLSID,
                         Object initializationData)
                  throws IOException,
                         AutomationException
Creates a single extension given the CLSID, then passes initializationData to IExtension::Startup.

Description

The AddExtension method loads the extension specified by the CLSID. Before using a licensed extension, it needs to be loaded and enabled.

extensionCLSID specifies the unique identifier (UID) of an extension.

To enable the extension, find the extension using the IExtensionManager::FindExtension method, obtain IExtensionConfig on the extension, and then set the State property to esriESEnabled.

To load all the extension within a specified component category (for example, ESRI Mx Extensions) use the StartipExtensions method.

Remarks

COM coclasses are identified by a globally unique identifier (GUID). There two formats for the GUID for a coclass: a class ID (CLSID) and a ProgID. The ProgID is a text alias for a CLSID. The UID coclass can be used to represent the GUID of an extension object. You can set the IUID.Value property to either the CLSID or the ProgID.

To find the CLSID and ProgID of an ESRI extension, refer to the following technical document:

ArcObjects Developer Help > Technical Documents > ESRI Extensions: Names and IDs

For your custom extensions, the ProgID is a string composed of the name of your project used to make the extension and the class name of the extension.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
addExtension in interface IExtensionManagerAdmin
Parameters:
extensionCLSID - A reference to a com.esri.arcgis.system.IUID (in)
initializationData - A Variant (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

interfaceSupportsErrorInfo

public void interfaceSupportsErrorInfo(GUID riid)
                                throws IOException,
                                       AutomationException
interfaceSupportsErrorInfo

Description

Indicates whether the interface supports IErrorInfo.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
interfaceSupportsErrorInfo in interface ISupportErrorInfo
Parameters:
riid - A Structure: com.esri.arcgis.support.ms.stdole.GUID (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getJITExtensionCount

public int getJITExtensionCount()
                         throws IOException,
                                AutomationException
The number of just in time extensions registered with the application.

Description

Returns the number of JIT extensions currently in the application. This does not include any ordinary extensions.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getJITExtensionCount in interface IJITExtensionManager
Returns:
The pCount
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getJITExtensionCLSID

public IUID getJITExtensionCLSID(int index)
                          throws IOException,
                                 AutomationException
Retrieves the CLSID of the JIT Extension at index.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
getJITExtensionCLSID in interface IJITExtensionManager
Parameters:
index - The index (in)
Returns:
A reference to a com.esri.arcgis.system.IUID
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isLoaded

public boolean isLoaded(IUID pID)
                 throws IOException,
                        AutomationException
Returns whether the extension is currently loaded.

Description

Indicates whether the specified JIT extension is loaded. A JIT extension will be loaded the first time that IApplication::FindExtensionByCLSID is called for that extension. Use the JITExtensionCLSID property to get the UID of the extension.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
isLoaded in interface IJITExtensionManager
Parameters:
pID - A reference to a com.esri.arcgis.system.IUID (in)
Returns:
The bLoaded
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

removeExtension

public void removeExtension(IExtension pExtension)
                     throws IOException,
                            AutomationException
Removes a just in time extension from the manager.

Description

Removed the specified JIT extension from the ExtensionManager.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
removeExtension in interface IJITExtensionManager
Parameters:
pExtension - A reference to a com.esri.arcgis.system.IExtension (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

insertExtension

public void insertExtension(IUID pExtCLSID,
                            IExtension pExtension)
                     throws IOException,
                            AutomationException
Adds an extension to the manager without initialization.

Description

Adds the specified JIT extension to the ExtensionManager. Note that a JIT extension will be loaded the first time that IApplication::FindExtensionByCLSID is called for that extension.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
insertExtension in interface IJITExtensionManager
Parameters:
pExtCLSID - A reference to a com.esri.arcgis.system.IUID (in)
pExtension - A reference to a com.esri.arcgis.system.IExtension (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isExtensionEnabled

public boolean isExtensionEnabled(IUID pExtCLSID)
                           throws IOException,
                                  AutomationException
Returns whether the extension is currently checked on.

Description

Indicates whether the specified JIT extension is enabled. Use the JITExtensionCLSID property to get the UID of the extension.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
isExtensionEnabled in interface IJITExtensionManager
Parameters:
pExtCLSID - A reference to a com.esri.arcgis.system.IUID (in)
Returns:
The enabled
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.