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 classAbstractBulkMigrator.MigrationActionstatic classAbstractBulkMigrator.MigrationComputation
-
Field Summary
Fields Modifier and Type Field Description protected MigrationDescriptordescriptorprotected static StringMIGRATION_PROCESSOR_NAMEstatic StringPARAM_MIGRATION_IDstatic StringPARAM_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 voidclearRunningBulkCommands(String migrationId, String step)abstract voidcompute(CoreSession session, List<String> ids, Map<String,Serializable> properties)Executes the migration on the given batch.protected BulkCommandcreateBulkCommand(String repositoryName, String migrationId, String migrationStep)protected StringgetBulkCommandsKey(String migrationId, String step)protected static KeyValueStoregetKeyValueStore()protected abstract StringgetNXQLScrollQuery()protected List<String>getRunningBulkCommands(String migrationId, String step)protected abstract StringprobeSession(CoreSession session)Probes the current state of asessionby analyzing persistent data.StringprobeState()Probes the current state of a migration by analyzing persistent data.voidrun(String step, MigrationService.MigrationContext migrationContext)Runs a migration step.protected voidsaveRunningBulkCommands(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 descriptorthis migrator is linked to
-
-
Method Detail
-
probeState
public String probeState()
Description copied from interface:MigrationService.MigratorProbes 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:
probeStatein interfaceMigrationService.Migrator- Returns:
- the probed state, or
nullif it cannot be determined
-
probeSession
protected abstract String probeSession(CoreSession session)
Probes the current state of asessionby analyzing persistent data.Assumes no migration step is currently running.
- Returns:
- the probed state, or
nullif it cannot be determined
-
run
public void run(String step, MigrationService.MigrationContext migrationContext)
Description copied from interface:MigrationService.MigratorRuns a migration step.This method should periodically check for
MigrationService.MigrationContext.isShutdownRequested()andThread.isInterrupted()and return iftrue.- Specified by:
runin 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 throughpropertieswith the keyPARAM_MIGRATION_STEP.This method is called by the
AbstractBulkMigrator.MigrationComputation, the transaction is handled by it.
-
getKeyValueStore
protected static KeyValueStore getKeyValueStore()
-
-