Search in sources :

Example 1 with DatasourceNotFoundException

use of com.thinkbiganalytics.metadata.api.datasource.DatasourceNotFoundException in project kylo by Teradata.

the class JcrFeedProvider method ensureFeedDestination.

@Override
public FeedDestination ensureFeedDestination(Feed.ID feedId, com.thinkbiganalytics.metadata.api.datasource.Datasource.ID dsId) {
    JcrFeed feed = (JcrFeed) findById(feedId);
    FeedDestination source = feed.getDestination(dsId);
    if (source == null) {
        JcrDatasource datasource = (JcrDatasource) datasourceProvider.getDatasource(dsId);
        if (datasource != null) {
            JcrFeedDestination jcrDest = feed.ensureFeedDestination(datasource);
            // save();
            return jcrDest;
        } else {
            throw new DatasourceNotFoundException(dsId);
        }
    } else {
        return source;
    }
}
Also used : JcrDatasource(com.thinkbiganalytics.metadata.modeshape.datasource.JcrDatasource) FeedDestination(com.thinkbiganalytics.metadata.api.feed.FeedDestination) DatasourceNotFoundException(com.thinkbiganalytics.metadata.api.datasource.DatasourceNotFoundException)

Example 2 with DatasourceNotFoundException

use of com.thinkbiganalytics.metadata.api.datasource.DatasourceNotFoundException in project kylo by Teradata.

the class JcrFeedProvider method ensureFeedSource.

@Override
public FeedSource ensureFeedSource(Feed.ID feedId, Datasource.ID dsId) {
    JcrFeed feed = (JcrFeed) findById(feedId);
    FeedSource source = feed.getSource(dsId);
    if (source == null) {
        JcrDatasource datasource = (JcrDatasource) datasourceProvider.getDatasource(dsId);
        if (datasource != null) {
            JcrFeedSource jcrSrc = feed.ensureFeedSource(datasource);
            // save();
            return jcrSrc;
        } else {
            throw new DatasourceNotFoundException(dsId);
        }
    } else {
        return source;
    }
}
Also used : JcrDatasource(com.thinkbiganalytics.metadata.modeshape.datasource.JcrDatasource) FeedSource(com.thinkbiganalytics.metadata.api.feed.FeedSource) DatasourceNotFoundException(com.thinkbiganalytics.metadata.api.datasource.DatasourceNotFoundException)

Aggregations

DatasourceNotFoundException (com.thinkbiganalytics.metadata.api.datasource.DatasourceNotFoundException)2 JcrDatasource (com.thinkbiganalytics.metadata.modeshape.datasource.JcrDatasource)2 FeedDestination (com.thinkbiganalytics.metadata.api.feed.FeedDestination)1 FeedSource (com.thinkbiganalytics.metadata.api.feed.FeedSource)1