2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2019 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;
24 * Class to hold statistical data for xacmlPdp component.
27 public class XacmlPdpStatisticsManager {
29 private static long totalPolicyTypesCount;
30 private static long totalPoliciesCount;
31 private static long errorsCount;
32 private static long permitDecisionsCount;
33 private static long denyDecisionsCount;
34 private static long indeterminantDecisionsCount;
35 private static long notApplicableDecisionsCount;
37 private XacmlPdpStatisticsManager() {
38 throw new IllegalStateException("Instantiation of the class is not allowed");
42 * Method to set the xacml pdp total policy types count. This
43 * doesn't really increment, it depends on the applications
44 * that are loaded. Which can be dynamic.
48 public static long setTotalPolicyTypesCount(long newCount) {
49 totalPolicyTypesCount = newCount;
50 return totalPolicyTypesCount;
54 * Method to update the xacml pdp total policies count.
58 public static long updateTotalPoliciesCount() {
59 return ++totalPoliciesCount;
63 * Method to update the number of error decisions.
65 * @return the errorDecisionsCount
67 public static long updateErrorCount() {
72 * Method to update the number of permit decisions.
74 * @return the permitDecisionsCount
76 public static long updatePermitDecisionsCount() {
77 return ++permitDecisionsCount;
81 * Method to update the number of deny decisions.
83 * @return the denyDecisionsCount
85 public static long updateDenyDecisionsCount() {
86 return ++denyDecisionsCount;
90 * Method to update the number of indeterminant decisions.
92 * @return the indeterminantDecisionsCount
94 public static long updateIndeterminantDecisionsCount() {
95 return ++indeterminantDecisionsCount;
99 * Method to update the number of not applicable decisions.
101 * @return the notApplicableDecisionsCount
103 public static long updateNotApplicableDecisionsCount() {
104 return ++notApplicableDecisionsCount;
108 * Returns the current value of totalPolicyTypesCount.
110 * @return the totalPolicyTypesCount
112 public static long getTotalPolicyTypesCount() {
113 return totalPolicyTypesCount;
117 * Returns the current value of totalPoliciesCount.
119 * @return the totalPoliciesCount
121 public static long getTotalPoliciesCount() {
122 return totalPoliciesCount;
126 * Returns the current value of errorDecisionsCount.
128 * @return the permitDecisionsCount
130 public static long getErrorCount() {
135 * Returns the current value of permitDecisionsCount.
137 * @return the permitDecisionsCount
139 public static long getPermitDecisionsCount() {
140 return permitDecisionsCount;
144 * Returns the current value of denyDecisionsCount.
146 * @return the denyDecisionsCount
148 public static long getDenyDecisionsCount() {
149 return denyDecisionsCount;
153 * Returns the current value of indeterminantDecisionsCount.
155 * @return the indeterminantDecisionsCount
157 public static long getIndeterminantDecisionsCount() {
158 return indeterminantDecisionsCount;
162 * Returns the current value of notApplicableDecisionsCount.
164 * @return the notApplicableDecisionsCount
166 public static long getNotApplicableDecisionsCount() {
167 return notApplicableDecisionsCount;
171 * Reset all the statistics counts to 0.
173 public static void resetAllStatistics() {
174 totalPolicyTypesCount = 0L;
175 totalPoliciesCount = 0L;
177 permitDecisionsCount = 0L;
178 denyDecisionsCount = 0L;
179 indeterminantDecisionsCount = 0L;
180 notApplicableDecisionsCount = 0L;