use of com.thinkbiganalytics.metadata.modeshape.feed.JcrFeed in project kylo by Teradata.
the class CategoryAndFeedReindexingUpgradeAction method upgradeTo.
@Override
public void upgradeTo(KyloVersion startingVersion) {
log.info("****************** Start: Category and Feed Reindexing Support Upgrade Action ****************");
log.info("[REF.A] Upgrading feeds to support (1) allowing/stopping metadata indexing, AND (2) reindexing of history data for version: {}...", startingVersion);
log.info("Total feeds found for upgrading: {}", feedProvider.getFeeds().size());
if (feedProvider.getFeeds().isEmpty()) {
log.warn("No feeds have been found for upgrade!");
}
feedProvider.getFeeds().forEach(feed -> {
JcrFeed jcrFeed = (JcrFeed) feed;
if ((jcrFeed.getFeedSummary().isPresent()) && (jcrFeed.getFeedData().isPresent())) {
Node summaryNode = jcrFeed.getFeedSummary().get().getNode();
Node feedDataNode = jcrFeed.getFeedData().get().getNode();
try {
summaryNode.addMixin("tba:indexControlled");
summaryNode.setProperty("tba:allowIndexing", "Y");
if (!JcrUtil.hasNode(feedDataNode, "tba:historyReindexing")) {
log.info("Feed with id [{}] in category [{}] having name [{}] requires history reindexing support. Adding it.", jcrFeed.getId(), jcrFeed.getCategory().getDisplayName(), jcrFeed.getName());
feedDataNode.addNode("tba:historyReindexing", "tba:historyReindexing");
} else {
log.info("Feed with id [{}] in category [{}] having name [{}] already has history reindexing support. Skipping step to add again.", jcrFeed.getId(), jcrFeed.getCategory().getDisplayName(), jcrFeed.getName());
}
log.info("Upgraded feed with id [{}] in category [{}] having name [{}]", jcrFeed.getId(), jcrFeed.getCategory().getDisplayName(), jcrFeed.getName());
} catch (Exception e) {
log.error("Failed to configure feed {} to (1) support allowing/stopping metadata indexing, AND/OR (2) support reindexing of history data: {}", ((JcrFeed) feed).getName(), e);
throw new UpgradeException("Failed to configure feed to (1) support allowing/stopping metadata indexing, AND/OR (2) support reindexing of history data: " + summaryNode, e);
}
} else {
log.error("Failed to get summary and/or data node for feed: {}", ((JcrFeed) feed).getName());
throw new UpgradeException("Failed to get summary and/or data node for feed:" + ((JcrFeed) feed).getName());
}
});
log.info("Completed [REF.A]: Configured feeds to support (1) allowing/stopping metadata indexing, AND (2) reindexing of history data for version: {}", startingVersion);
log.info("[REF.B] Upgrading categories to support allowing/stopping metadata indexing for version: {}...", startingVersion);
log.info("Total categories found for upgrading: {}", categoryProvider.findAll().size());
if (categoryProvider.findAll().isEmpty()) {
log.warn("No categories have been found for for upgrade!");
}
categoryProvider.findAll().forEach(category -> {
JcrCategory jcrCategory = (JcrCategory) category;
Node categoryNode = jcrCategory.getNode();
try {
categoryNode.addMixin("tba:indexControlled");
categoryNode.setProperty("tba:allowIndexing", "Y");
log.info("Upgraded category with id [{}] having name [{}]", jcrCategory.getId(), jcrCategory.getDisplayName());
} catch (Exception e) {
log.error("Failed to configure category {} to support allowing/stopping metadata indexing: {}", ((JcrCategory) category).getDisplayName(), e);
throw new UpgradeException("Failed to configure category to support allowing/stopping metadata indexing: " + categoryNode, e);
}
});
log.info("Completed [REF.B]: Configured categories to support allowing/stopping metadata indexing for version: {}", startingVersion);
log.info("****************** End: Category and Feed Reindexing Support Upgrade Action ****************");
}
use of com.thinkbiganalytics.metadata.modeshape.feed.JcrFeed in project kylo by Teradata.
the class FeedSlaUpgradeAction method upgradeFeedSla.
private void upgradeFeedSla(ExtensibleType type) {
List<ExtensibleEntity> slaRels = entityProvider.getEntities(SLA_REL_TYPE_NAME);
for (ExtensibleEntity rel : slaRels) {
ServiceLevelAgreement sla = JcrUtil.getJcrObject(rel.getProperty("sla"), JcrServiceLevelAgreement.class);
Set<Feed> feeds = rel.getPropertyAsSet("feeds", Node.class).stream().map(JcrFeed::new).collect(Collectors.toSet());
feedSlaProvider.relateFeeds(sla, feeds);
entityProvider.deleteEntity(rel.getId());
}
this.typeProvider.deleteType(type.getId());
}
use of com.thinkbiganalytics.metadata.modeshape.feed.JcrFeed in project kylo by Teradata.
the class FeedWeakReferenceUpgradeAction method upgradeTo.
@Override
public void upgradeTo(final KyloVersion targetVersion) {
log.info("Updating template feed references: {}", targetVersion);
this.templateProvider.findAll().stream().map(JcrFeedTemplate.class::cast).map(JcrFeedTemplate::getNode).forEach(templateNode -> {
Set<Node> feedNodes = JcrPropertyUtil.getSetProperty(templateNode, JcrFeedTemplate.FEEDS);
JcrPropertyUtil.removeAllFromSetProperty(templateNode, JcrFeedTemplate.FEEDS);
feedNodes.forEach(feedNode -> JcrPropertyUtil.addToSetProperty(templateNode, JcrFeedTemplate.FEEDS, feedNode, true));
});
this.feedProvider.findAll().stream().map(JcrFeed.class::cast).map(JcrFeed::getFeedDetails).filter(Optional::isPresent).map(Optional::get).map(FeedDetails::getNode).forEach(detailsNode -> {
Node templateNode = JcrPropertyUtil.getProperty(detailsNode, FeedDetails.TEMPLATE);
JcrPropertyUtil.setProperty(detailsNode, FeedDetails.TEMPLATE, null);
JcrPropertyUtil.setWeakReferenceProperty(detailsNode, FeedDetails.TEMPLATE, templateNode);
});
}
use of com.thinkbiganalytics.metadata.modeshape.feed.JcrFeed in project kylo by Teradata.
the class JcrFeedTemplate method getFeeds.
public List<Feed> getFeeds() {
List<Feed> feeds = new ArrayList<>();
Set<Node> feedNodes = JcrPropertyUtil.getSetProperty(getNode(), FEEDS);
for (Node depNode : feedNodes) {
// TODO: note that feeds instances returned here will not be able to update feed ops
// access through permission changes to their allowed actions.
feeds.add(new JcrFeed(depNode, (FeedOpsAccessControlProvider) null));
}
return feeds;
}
use of com.thinkbiganalytics.metadata.modeshape.feed.JcrFeed in project kylo by Teradata.
the class JcrFeedTemplate method removeFeed.
public boolean removeFeed(Feed feed) {
JcrFeed jcrFeed = (JcrFeed) feed;
Node feedNode = jcrFeed.getNode();
return JcrPropertyUtil.removeFromSetProperty(getNode(), FEEDS, feedNode);
}
Aggregations