Class EngineUpdater

java.lang.Object
ch.rswk.meta.engine.EngineUpdater

public class EngineUpdater extends Object
EngineUpdater executes tasks against two engine instances for importing/exporting and migrating service data. The current instance acts as the source of data and a new, pristine instance acts as a target for data. After one or more tasks are run without error, all data directories of the current instance are swapped with the data directories of the new instance.

Custom tasks can be injected by implementing EngineUpdater.UpdateTask. Built in tasks:

EngineUpdater.MetaUpdater and EngineUpdater.MetaUserUpdater instances can be injected to do data/schema migrations.

Important notes:

  • Tasks are executed in the order they are provided to runTasks(String[], Function, Iterable)
  • If any of the tasks returns true for skipIndexReplacement, the Lucene work directories of the current instance are not replaced with the new ones
  • Replacement of Lucene work directories takes place, if every task returns false for skipIndexReplacement. If none of the tasks writes any Lucene data to the new instance, all data will be lost!
  • To import data into an existing instance, run EngineUpdater.CloneTask followed by EngineUpdater.JsonImportTask. Or the other way around, if the new data should have precedence