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;
27 * Class to hold statistical data for xacmlPdp component.
30 public class XacmlPdpStatisticsManager {
33 private static XacmlPdpStatisticsManager current = null;
35 private long totalPolicyTypesCount;
36 private long totalPoliciesCount;
37 private long errorsCount;
38 private long permitDecisionsCount;
39 private long denyDecisionsCount;
40 private long indeterminantDecisionsCount;
41 private long notApplicableDecisionsCount;
44 * Method to set the xacml pdp total policy types count. This
45 * doesn't really increment, it depends on the applications
46 * that are loaded. Which can be dynamic.
50 public long setTotalPolicyTypesCount(long newCount) {
51 totalPolicyTypesCount = newCount;
52 return totalPolicyTypesCount;
56 * Method to set the xacml pdp total policies count. This
57 * doesn't really increment, it depends on the applications
58 * that are loaded. Which can be dynamic.
62 public long setTotalPolicyCount(long newCount) {
63 totalPoliciesCount = newCount;
64 return totalPoliciesCount;
68 * Method to update the number of error decisions.
70 * @return the errorDecisionsCount
72 public long updateErrorCount() {
77 * Method to update the number of permit decisions.
79 * @return the permitDecisionsCount
81 public long updatePermitDecisionsCount() {
82 return ++permitDecisionsCount;
86 * Method to update the number of deny decisions.
88 * @return the denyDecisionsCount
90 public long updateDenyDecisionsCount() {
91 return ++denyDecisionsCount;
95 * Method to update the number of indeterminant decisions.
97 * @return the indeterminantDecisionsCount
99 public long updateIndeterminantDecisionsCount() {
100 return ++indeterminantDecisionsCount;
104 * Method to update the number of not applicable decisions.
106 * @return the notApplicableDecisionsCount
108 public long updateNotApplicableDecisionsCount() {
109 return ++notApplicableDecisionsCount;
113 * Returns the current value of totalPolicyTypesCount.
115 * @return the totalPolicyTypesCount
117 public long getTotalPolicyTypesCount() {
118 return totalPolicyTypesCount;
122 * Returns the current value of totalPoliciesCount.
124 * @return the totalPoliciesCount
126 public long getTotalPoliciesCount() {
127 return totalPoliciesCount;
131 * Returns the current value of errorDecisionsCount.
133 * @return the permitDecisionsCount
135 public long getErrorCount() {
140 * Returns the current value of permitDecisionsCount.
142 * @return the permitDecisionsCount
144 public long getPermitDecisionsCount() {
145 return permitDecisionsCount;
149 * Returns the current value of denyDecisionsCount.
151 * @return the denyDecisionsCount
153 public long getDenyDecisionsCount() {
154 return denyDecisionsCount;
158 * Returns the current value of indeterminantDecisionsCount.
160 * @return the indeterminantDecisionsCount
162 public long getIndeterminantDecisionsCount() {
163 return indeterminantDecisionsCount;
167 * Returns the current value of notApplicableDecisionsCount.
169 * @return the notApplicableDecisionsCount
171 public long getNotApplicableDecisionsCount() {
172 return notApplicableDecisionsCount;
176 * Reset all the statistics counts to 0.
178 public void resetAllStatistics() {
179 totalPolicyTypesCount = 0L;
180 totalPoliciesCount = 0L;
182 permitDecisionsCount = 0L;
183 denyDecisionsCount = 0L;
184 indeterminantDecisionsCount = 0L;
185 notApplicableDecisionsCount = 0L;