Interface ImportExportContributor
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.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceReads content data from the.gwexZIP for this contributor.static interfaceWrites content data to the.gwexZIP for this contributor.static final recordA selectable sub-item within a contributor. -
Method Summary
Modifier and TypeMethodDescriptionHuman-readable description for the export UI.Returns selectable sub-items for this contributor, allowing the user to make granular selections within this content type.getId()Unique identifier for this content type.getLabel()Human-readable label for the export UI (e.g., "Python Libraries", "Tags").booleanWhether this content is currently available for export on this gateway.voidonExport(ImportExportContributor.ContentWriter writer, List<ImportExportContributor.SelectableItem> selectedItems) Export this content to the.gwexZIP file.voidonImport(ImportContext context, ImportExportContributor.ContentReader reader, List<ImportExportContributor.SelectableItem> selectedItems) Import this content from the.gwexZIP file.
-
Method Details
-
getId
String getId()Unique identifier for this content type. Used as the path segment undercontributed/in the.gwexZIP (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
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
selectedItemsparameter inonExport(ImportExportContributor.ContentWriter, List)andonImport(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
void onExport(ImportExportContributor.ContentWriter writer, List<ImportExportContributor.SelectableItem> selectedItems) throws IOException Export this content to the.gwexZIP file.- Parameters:
writer- writes data undercontributed/{id}/in the ZIPselectedItems- the selected sub-items fromgetExportableItems()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
void onImport(ImportContext context, ImportExportContributor.ContentReader reader, List<ImportExportContributor.SelectableItem> selectedItems) throws IOException Import this content from the.gwexZIP file. Called during the import apply phase.- Parameters:
context- metadata from the source gateway'sexportinfo.jsonreader- reads data fromcontributed/{id}/in the ZIPselectedItems- 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
-