Interface ImportExportContributor


public interface ImportExportContributor
Contributes standalone content (not tied to a specific resource type) to the gateway import/export system. Each contributor represents a category of additional content that can be independently selected for export and import (e.g., user-lib/pylib, tags).

Contributors are registered with ImportExportManager.registerContributor(ImportExportContributor) during gateway startup. The manager queries them to build the additionalContent section of the exportable tree and delegates export/import operations to the appropriate contributor by ID.

Content is stored under contributed/{id}/ in the .gwex ZIP, where id is the value returned by getId().

Granularity

By default, a contributor appears as a single all-or-nothing checkbox in the export UI. Contributors that need sub-item selection (e.g., selecting which tag providers to include) can override getExportableItems() to return a tree of selectable items. The selected items (as a filtered tree) are passed to onExport(ImportExportContributor.ContentWriter, List) and onImport(ImportContext, ImportExportContributor.ContentReader, List) so the contributor can act on just the user's selection. Selecting a parent node implies all children are selected.

  • Method Details

    • getId

      String getId()
      Unique identifier for this content type. Used as the path segment under contributed/ in the .gwex ZIP (e.g., "user-lib/pylib" → contributed/user-lib/pylib/).
    • getLabel

      String getLabel()
      Human-readable label for the export UI (e.g., "Python Libraries", "Tags").
    • getDescription

      String getDescription()
      Human-readable description for the export UI.
    • isAvailable

      boolean isAvailable()
      Whether this content is currently available for export on this gateway.
    • getExportableItems

      default List<ImportExportContributor.SelectableItem> getExportableItems()
      Returns selectable sub-items for this contributor, allowing the user to make granular selections within this content type. For example, a tag contributor could return one item per tag provider.

      If this returns an empty list (the default), the contributor appears as a single all-or-nothing checkbox in the UI and the selectedItems parameter in onExport(ImportExportContributor.ContentWriter, List) and onImport(ImportContext, ImportExportContributor.ContentReader, List) will be empty.

      Items can be nested (e.g., a tag provider with sub-folders). Selecting a parent node in the UI implies all children are selected.

      Returns:
      the selectable items, or an empty list for all-or-nothing behavior
    • onExport

      Export this content to the .gwex ZIP file.
      Parameters:
      writer - writes data under contributed/{id}/ in the ZIP
      selectedItems - the selected sub-items from getExportableItems() as a filtered tree (only selected nodes and their selected children). Empty if the contributor has no selectable items (all-or-nothing).
      Throws:
      IOException
    • onImport

      Import this content from the .gwex ZIP file. Called during the import apply phase.
      Parameters:
      context - metadata from the source gateway's exportinfo.json
      reader - reads data from contributed/{id}/ in the ZIP
      selectedItems - the selected sub-items for import as a filtered tree. Empty if the contributor has no selectable items (all-or-nothing — import everything).
      Throws:
      IOException