aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/main/java/org')
-rw-r--r--main/src/main/java/org/onap/policy/api/main/config/PolicyApiConfig.java40
-rw-r--r--main/src/main/java/org/onap/policy/api/main/exception/ServiceExceptionHandler.java5
-rw-r--r--main/src/main/java/org/onap/policy/api/main/rest/ApiRestController.java174
-rw-r--r--main/src/main/java/org/onap/policy/api/main/rest/provider/statistics/ApiStatisticsManager.java235
-rw-r--r--main/src/main/java/org/onap/policy/api/main/rest/provider/statistics/StatisticsProvider.java50
-rw-r--r--main/src/main/java/org/onap/policy/api/main/rest/provider/statistics/StatisticsReport.java55
-rw-r--r--main/src/main/java/org/onap/policy/api/main/rest/stub/ApiRestControllerStub.java8
7 files changed, 4 insertions, 563 deletions
diff --git a/main/src/main/java/org/onap/policy/api/main/config/PolicyApiConfig.java b/main/src/main/java/org/onap/policy/api/main/config/PolicyApiConfig.java
deleted file mode 100644
index 0510d65f..00000000
--- a/main/src/main/java/org/onap/policy/api/main/config/PolicyApiConfig.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2022 Bell Canada. All rights reserved.
- * Modifications Copyright (C) 2022 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.api.main.config;
-
-import org.onap.policy.api.main.rest.provider.statistics.StatisticsReport;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-@Configuration
-public class PolicyApiConfig {
-
- /**
- * Initialize the statistics report bean.
- *
- * @return a new instance of StatisticsReport
- */
- @Bean
- public StatisticsReport createStatisticsReport() {
- return new StatisticsReport();
- }
-} \ No newline at end of file
diff --git a/main/src/main/java/org/onap/policy/api/main/exception/ServiceExceptionHandler.java b/main/src/main/java/org/onap/policy/api/main/exception/ServiceExceptionHandler.java
index 1909e199..93240df9 100644
--- a/main/src/main/java/org/onap/policy/api/main/exception/ServiceExceptionHandler.java
+++ b/main/src/main/java/org/onap/policy/api/main/exception/ServiceExceptionHandler.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2022 Bell Canada. All rights reserved.
+ * Copyright (C) 2022-2023 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -61,8 +61,7 @@ public class ServiceExceptionHandler {
* @param joinPoint the point of execution
* @param exception the exception
*/
- @AfterThrowing(pointcut = "execution(* org.onap.policy.api.main..*.*(..))"
- + " && !execution(* org.onap.policy.api.main.rest.provider.statistics.*.*(..))", throwing = "exception")
+ @AfterThrowing(pointcut = "execution(* org.onap.policy.api.main..*.*(..))", throwing = "exception")
public void handleTransactionException(JoinPoint joinPoint, TransactionException exception) {
final var errorResponse = new ErrorResponse();
errorResponse.setResponseCode(Response.Status.INTERNAL_SERVER_ERROR);
diff --git a/main/src/main/java/org/onap/policy/api/main/rest/ApiRestController.java b/main/src/main/java/org/onap/policy/api/main/rest/ApiRestController.java
index 47d82927..a1e6db25 100644
--- a/main/src/main/java/org/onap/policy/api/main/rest/ApiRestController.java
+++ b/main/src/main/java/org/onap/policy/api/main/rest/ApiRestController.java
@@ -5,7 +5,7 @@
* Copyright (C) 2018 Samsung Electronics Co., Ltd. All rights reserved.
* Modifications Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2020-2022 Nordix Foundation.
- * Modifications Copyright (C) 2020-2022 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2020-2023 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,9 +32,6 @@ import lombok.RequiredArgsConstructor;
import org.onap.policy.api.main.exception.PolicyApiRuntimeException;
import org.onap.policy.api.main.rest.genapi.PolicyDesignApi;
import org.onap.policy.api.main.rest.provider.healthcheck.HealthCheckProvider;
-import org.onap.policy.api.main.rest.provider.statistics.ApiStatisticsManager;
-import org.onap.policy.api.main.rest.provider.statistics.StatisticsProvider;
-import org.onap.policy.api.main.rest.provider.statistics.StatisticsReport;
import org.onap.policy.api.main.service.ToscaServiceTemplateService;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.report.HealthCheckReport;
@@ -67,8 +64,6 @@ public class ApiRestController extends CommonRestController implements PolicyDes
private final ToscaServiceTemplateService toscaServiceTemplateService;
private final HealthCheckProvider healthCheckProvider;
- private final ApiStatisticsManager mgr;
- private final StatisticsProvider statisticsProvider;
/**
* Retrieves the healthcheck status of the API component.
@@ -78,22 +73,10 @@ public class ApiRestController extends CommonRestController implements PolicyDes
@Override
public ResponseEntity<HealthCheckReport> getHealthCheck(UUID requestId) {
final var report = healthCheckProvider.performHealthCheck();
- updateApiStatisticsCounter(Target.OTHER, HttpStatus.resolve(report.getCode()), HttpMethod.GET);
return makeResponse(requestId, report, report.getCode());
}
/**
- * Retrieves the statistics report of the API component.
- *
- * @return the Response object containing the results of the API operation
- */
- @Override
- public ResponseEntity<StatisticsReport> getStatistics(UUID requestId) {
- updateApiStatisticsCounter(Target.OTHER, HttpStatus.OK, HttpMethod.GET);
- return makeOkResponse(requestId, statisticsProvider.fetchCurrentStatistics());
- }
-
- /**
* Retrieves all available policy types.
*
* @return the Response object containing the results of the API operation
@@ -102,12 +85,9 @@ public class ApiRestController extends CommonRestController implements PolicyDes
public ResponseEntity<ToscaServiceTemplate> getAllPolicyTypes(UUID requestId) {
try {
ToscaServiceTemplate serviceTemplate = toscaServiceTemplateService.fetchPolicyTypes(null, null);
- updateApiStatisticsCounter(Target.POLICY_TYPE, HttpStatus.OK, HttpMethod.GET);
return makeOkResponse(requestId, serviceTemplate);
} catch (PfModelException | PfModelRuntimeException pfme) {
final var msg = "GET /policytypes";
- updateApiStatisticsCounter(Target.POLICY_TYPE, HttpStatus.resolve(pfme.getErrorResponse().getResponseCode()
- .getStatusCode()), HttpMethod.GET);
throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);
}
}
@@ -125,12 +105,9 @@ public class ApiRestController extends CommonRestController implements PolicyDes
UUID requestId) {
try {
ToscaServiceTemplate serviceTemplate = toscaServiceTemplateService.fetchPolicyTypes(policyTypeId, null);
- updateApiStatisticsCounter(Target.POLICY_TYPE, HttpStatus.OK, HttpMethod.GET);
return makeOkResponse(requestId, serviceTemplate);
} catch (PfModelException | PfModelRuntimeException pfme) {
var msg = String.format("GET /policytypes/%s", policyTypeId);
- updateApiStatisticsCounter(Target.POLICY_TYPE, HttpStatus.resolve(pfme.getErrorResponse().getResponseCode()
- .getStatusCode()), HttpMethod.GET);
throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);
}
}
@@ -151,12 +128,9 @@ public class ApiRestController extends CommonRestController implements PolicyDes
try {
ToscaServiceTemplate serviceTemplate =
toscaServiceTemplateService.fetchPolicyTypes(policyTypeId, versionId);
- updateApiStatisticsCounter(Target.POLICY_TYPE, HttpStatus.OK, HttpMethod.GET);
return makeOkResponse(requestId, serviceTemplate);
} catch (PfModelException | PfModelRuntimeException pfme) {
var msg = String.format("GET /policytypes/%s/versions/%s", policyTypeId, versionId);
- updateApiStatisticsCounter(Target.POLICY_TYPE, HttpStatus.resolve(pfme.getErrorResponse().getResponseCode()
- .getStatusCode()), HttpMethod.GET);
throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);
}
}
@@ -174,12 +148,9 @@ public class ApiRestController extends CommonRestController implements PolicyDes
UUID requestId) {
try {
ToscaServiceTemplate serviceTemplate = toscaServiceTemplateService.fetchLatestPolicyTypes(policyTypeId);
- updateApiStatisticsCounter(Target.POLICY_TYPE, HttpStatus.OK, HttpMethod.GET);
return makeOkResponse(requestId, serviceTemplate);
} catch (PfModelException | PfModelRuntimeException pfme) {
var msg = String.format("GET /policytypes/%s/versions/latest", policyTypeId);
- updateApiStatisticsCounter(Target.POLICY_TYPE, HttpStatus.resolve(pfme.getErrorResponse().getResponseCode()
- .getStatusCode()), HttpMethod.GET);
throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);
}
}
@@ -200,12 +171,9 @@ public class ApiRestController extends CommonRestController implements PolicyDes
}
try {
ToscaServiceTemplate serviceTemplate = toscaServiceTemplateService.createPolicyType(body);
- updateApiStatisticsCounter(Target.POLICY_TYPE, HttpStatus.OK, HttpMethod.POST);
return makeOkResponse(requestId, serviceTemplate);
} catch (PfModelRuntimeException pfme) {
final var msg = "POST /policytypes";
- updateApiStatisticsCounter(Target.POLICY_TYPE, HttpStatus.resolve(pfme.getErrorResponse().getResponseCode()
- .getStatusCode()), HttpMethod.POST);
throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);
}
}
@@ -226,12 +194,9 @@ public class ApiRestController extends CommonRestController implements PolicyDes
try {
ToscaServiceTemplate serviceTemplate =
toscaServiceTemplateService.deletePolicyType(policyTypeId, versionId);
- updateApiStatisticsCounter(Target.POLICY_TYPE, HttpStatus.OK, HttpMethod.DELETE);
return makeOkResponse(requestId, serviceTemplate);
} catch (PfModelRuntimeException pfme) {
var msg = String.format("DELETE /policytypes/%s/versions/%s", policyTypeId, versionId);
- updateApiStatisticsCounter(Target.POLICY_TYPE, HttpStatus.resolve(pfme.getErrorResponse().getResponseCode()
- .getStatusCode()), HttpMethod.DELETE);
throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);
}
}
@@ -253,12 +218,9 @@ public class ApiRestController extends CommonRestController implements PolicyDes
try {
ToscaServiceTemplate serviceTemplate =
toscaServiceTemplateService.fetchPolicies(policyTypeId, policyTypeVersion, null, null, mode);
- updateApiStatisticsCounter(Target.POLICY, HttpStatus.OK, HttpMethod.GET);
return makeOkResponse(requestId, serviceTemplate);
} catch (PfModelException | PfModelRuntimeException pfme) {
var msg = String.format("GET /policytypes/%s/versions/%s/policies", policyTypeId, policyTypeVersion);
- updateApiStatisticsCounter(Target.POLICY, HttpStatus.resolve(pfme.getErrorResponse().getResponseCode()
- .getStatusCode()), HttpMethod.GET);
throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);
}
}
@@ -282,13 +244,10 @@ public class ApiRestController extends CommonRestController implements PolicyDes
try {
ToscaServiceTemplate serviceTemplate =
toscaServiceTemplateService.fetchPolicies(policyTypeId, policyTypeVersion, policyId, null, mode);
- updateApiStatisticsCounter(Target.POLICY, HttpStatus.OK, HttpMethod.GET);
return makeOkResponse(requestId, serviceTemplate);
} catch (PfModelException | PfModelRuntimeException pfme) {
var msg = String.format("/policytypes/%s/versions/%s/policies/%s",
policyTypeId, policyTypeVersion, policyId);
- updateApiStatisticsCounter(Target.POLICY, HttpStatus.resolve(pfme.getErrorResponse().getResponseCode()
- .getStatusCode()), HttpMethod.GET);
throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);
}
}
@@ -314,13 +273,10 @@ public class ApiRestController extends CommonRestController implements PolicyDes
try {
ToscaServiceTemplate serviceTemplate = toscaServiceTemplateService
.fetchPolicies(policyTypeId, policyTypeVersion, policyId, policyVersion, mode);
- updateApiStatisticsCounter(Target.POLICY, HttpStatus.OK, HttpMethod.GET);
return makeOkResponse(requestId, serviceTemplate);
} catch (PfModelException | PfModelRuntimeException pfme) {
var msg = String.format("GET /policytypes/%s/versions/%s/policies/%s/versions/%s",
policyTypeId, policyTypeVersion, policyId, policyVersion);
- updateApiStatisticsCounter(Target.POLICY, HttpStatus.resolve(pfme.getErrorResponse().getResponseCode()
- .getStatusCode()), HttpMethod.GET);
throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);
}
}
@@ -344,13 +300,10 @@ public class ApiRestController extends CommonRestController implements PolicyDes
try {
ToscaServiceTemplate serviceTemplate =
toscaServiceTemplateService.fetchLatestPolicies(policyTypeId, policyTypeVersion, policyId, mode);
- updateApiStatisticsCounter(Target.POLICY, HttpStatus.OK, HttpMethod.GET);
return makeOkResponse(requestId, serviceTemplate);
} catch (PfModelException | PfModelRuntimeException pfme) {
var msg = String.format("GET /policytypes/%s/versions/%s/policies/%s/versions/latest",
policyTypeId, policyTypeVersion, policyId);
- updateApiStatisticsCounter(Target.POLICY, HttpStatus.resolve(pfme.getErrorResponse().getResponseCode()
- .getStatusCode()), HttpMethod.GET);
throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);
}
}
@@ -377,12 +330,9 @@ public class ApiRestController extends CommonRestController implements PolicyDes
try {
ToscaServiceTemplate serviceTemplate =
toscaServiceTemplateService.createPolicy(policyTypeId, policyTypeVersion, body);
- updateApiStatisticsCounter(Target.POLICY, HttpStatus.OK, HttpMethod.POST);
return makeOkResponse(requestId, serviceTemplate);
} catch (PfModelRuntimeException pfme) {
var msg = String.format("POST /policytypes/%s/versions/%s/policies", policyTypeId, policyTypeVersion);
- updateApiStatisticsCounter(Target.POLICY, HttpStatus.resolve(pfme.getErrorResponse().getResponseCode()
- .getStatusCode()), HttpMethod.POST);
throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);
}
}
@@ -407,13 +357,10 @@ public class ApiRestController extends CommonRestController implements PolicyDes
try {
ToscaServiceTemplate serviceTemplate =
toscaServiceTemplateService.deletePolicy(policyTypeId, policyTypeVersion, policyId, policyVersion);
- updateApiStatisticsCounter(Target.POLICY, HttpStatus.OK, HttpMethod.DELETE);
return makeOkResponse(requestId, serviceTemplate);
} catch (PfModelRuntimeException pfme) {
var msg = String.format("DELETE /policytypes/%s/versions/%s/policies/%s/versions/%s",
policyTypeId, policyTypeVersion, policyId, policyVersion);
- updateApiStatisticsCounter(Target.POLICY, HttpStatus.resolve(pfme.getErrorResponse().getResponseCode()
- .getStatusCode()), HttpMethod.DELETE);
throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);
}
}
@@ -430,12 +377,9 @@ public class ApiRestController extends CommonRestController implements PolicyDes
try {
ToscaServiceTemplate serviceTemplate =
toscaServiceTemplateService.fetchPolicies(null, null, null, null, mode);
- updateApiStatisticsCounter(Target.POLICY, HttpStatus.OK, HttpMethod.GET);
return makeOkResponse(requestId, serviceTemplate);
} catch (PfModelException | PfModelRuntimeException pfme) {
final var msg = "GET /policies/ --";
- updateApiStatisticsCounter(Target.POLICY, HttpStatus.resolve(pfme.getErrorResponse().getResponseCode()
- .getStatusCode()), HttpMethod.GET);
if (pfme.getErrorResponse().getResponseCode().equals(Status.NOT_FOUND)) {
pfme.getErrorResponse().setErrorMessage(ERROR_MESSAGE_NO_POLICIES_FOUND);
pfme.getErrorResponse().setErrorDetails(List.of(ERROR_MESSAGE_NO_POLICIES_FOUND));
@@ -461,12 +405,9 @@ public class ApiRestController extends CommonRestController implements PolicyDes
try {
ToscaServiceTemplate serviceTemplate =
toscaServiceTemplateService.fetchPolicies(null, null, policyId, policyVersion, mode);
- updateApiStatisticsCounter(Target.POLICY, HttpStatus.OK, HttpMethod.GET);
return makeOkResponse(requestId, serviceTemplate);
} catch (PfModelException | PfModelRuntimeException pfme) {
var msg = String.format("GET /policies/%s/versions/%s", policyId, policyVersion);
- updateApiStatisticsCounter(Target.POLICY, HttpStatus.resolve(pfme.getErrorResponse().getResponseCode()
- .getStatusCode()), HttpMethod.GET);
throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);
}
}
@@ -487,12 +428,9 @@ public class ApiRestController extends CommonRestController implements PolicyDes
}
try {
ToscaServiceTemplate serviceTemplate = toscaServiceTemplateService.createPolicies(body);
- updateApiStatisticsCounter(Target.POLICY, HttpStatus.OK, HttpMethod.POST);
return makeOkResponse(requestId, serviceTemplate);
} catch (PfModelRuntimeException pfme) {
final var msg = "POST /policies";
- updateApiStatisticsCounter(Target.POLICY, HttpStatus.resolve(pfme.getErrorResponse().getResponseCode()
- .getStatusCode()), HttpMethod.POST);
throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);
}
}
@@ -513,120 +451,10 @@ public class ApiRestController extends CommonRestController implements PolicyDes
try {
ToscaServiceTemplate serviceTemplate =
toscaServiceTemplateService.deletePolicy(null, null, policyId, policyVersion);
- updateApiStatisticsCounter(Target.POLICY, HttpStatus.OK, HttpMethod.DELETE);
return makeOkResponse(requestId, serviceTemplate);
} catch (PfModelRuntimeException pfme) {
var msg = String.format("DELETE /policies/%s/versions/%s", policyId, policyVersion);
- updateApiStatisticsCounter(Target.POLICY, HttpStatus.resolve(pfme.getErrorResponse().getResponseCode()
- .getStatusCode()), HttpMethod.DELETE);
throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);
}
}
-
- private void updateApiStatisticsCounter(Target target, HttpStatus result, HttpMethod http) {
- mgr.updateTotalApiCallCount();
- switch (target) {
- case POLICY:
- updatePolicyStats(result, http);
- break;
- case POLICY_TYPE:
- updatePolicyTypeStats(result, http);
- break;
- default:
- mgr.updateApiCallSuccessCount();
- break;
- }
- }
-
- private void updatePolicyStats(HttpStatus result, HttpMethod http) {
- if (result.equals(HttpStatus.OK)) {
- switch (http) {
- case GET:
- mgr.updateApiCallSuccessCount();
- mgr.updateTotalPolicyGetCount();
- mgr.updatePolicyGetSuccessCount();
- break;
- case POST:
- mgr.updateApiCallSuccessCount();
- mgr.updateTotalPolicyPostCount();
- mgr.updatePolicyPostSuccessCount();
- break;
- case DELETE:
- mgr.updateApiCallSuccessCount();
- mgr.updateTotalPolicyDeleteCount();
- mgr.updatePolicyDeleteSuccessCount();
- break;
- default:
- mgr.updateApiCallSuccessCount();
- break;
- }
- } else {
- switch (http) {
- case GET:
- mgr.updateApiCallFailureCount();
- mgr.updateTotalPolicyGetCount();
- mgr.updatePolicyGetFailureCount();
- break;
- case POST:
- mgr.updateApiCallFailureCount();
- mgr.updateTotalPolicyPostCount();
- mgr.updatePolicyPostFailureCount();
- break;
- case DELETE:
- mgr.updateApiCallFailureCount();
- mgr.updateTotalPolicyDeleteCount();
- mgr.updatePolicyDeleteFailureCount();
- break;
- default:
- mgr.updateApiCallFailureCount();
- break;
- }
- }
- }
-
- private void updatePolicyTypeStats(HttpStatus result, HttpMethod http) {
- if (result.equals(HttpStatus.OK)) {
- switch (http) {
- case GET:
- mgr.updateApiCallSuccessCount();
- mgr.updateTotalPolicyTypeGetCount();
- mgr.updatePolicyTypeGetSuccessCount();
- break;
- case POST:
- mgr.updateApiCallSuccessCount();
- mgr.updateTotalPolicyTypePostCount();
- mgr.updatePolicyTypePostSuccessCount();
- break;
- case DELETE:
- mgr.updateApiCallSuccessCount();
- mgr.updateTotalPolicyTypeDeleteCount();
- mgr.updatePolicyTypeDeleteSuccessCount();
- break;
- default:
- mgr.updateApiCallSuccessCount();
- break;
- }
- } else {
- switch (http) {
- case GET:
- mgr.updateApiCallFailureCount();
- mgr.updateTotalPolicyTypeGetCount();
- mgr.updatePolicyTypeGetFailureCount();
- break;
- case POST:
- mgr.updateApiCallFailureCount();
- mgr.updateTotalPolicyTypePostCount();
- mgr.updatePolicyTypePostFailureCount();
- break;
- case DELETE:
- mgr.updateApiCallFailureCount();
- mgr.updateTotalPolicyTypeDeleteCount();
- mgr.updatePolicyTypeDeleteFailureCount();
- break;
- default:
- mgr.updateApiCallFailureCount();
- break;
- }
- }
- }
}
diff --git a/main/src/main/java/org/onap/policy/api/main/rest/provider/statistics/ApiStatisticsManager.java b/main/src/main/java/org/onap/policy/api/main/rest/provider/statistics/ApiStatisticsManager.java
deleted file mode 100644
index c0d95e27..00000000
--- a/main/src/main/java/org/onap/policy/api/main/rest/provider/statistics/ApiStatisticsManager.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy API
- * ================================================================================
- * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2020-2022 Bell Canada. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.api.main.rest.provider.statistics;
-
-import lombok.RequiredArgsConstructor;
-import org.springframework.stereotype.Component;
-
-/**
- * Class to hold statistical data for API access.
- *
- * @author Chenfei Gao (cgao@research.att.com)
- */
-@Component
-@RequiredArgsConstructor
-public class ApiStatisticsManager {
-
- private final StatisticsReport report;
-
- private long totalPolicyDeleteCount;
- private long totalPolicyTypeDeleteCount;
- private long policyDeleteSuccessCount;
- private long policyDeleteFailureCount;
- private long policyTypeDeleteSuccessCount;
- private long policyTypeDeleteFailureCount;
-
- /**
- * Method to update the total api call count.
- *
- * @return the updated value of totalApiCallCount
- */
- public long updateTotalApiCallCount() {
- return ++report.totalApiCallCount;
- }
-
- /**
- * Method to update the successful api call count.
- *
- * @return the updated value of apiCallSuccessCount
- */
- public long updateApiCallSuccessCount() {
- return ++report.apiCallSuccessCount;
- }
-
- /**
- * Method to update the failed api call count.
- *
- * @return the updated value of apiCallFailureCount
- */
- public long updateApiCallFailureCount() {
- return ++report.apiCallFailureCount;
- }
-
- /**
- * Method to update the total policy GET count.
- *
- * @return the updated value of totalPolicyGetCount
- */
- public long updateTotalPolicyGetCount() {
- return ++report.totalPolicyGetCount;
- }
-
- /**
- * Method to update the total policy POST count.
- *
- * @return the updated value of totalPolicyPostCount
- */
- public long updateTotalPolicyPostCount() {
- return ++report.totalPolicyPostCount;
- }
-
- /**
- * Method to update the total policy DELETE count.
- *
- * @return the updated value of totalPolicyDeleteCount
- */
- public long updateTotalPolicyDeleteCount() {
- return ++totalPolicyDeleteCount;
- }
-
- /**
- * Method to update the total policyType GET count.
- *
- * @return the updated value of totalPolicyTypeGetCount
- */
- public long updateTotalPolicyTypeGetCount() {
- return ++report.totalPolicyTypeGetCount;
- }
-
- /**
- * Method to update the total policyType POST count.
- *
- * @return the updated value of totalPolicyTypePostCount
- */
- public long updateTotalPolicyTypePostCount() {
- return ++report.totalPolicyTypePostCount;
- }
-
- /**
- * Method to update the total policyType DELETE count.
- *
- * @return the updated value of totalPolicyTypeDeleteCount
- */
- public long updateTotalPolicyTypeDeleteCount() {
- return ++totalPolicyTypeDeleteCount;
- }
-
- /**
- * Method to update successful policy GET count.
- *
- * @return the updated value of policyGetSuccessCount
- */
- public long updatePolicyGetSuccessCount() {
- return ++report.policyGetSuccessCount;
- }
-
- /**
- * Method to update failed policy GET count.
- *
- * @return the updated value of policyGetFailureCount
- */
- public long updatePolicyGetFailureCount() {
- return ++report.policyGetFailureCount;
- }
-
- /**
- * Method to update successful policy POST count.
- *
- * @return the updated value of policyPostSuccessCount
- */
- public long updatePolicyPostSuccessCount() {
- return ++report.policyPostSuccessCount;
- }
-
- /**
- * Method to update failed policy POST count.
- *
- * @return the updated value of policyPostFailureCount
- */
- public long updatePolicyPostFailureCount() {
- return ++report.policyPostFailureCount;
- }
-
- /**
- * Method to update successful policy DELETE count.
- *
- * @return the updated value of policyDeleteSuccessCount
- */
- public long updatePolicyDeleteSuccessCount() {
- return ++policyDeleteSuccessCount;
- }
-
- /**
- * Method to update failed policy DELETE count.
- *
- * @return the updated value of policyDeleteFailureCount
- */
- public long updatePolicyDeleteFailureCount() {
- return ++policyDeleteFailureCount;
- }
-
- /**
- * Method to update successful policyType GET count.
- *
- * @return the updated value of policyTypeGetSuccessCount
- */
- public long updatePolicyTypeGetSuccessCount() {
- return ++report.policyTypeGetSuccessCount;
- }
-
- /**
- * Method to update failed policyType GET count.
- *
- * @return the updated value of policyTypeGetFailureCount
- */
- public long updatePolicyTypeGetFailureCount() {
- return ++report.policyTypeGetFailureCount;
- }
-
- /**
- * Method to update successful policyType POST count.
- *
- * @return the updated value of policyTypePostSuccessCount
- */
- public long updatePolicyTypePostSuccessCount() {
- return ++report.policyTypePostSuccessCount;
- }
-
- /**
- * Method to update failed policyType POST count.
- *
- * @return the updated value of policyTypePostFailureCount
- */
- public long updatePolicyTypePostFailureCount() {
- return ++report.policyTypePostFailureCount;
- }
-
- /**
- * Method to update successful policyType DELETE count.
- *
- * @return the updated value of policyTypeDeleteSuccessCount
- */
- public long updatePolicyTypeDeleteSuccessCount() {
- return ++policyTypeDeleteSuccessCount;
- }
-
- /**
- * Method to update failed policyType DELETE count.
- *
- * @return the updated value of policyTypePostFailureCount
- */
- public long updatePolicyTypeDeleteFailureCount() {
- return ++policyTypeDeleteFailureCount;
- }
-} \ No newline at end of file
diff --git a/main/src/main/java/org/onap/policy/api/main/rest/provider/statistics/StatisticsProvider.java b/main/src/main/java/org/onap/policy/api/main/rest/provider/statistics/StatisticsProvider.java
deleted file mode 100644
index 7016ed40..00000000
--- a/main/src/main/java/org/onap/policy/api/main/rest/provider/statistics/StatisticsProvider.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy API
- * ================================================================================
- * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2022 Bell Canada. All rights reserved.
- * ================================================================================
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.api.main.rest.provider.statistics;
-
-import lombok.RequiredArgsConstructor;
-import org.springframework.stereotype.Service;
-
-/**
- * Class to fetch API statistics.
- *
- * @author Chenfei Gao (cgao@research.att.com)
- */
-@Service
-@RequiredArgsConstructor
-public class StatisticsProvider {
-
- private final StatisticsReport report;
-
- /**
- * Return the current API statistics.
- *
- * @return Report containing API statistics
- */
- public StatisticsReport fetchCurrentStatistics() {
- report.setCode(200);
- return report;
- }
-} \ No newline at end of file
diff --git a/main/src/main/java/org/onap/policy/api/main/rest/provider/statistics/StatisticsReport.java b/main/src/main/java/org/onap/policy/api/main/rest/provider/statistics/StatisticsReport.java
deleted file mode 100644
index 3236392a..00000000
--- a/main/src/main/java/org/onap/policy/api/main/rest/provider/statistics/StatisticsReport.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy API
- * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.api.main.rest.provider.statistics;
-
-import lombok.Getter;
-import lombok.Setter;
-import lombok.ToString;
-
-/**
- * Class to represent API statistics report.
- *
- * @author Chenfei Gao (cgao@research.att.com)
- */
-@ToString
-@Getter
-@Setter
-public class StatisticsReport {
- private int code;
- protected long totalApiCallCount;
- protected long apiCallSuccessCount;
- protected long apiCallFailureCount;
- protected long totalPolicyGetCount;
- protected long totalPolicyPostCount;
- protected long totalPolicyTypeGetCount;
- protected long totalPolicyTypePostCount;
- protected long policyGetSuccessCount;
- protected long policyGetFailureCount;
- protected long policyPostSuccessCount;
- protected long policyPostFailureCount;
- protected long policyTypeGetSuccessCount;
- protected long policyTypeGetFailureCount;
- protected long policyTypePostSuccessCount;
- protected long policyTypePostFailureCount;
-} \ No newline at end of file
diff --git a/main/src/main/java/org/onap/policy/api/main/rest/stub/ApiRestControllerStub.java b/main/src/main/java/org/onap/policy/api/main/rest/stub/ApiRestControllerStub.java
index 4b848904..38fe0032 100644
--- a/main/src/main/java/org/onap/policy/api/main/rest/stub/ApiRestControllerStub.java
+++ b/main/src/main/java/org/onap/policy/api/main/rest/stub/ApiRestControllerStub.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2023 Nordix Foundation.
+ * Modifications Copyright (C) 2023 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,7 +27,6 @@ import lombok.RequiredArgsConstructor;
import org.onap.policy.api.main.rest.CommonRestController;
import org.onap.policy.api.main.rest.PolicyFetchMode;
import org.onap.policy.api.main.rest.genapi.PolicyDesignApi;
-import org.onap.policy.api.main.rest.provider.statistics.StatisticsReport;
import org.onap.policy.common.endpoints.report.HealthCheckReport;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.springframework.context.annotation.Profile;
@@ -174,10 +174,4 @@ public class ApiRestControllerStub extends CommonRestController implements Polic
return stubUtils.getStubbedResponse(ToscaServiceTemplate.class);
}
- @Override
- public ResponseEntity<StatisticsReport> getStatistics(
- UUID requestID) {
- return stubUtils.getStubbedResponse(StatisticsReport.class);
- }
-
}