Package org.openrefine.model
Interface Runner
-
- All Known Implementing Classes:
LocalRunner
,LoggedRunner
,TestingRunner
public interface Runner
Encapsulates the context required to implement, read and execute operations onGrid
andChangeData
objects. Implementations should have a constructor with a single parameter, aRunnerConfiguration
object, which is used to initialize the runner.
-
-
Field Summary
Fields Modifier and Type Field Description static String
COMPLETION_MARKER_FILE_NAME
static Charset
GRID_ENCODING
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default <T> ChangeData<T>
changeDataFromIterable(CloseableIterable<IndexedData<T>> iterable, long itemCount)
Creates aChangeData
from an iterable.<T> ChangeData<T>
changeDataFromList(List<IndexedData<T>> changeData)
Creates aChangeData
from an in-memory list of indexed data.<T> ChangeData<T>
emptyChangeData()
Creates an empty change data object of a given type, marked as incomplete.default Grid
gridFromIterable(ColumnModel columnModel, CloseableIterable<Row> rows, Map<String,OverlayModel> overlayModels, long rowCount, long recordCount)
Creates aGrid
from an iterable collection of rows.Grid
gridFromList(ColumnModel columnModel, List<Row> rows, Map<String,OverlayModel> overlayModels)
Creates aGrid
from 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 aChangeData
serialized at a given location.Grid
loadGrid(File path)
Loads aGrid
serialized at a given location.Grid
loadTextFile(String path, MultiFileReadingProgress progress, Charset encoding)
Loads a text file as aGrid
with a single column named "Column" and whose contents are the lines in the file, parsed as strings.Grid
loadTextFile(String path, MultiFileReadingProgress progress, Charset encoding, long limit)
Loads a text file as aGrid
with a single column named "Column" and whose contents are the lines in the file, parsed as strings.boolean
supportsProgressReporting()
Indicates whether this implementation supports progress reporting.
-
-
-
Field Detail
-
GRID_ENCODING
static final Charset GRID_ENCODING
-
COMPLETION_MARKER_FILE_NAME
static final String COMPLETION_MARKER_FILE_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
loadGrid
Grid loadGrid(File path) throws IOException
Loads aGrid
serialized at a given location.- 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
<T> ChangeData<T> loadChangeData(File path, ChangeDataSerializer<T> serializer) throws IOException
Loads aChangeData
serialized at a given location.- Parameters:
path
- the directory where the ChangeData is stored- Throws:
IOException
- when loading the grid failed
-
gridFromList
Grid gridFromList(ColumnModel columnModel, List<Row> rows, Map<String,OverlayModel> overlayModels)
Creates aGrid
from an in-memory list of rows, which will be numbered from 0 to length-1.
-
gridFromIterable
default Grid gridFromIterable(ColumnModel columnModel, CloseableIterable<Row> rows, Map<String,OverlayModel> overlayModels, long rowCount, long recordCount)
Creates aGrid
from an iterable collection of rows. By default, this just gathers the iterable in a list and delegates togridFromList(ColumnModel, List, Map)
, but implementations may implement a different approach which delays the loading of the collection in memory.- Parameters:
rowCount
- 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
Grid loadTextFile(String path, MultiFileReadingProgress progress, Charset encoding) throws IOException
Loads a text file as aGrid
with a single column named "Column" and whose contents are the lines in the file, parsed as strings.- Parameters:
encoding
- TODO- Throws:
IOException
-
loadTextFile
Grid loadTextFile(String path, MultiFileReadingProgress progress, Charset encoding, long limit) throws IOException
Loads a text file as aGrid
with a single column named "Column" and whose contents are the lines in the file, parsed as strings.- Parameters:
path
- the path to the text file to loadencoding
- TODOlimit
- the maximum number of lines to read- Throws:
IOException
-
changeDataFromList
<T> ChangeData<T> changeDataFromList(List<IndexedData<T>> changeData)
Creates aChangeData
from an in-memory list of indexed data. The list is required to be sorted.
-
changeDataFromIterable
default <T> ChangeData<T> changeDataFromIterable(CloseableIterable<IndexedData<T>> iterable, long itemCount)
Creates aChangeData
from an iterable. By default, this just gathers the iterable in a list and delegates tochangeDataFromList(List)
, but implementations may implement a different approach which delays the loading of the collection in memory.- Parameters:
itemCount
- if the number of items is known, supply it here, otherwise set this parameter to -1.
-
emptyChangeData
<T> ChangeData<T> emptyChangeData()
Creates an empty change data object of a given type, marked as incomplete.
-
supportsProgressReporting
boolean supportsProgressReporting()
Indicates whether this implementation supports progress reporting. If not, progress objects will be left untouched when passed to methods in this interface.
-
-