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 totalPoliciesCount;
30 private static long permitDecisionsCount;
31 private static long denyDecisionsCount;
32 private static long indeterminantDecisionsCount;
33 private static long notApplicableDecisionsCount;
35 private XacmlPdpStatisticsManager() {
36 throw new IllegalStateException("Instantiation of the class is not allowed");
40 * Method to update the xacml pdp total policies count.
44 public static long updateTotalPoliciesCount() {
45 return ++totalPoliciesCount;
49 * Method to update the number of permit decisions.
51 * @return the permitDecisionsCount
53 public static long updatePermitDecisionsCount() {
54 return ++permitDecisionsCount;
58 * Method to update the number of deny decisions.
60 * @return the denyDecisionsCount
62 public static long updateDenyDecisionsCount() {
63 return ++denyDecisionsCount;
67 * Method to update the number of indeterminant decisions.
69 * @return the indeterminantDecisionsCount
71 public static long updateIndeterminantDecisionsCount() {
72 return ++indeterminantDecisionsCount;
76 * Method to update the number of not applicable decisions.
78 * @return the notApplicableDecisionsCount
80 public static long updateNotApplicableDecisionsCount() {
81 return ++notApplicableDecisionsCount;
85 * Returns the current value of totalPoliciesCount.
87 * @return the totalPoliciesCount
89 public static long getTotalPoliciesCount() {
90 return totalPoliciesCount;
94 * Returns the current value of permitDecisionsCount.
96 * @return the permitDecisionsCount
98 public static long getPermitDecisionsCount() {
99 return permitDecisionsCount;
103 * Returns the current value of denyDecisionsCount.
105 * @return the denyDecisionsCount
107 public static long getDenyDecisionsCount() {
108 return denyDecisionsCount;
112 * Returns the current value of indeterminantDecisionsCount.
114 * @return the indeterminantDecisionsCount
116 public static long getIndeterminantDecisionsCount() {
117 return indeterminantDecisionsCount;
121 * Returns the current value of notApplicableDecisionsCount.
123 * @return the notApplicableDecisionsCount
125 public static long getNotApplicableDecisionsCount() {
126 return notApplicableDecisionsCount;
130 * Reset all the statistics counts to 0.
132 public static void resetAllStatistics() {
133 totalPoliciesCount = 0L;
134 permitDecisionsCount = 0L;
135 denyDecisionsCount = 0L;
136 indeterminantDecisionsCount = 0L;
137 notApplicableDecisionsCount = 0L;