Class LoggedRunner
- java.lang.Object
-
- org.openrefine.runners.local.logging.LoggedRunner
-
-
Field Summary
Fields Modifier and Type Field Description protected Runnerrunner-
Fields inherited from interface org.openrefine.model.Runner
COMPLETION_MARKER_FILE_NAME, GRID_ENCODING
-
-
Constructor Summary
Constructors Constructor Description LoggedRunner(Runner runner)LoggedRunner(RunnerConfiguration configuration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> ChangeData<T>changeDataFromIterable(CloseableIterable<IndexedData<T>> iterable, long itemCount)Creates aChangeDatafrom an iterable.<T> ChangeData<T>changeDataFromList(List<IndexedData<T>> changeData)Creates aChangeDatafrom an in-memory list of indexed data.<T> ChangeData<T>emptyChangeData()Creates an empty change data object of a given type, marked as incomplete.protected voidexec(String name, Runnable action)protected <T> Texec(String name, Supplier<T> action)GridgridFromIterable(ColumnModel columnModel, CloseableIterable<Row> rows, Map<String,OverlayModel> overlayModels, long rowCount, long recordCount)Creates aGridfrom an iterable collection of rows.GridgridFromList(ColumnModel columnModel, List<Row> rows, Map<String,OverlayModel> overlayModels)Creates aGridfrom an in-memory list of rows, which will be numbered from 0 to length-1.<T> ChangeData<T>loadChangeData(File path, ChangeDataSerializer<T> serializer)Loads aChangeDataserialized at a given location.GridloadGrid(File path)Loads aGridserialized at a given location.GridloadTextFile(String path, MultiFileReadingProgress progress, Charset encoding)Loads a text file as aGridwith a single column named "Column" and whose contents are the lines in the file, parsed as strings.GridloadTextFile(String path, MultiFileReadingProgress progress, Charset encoding, long limit)Loads a text file as aGridwith a single column named "Column" and whose contents are the lines in the file, parsed as strings.booleansupportsProgressReporting()Indicates whether this implementation supports progress reporting.protected <T> ChangeData<T>wrap(ChangeData<T> changeData)protected Gridwrap(Grid grid)
-
-
-
Field Detail
-
runner
protected final Runner runner
-
-
Constructor Detail
-
LoggedRunner
public LoggedRunner(RunnerConfiguration configuration)
-
LoggedRunner
public LoggedRunner(Runner runner)
-
-
Method Detail
-
wrap
protected <T> ChangeData<T> wrap(ChangeData<T> changeData)
-
loadGrid
public Grid loadGrid(File path) throws IOException
Description copied from interface:RunnerLoads aGridserialized at a given location.- Specified by:
loadGridin interfaceRunner- Parameters:
path- the directory where the Grid is stored- Returns:
- the grid
- Throws:
IOException- when loading the grid failed, or when the grid's serialization was incomplete (lacking a _SUCCESS marker)
-
loadChangeData
public <T> ChangeData<T> loadChangeData(File path, ChangeDataSerializer<T> serializer) throws IOException
Description copied from interface:RunnerLoads aChangeDataserialized at a given location.- Specified by:
loadChangeDatain interfaceRunner- Parameters:
path- the directory where the ChangeData is stored- Throws:
IOException- when loading the grid failed
-
gridFromList
public Grid gridFromList(ColumnModel columnModel, List<Row> rows, Map<String,OverlayModel> overlayModels)
Description copied from interface:RunnerCreates aGridfrom an in-memory list of rows, which will be numbered from 0 to length-1.- Specified by:
gridFromListin interfaceRunner
-
gridFromIterable
public Grid gridFromIterable(ColumnModel columnModel, CloseableIterable<Row> rows, Map<String,OverlayModel> overlayModels, long rowCount, long recordCount)
Description copied from interface:RunnerCreates aGridfrom an iterable collection of rows. By default, this just gathers the iterable in a list and delegates toRunner.gridFromList(ColumnModel, List, Map), but implementations may implement a different approach which delays the loading of the collection in memory.- Specified by:
gridFromIterablein interfaceRunnerrowCount- if the number of rows is known, supply it in this parameter as it might improve efficiency. Otherwise, set to -1.recordCount- if the number of records is known, supply it in this parameter as it might improve efficiency. Otherwise, set to -1.
-
loadTextFile
public Grid loadTextFile(String path, MultiFileReadingProgress progress, Charset encoding) throws IOException
Description copied from interface:RunnerLoads a text file as aGridwith a single column named "Column" and whose contents are the lines in the file, parsed as strings.- Specified by:
loadTextFilein interfaceRunnerencoding- TODO- Throws:
IOException
-
loadTextFile
public Grid loadTextFile(String path, MultiFileReadingProgress progress, Charset encoding, long limit) throws IOException
Description copied from interface:RunnerLoads a text file as aGridwith a single column named "Column" and whose contents are the lines in the file, parsed as strings.- Specified by:
loadTextFilein interfaceRunner- Parameters:
path- the path to the text file to loadencoding- TODOlimit- the maximum number of lines to read- Throws:
IOException
-
changeDataFromList
public <T> ChangeData<T> changeDataFromList(List<IndexedData<T>> changeData)
Description copied from interface:RunnerCreates aChangeDatafrom an in-memory list of indexed data. The list is required to be sorted.- Specified by:
changeDataFromListin interfaceRunner
-
changeDataFromIterable
public <T> ChangeData<T> changeDataFromIterable(CloseableIterable<IndexedData<T>> iterable, long itemCount)
Description copied from interface:RunnerCreates aChangeDatafrom an iterable. By default, this just gathers the iterable in a list and delegates toRunner.changeDataFromList(List), but implementations may implement a different approach which delays the loading of the collection in memory.- Specified by:
changeDataFromIterablein interfaceRunneritemCount- if the number of items is known, supply it here, otherwise set this parameter to -1.
-
emptyChangeData
public <T> ChangeData<T> emptyChangeData()
Description copied from interface:RunnerCreates an empty change data object of a given type, marked as incomplete.- Specified by:
emptyChangeDatain interfaceRunner
-
supportsProgressReporting
public boolean supportsProgressReporting()
Description copied from interface:RunnerIndicates whether this implementation supports progress reporting. If not, progress objects will be left untouched when passed to methods in this interface.- Specified by:
supportsProgressReportingin interfaceRunner
-
-