use of com.thinkbiganalytics.metadata.api.feed.FeedNotFoundException in project kylo by Teradata.
the class FeedManagerMetadataService method startFeed.
@Override
@SuppressWarnings("deprecation")
public FeedSummary startFeed(String feedId) {
FeedMetadata feedMetadata = this.metadataAccess.read(() -> {
this.accessController.checkPermission(AccessController.SERVICES, FeedServicesAccessControl.ADMIN_FEEDS);
Feed.ID domainId = domainFeedProvider.resolveId(feedId);
Feed domainFeed = domainFeedProvider.findById(domainId);
if (domainFeed != null) {
this.accessController.checkPermission(domainFeed, FeedAccessControl.START);
return feedModelTransform.domainToFeedMetadata(domainFeed);
} else {
throw new FeedNotFoundException(domainId);
}
});
Optional<ProcessorDTO> feedInputProcessor = nifiClient.processGroups().findByName("root", feedMetadata.getSystemCategoryName(), false, false).flatMap(categoryGroup -> nifiClient.processGroups().findByName(categoryGroup.getId(), feedMetadata.getSystemFeedName(), false, true)).map(feedGroup -> {
List<ProcessorDTO> inputProcessors = this.nifiRestClient.getInputProcessors(feedGroup.getId());
ProcessorDTO inputProcessor = NifiProcessUtil.findFirstProcessorsByTypeAndName(inputProcessors, feedMetadata.getInputProcessorType(), feedMetadata.getInputProcessorName());
if (inputProcessor != null) {
this.nifiClient.processors().wakeUp(inputProcessor);
}
return inputProcessor;
});
if (!feedInputProcessor.isPresent()) {
log.error("Unable to start the feed {}. Could not find the input processor to start.", feedMetadata.getCategoryAndFeedName());
throw new RuntimeException("Unable to start Feed " + feedMetadata.getCategoryAndFeedName() + ". Could not find the input processor to start the feed");
}
return new FeedSummary(feedMetadata);
}
use of com.thinkbiganalytics.metadata.api.feed.FeedNotFoundException in project kylo by Teradata.
the class FeedWaterMarkService method updateWaterMark.
public String updateWaterMark(String feedId, String waterMarkName, String value, boolean cancelActive) {
com.thinkbiganalytics.metadata.api.feed.Feed.ID updId = this.metadata.commit(() -> {
this.accessController.checkPermission(AccessController.SERVICES, FeedServicesAccessControl.EDIT_FEEDS);
com.thinkbiganalytics.metadata.api.feed.Feed.ID id = feedProvider.resolveFeed(feedId);
com.thinkbiganalytics.metadata.api.feed.Feed feed = feedProvider.getFeed(id);
if (feed != null) {
feed.setWaterMarkValue(waterMarkName, value);
return id;
} else {
throw new FeedNotFoundException(id);
}
});
if (cancelActive) {
cancelActiveWaterMark(updId, waterMarkName);
}
return this.metadata.commit(() -> {
com.thinkbiganalytics.metadata.api.feed.Feed feed = feedProvider.getFeed(updId);
if (feed != null) {
return feed.getWaterMarkValue(waterMarkName).orElseThrow(() -> new WaterMarkNotFoundExcepton(updId, waterMarkName));
} else {
throw new FeedNotFoundException(updId);
}
});
}
use of com.thinkbiganalytics.metadata.api.feed.FeedNotFoundException in project kylo by Teradata.
the class FeedWaterMarkService method getWaterMarks.
public List<String> getWaterMarks(String feedId) {
return this.metadata.read(() -> {
this.accessController.checkPermission(AccessController.SERVICES, FeedServicesAccessControl.ACCESS_FEEDS);
com.thinkbiganalytics.metadata.api.feed.Feed.ID id = feedProvider.resolveFeed(feedId);
com.thinkbiganalytics.metadata.api.feed.Feed feed = feedProvider.getFeed(id);
if (feed != null) {
List<String> list = feed.getWaterMarkNames().stream().collect(Collectors.toList());
Collections.sort(list);
return list;
} else {
throw new FeedNotFoundException(id);
}
});
}
use of com.thinkbiganalytics.metadata.api.feed.FeedNotFoundException in project kylo by Teradata.
the class FeedWaterMarkService method cancelActiveWaterMark.
public void cancelActiveWaterMark(String feedId, String waterMarkName) {
com.thinkbiganalytics.metadata.api.feed.Feed.ID updId = this.metadata.read(() -> {
this.accessController.checkPermission(AccessController.SERVICES, FeedServicesAccessControl.EDIT_FEEDS);
com.thinkbiganalytics.metadata.api.feed.Feed.ID id = feedProvider.resolveFeed(feedId);
com.thinkbiganalytics.metadata.api.feed.Feed feed = feedProvider.getFeed(id);
if (feed != null) {
return feed.getId();
} else {
throw new FeedNotFoundException(id);
}
});
cancelActiveWaterMark(updId, waterMarkName);
}
use of com.thinkbiganalytics.metadata.api.feed.FeedNotFoundException in project kylo by Teradata.
the class FeedWaterMarkService method getWaterMark.
public Optional<String> getWaterMark(String feedId, String waterMarkName) {
return this.metadata.read(() -> {
this.accessController.checkPermission(AccessController.SERVICES, FeedServicesAccessControl.ACCESS_FEEDS);
com.thinkbiganalytics.metadata.api.feed.Feed.ID id = feedProvider.resolveFeed(feedId);
com.thinkbiganalytics.metadata.api.feed.Feed feed = feedProvider.getFeed(id);
if (feed != null) {
return feed.getWaterMarkValue(waterMarkName);
} else {
throw new FeedNotFoundException(id);
}
});
}
Aggregations