Package org.nuxeo.ecm.core.migrator
Class AbstractBulkMigrator
- java.lang.Object
-
- org.nuxeo.ecm.core.migrator.AbstractBulkMigrator
-
- All Implemented Interfaces:
MigrationService.Migrator
- Direct Known Subclasses:
BlobKeysBulkMigrator
public abstract class AbstractBulkMigrator extends Object implements MigrationService.Migrator
- Since:
- 2023.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractBulkMigrator.MigrationAction
static class
AbstractBulkMigrator.MigrationComputation
-
Field Summary
Fields Modifier and Type Field Description protected MigrationDescriptor
descriptor
protected static String
MIGRATION_PROCESSOR_NAME
static String
PARAM_MIGRATION_ID
static String
PARAM_MIGRATION_STEP
-
Constructor Summary
Constructors Constructor Description AbstractBulkMigrator(MigrationDescriptor descriptor)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
clearRunningBulkCommands(String migrationId, String step)
abstract void
compute(CoreSession session, List<String> ids, Map<String,Serializable> properties)
Executes the migration on the given batch.protected BulkCommand
createBulkCommand(String repositoryName, String migrationId, String migrationStep)
protected String
getBulkCommandsKey(String migrationId, String step)
protected static KeyValueStore
getKeyValueStore()
protected abstract String
getNXQLScrollQuery()
protected List<String>
getRunningBulkCommands(String migrationId, String step)
protected abstract String
probeSession(CoreSession session)
Probes the current state of asession
by analyzing persistent data.String
probeState()
Probes the current state of a migration by analyzing persistent data.void
run(String step, MigrationService.MigrationContext migrationContext)
Runs a migration step.protected void
saveRunningBulkCommands(String migrationId, String step, List<String> bulkIds)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.runtime.migration.MigrationService.Migrator
notifyStatusChange
-
-
-
-
Field Detail
-
PARAM_MIGRATION_ID
public static final String PARAM_MIGRATION_ID
- See Also:
- Constant Field Values
-
PARAM_MIGRATION_STEP
public static final String PARAM_MIGRATION_STEP
- See Also:
- Constant Field Values
-
MIGRATION_PROCESSOR_NAME
protected static final String MIGRATION_PROCESSOR_NAME
- See Also:
- Constant Field Values
-
descriptor
protected final MigrationDescriptor descriptor
-
-
Constructor Detail
-
AbstractBulkMigrator
public AbstractBulkMigrator(MigrationDescriptor descriptor)
- Parameters:
descriptor
- themigration descriptor
this migrator is linked to
-
-
Method Detail
-
probeState
public String probeState()
Description copied from interface:MigrationService.Migrator
Probes the current state of a migration by analyzing persistent data.Assumes no migration step is currently running.
THIS METHOD MAY TAKE A WHILE as it needs to get information from persistent storage.
- Specified by:
probeState
in interfaceMigrationService.Migrator
- Returns:
- the probed state, or
null
if it cannot be determined
-
probeSession
protected abstract String probeSession(CoreSession session)
Probes the current state of asession
by analyzing persistent data.Assumes no migration step is currently running.
- Returns:
- the probed state, or
null
if it cannot be determined
-
run
public void run(String step, MigrationService.MigrationContext migrationContext)
Description copied from interface:MigrationService.Migrator
Runs a migration step.This method should periodically check for
MigrationService.MigrationContext.isShutdownRequested()
andThread.isInterrupted()
and return iftrue
.- Specified by:
run
in interfaceMigrationService.Migrator
- Parameters:
step
- the migration step to runmigrationContext
- the migration context.
-
saveRunningBulkCommands
protected void saveRunningBulkCommands(String migrationId, String step, List<String> bulkIds)
-
getRunningBulkCommands
protected List<String> getRunningBulkCommands(String migrationId, String step)
-
createBulkCommand
protected BulkCommand createBulkCommand(String repositoryName, String migrationId, String migrationStep)
-
getNXQLScrollQuery
protected abstract String getNXQLScrollQuery()
- Returns:
- the NXQL query to scroll for bulk migration
-
compute
public abstract void compute(CoreSession session, List<String> ids, Map<String,Serializable> properties)
Executes the migration on the given batch. The migration step is given throughproperties
with the keyPARAM_MIGRATION_STEP
.This method is called by the
AbstractBulkMigrator.MigrationComputation
, the transaction is handled by it.
-
getKeyValueStore
protected static KeyValueStore getKeyValueStore()
-
-