Type Parameters:
T - The type of the handle used for each split
payload
All Implemented Interfaces:
Splitter <T>
The JSONSplitter is used to split large JSON
file into separate payloads for writing to the database. The JSON
file is typically an array containing an object for each record.
JSONSplitter could split each targeted object or array into
separate files.
Nested Class Summary
Nested Classes
static
class
The basic visitor only splits objects or arrays
under top array.
static
interface
UriMaker which generates URI for each split
file
static
class
The Visitor class is used to accumulate and
inspect state during the depth-first traversal of the JSON tree and
make the decision of how to split the JSON file.
Constructor Summary
Constructors
Construct a JSONSplitter which splits the JSON
file according to the visitor.
Method Summary
All Methods Static Methods Instance Methods Concrete Methods
long
Returns the number of splits.
Get the UriMaker of the splitter
Get the visitor used in JSONSplitter
class.
Construct a simple JSONSplitter which split
objects or arrays under an array.
void
Set the UriMaker to the splitter
void
Set the visitor to select objects or arrays to
split in JSONSplitter.
split (com.fasterxml.jackson.core.JsonParser input)
Take an input of JsonParser created from the
JSON file and split it into a stream of handles to write to
database.
Takes an InputStream of a JSON file and split it
into a steam of handles.
Take an input of JsonParser created from the
JSON file and split it into a stream of DocumentWriteOperations to
write to database.
Takes an InputStream of a JSON file and split it
into a steam of DocumentWriteOperation to write to database.
Takes an InputStream of a JSON file and file
name and split it into a steam of DocumentWriteOperation to write
to database.
Methods
inherited from class java.lang.Object
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait
Constructor Details
Method Details
makeArraySplitter
Construct a simple JSONSplitter which split
objects or arrays under an array.
Returns:
a JSONSplitter class which splits each object or array into a
separate payload
getVisitor
Get the visitor used in JSONSplitter
class.
Returns:
the visitor used in JSONSplitter class
setVisitor
Set the visitor to select objects or arrays to
split in JSONSplitter.
Parameters:
visitor - the visitor describes the rule to split
the JSON file
getCount
public long getCount ()
Returns the number of splits.
Specified by:
getCount in
interface Splitter <T extends JSONWriteHandle >
Returns:
the number of splits
split
Takes an InputStream of a JSON file and split it
into a steam of handles.
Specified by:
split in
interface Splitter <T extends JSONWriteHandle >
Parameters:
input - is the incoming InputStream of a JSON
file.
Returns:
a stream of handles to write to database
Throws:
IOException - if the input cannot be
split
splitWriteOperations
Takes an InputStream of a JSON file and split it
into a steam of DocumentWriteOperation to write to database.
Specified by:
splitWriteOperations in
interface Splitter <T extends JSONWriteHandle >
Parameters:
input - is the incoming input stream of a JSON
file
Returns:
a stream of DocumentWriteOperation to write to database
Throws:
Exception - if the input cannot be
split
splitWriteOperations
Takes an InputStream of a JSON file and file
name and split it into a steam of DocumentWriteOperation to write
to database.
Specified by:
splitWriteOperations in
interface Splitter <T extends JSONWriteHandle >
Parameters:
input - is the incoming input stream of a JSON
file
splitFilename - is the name of input file,
including name and extension. It is used to generate URLs for split
files.The splitFilename could either be provided here or in
user-defined UriMaker.
Returns:
a stream of DocumentWriteOperation to write to database
Throws:
Exception - if the input cannot be
split
split
Take an input of JsonParser created from the
JSON file and split it into a stream of handles to write to
database.
Parameters:
input - JsonParser created from the JSON file
Returns:
a stream of handles to write to database
Throws:
IOException - if the input cannot be
split
splitWriteOperations
Take an input of JsonParser created from the
JSON file and split it into a stream of DocumentWriteOperations to
write to database.
Parameters:
input - JsonParser created from the JSON file
splitFilename - is the name of input file,
including name and extension. It is used to generate URLs for split
files.The splitFilename could either be provided here or in
user-defined UriMaker.
Returns:
a stream of DocumentWriteOperation to write to database
getUriMaker
Get the UriMaker of the splitter
Returns:
the UriMaker of the splitter
setUriMaker
Set the UriMaker to the splitter
Parameters:
uriMaker - the uriMaker to generate URI of each
split file.
Copyright (c) 2010-2025 Progress
Software Corporation and/or its subsidiaries or affiliates. All
Rights Reserved.