2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2019 Nordix Foundation.
4 * Modifications Copyright (C) 2019 AT&T Intellectual Property.
5 * ================================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * SPDX-License-Identifier: Apache-2.0
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.pap.main.rest;
24 import java.util.concurrent.atomic.AtomicLong;
27 * Class to hold statistical data for pap component.
29 * @author Ram Krishna Verma (ram.krishna.verma@est.tech)
31 public class PapStatisticsManager {
33 private final AtomicLong totalPdpCount = new AtomicLong(0);
34 private final AtomicLong totalPdpGroupCount = new AtomicLong(0);
35 private final AtomicLong totalPolicyDeployCount = new AtomicLong(0);
36 private final AtomicLong policyDeploySuccessCount = new AtomicLong(0);
37 private final AtomicLong policyDeployFailureCount = new AtomicLong(0);
38 private final AtomicLong totalPolicyDownloadCount = new AtomicLong(0);
39 private final AtomicLong policyDownloadSuccessCount = new AtomicLong(0);
40 private final AtomicLong policyDownloadFailureCount = new AtomicLong(0);
43 * Constructs the object.
45 public PapStatisticsManager() {
50 * Method to update the total pdp count.
52 * @return the updated value of totalPdpCount
54 public long updateTotalPdpCount() {
55 return totalPdpCount.incrementAndGet();
59 * Method to update the total pdp group count.
61 * @return the updated value of totalPdpGroupCount
63 public long updateTotalPdpGroupCount() {
64 return totalPdpGroupCount.incrementAndGet();
68 * Method to update the total policy deploy count.
70 * @return the updated value of totalPolicyDeployCount
72 public long updateTotalPolicyDeployCount() {
73 return totalPolicyDeployCount.incrementAndGet();
77 * Method to update the policy deploy success count.
79 * @return the updated value of policyDeploySuccessCount
81 public long updatePolicyDeploySuccessCount() {
82 return policyDeploySuccessCount.incrementAndGet();
86 * Method to update the policy deploy failure count.
88 * @return the updated value of policyDeployFailureCount
90 public long updatePolicyDeployFailureCount() {
91 return policyDeployFailureCount.incrementAndGet();
95 * Method to update the total policy download count.
97 * @return the updated value of totalPolicyDownloadCount
99 public long updateTotalPolicyDownloadCount() {
100 return totalPolicyDownloadCount.incrementAndGet();
104 * Method to update the policy download success count.
106 * @return the updated value of policyDownloadSuccessCount
108 public long updatePolicyDownloadSuccessCount() {
109 return policyDownloadSuccessCount.incrementAndGet();
113 * Method to update the policy download failure count.
115 * @return the updated value of policyDownloadFailureCount
117 public long updatePolicyDownloadFailureCount() {
118 return policyDownloadFailureCount.incrementAndGet();
122 * Reset all the statistics counts to 0.
124 public void resetAllStatistics() {
125 totalPdpCount.set(0L);
126 totalPdpGroupCount.set(0L);
127 totalPolicyDeployCount.set(0L);
128 policyDeploySuccessCount.set(0L);
129 policyDeployFailureCount.set(0L);
130 totalPolicyDownloadCount.set(0L);
131 policyDownloadSuccessCount.set(0L);
132 policyDownloadFailureCount.set(0L);
135 public long getTotalPdpCount() {
136 return totalPdpCount.get();
139 public long getTotalPdpGroupCount() {
140 return totalPdpGroupCount.get();
143 public long getTotalPolicyDeployCount() {
144 return totalPolicyDeployCount.get();
147 public long getPolicyDeploySuccessCount() {
148 return policyDeploySuccessCount.get();
151 public long getPolicyDeployFailureCount() {
152 return policyDeployFailureCount.get();
155 public long getTotalPolicyDownloadCount() {
156 return totalPolicyDownloadCount.get();
159 public long getPolicyDownloadSuccessCount() {
160 return policyDownloadSuccessCount.get();
163 public long getPolicyDownloadFailureCount() {
164 return policyDownloadFailureCount.get();