Interface Exporter
Implement this interface to export data so that it can be imported by an Importer.
Migration archives are read and written sequentially. Entries added by this exporter will be read in the same order
by the corresponding Importer.
There are two different types of entries:
-
File entriesUsed to migrate data that has been generated in memory, for example, JSON data.
-
Archive entriesUsed to migrate data that already exists on the file system.
Exporters are required to be stateless, as they are essentially singletons. State, which
should persist over the whole lifetime of a job, can be stored in ExportContext.getAttributeMap(). This data
is kept in memory and care should be taken that memory usage in this attribute map does not grow considerably over
time.
References to entities during the export
References to entities, such as repositories or projects, should be exported
using their export ID.
Importers can use this export ID to retrieve the local ID of the entity using the
import entity mapping.
StandardMigrationEntityTypes define mappings for
projects and repositories.
Custom entity types should implement the MigrationEntityType interface.
Plugin definition
A plugin has to define a <migration-handler> module in its atlassian-plugin.xml for the migration
process to include it. Migration handlers always define a pair of exporters and
importers. Only entries added by the corresponding Exporter will be consumed by its
Importer.
Example module definition:
<migration-handler key="handler" weight="150">
<exporter class="org.foo.bar.PluginExporter"/>
<importer class="org.foo.bar.PluginImporter"/>
</migration-handler>
A migration handler's weight defines the order in which it is called in relation to other migration handlers. A higher
weight signifies a dependency on a lower weight handler. All core handlers have a weight lower than 100.- Since:
- 5.13
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intArchive version that this version of the product generates. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidexport(ExportContext exportContext, com.atlassian.bitbucket.project.Project project) Called when a project is exported.default voidexport(ExportContext exportContext, com.atlassian.bitbucket.pull.PullRequest pullRequest) Called when a pull request is exported.default voidexport(ExportContext exportContext, com.atlassian.bitbucket.repository.Repository repository) Called when a repository is exported.default voidonEnd(ExportContext exportContext) Called after the export is finished.default voidonStart(ExportContext exportContext) Called before the export is started.
-
Field Details
-
ARCHIVE_VERSION
static final int ARCHIVE_VERSIONArchive version that this version of the product generates.- See Also:
-
-
Method Details
-
export
default void export(@Nonnull ExportContext exportContext, @Nonnull com.atlassian.bitbucket.project.Project project) Called when a project is exported. Implementors should implement this method to export all relevant data that is associated with the project.- Parameters:
exportContext- thecontextfor this export operationproject- the project that is exported
-
export
default void export(@Nonnull ExportContext exportContext, @Nonnull com.atlassian.bitbucket.pull.PullRequest pullRequest) Called when a pull request is exported. Implementors should implement this method to export all relevant data that is associated with the pull request.- Parameters:
exportContext- thecontextfor this export operationpullRequest- the pull request that is exported
-
export
default void export(@Nonnull ExportContext exportContext, @Nonnull com.atlassian.bitbucket.repository.Repository repository) Called when a repository is exported. Implementors should implement this method to export all relevant data that is associated with the repository.- Parameters:
exportContext- thecontextfor this export operationrepository- the repository that is exported
-
onEnd
Called after the export is finished.- Parameters:
exportContext- thecontextfor this export operation
-
onStart
Called before the export is started.- Parameters:
exportContext- thecontextfor this export operation
-