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 update the xacml pdp total policies count.
60 public long updateTotalPoliciesCount() {
61 return ++totalPoliciesCount;
65 * Method to update the number of error decisions.
67 * @return the errorDecisionsCount
69 public long updateErrorCount() {
74 * Method to update the number of permit decisions.
76 * @return the permitDecisionsCount
78 public long updatePermitDecisionsCount() {
79 return ++permitDecisionsCount;
83 * Method to update the number of deny decisions.
85 * @return the denyDecisionsCount
87 public long updateDenyDecisionsCount() {
88 return ++denyDecisionsCount;
92 * Method to update the number of indeterminant decisions.
94 * @return the indeterminantDecisionsCount
96 public long updateIndeterminantDecisionsCount() {
97 return ++indeterminantDecisionsCount;
101 * Method to update the number of not applicable decisions.
103 * @return the notApplicableDecisionsCount
105 public long updateNotApplicableDecisionsCount() {
106 return ++notApplicableDecisionsCount;
110 * Returns the current value of totalPolicyTypesCount.
112 * @return the totalPolicyTypesCount
114 public long getTotalPolicyTypesCount() {
115 return totalPolicyTypesCount;
119 * Returns the current value of totalPoliciesCount.
121 * @return the totalPoliciesCount
123 public long getTotalPoliciesCount() {
124 return totalPoliciesCount;
128 * Returns the current value of errorDecisionsCount.
130 * @return the permitDecisionsCount
132 public long getErrorCount() {
137 * Returns the current value of permitDecisionsCount.
139 * @return the permitDecisionsCount
141 public long getPermitDecisionsCount() {
142 return permitDecisionsCount;
146 * Returns the current value of denyDecisionsCount.
148 * @return the denyDecisionsCount
150 public long getDenyDecisionsCount() {
151 return denyDecisionsCount;
155 * Returns the current value of indeterminantDecisionsCount.
157 * @return the indeterminantDecisionsCount
159 public long getIndeterminantDecisionsCount() {
160 return indeterminantDecisionsCount;
164 * Returns the current value of notApplicableDecisionsCount.
166 * @return the notApplicableDecisionsCount
168 public long getNotApplicableDecisionsCount() {
169 return notApplicableDecisionsCount;
173 * Reset all the statistics counts to 0.
175 public void resetAllStatistics() {
176 totalPolicyTypesCount = 0L;
177 totalPoliciesCount = 0L;
179 permitDecisionsCount = 0L;
180 denyDecisionsCount = 0L;
181 indeterminantDecisionsCount = 0L;
182 notApplicableDecisionsCount = 0L;