Implementing optional functionality on plug-in data sources


Summary This topic discusses how to implement optional functionality on a plug-in data source, for example, context menu commands such as, copy, rename and delete, attribute indexes, licensing, and custom GxObjects for ArcCatalog.

In this topic


Plug-in data source objects

The following illustration shows the general object model for ArcGIS plug-in data source objects:

Implementing copy, delete, and rename for plug-in data sources

A plug-in data source can be integrated with the copy, delete, and rename functionality of ArcGIS, including the drag-and-drop functionality of datasets. See the following screen shot: 
 
The following two optional interfaces can be implemented on the plug-in dataset helper. The members of these interfaces work the same way, the difference being that an extra class index parameter is available on the IPlugInFileOperationsClass members.
IPlugInFileOperations.Rename takes a name and also returns a name. The input name might or might not have a file extension on it. The output name must be in the form in which names are passed to the data source on creation. When implementing Rename, change any cached representation of the dataset name in the plug-in dataset helper.
When implementing copy and paste with file- or folder-based data sources, remember that a user might paste a dataset to a location that is empty of other datasets. To allow this, implement IPlugInWorkspaceFactoryHelper.OpenWorkspace to succeed on locations that are empty.
The rest of ArcObjects also works with the copy, delete, and rename implementation. For example, a client of the plug-in data source could call IDataset.Delete on one of the data source's datasets.
Some developers programmatically copy data by calling IWorkspaceFactory.Create to make a workspace before copying data into it. To support this for a plug-in data source, implement IPlugInCreateWorkspace on the plug-in workspace factory.

Implementing attribute indexes for plug-in data sources

The concept of attribute indexes can be supported on a plug-in data source to speed up certain queries. A plug-in data source can also be configured so that the standard ArcCatalog user interface (UI) works with the data to display and manipulate attribute indexes. See the following screen shot:
On the preceding Feature Class Properties dialog box, the Add and Delete buttons are activated if IPlugInWorkspaceHelper2 is implemented on a workspace helper, and it returns true for CanAddIndex and CanDeleteIndex. In this case, IPlugInWorkspaceHelper2.IsReadOnly must return false. This sets the esriWorkspacePropIsReadonly property for the workspace. This property does not indicate whether the plug-in data source supports read/write functionality, rather that this particular workspace can be written to. In the case of adding an index, the schema of the data is being changed, and the property is indicating that the index has been written to the workspace in some way.
To support the listing of indexes in the UI, implement IPlugInIndexInfo on a plug-in dataset helper. If there are no indexes, return a pointer to an empty Indexes object rather than a null pointer. To support the addition and deletion of indexes, implement IPlugInIndexManager on a plug-in dataset helper. This interface must be implemented if CanAddIndex and CanDeleteIndex return true (on IPlugInWorkspaceHelper2).
How indexes are implemented and queries are handled is the developer's decision. The plug-in interfaces enable integration with ArcGIS for manipulation of the indexes. This includes the rest of ArcObjects, for example, a client of a plug-in data source could call IClass.Indexes to get the list of indexes on a class.

Implementing license handling for plug-in data sources

If a plug-in data source requires a license, a plug-in extension class must be created, and IPlugInLicense must be implemented on the plug-in workspace helper or the plug-in dataset helper.
The plug-in extension class must implement IExtension and register itself in the ESRI Mx Extensions (for drawing) and ESRI Gx Extensions (for browsing) component categories. The class can implement IExtensionConfig, in which case it appears on the Extensions dialog box. It should also implement IAutoExtension if it automatically enables and disables.
A plug-in workspace helper should implement IPlugInLicense if enabling the license enables all datasets of the data source type. If only some datasets are to be enabled, the interface should be implemented on the plug-in dataset helper. If the interface is implemented on both classes, the implementation on the dataset helper is used. The license is checked when feature classes, tables, and cursors from data sources are created.

Custom context menus and plug-in data sources

Adding commands to the context menus of the plug-in data source is an option, for example, adding a command that exports the data to another nonstandard format.
The following are the relevant component categories; however, these are shared between all plug-in data sources:
  • ESRI Gx read-only—Feature class context menu commands.
  • ESRI Gx read-only—Stand-alone feature class context menu commands.
  • ESRI Gx read-only—Table context menu commands.
  • ESRI Gx read-only—Feature dataset context menu commands.
If commands are added to these component categories, they appear on the context menus of all plug-in data sources; therefore, a solution might not integrate with that of a third party.
An alternative approach is to implement custom ArcCatalog objects for a plug-in data source, in particular, a GxObjectFactory and a GxObject. This enables the use of custom context menus that apply just to datasets from the plug-in data source and also custom icons. For this solution, do not register the plug-in workspace factory to ESRI Gx Enabled Workspace Factories.


See Also:

Plug-in data sources
Creating a plug-in data source
Sample: Simple point plug-in data source




Development licensing Deployment licensing
ArcView ArcView
ArcEditor ArcEditor
ArcInfo ArcInfo