Interface Exporter


public interface Exporter
Data Center Migration Exporter SPI

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 entries

    Used to migrate data that has been generated in memory, for example, JSON data.

  • Archive entries

    Used to migrate data that already exists on the file system.

Important: 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

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Archive version that this version of the product generates.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    export(ExportContext exportContext, com.atlassian.bitbucket.project.Project project)
    Called when a project is exported.
    default void
    export(ExportContext exportContext, com.atlassian.bitbucket.pull.PullRequest pullRequest)
    Called when a pull request is exported.
    default void
    export(ExportContext exportContext, com.atlassian.bitbucket.repository.Repository repository)
    Called when a repository is exported.
    default void
    onEnd(ExportContext exportContext)
    Called after the export is finished.
    default void
    onStart(ExportContext exportContext)
    Called before the export is started.
  • Field Details

    • ARCHIVE_VERSION

      static final int ARCHIVE_VERSION
      Archive 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 - the context for this export operation
      project - 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 - the context for this export operation
      pullRequest - 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 - the context for this export operation
      repository - the repository that is exported
    • onEnd

      default void onEnd(@Nonnull ExportContext exportContext)
      Called after the export is finished.
      Parameters:
      exportContext - the context for this export operation
    • onStart

      default void onStart(@Nonnull ExportContext exportContext)
      Called before the export is started.
      Parameters:
      exportContext - the context for this export operation