Search in sources :

Example 16 with MetadataProvider

use of com.thinkbiganalytics.nifi.core.api.metadata.MetadataProvider in project kylo by Teradata.

the class ExecuteSparkJob method fetchDataSet.

private com.thinkbiganalytics.kylo.catalog.rest.model.DataSet fetchDataSet(String id, ProcessSession session, FlowFile flowFile, MetadataProviderService metadataService, List<String> extraJarPaths) {
    final MetadataProvider provider = metadataService.getProvider();
    final Optional<com.thinkbiganalytics.kylo.catalog.rest.model.DataSet> dataSet;
    try {
        dataSet = provider.getDataSet(id);
    } catch (final Exception e) {
        getLog().error("Unable to access data set: {}: {}", new Object[] { id, e }, e);
        throw e;
    }
    if (dataSet.isPresent()) {
        if (dataSet.get().getJars() != null) {
            extraJarPaths.addAll(dataSet.get().getJars());
        }
        if (dataSet.get().getDataSource() != null) {
            final com.thinkbiganalytics.kylo.catalog.rest.model.DataSource dataSource = dataSet.get().getDataSource();
            if (dataSource.getTemplate() != null && dataSource.getTemplate().getJars() != null) {
                extraJarPaths.addAll(dataSource.getTemplate().getJars());
            }
            if (dataSource.getConnector() != null && dataSource.getConnector().getTemplate() != null && dataSource.getConnector().getTemplate().getJars() != null) {
                extraJarPaths.addAll(dataSource.getConnector().getTemplate().getJars());
            }
        }
    }
    return dataSet != null && dataSet.isPresent() ? dataSet.get() : null;
}
Also used : MetadataProvider(com.thinkbiganalytics.nifi.core.api.metadata.MetadataProvider) ProcessException(org.apache.nifi.processor.exception.ProcessException) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) IOException(java.io.IOException)

Aggregations

MetadataProvider (com.thinkbiganalytics.nifi.core.api.metadata.MetadataProvider)16 ProcessException (org.apache.nifi.processor.exception.ProcessException)6 Datasource (com.thinkbiganalytics.metadata.rest.model.data.Datasource)4 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)3 IOException (java.io.IOException)3 JdbcDatasource (com.thinkbiganalytics.metadata.rest.model.data.JdbcDatasource)2 Feed (com.thinkbiganalytics.metadata.rest.model.feed.Feed)2 Dataset (com.thinkbiganalytics.metadata.rest.model.op.Dataset)2 Properties (java.util.Properties)2 FlowFile (org.apache.nifi.flowfile.FlowFile)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 DatasourceUpdatedSinceFeedExecuted (com.thinkbiganalytics.metadata.api.sla.DatasourceUpdatedSinceFeedExecuted)1 DirectoryDatasource (com.thinkbiganalytics.metadata.rest.model.data.DirectoryDatasource)1 HiveTableDatasource (com.thinkbiganalytics.metadata.rest.model.data.HiveTableDatasource)1 FeedPreconditionTriggerEvent (com.thinkbiganalytics.metadata.rest.model.event.FeedPreconditionTriggerEvent)1 FeedDestination (com.thinkbiganalytics.metadata.rest.model.feed.FeedDestination)1 DataOperation (com.thinkbiganalytics.metadata.rest.model.op.DataOperation)1 Metric (com.thinkbiganalytics.metadata.sla.api.Metric)1 FeedPreconditionEventService (com.thinkbiganalytics.nifi.core.api.precondition.FeedPreconditionEventService)1 PreconditionListener (com.thinkbiganalytics.nifi.core.api.precondition.PreconditionListener)1