2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2019, 2021 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.
31 public class XacmlPdpStatisticsManager {
34 private static XacmlPdpStatisticsManager current = null;
36 private long totalPolicyTypesCount;
37 private long totalPoliciesCount;
38 private long errorCount;
39 private long permitDecisionsCount;
40 private long denyDecisionsCount;
41 private long indeterminantDecisionsCount;
42 private long notApplicableDecisionsCount;
45 * Method to set the xacml pdp total policy types count. This
46 * doesn't really increment, it depends on the applications
47 * that are loaded. Which can be dynamic.
51 public long setTotalPolicyTypesCount(long newCount) {
52 totalPolicyTypesCount = newCount;
53 return totalPolicyTypesCount;
57 * Method to set the xacml pdp total policies count. This
58 * doesn't really increment, it depends on the applications
59 * that are loaded. Which can be dynamic.
63 public long setTotalPolicyCount(long newCount) {
64 totalPoliciesCount = newCount;
65 return totalPoliciesCount;
69 * Method to update the number of error decisions.
71 * @return the errorDecisionsCount
73 public long updateErrorCount() {
78 * Method to update the number of permit decisions.
80 * @return the permitDecisionsCount
82 public long updatePermitDecisionsCount() {
83 return ++permitDecisionsCount;
87 * Method to update the number of deny decisions.
89 * @return the denyDecisionsCount
91 public long updateDenyDecisionsCount() {
92 return ++denyDecisionsCount;
96 * Method to update the number of indeterminant decisions.
98 * @return the indeterminantDecisionsCount
100 public long updateIndeterminantDecisionsCount() {
101 return ++indeterminantDecisionsCount;
105 * Method to update the number of not applicable decisions.
107 * @return the notApplicableDecisionsCount
109 public long updateNotApplicableDecisionsCount() {
110 return ++notApplicableDecisionsCount;
114 * Reset all the statistics counts to 0.
116 public void resetAllStatistics() {
117 totalPolicyTypesCount = 0L;
118 totalPoliciesCount = 0L;
120 permitDecisionsCount = 0L;
121 denyDecisionsCount = 0L;
122 indeterminantDecisionsCount = 0L;
123 notApplicableDecisionsCount = 0L;