public interface Migratable extends Describable
ConfigurationAdmin
will automatically be
migrated by a migratable specifically developed for this purpose and do not need to be managed by
implementors of this class. The framework that handles the migratables ensures that no two
migratable's methods are running at the same time. Implementors do not need to program exports
and imports with regard to reflexive thread-safety.
This is the only interface that should be implemented by implementers and registered as an OSGI service. All other interfaces will be implemented by the framework that provides support for migratables.
During an import operation, only one of doImport(org.codice.ddf.migration.ImportMigrationContext)
, doIncompatibleImport(org.codice.ddf.migration.ImportMigrationContext, java.lang.String)
, or
doMissingImport(org.codice.ddf.migration.ImportMigrationContext)
methods will be called by the framework.
This code is experimental. While this interface is functional and tested, it may change or be removed in a future version of the library.
Modifier and Type | Method and Description |
---|---|
void |
doExport(ExportMigrationContext context)
Exports all required migratable data to the specified context.
|
void |
doImport(ImportMigrationContext context)
Imports all exported migratable data provided by the specified context when the current version
of this migratable (see
getVersion() ) matches the exported version. |
default void |
doIncompatibleImport(ImportMigrationContext context,
String version)
Imports all exported migratable data provided by the specified context when the current version
of this migratable (see
getVersion() ) is different than the exported version. |
default void |
doMissingImport(ImportMigrationContext context)
Called when data for this migratable was not exported.
|
String |
getVersion()
Gets the current export version handled by this migratable.
|
getDescription, getId, getOrganization, getTitle
String getVersion()
When exporting data, the migration framework will export this version information and
provide it back to the doIncompatibleImport(org.codice.ddf.migration.ImportMigrationContext, java.lang.String)
method if the exported version string
doesn't match the one provided by this method when importing the data for this migratable.
The format of the version string is migratable-dependent.
getVersion
in interface Describable
void doExport(ExportMigrationContext context)
Errors, warnings, and/or information messages can be recorded along with the context's report. Doing so will not abort the operation.
context
- a migration context to export all migratable data toMigrationException
- to stop the export operationvoid doImport(ImportMigrationContext context)
getVersion()
) matches the exported version.
Errors, warnings, and/or information messages can be recorded along with the context's report. Doing so will not abort the operation.
context
- a migration context to import all exported migratable data fromMigrationException
- to stop the import operationdefault void doIncompatibleImport(ImportMigrationContext context, String version)
getVersion()
) is different than the exported version.
Errors, warnings, and/or information messages can be recorded along with the context's report. Doing so will not abort the operation.
Note: The default implementation provided here will record an incompatibility error with the context's report.
context
- a migration context to import all exported migratable data fromversion
- the exported version for the data to re-importMigrationException
- to stop the import operationdefault void doMissingImport(ImportMigrationContext context)
Errors, warnings, and/or information messages can be recorded along with the context's report. Doing so will not abort the operation.
Note: The default implementation provided here will record an incompatibility error with the context's report.
context
- a migration context to import all exported migratable data fromMigrationException
- to stop the import operationThis work is licensed under a Creative Commons Attribution 4.0 International License.