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 permitDecisionsCount;
32 private static long denyDecisionsCount;
33 private static long indeterminantDecisionsCount;
34 private static long notApplicableDecisionsCount;
36 private XacmlPdpStatisticsManager() {
37 throw new IllegalStateException("Instantiation of the class is not allowed");
41 * Method to set the xacml pdp total policy types count. This
42 * doesn't really increment, it depends on the applications
43 * that are loaded. Which can be dynamic.
47 public static long setTotalPolicyTypesCount(long newCount) {
48 totalPolicyTypesCount = newCount;
49 return totalPolicyTypesCount;
53 * Method to update the xacml pdp total policies count.
57 public static long updateTotalPoliciesCount() {
58 return ++totalPoliciesCount;
62 * Method to update the number of permit decisions.
64 * @return the permitDecisionsCount
66 public static long updatePermitDecisionsCount() {
67 return ++permitDecisionsCount;
71 * Method to update the number of deny decisions.
73 * @return the denyDecisionsCount
75 public static long updateDenyDecisionsCount() {
76 return ++denyDecisionsCount;
80 * Method to update the number of indeterminant decisions.
82 * @return the indeterminantDecisionsCount
84 public static long updateIndeterminantDecisionsCount() {
85 return ++indeterminantDecisionsCount;
89 * Method to update the number of not applicable decisions.
91 * @return the notApplicableDecisionsCount
93 public static long updateNotApplicableDecisionsCount() {
94 return ++notApplicableDecisionsCount;
98 * Returns the current value of totalPolicyTypesCount.
100 * @return the totalPolicyTypesCount
102 public static long getTotalPolicyTypesCount() {
103 return totalPolicyTypesCount;
107 * Returns the current value of totalPoliciesCount.
109 * @return the totalPoliciesCount
111 public static long getTotalPoliciesCount() {
112 return totalPoliciesCount;
116 * Returns the current value of permitDecisionsCount.
118 * @return the permitDecisionsCount
120 public static long getPermitDecisionsCount() {
121 return permitDecisionsCount;
125 * Returns the current value of denyDecisionsCount.
127 * @return the denyDecisionsCount
129 public static long getDenyDecisionsCount() {
130 return denyDecisionsCount;
134 * Returns the current value of indeterminantDecisionsCount.
136 * @return the indeterminantDecisionsCount
138 public static long getIndeterminantDecisionsCount() {
139 return indeterminantDecisionsCount;
143 * Returns the current value of notApplicableDecisionsCount.
145 * @return the notApplicableDecisionsCount
147 public static long getNotApplicableDecisionsCount() {
148 return notApplicableDecisionsCount;
152 * Reset all the statistics counts to 0.
154 public static void resetAllStatistics() {
155 totalPoliciesCount = 0L;
156 permitDecisionsCount = 0L;
157 denyDecisionsCount = 0L;
158 indeterminantDecisionsCount = 0L;
159 notApplicableDecisionsCount = 0L;