Search in sources :

Example 1 with ReaderDataProvider

use of org.talend.components.api.component.runtime.ReaderDataProvider in project components by Talend.

the class SalesforceDatasetRuntime method getSample.

@Override
public void getSample(int limit, Consumer<IndexedRecord> consumer) {
    SalesforceDataprepSource sds = new SalesforceDataprepSource();
    SalesforceInputProperties properties = new SalesforceInputProperties("model");
    properties.setDatasetProperties(dataset);
    throwExceptionIfValidationResultIsError(sds.initialize(container, properties));
    throwExceptionIfValidationResultIsError(sds.validate(container));
    SalesforceBulkQueryReader reader = (SalesforceBulkQueryReader) sds.createReader(container);
    reader.setLimit(limit);
    ReaderDataProvider<IndexedRecord> readerDataProvider = new ReaderDataProvider<>(reader, limit, consumer);
    readerDataProvider.retrieveData();
}
Also used : ReaderDataProvider(org.talend.components.api.component.runtime.ReaderDataProvider) IndexedRecord(org.apache.avro.generic.IndexedRecord) SalesforceInputProperties(org.talend.components.salesforce.dataprep.SalesforceInputProperties)

Example 2 with ReaderDataProvider

use of org.talend.components.api.component.runtime.ReaderDataProvider in project components by Talend.

the class JDBCDatasetRuntime method getSample.

@Override
public void getSample(int limit, Consumer<IndexedRecord> consumer) {
    JDBCSource js = new JDBCSource();
    throwExceptionIfValidationResultIsError(js.initialize(container, dataset));
    throwExceptionIfValidationResultIsError(js.validate(container));
    JDBCInputReader reader = (JDBCInputReader) js.createReader(container);
    ReaderDataProvider<IndexedRecord> readerDataProvider = new ReaderDataProvider<>(reader, limit, consumer);
    readerDataProvider.retrieveData();
}
Also used : ReaderDataProvider(org.talend.components.api.component.runtime.ReaderDataProvider) IndexedRecord(org.apache.avro.generic.IndexedRecord) JDBCSource(org.talend.components.jdbc.runtime.JDBCSource) JDBCInputReader(org.talend.components.jdbc.runtime.reader.JDBCInputReader)

Example 3 with ReaderDataProvider

use of org.talend.components.api.component.runtime.ReaderDataProvider in project components by Talend.

the class GoogleDriveDatasetRuntime method getSample.

@Override
public void getSample(int limit, Consumer<IndexedRecord> consumer) {
    GoogleDriveInputProperties properties = new GoogleDriveInputProperties("sample");
    properties.setDatasetProperties(dataset);
    GoogleDriveInputReader reader = (GoogleDriveInputReader) createDataSource(properties).createReader(container);
    reader.setLimit(limit);
    ReaderDataProvider<IndexedRecord> provider = new ReaderDataProvider<>(reader, limit, consumer);
    provider.retrieveData();
}
Also used : ReaderDataProvider(org.talend.components.api.component.runtime.ReaderDataProvider) IndexedRecord(org.apache.avro.generic.IndexedRecord) GoogleDriveInputProperties(org.talend.components.google.drive.data.GoogleDriveInputProperties)

Aggregations

IndexedRecord (org.apache.avro.generic.IndexedRecord)3 ReaderDataProvider (org.talend.components.api.component.runtime.ReaderDataProvider)3 GoogleDriveInputProperties (org.talend.components.google.drive.data.GoogleDriveInputProperties)1 JDBCSource (org.talend.components.jdbc.runtime.JDBCSource)1 JDBCInputReader (org.talend.components.jdbc.runtime.reader.JDBCInputReader)1 SalesforceInputProperties (org.talend.components.salesforce.dataprep.SalesforceInputProperties)1