cd78d254b6fc2642d79470867749f0736076fdd8
[policy/distribution.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2018 Ericsson. 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
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  *
17  * SPDX-License-Identifier: Apache-2.0
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.policy.distribution.reception.statistics;
22
23 /**
24  * Class to hold statistical data for distribution component.
25  *
26  * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
27  */
28 public class DistributionStatisticsManager {
29
30     private static long totalDistributionCount;
31     private static long distributionSuccessCount;
32     private static long distributionFailureCount;
33     private static long totalDownloadCount;
34     private static long downloadSuccessCount;
35     private static long downloadFailureCount;
36
37     /**
38      * Method to update the total distribution count.
39      *
40      * @return the updated value of totalDistributionCount
41      */
42     public static long updateTotalDistributionCount() {
43         return ++totalDistributionCount;
44     }
45
46     /**
47      * Method to update the distribution success count.
48      *
49      * @return the updated value of distributionSuccessCount
50      */
51     public static long updateDistributionSuccessCount() {
52         return ++distributionSuccessCount;
53     }
54
55     /**
56      * Method to update the distribution failure count.
57      *
58      * @return the updated value of distributionFailureCount
59      */
60     public static long updateDistributionFailureCount() {
61         return ++distributionFailureCount;
62     }
63
64     /**
65      * Method to update the total download count.
66      *
67      * @return the updated value of totalDownloadCount
68      */
69     public static long updateTotalDownloadCount() {
70         return ++totalDownloadCount;
71     }
72
73     /**
74      * Method to update the download success count.
75      *
76      * @return the updated value of downloadSuccessCount
77      */
78     public static long updateDownloadSuccessCount() {
79         return ++downloadSuccessCount;
80     }
81
82     /**
83      * Method to update the download failure count.
84      *
85      * @return the updated value of downloadFailureCount
86      */
87     public static long updateDownloadFailureCount() {
88         return ++downloadFailureCount;
89     }
90
91     /**
92      * Returns the current value of totalDistributionCount.
93      *
94      * @return the totalDistributionCount
95      */
96     public static long getTotalDistributionCount() {
97         return totalDistributionCount;
98     }
99
100     /**
101      * Returns the current value of distributionSuccessCount.
102      *
103      * @return the distributionSuccessCount
104      */
105     public static long getDistributionSuccessCount() {
106         return distributionSuccessCount;
107     }
108
109     /**
110      * Returns the current value of distributionFailureCount.
111      *
112      * @return the distributionFailureCount
113      */
114     public static long getDistributionFailureCount() {
115         return distributionFailureCount;
116     }
117
118     /**
119      * Returns the current value of totalDownloadCount.
120      *
121      * @return the totalDownloadCount
122      */
123     public static long getTotalDownloadCount() {
124         return totalDownloadCount;
125     }
126
127     /**
128      * Returns the current value of downloadSuccessCount.
129      *
130      * @return the downloadSuccessCount
131      */
132     public static long getDownloadSuccessCount() {
133         return downloadSuccessCount;
134     }
135
136     /**
137      * Returns the current value of downloadFailureCount.
138      *
139      * @return the downloadFailureCount
140      */
141     public static long getDownloadFailureCount() {
142         return downloadFailureCount;
143     }
144
145     /**
146      * Reset all the statistics counts to 0.
147      */
148     public static void resetAllStatistics() {
149         totalDistributionCount = 0L;
150         distributionSuccessCount = 0L;
151         distributionFailureCount = 0L;
152         totalDownloadCount = 0L;
153         downloadSuccessCount = 0L;
154         downloadFailureCount = 0L;
155     }
156 }