Search in sources :

Example 6 with ServiceLevelAgreementActionConfiguration

use of com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreementActionConfiguration in project kylo by Teradata.

the class JcrServiceLevelAgreementCheck method setActionConfigurations.

public void setActionConfigurations(List<? extends ServiceLevelAgreementActionConfiguration> actionConfigurations) {
    try {
        NodeIterator nodes = this.node.getNodes(ACTION_CONFIGURATIONS);
        while (nodes.hasNext()) {
            Node metricNode = (Node) nodes.next();
            metricNode.remove();
        }
        for (ServiceLevelAgreementActionConfiguration actionConfiguration : actionConfigurations) {
            Node node = this.node.addNode(ACTION_CONFIGURATIONS, ACTION_CONFIGURATION_TYPE);
            JcrPropertyUtil.setProperty(node, JcrPropertyConstants.TITLE, actionConfiguration.getClass().getSimpleName());
            ServiceLevelAgreementActionConfig annotation = actionConfiguration.getClass().getAnnotation(ServiceLevelAgreementActionConfig.class);
            String desc = actionConfiguration.getClass().getSimpleName();
            if (annotation != null) {
                desc = annotation.description();
            }
            JcrPropertyUtil.setProperty(node, DESCRIPTION, desc);
            JcrUtil.addGenericJson(node, JcrPropertyConstants.JSON, actionConfiguration);
        }
    } catch (RepositoryException e) {
        throw new MetadataRepositoryException("Failed to retrieve the metric nodes", e);
    }
}
Also used : NodeIterator(javax.jcr.NodeIterator) MetadataRepositoryException(com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException) Node(javax.jcr.Node) MetadataRepositoryException(com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException) RepositoryException(javax.jcr.RepositoryException) ServiceLevelAgreementActionConfiguration(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreementActionConfiguration) ServiceLevelAgreementActionConfig(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreementActionConfig)

Aggregations

ServiceLevelAgreementActionConfiguration (com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreementActionConfiguration)6 ArrayList (java.util.ArrayList)4 MetadataRepositoryException (com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException)2 Obligation (com.thinkbiganalytics.metadata.rest.model.sla.Obligation)2 ServiceLevelAgreement (com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement)2 ServiceLevelAgreementActionValidation (com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreementActionValidation)2 ServiceLevelAgreementCheck (com.thinkbiganalytics.metadata.sla.spi.ServiceLevelAgreementCheck)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 Lists (com.google.common.collect.Lists)1 ServicesApplicationStartupListener (com.thinkbiganalytics.app.ServicesApplicationStartupListener)1 VelocityTemplate (com.thinkbiganalytics.common.velocity.model.VelocityTemplate)1 VelocityTemplateProvider (com.thinkbiganalytics.common.velocity.service.VelocityTemplateProvider)1 FeedMetadata (com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata)1 FeedServicesAccessControl (com.thinkbiganalytics.feedmgr.security.FeedServicesAccessControl)1 FeedManagerFeedService (com.thinkbiganalytics.feedmgr.service.feed.FeedManagerFeedService)1 MetadataAccess (com.thinkbiganalytics.metadata.api.MetadataAccess)1 Feed (com.thinkbiganalytics.metadata.api.feed.Feed)1 FeedNotFoundException (com.thinkbiganalytics.metadata.api.feed.FeedNotFoundException)1 FeedProvider (com.thinkbiganalytics.metadata.api.feed.FeedProvider)1