public class JsonConnector extends AbstractFileBasedConnector
It is capable of reading from any URL, provided that there is a handler installed for it. For file URLs, it is also capable of reading several files at once
from a given root directory.
This connector is highly configurable; see its dsbulk-reference.conf file, bundled
within its jar archive, for detailed information.
AbstractFileBasedConnector.RecordReader, AbstractFileBasedConnector.RecordWritercompression, COMPRESSION, encoding, ENCODING, FILE_NAME_FORMAT, FILE_NAME_PATTERN, fileCounter, fileNameFormat, files, MAX_CONCURRENT_FILES, MAX_RECORDS, maxConcurrentFiles, maxRecords, nextWriterIndex, pattern, read, recursive, RECURSIVE, resourceCount, retainRecordSources, roots, singleWriter, SKIP_RECORDS, skipRecords, URL, URLFILE, urls, writers| Constructor and Description |
|---|
JsonConnector() |
| Modifier and Type | Method and Description |
|---|---|
void |
configure(Config settings,
boolean read,
boolean retainRecordSources)
Configures the connector.
|
String |
getConnectorName()
Returns the connector name, e.g.
|
RecordMetadata |
getRecordMetadata()
Returns metadata about the records that this connector can read or write.
|
void |
init()
Initializes the connector.
|
protected AbstractFileBasedConnector.RecordReader |
newSingleFileReader(URL url)
Returns a new
AbstractFileBasedConnector.RecordReader instance; cannot be null. |
protected AbstractFileBasedConnector.RecordWriter |
newSingleFileWriter()
Returns a new
AbstractFileBasedConnector.RecordWriter instance; cannot be null. |
boolean |
supports(ConnectorFeature feature)
Whether or not the connector supports the given feature.
|
applyPerFileLimits, close, getOrCreateDestinationURL, isDataSizeSamplingAvailable, loadURLs, processURLsForRead, processURLsForWrite, read, readConcurrency, readSingleFile, scanRootDirectory, write, writeConcurrency@NonNull public String getConnectorName()
AbstractFileBasedConnectorconnector.foo.getConnectorName in class AbstractFileBasedConnectorpublic void configure(@NonNull
Config settings,
boolean read,
boolean retainRecordSources)
Connectorconfigure in interface Connectorconfigure in class AbstractFileBasedConnectorsettings - the connector settings.read - whether the connector should be configured for reading or writing.retainRecordSources - whether the connector should retain sources when emitting records; only applicable when the connector is being configured for
reads.public void init()
throws URISyntaxException,
IOException
ConnectorThis method should only be called after the connector is properly configured.
init in interface Connectorinit in class AbstractFileBasedConnectorURISyntaxExceptionIOException@NonNull public RecordMetadata getRecordMetadata()
ConnectorThis method should only be called after the connector is properly configured and initialized.
public boolean supports(@NonNull
ConnectorFeature feature)
Connectorfeature - the feature to check.true if this connector supports the feature, false otherwise.@NonNull protected AbstractFileBasedConnector.RecordReader newSingleFileReader(@NonNull URL url) throws IOException
AbstractFileBasedConnectorAbstractFileBasedConnector.RecordReader instance; cannot be null. Only used when reading. Each
invocation of this method is expected to return a newly-allocated instance. The reader is
expected to be initialized already, and ready to emit its first record. It is possible to throw
IOException if the reader cannot be initialized.newSingleFileReader in class AbstractFileBasedConnectorIOException@NonNull protected AbstractFileBasedConnector.RecordWriter newSingleFileWriter()
AbstractFileBasedConnectorAbstractFileBasedConnector.RecordWriter instance; cannot be null. Only used when writing. Each
invocation of this method is expected to return a newly-allocated instance.newSingleFileWriter in class AbstractFileBasedConnectorCopyright © 2017–2021 DataStax. All rights reserved.