use of com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreementActionConfig in project kylo by Teradata.
the class ServiceLevelAgreementActionConfigTransformer method buildActionConfigurationRegistry.
private synchronized void buildActionConfigurationRegistry() {
actionConfigurationRegistry = new ArrayList<>();
List<ServiceLevelAgreementActionUiConfigurationItem> rules = new ArrayList<>();
Set<Class<?>> items = ReflectionPolicyAnnotationDiscoverer.getTypesAnnotatedWith(ServiceLevelAgreementActionConfig.class);
for (Class c : items) {
List<FieldRuleProperty> properties = getUiProperties(c);
ServiceLevelAgreementActionConfig policy = (ServiceLevelAgreementActionConfig) c.getAnnotation(ServiceLevelAgreementActionConfig.class);
ServiceLevelAgreementActionUiConfigurationItem configItem = buildUiModel(policy, c, properties);
rules.add(configItem);
actionConfigurationRegistry.add(configItem);
}
}
use of com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreementActionConfig in project kylo by Teradata.
the class ServiceLevelAgreementActionConfigTransformer method validateAction.
public List<ServiceLevelAgreementActionValidation> validateAction(String actionConfigurationClassName) {
List<ServiceLevelAgreementActionValidation> validation = null;
try {
Class<? extends ServiceLevelAgreementActionConfiguration> configurationClass = ClassNameChangeRegistry.findClass(actionConfigurationClassName);
ServiceLevelAgreementActionConfig annotation = (ServiceLevelAgreementActionConfig) configurationClass.getAnnotation(ServiceLevelAgreementActionConfig.class);
Class<? extends ServiceLevelAgreementAction>[] actions = annotation.actionClasses();
if (actions != null) {
List<Class<? extends ServiceLevelAgreementAction>> actionClassList = Lists.newArrayList(actions);
validation = ServiceLevelAgreementActionUtil.validateActionConfiguration(actionClassList);
} else {
validation.add(new ServiceLevelAgreementActionValidation(false, "No Actions are defined for :" + actionConfigurationClassName));
}
} catch (ClassNotFoundException e) {
if (validation != null) {
validation.add(new ServiceLevelAgreementActionValidation(false, "ImmutableAction Configuration Not Found: " + e.getMessage()));
}
}
return validation;
}
use of com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreementActionConfig in project kylo by Teradata.
the class JcrServiceLevelAgreementCheck method setActionConfigurations.
public void setActionConfigurations(List<? extends ServiceLevelAgreementActionConfiguration> actionConfigurations) {
try {
NodeIterator nodes = getNode().getNodes(ACTION_CONFIGURATIONS);
while (nodes.hasNext()) {
Node metricNode = (Node) nodes.next();
metricNode.remove();
}
for (ServiceLevelAgreementActionConfiguration actionConfiguration : actionConfigurations) {
Node node = getNode().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);
}
}
Aggregations