Search in sources :

Example 36 with Feed

use of com.thinkbiganalytics.metadata.api.feed.Feed 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);
        }
    });
}
Also used : Feed(com.thinkbiganalytics.metadata.api.feed.Feed) FeedNotFoundException(com.thinkbiganalytics.metadata.api.feed.FeedNotFoundException) Feed(com.thinkbiganalytics.metadata.api.feed.Feed)

Example 37 with Feed

use of com.thinkbiganalytics.metadata.api.feed.Feed 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);
        }
    });
}
Also used : Feed(com.thinkbiganalytics.metadata.api.feed.Feed) FeedNotFoundException(com.thinkbiganalytics.metadata.api.feed.FeedNotFoundException) Feed(com.thinkbiganalytics.metadata.api.feed.Feed)

Example 38 with Feed

use of com.thinkbiganalytics.metadata.api.feed.Feed in project kylo by Teradata.

the class InMemoryFeedProvider method ensureFeed.

@Override
public Feed ensureFeed(String categorySystemName, String name, String descr) {
    synchronized (this.feeds) {
        for (Feed feed : this.feeds.values()) {
            if (feed.getName().equals(name)) {
                return feed;
            }
        }
    }
    BaseFeed newFeed = new BaseFeed(name, descr);
    this.feeds.put(newFeed.getId(), newFeed);
    return newFeed;
}
Also used : Feed(com.thinkbiganalytics.metadata.api.feed.Feed)

Example 39 with Feed

use of com.thinkbiganalytics.metadata.api.feed.Feed in project kylo by Teradata.

the class FeedDetails method getUsedByFeeds.

public List<Feed> getUsedByFeeds() {
    List<Feed> deps = new ArrayList<>();
    Set<Node> depNodes = JcrPropertyUtil.getSetProperty(this.node, USED_BY_FEEDS);
    for (Node depNode : depNodes) {
        deps.add(new JcrFeed(depNode, this.summary.getParentFeed().getOpsAccessProvider().orElse(null)));
    }
    return deps;
}
Also used : Node(javax.jcr.Node) ArrayList(java.util.ArrayList) Feed(com.thinkbiganalytics.metadata.api.feed.Feed)

Example 40 with Feed

use of com.thinkbiganalytics.metadata.api.feed.Feed in project kylo by Teradata.

the class FeedDetails method getDependentFeeds.

public <C extends Category> List<Feed> getDependentFeeds() {
    List<Feed> deps = new ArrayList<>();
    Set<Node> depNodes = JcrPropertyUtil.getSetProperty(this.node, DEPENDENTS);
    for (Node depNode : depNodes) {
        deps.add(new JcrFeed(depNode, this.summary.getParentFeed().getOpsAccessProvider().orElse(null)));
    }
    return deps;
}
Also used : Node(javax.jcr.Node) ArrayList(java.util.ArrayList) Feed(com.thinkbiganalytics.metadata.api.feed.Feed)

Aggregations

Feed (com.thinkbiganalytics.metadata.api.feed.Feed)69 ArrayList (java.util.ArrayList)19 UIFeed (com.thinkbiganalytics.feedmgr.rest.model.UIFeed)17 FeedMetadata (com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata)15 NifiFeed (com.thinkbiganalytics.feedmgr.rest.model.NifiFeed)15 Category (com.thinkbiganalytics.metadata.api.category.Category)14 FeedNotFoundException (com.thinkbiganalytics.metadata.api.feed.FeedNotFoundException)14 FeedManagerTemplate (com.thinkbiganalytics.metadata.api.template.FeedManagerTemplate)13 List (java.util.List)13 FeedProvider (com.thinkbiganalytics.metadata.api.feed.FeedProvider)12 HashMap (java.util.HashMap)12 DateTime (org.joda.time.DateTime)12 ID (com.thinkbiganalytics.metadata.api.feed.Feed.ID)11 Collectors (java.util.stream.Collectors)11 Inject (javax.inject.Inject)11 Test (org.junit.Test)11 FeedAccessControl (com.thinkbiganalytics.metadata.api.feed.security.FeedAccessControl)10 MetadataRepositoryException (com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException)10 AccessController (com.thinkbiganalytics.security.AccessController)10 HashSet (java.util.HashSet)10