diff options
Diffstat (limited to 'dcae-analytics-model/src/main/java')
17 files changed, 34 insertions, 54 deletions
diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/BaseDynamicPropertiesProvider.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/BaseDynamicPropertiesProvider.java index 4190587..80e1665 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/BaseDynamicPropertiesProvider.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/BaseDynamicPropertiesProvider.java @@ -62,8 +62,6 @@ public abstract class BaseDynamicPropertiesProvider implements DynamicProperties * @return return true if Dynamic Properties are present */ public boolean isDynamicPropertiesPresent() { - return dynamicProperties.size() == 0; + return dynamicProperties.isEmpty(); } - - } diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/DynamicPropertiesProvider.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/DynamicPropertiesProvider.java index 28b607a..e4fc373 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/DynamicPropertiesProvider.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/DynamicPropertiesProvider.java @@ -38,7 +38,6 @@ import java.util.Map; */ public interface DynamicPropertiesProvider extends DCAEAnalyticsModel { - /** * Adds dynamic properties in a Map object * diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/AlertAction.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/AlertAction.java index 664bd4a..4e6759c 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/AlertAction.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/AlertAction.java @@ -27,6 +27,6 @@ package org.openecomp.dcae.apod.analytics.model.domain.cef; */ public enum AlertAction implements CEFModel { - CLEAR, CONT, SET; + CLEAR, CONT, SET } diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/AlertType.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/AlertType.java index 9fc8046..aa17043 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/AlertType.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/AlertType.java @@ -32,7 +32,7 @@ public enum AlertType implements CEFModel { SERVICE_ANOMALY("SERVICE-ANOMALY"), UNKNOWN(null); - private String name; + private final String name; AlertType(String name) { this.name = name; @@ -41,5 +41,4 @@ public enum AlertType implements CEFModel { public String getName() { return name; } - } diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/BaseCEFModel.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/BaseCEFModel.java index 5438297..519e961 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/BaseCEFModel.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/BaseCEFModel.java @@ -36,6 +36,4 @@ import org.openecomp.dcae.apod.analytics.model.domain.BaseDynamicPropertiesProvi @Data @EqualsAndHashCode(callSuper = true) public abstract class BaseCEFModel extends BaseDynamicPropertiesProvider implements CEFModel { - - } diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/CEFModel.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/CEFModel.java index 8df7d61..e6351b3 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/CEFModel.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/CEFModel.java @@ -29,6 +29,4 @@ import org.openecomp.dcae.apod.analytics.model.domain.DCAEAnalyticsModel; * @author Rajiv Singla. Creation Date: 08/15/2017. */ public interface CEFModel extends DCAEAnalyticsModel { - - } diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/Criticality.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/Criticality.java index 69d23c4..d8e334c 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/Criticality.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/Criticality.java @@ -27,5 +27,5 @@ package org.openecomp.dcae.apod.analytics.model.domain.cef; */ public enum Criticality implements CEFModel { - CRIT, MAJ, UNKNOWN; + CRIT, MAJ, UNKNOWN } diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/Event.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/Event.java index bb8a13a..d727a0e 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/Event.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/Event.java @@ -44,7 +44,7 @@ public class Event extends BaseCEFModel { private CommonEventHeader commonEventHeader; /** - * MeasurementsForVfScaling fields + * Measurements for Vf scaling fields * * @param measurementsForVfScalingFields New value for MeasurementsForVfScaling * @return MeasurementsForVfScaling fields @@ -52,12 +52,10 @@ public class Event extends BaseCEFModel { private MeasurementsForVfScalingFields measurementsForVfScalingFields; /** - * Threshold crossing Fields + * Threshold crossing alert Fields. * * @param thresholdCrossingAlertFields New value for Threshold crossing Fields * @return Threshold crossing Fields */ private ThresholdCrossingAlertFields thresholdCrossingAlertFields; - - } diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/EventListener.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/EventListener.java index 0854790..aa543f7 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/EventListener.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/EventListener.java @@ -34,13 +34,12 @@ public class EventListener extends BaseCEFModel { private static final long serialVersionUID = 1L; - /** + + /** * Common Event Format - Event * * @param event New value for Event * @return Common Event Format Event */ private Event event; - - } diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/EventSeverity.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/EventSeverity.java index d7f85fa..6626e77 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/EventSeverity.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/EventSeverity.java @@ -32,5 +32,5 @@ public enum EventSeverity implements CEFModel { MAJOR, MINOR, WARNING, - NORMAL; + NORMAL } diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/PerformanceCounter.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/PerformanceCounter.java index e8dbee9..46b4c4f 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/PerformanceCounter.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/PerformanceCounter.java @@ -33,13 +33,15 @@ import lombok.EqualsAndHashCode; public class PerformanceCounter extends BaseCEFModel { private static final long serialVersionUID = 1L; + /** - * Performance Counter Criticality + * Performance Counter Criticality. * * @param criticality New value for Criticality * @return Performance Counter Criticality */ private Criticality criticality; + /** * Performance Counter Name * @@ -47,19 +49,20 @@ public class PerformanceCounter extends BaseCEFModel { * @return Performance Counter Name */ private String name; - /** - * Performance Counter Threshold Crossed + + /** + * Performance Counter for Threshold Crossed. * * @param thresholdCrossed New value for Performance Counter Threshold Crossed * @return Performance Counter Threshold Crossed */ private String thresholdCrossed; + /** - * Performance Counter Value + * Performance Counter Value. * * @param value New Performance Counter Value * @return Performance Counter Value */ private String value; - } diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/Priority.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/Priority.java index f2c6674..0206899 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/Priority.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/Priority.java @@ -27,6 +27,8 @@ package org.openecomp.dcae.apod.analytics.model.domain.cef; */ public enum Priority implements CEFModel { - High, Medium, Normal, Low; - + High, + Medium, + Normal, + Low } diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/ThresholdCrossingAlertFields.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/ThresholdCrossingAlertFields.java index 55dd696..5fbe3e3 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/ThresholdCrossingAlertFields.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/ThresholdCrossingAlertFields.java @@ -20,11 +20,10 @@ package org.openecomp.dcae.apod.analytics.model.domain.cef; +import java.util.List; import lombok.Data; import lombok.EqualsAndHashCode; -import java.util.List; - /** * Common Event Format - Fields Specific to threshold crossing alert events * @@ -37,7 +36,7 @@ public class ThresholdCrossingAlertFields extends BaseCEFModel { private static final long serialVersionUID = 1L; /** - * Additional Performance counters + * Additional Performance counters parameters. * * @param additionalParameters New value for Additional Performance counters * @return Additional Performance counters @@ -45,10 +44,10 @@ public class ThresholdCrossingAlertFields extends BaseCEFModel { private List<PerformanceCounter> additionalParameters; /** - * Event Action + * Event alert action * * @param alertAction New Event Action - * @return Event Action + * @return Event alert action */ private AlertAction alertAction; @@ -156,6 +155,4 @@ public class ThresholdCrossingAlertFields extends BaseCEFModel { * @return Version of the thresholdCrossingAlertFields block */ private Integer thresholdCrossingFieldsVersion; - - } diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/AnalyticsModelIOUtils.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/AnalyticsModelIOUtils.java index d6d5dc2..df1d46d 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/AnalyticsModelIOUtils.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/AnalyticsModelIOUtils.java @@ -22,15 +22,14 @@ package org.openecomp.dcae.apod.analytics.model.util; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.Charset; import java.util.Properties; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Utility class containing methods for IO related operations @@ -50,8 +49,9 @@ public abstract class AnalyticsModelIOUtils extends AnalyticsModelJsonUtils { * @param <T> binding Class Type * * @return binding Class Object which properties populated from JSON File Location + * @throws IOException when fails to do IO operations */ - public static final <T> T convertToJsonObject(String fileLocation, Class<T> bindingClass) { + public static final <T> T convertToJsonObject(String fileLocation, Class<T> bindingClass) throws IOException { // Load Resource from give path final InputStream resourceAsStream = loadResourceAsStream(fileLocation); @@ -59,14 +59,13 @@ public abstract class AnalyticsModelIOUtils extends AnalyticsModelJsonUtils { // If resource is null throw an exception if (resourceAsStream == null) { final String errorMessage = String.format("Invalid File location: %s", fileLocation); - throw new RuntimeException(errorMessage, new FileNotFoundException(errorMessage)); + throw new IOException(errorMessage, new FileNotFoundException(errorMessage)); } // Parse input stream try (InputStreamReader inputStreamReader = new InputStreamReader(resourceAsStream, Charset.forName("UTF-8"))) { return ANALYTICS_MODEL_OBJECT_MAPPER.readValue(inputStreamReader, bindingClass); - } catch (JsonMappingException | JsonParseException e) { // If parsing fails due to Invalid Json or Json IO Issues throw an exception @@ -74,17 +73,14 @@ public abstract class AnalyticsModelIOUtils extends AnalyticsModelJsonUtils { fileLocation); LOG.error(errorMessage); - throw new RuntimeException(errorMessage, e); - + throw new IOException(errorMessage, e); } catch (IOException e) { // If parsing fails due to IO Issues throw an exception final String errorMessage = String.format("IO Error while parsing Json File location: %s", fileLocation); LOG.error(errorMessage); - throw new RuntimeException(errorMessage, e); - + throw new IOException(errorMessage, e); } - } /** @@ -105,7 +101,8 @@ public abstract class AnalyticsModelIOUtils extends AnalyticsModelJsonUtils { // If properties file is not present throw an exception if (propertiesFileInputStream == null) { final String errorMessage = String.format("Invalid Properties File at location: %s", - propertiesFileLocation); + propertiesFileLocation); + //TODO: discuss and change this excpeiton as well. throw new RuntimeException(errorMessage, new FileNotFoundException(errorMessage)); } @@ -132,6 +129,4 @@ public abstract class AnalyticsModelIOUtils extends AnalyticsModelJsonUtils { // Load Resource from give path return Thread.currentThread().getContextClassLoader().getResourceAsStream(fileLocation); } - - } diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/cef/BaseCEFModelMixin.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/cef/BaseCEFModelMixin.java index 092d554..dab6b76 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/cef/BaseCEFModelMixin.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/cef/BaseCEFModelMixin.java @@ -28,6 +28,4 @@ import org.openecomp.dcae.apod.analytics.model.util.json.mixin.BaseDynamicProper * @author Rajiv Singla. Creation Date: 08/15/2017. */ public abstract class BaseCEFModelMixin extends BaseDynamicPropertiesProviderMixin { - - } diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/cef/EventListenerMixin.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/cef/EventListenerMixin.java index 9f92bd7..56112dd 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/cef/EventListenerMixin.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/cef/EventListenerMixin.java @@ -26,6 +26,4 @@ package org.openecomp.dcae.apod.analytics.model.util.json.mixin.cef; * @author Rajiv Singla. Creation Date: 08/15/2017. */ public abstract class EventListenerMixin extends BaseCEFModelMixin { - - } diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/cef/EventMixin.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/cef/EventMixin.java index 269ddb7..00a83ba 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/cef/EventMixin.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/cef/EventMixin.java @@ -26,6 +26,4 @@ package org.openecomp.dcae.apod.analytics.model.util.json.mixin.cef; * @author Rajiv Singla. Creation Date: 08/15/2017. */ public abstract class EventMixin extends BaseCEFModelMixin { - - } |