use of com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement 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.sla.api.ServiceLevelAgreement in project kylo by Teradata.
the class FeedDetails method getServiceLevelAgreements.
public List<ServiceLevelAgreement> getServiceLevelAgreements() {
Set<Node> list = JcrPropertyUtil.getReferencedNodeSet(this.node, SLA);
List<ServiceLevelAgreement> serviceLevelAgreements = new ArrayList<>();
if (list != null) {
for (Node n : list) {
serviceLevelAgreements.add(JcrUtil.createJcrObject(n, JcrServiceLevelAgreement.class));
}
}
return serviceLevelAgreements;
}
use of com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement in project kylo by Teradata.
the class JcrFeedProvider method enableFeed.
//
// @Override
// public com.thinkbiganalytics.metadata.api.feed.FeedSource.ID resolveSource(Serializable sid) {
// return new JcrFeedSource.FeedSourceId((sid));
// }
//
// @Override
// public com.thinkbiganalytics.metadata.api.feed.FeedDestination.ID resolveDestination(Serializable sid) {
// return new JcrFeedDestination.FeedDestinationId(sid);
// }
@Override
public boolean enableFeed(Feed.ID id) {
Feed feed = getFeed(id);
if (accessController.isEntityAccessControlled()) {
feed.getAllowedActions().checkPermission(FeedAccessControl.ENABLE_DISABLE);
}
if (!feed.getState().equals(Feed.State.ENABLED)) {
feed.setState(Feed.State.ENABLED);
// Enable any SLAs on this feed
List<ServiceLevelAgreement> serviceLevelAgreements = feed.getServiceLevelAgreements();
if (serviceLevelAgreements != null) {
for (ServiceLevelAgreement sla : serviceLevelAgreements) {
JcrServiceLevelAgreement jcrSla = (JcrServiceLevelAgreement) sla;
jcrSla.enable();
}
}
return true;
}
return false;
}
use of com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement in project kylo by Teradata.
the class JcrServiceLevelAgreementProvider method getAgreements.
/* (non-Javadoc)
* @see com.thinkbiganalytics.metadata.sla.spi.ServiceLevelAgreementProvider#getAgreements()
*/
@Override
public /**
* Find all Agreements that are not Preconditions
*/
List<ServiceLevelAgreement> getAgreements() {
try {
Session session = getSession();
Node slasNode = session.getNode(EntityUtil.pathForSla());
@SuppressWarnings("unchecked") Iterator<Node> itr = (Iterator<Node>) slasNode.getNodes("sla-*");
return Lists.newArrayList(Iterators.transform(itr, (slaNode) -> {
return JcrUtil.createJcrObject(slaNode, JcrServiceLevelAgreement.class);
}));
} catch (RepositoryException e) {
throw new MetadataRepositoryException("Failed to retrieve the ServiceLevelAgreements", e);
}
}
use of com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement in project kylo by Teradata.
the class InMemoryFeedProvider method createPrecondition.
@Override
public Feed createPrecondition(Feed.ID feedId, String descr, List<Metric> metrics) {
BaseFeed feed = (BaseFeed) this.feeds.get(feedId);
if (feed != null) {
// Remove the old one if any
FeedPreconditionImpl precond = (FeedPreconditionImpl) feed.getPrecondition();
if (precond != null) {
this.slaProvider.removeAgreement(precond.getAgreement().getId());
}
ServiceLevelAgreement sla = this.slaProvider.builder().name("Precondition for feed " + feed.getName() + " (" + feed.getId() + ")").description(descr).obligationBuilder(Condition.REQUIRED).metric(metrics).build().build();
return setupPrecondition(feed, sla);
} else {
throw new FeedCreateException("A feed with the given ID does not exists: " + feedId);
}
}
Aggregations