Package org.openrefine.importers.tree
Class TreeImportingParserBase
- java.lang.Object
-
- org.openrefine.importers.ImportingParserBase
-
- org.openrefine.importers.tree.TreeImportingParserBase
-
- All Implemented Interfaces:
ImportingParser
- Direct Known Subclasses:
JsonImporter
,XmlImporter
public abstract class TreeImportingParserBase extends ImportingParserBase
Abstract class for importer parsers which handle tree-shaped data (currently XML and JSON).
-
-
Constructor Summary
Constructors Constructor Description TreeImportingParserBase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.fasterxml.jackson.databind.node.ObjectNode
createParserUIInitializationData(Runner runner, ImportingJob job, List<ImportingFileRecord> fileRecords, String format)
Create data sufficient for the parser UI on the client side to do its work.Grid
parse(Runner runner, ProjectMetadata metadata, ImportingJob job, List<ImportingFileRecord> fileRecords, String format, long limit, com.fasterxml.jackson.databind.node.ObjectNode options)
Main method of the parser: parse a grid out of input filesvoid
parseOneFile(TreeImportUtilities.ColumnIndexAllocator allocator, List<Row> rows, ProjectMetadata metadata, ImportingJob job, String fileSource, String archiveFileName, InputStream inputStream, ImportColumnGroup rootColumnGroup, long limit, com.fasterxml.jackson.databind.node.ObjectNode options)
Parse a single file from an InputStream.protected void
parseOneFile(TreeImportUtilities.ColumnIndexAllocator allocator, List<Row> rows, ProjectMetadata metadata, ImportingJob job, String fileSource, String archiveFileName, TreeReader treeParser, ImportColumnGroup rootColumnGroup, long limit, com.fasterxml.jackson.databind.node.ObjectNode options)
Parse a single file from a TreeReader.void
parseOneFile(TreeImportUtilities.ColumnIndexAllocator allocator, List<Row> rows, ProjectMetadata metadata, ImportingJob job, ImportingFileRecord fileRecord, ImportColumnGroup rootColumnGroup, long limit, com.fasterxml.jackson.databind.node.ObjectNode options, MultiFileReadingProgress progress)
-
Methods inherited from class org.openrefine.importers.ImportingParserBase
parseOneFile
-
-
-
-
Method Detail
-
createParserUIInitializationData
public com.fasterxml.jackson.databind.node.ObjectNode createParserUIInitializationData(Runner runner, ImportingJob job, List<ImportingFileRecord> fileRecords, String format)
Description copied from interface:ImportingParser
Create data sufficient for the parser UI on the client side to do its work. For example, an XML parser UI would need to know some sample elements so it can let the user pick which the path to the record elements.- Specified by:
createParserUIInitializationData
in interfaceImportingParser
- Overrides:
createParserUIInitializationData
in classImportingParserBase
-
parse
public Grid parse(Runner runner, ProjectMetadata metadata, ImportingJob job, List<ImportingFileRecord> fileRecords, String format, long limit, com.fasterxml.jackson.databind.node.ObjectNode options) throws Exception
Description copied from interface:ImportingParser
Main method of the parser: parse a grid out of input files- Specified by:
parse
in interfaceImportingParser
- Overrides:
parse
in classImportingParserBase
- Parameters:
runner
- the runner to use to create the gridmetadata
- the project metadata, to which the importer can contributejob
- the importing job, useful to report importing progressfileRecords
- the files to importformat
- the identifier for the formatlimit
- maximum number of rows to createoptions
- custom options put together by the UI corresponding to this parser, which the parser should understand- Throws:
Exception
-
parseOneFile
public void parseOneFile(TreeImportUtilities.ColumnIndexAllocator allocator, List<Row> rows, ProjectMetadata metadata, ImportingJob job, ImportingFileRecord fileRecord, ImportColumnGroup rootColumnGroup, long limit, com.fasterxml.jackson.databind.node.ObjectNode options, MultiFileReadingProgress progress) throws Exception
- Throws:
Exception
-
parseOneFile
public void parseOneFile(TreeImportUtilities.ColumnIndexAllocator allocator, List<Row> rows, ProjectMetadata metadata, ImportingJob job, String fileSource, String archiveFileName, InputStream inputStream, ImportColumnGroup rootColumnGroup, long limit, com.fasterxml.jackson.databind.node.ObjectNode options) throws Exception
Parse a single file from an InputStream. The default implementation just throws a NotImplementedException. Override in subclasses to implement.- Throws:
Exception
-
parseOneFile
protected void parseOneFile(TreeImportUtilities.ColumnIndexAllocator allocator, List<Row> rows, ProjectMetadata metadata, ImportingJob job, String fileSource, String archiveFileName, TreeReader treeParser, ImportColumnGroup rootColumnGroup, long limit, com.fasterxml.jackson.databind.node.ObjectNode options) throws Exception
Parse a single file from a TreeReader.- Throws:
Exception
-
-