/*-
* ============LICENSE_START=======================================================
- * ONAP Policy API
- * ================================================================================
+ * ONAP Policy API
+ * ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.policy.api.main.rest;
+import lombok.Getter;
+
/**
* Class to hold statistical data for API access.
+ *
+ * @author Chenfei Gao (cgao@research.att.com)
*/
public class ApiStatisticsManager {
-
+
+ @Getter
private static long totalApiCallCount;
+
+ @Getter
private static long apiCallSuccessCount;
+
+ @Getter
private static long apiCallFailureCount;
+
+ @Getter
private static long totalPolicyGetCount;
+
+ @Getter
private static long totalPolicyPostCount;
- private static long totalTemplateGetCount;
- private static long totalTemplatePostCount;
+
+ @Getter
+ private static long totalPolicyTypeGetCount;
+
+ @Getter
+ private static long totalPolicyTypePostCount;
+
+ @Getter
private static long policyGetSuccessCount;
+
+ @Getter
private static long policyGetFailureCount;
+
+ @Getter
private static long policyPostSuccessCount;
+
+ @Getter
private static long policyPostFailureCount;
- private static long templateGetSuccessCount;
- private static long templateGetFailureCount;
- private static long templatePostSuccessCount;
- private static long templatePostFailureCount;
-
+
+ @Getter
+ private static long policyTypeGetSuccessCount;
+
+ @Getter
+ private static long policyTypeGetFailureCount;
+
+ @Getter
+ private static long policyTypePostSuccessCount;
+
+ @Getter
+ private static long policyTypePostFailureCount;
+
private ApiStatisticsManager() {
throw new IllegalStateException("Instantiation of the class is not allowed");
}
-
+
/**
* Method to update the total api call count.
- *
+ *
* @return the updated value of totalApiCallCount
*/
public static long updateTotalApiCallCount() {
return ++totalApiCallCount;
}
-
+
/**
* Method to update the successful api call count.
- *
+ *
* @return the updated value of apiCallSuccessCount
*/
public static long updateApiCallSuccessCount() {
return ++apiCallSuccessCount;
}
-
+
/**
* Method to update the failed api call count.
- *
+ *
* @return the updated value of apiCallFailureCount
*/
public static long updateApiCallFailureCount() {
return ++apiCallFailureCount;
}
-
+
/**
* Method to update the total policy GET count.
- *
+ *
* @return the updated value of totalPolicyGetCount
*/
public static long updateTotalPolicyGetCount() {
return ++totalPolicyGetCount;
}
-
+
/**
* Method to update the total policy POST count.
- *
+ *
* @return the updated value of totalPolicyPostCount
*/
public static long updateTotalPolicyPostCount() {
return ++totalPolicyPostCount;
}
-
+
/**
- * Method to update the total template GET count.
- *
- * @return the updated value of totalTemplateGetCount
+ * Method to update the total policyType GET count.
+ *
+ * @return the updated value of totalPolicyTypeGetCount
*/
- public static long updateTotalTemplateGetCount() {
- return ++totalTemplateGetCount;
+ public static long updateTotalPolicyTypeGetCount() {
+ return ++totalPolicyTypeGetCount;
}
-
+
/**
- * Method to update the total template POST count.
- *
- * @return the updated value of totalTemplatePostCount
+ * Method to update the total policyType POST count.
+ *
+ * @return the updated value of totalPolicyTypePostCount
*/
- public static long updateTotalTemplatePostCount() {
- return ++totalTemplatePostCount;
+ public static long updateTotalPolicyTypePostCount() {
+ return ++totalPolicyTypePostCount;
}
-
+
/**
* Method to update successful policy GET count.
- *
+ *
* @return the updated value of policyGetSuccessCount
*/
public static long updatePolicyGetSuccessCount() {
return ++policyGetSuccessCount;
}
-
+
/**
* Method to update failed policy GET count.
- *
+ *
* @return the updated value of policyGetFailureCount
*/
public static long updatePolicyGetFailureCount() {
return ++policyGetFailureCount;
}
-
+
/**
* Method to update successful policy POST count.
- *
+ *
* @return the updated value of policyPostSuccessCount
*/
public static long updatePolicyPostSuccessCount() {
return ++policyPostSuccessCount;
}
-
+
/**
* Method to update failed policy POST count.
- *
+ *
* @return the updated value of policyPostFailureCount
*/
public static long updatePolicyPostFailureCount() {
return ++policyPostFailureCount;
}
-
- /**
- * Method to update successful template GET count.
- *
- * @return the updated value of templateGetSuccessCount
- */
- public static long updateTemplateGetSuccessCount() {
- return ++templateGetSuccessCount;
- }
-
- /**
- * Method to update failed template GET count.
- *
- * @return the updated value of templateGetFailureCount
- */
- public static long updateTemplateGetFailureCount() {
- return ++templateGetFailureCount;
- }
-
- /**
- * Method to update successful template POST count.
- *
- * @return the updated value of templatePostSuccessCount
- */
- public static long updateTemplatePostSuccessCount() {
- return ++templatePostSuccessCount;
- }
-
- /**
- * Method to update failed template POST count.
- *
- * @return the updated value of templatePostFailureCount
- */
- public static long updateTemplatePostFailureCount() {
- return ++templatePostFailureCount;
- }
-
- /**
- * Returns the current value of totalApiCallCount.
- *
- * @return the totalApiCallCount
- */
- public static long getTotalApiCallCount() {
- return totalApiCallCount;
- }
-
- /**
- * Returns the current value of apiCallSuccessCount.
- *
- * @return the apiCallSuccessCount
- */
- public static long getApiCallSuccessCount() {
- return apiCallSuccessCount;
- }
-
- /**
- * Returns the current value of apiCallFailureCount.
- *
- * @return the apiCallFailureCount
- */
- public static long getApiCallFailureCount() {
- return apiCallFailureCount;
- }
-
- /**
- * Returns the current value of totalPolicyGetCount.
- *
- * @return the totalPolicyGetCount
- */
- public static long getTotalPolicyGetCount() {
- return totalPolicyGetCount;
- }
-
- /**
- * Returns the current value of totalPolicyPostCount.
- *
- * @return the totalPolicyPostCount
- */
- public static long getTotalPolicyPostCount() {
- return totalPolicyPostCount;
- }
-
- /**
- * Returns the current value of totalTemplateGetCount.
- *
- * @return the totalTemplateGetCount
- */
- public static long getTotalTemplateGetCount() {
- return totalTemplateGetCount;
- }
-
- /**
- * Returns the current value of totalTemplatePostCount.
- *
- * @return the totalTemplatePostCount
- */
- public static long getTotalTemplatePostCount() {
- return totalTemplatePostCount;
- }
-
- /**
- * Returns the current value of policyGetSuccessCount.
- *
- * @return the policyGetSuccessCount
- */
- public static long getPolicyGetSuccessCount() {
- return policyGetSuccessCount;
- }
-
- /**
- * Returns the current value of policyGetFailureCount.
- *
- * @return the policyGetFailureCount
- */
- public static long getPolicyGetFailureCount() {
- return policyGetFailureCount;
- }
-
- /**
- * Returns the current value of policyPostSuccessCount.
- *
- * @return the policyPostSuccessCount
- */
- public static long getPolicyPostSuccessCount() {
- return policyPostSuccessCount;
- }
-
- /**
- * Returns the current value of policyPostFailureCount.
- *
- * @return the policyPostFailureCount
- */
- public static long getPolicyPostFailureCount() {
- return policyPostFailureCount;
- }
-
+
/**
- * Returns the current value of templateGetSuccessCount.
- *
- * @return the templateGetSuccessCount
+ * Method to update successful policyType GET count.
+ *
+ * @return the updated value of policyTypeGetSuccessCount
*/
- public static long getTemplateGetSuccessCount() {
- return templateGetSuccessCount;
+ public static long updatePolicyTypeGetSuccessCount() {
+ return ++policyTypeGetSuccessCount;
}
-
+
/**
- * Returns the current value of templateGetFailureCount.
- *
- * @return the templateGetFailureCount
+ * Method to update failed policyType GET count.
+ *
+ * @return the updated value of policyTypeGetFailureCount
*/
- public static long getTemplateGetFailureCount() {
- return templateGetFailureCount;
+ public static long updatePolicyTypeGetFailureCount() {
+ return ++policyTypeGetFailureCount;
}
-
+
/**
- * Returns the current value of templatePostSuccessCount.
- *
- * @return the templatePostSuccessCount
+ * Method to update successful policyType POST count.
+ *
+ * @return the updated value of policyTypePostSuccessCount
*/
- public static long getTemplatePostSuccessCount() {
- return templatePostSuccessCount;
+ public static long updatePolicyTypePostSuccessCount() {
+ return ++policyTypePostSuccessCount;
}
-
+
/**
- * Returns the current value of templatePostFailureCount.
- *
- * @return the templatePostFailureCount
+ * Method to update failed policyType POST count.
+ *
+ * @return the updated value of policyTypePostFailureCount
*/
- public static long getTemplatePostFailureCount() {
- return templatePostFailureCount;
+ public static long updatePolicyTypePostFailureCount() {
+ return ++policyTypePostFailureCount;
}
-
+
/**
* Reset all the statistics counts to 0.
*/
apiCallFailureCount = 0L;
totalPolicyGetCount = 0L;
totalPolicyPostCount = 0L;
- totalTemplateGetCount = 0L;
- totalTemplatePostCount = 0L;
+ totalPolicyTypeGetCount = 0L;
+ totalPolicyTypePostCount = 0L;
policyGetSuccessCount = 0L;
policyGetFailureCount = 0L;
policyPostSuccessCount = 0L;
policyPostFailureCount = 0L;
- templateGetSuccessCount = 0L;
- templateGetFailureCount = 0L;
- templatePostSuccessCount = 0L;
- templatePostFailureCount = 0L;
+ policyTypeGetSuccessCount = 0L;
+ policyTypeGetFailureCount = 0L;
+ policyTypePostSuccessCount = 0L;
+ policyTypePostFailureCount = 0L;
}
}