2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2019, 2021-2022 AT&T Intellectual Property. All rights reserved.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.pdpx.main.rest;
25 import lombok.Synchronized;
28 * Class to hold statistical data for xacmlPdp component.
30 @Getter(onMethod_ = @Synchronized)
31 public class XacmlPdpStatisticsManager {
34 private static XacmlPdpStatisticsManager current = null;
36 private long totalPolicyTypesCount;
37 private long totalPoliciesCount;
38 private long errorCount;
39 private long permitDecisionsCount;
40 private long denyDecisionsCount;
41 private long deploySuccessCount;
42 private long deployFailureCount;
43 private long undeploySuccessCount;
44 private long undeployFailureCount;
45 private long indeterminantDecisionsCount;
46 private long notApplicableDecisionsCount;
49 * Method to set the xacml pdp total policy types count. This
50 * doesn't really increment, it depends on the applications
51 * that are loaded. Which can be dynamic.
56 public long setTotalPolicyTypesCount(long newCount) {
57 totalPolicyTypesCount = newCount;
58 return totalPolicyTypesCount;
62 * Method to set the xacml pdp total policies count. This
63 * doesn't really increment, it depends on the applications
64 * that are loaded. Which can be dynamic.
69 public long setTotalPolicyCount(long newCount) {
70 totalPoliciesCount = newCount;
71 return totalPoliciesCount;
75 * Method to update the number of error decisions.
77 * @return the errorDecisionsCount
80 public long updateErrorCount() {
85 * Method to update the number of permit decisions.
87 * @return the permitDecisionsCount
90 public long updatePermitDecisionsCount() {
91 return ++permitDecisionsCount;
95 * Method to update the number of deny decisions.
97 * @return the denyDecisionsCount
100 public long updateDenyDecisionsCount() {
101 return ++denyDecisionsCount;
105 * Method to update the number of successful deploys.
107 * @return the deploySuccessCount
110 public long updateDeploySuccessCount() {
111 return ++deploySuccessCount;
115 * Method to update the number of failed deploys.
117 * @return the deployFailureCount
120 public long updateDeployFailureCount() {
121 return ++deployFailureCount;
125 * Method to update the number of successful undeploys.
127 * @return the undeploySuccessCount
130 public long updateUndeploySuccessCount() {
131 return ++undeploySuccessCount;
135 * Method to update the number of failed undeploys.
137 * @return the undeployFailureCount
140 public long updateUndeployFailureCount() {
141 return ++undeployFailureCount;
145 * Method to update the number of indeterminant decisions.
147 * @return the indeterminantDecisionsCount
150 public long updateIndeterminantDecisionsCount() {
151 return ++indeterminantDecisionsCount;
155 * Method to update the number of not applicable decisions.
157 * @return the notApplicableDecisionsCount
160 public long updateNotApplicableDecisionsCount() {
161 return ++notApplicableDecisionsCount;
165 * Reset all the statistics counts to 0.
168 public void resetAllStatistics() {
169 totalPolicyTypesCount = 0L;
170 totalPoliciesCount = 0L;
172 permitDecisionsCount = 0L;
173 denyDecisionsCount = 0L;
174 deploySuccessCount = 0L;
175 deployFailureCount = 0L;
176 undeploySuccessCount = 0L;
177 undeployFailureCount = 0L;
178 indeterminantDecisionsCount = 0L;
179 notApplicableDecisionsCount = 0L;