add SDC client and reception handle
[multicloud/framework.git] / artifactbroker / reception / src / main / java / org / onap / policy / distribution / reception / statistics / DistributionStatisticsManager.java
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     private DistributionStatisticsManager() {
38         throw new IllegalStateException("Instantiation of the class is not allowed");
39     }
40
41     /**
42      * Method to update the total distribution count.
43      *
44      * @return the updated value of totalDistributionCount
45      */
46     public static long updateTotalDistributionCount() {
47         return ++totalDistributionCount;
48     }
49
50     /**
51      * Method to update the distribution success count.
52      *
53      * @return the updated value of distributionSuccessCount
54      */
55     public static long updateDistributionSuccessCount() {
56         return ++distributionSuccessCount;
57     }
58
59     /**
60      * Method to update the distribution failure count.
61      *
62      * @return the updated value of distributionFailureCount
63      */
64     public static long updateDistributionFailureCount() {
65         return ++distributionFailureCount;
66     }
67
68     /**
69      * Method to update the total download count.
70      *
71      * @return the updated value of totalDownloadCount
72      */
73     public static long updateTotalDownloadCount() {
74         return ++totalDownloadCount;
75     }
76
77     /**
78      * Method to update the download success count.
79      *
80      * @return the updated value of downloadSuccessCount
81      */
82     public static long updateDownloadSuccessCount() {
83         return ++downloadSuccessCount;
84     }
85
86     /**
87      * Method to update the download failure count.
88      *
89      * @return the updated value of downloadFailureCount
90      */
91     public static long updateDownloadFailureCount() {
92         return ++downloadFailureCount;
93     }
94
95     /**
96      * Returns the current value of totalDistributionCount.
97      *
98      * @return the totalDistributionCount
99      */
100     public static long getTotalDistributionCount() {
101         return totalDistributionCount;
102     }
103
104     /**
105      * Returns the current value of distributionSuccessCount.
106      *
107      * @return the distributionSuccessCount
108      */
109     public static long getDistributionSuccessCount() {
110         return distributionSuccessCount;
111     }
112
113     /**
114      * Returns the current value of distributionFailureCount.
115      *
116      * @return the distributionFailureCount
117      */
118     public static long getDistributionFailureCount() {
119         return distributionFailureCount;
120     }
121
122     /**
123      * Returns the current value of totalDownloadCount.
124      *
125      * @return the totalDownloadCount
126      */
127     public static long getTotalDownloadCount() {
128         return totalDownloadCount;
129     }
130
131     /**
132      * Returns the current value of downloadSuccessCount.
133      *
134      * @return the downloadSuccessCount
135      */
136     public static long getDownloadSuccessCount() {
137         return downloadSuccessCount;
138     }
139
140     /**
141      * Returns the current value of downloadFailureCount.
142      *
143      * @return the downloadFailureCount
144      */
145     public static long getDownloadFailureCount() {
146         return downloadFailureCount;
147     }
148
149     /**
150      * Reset all the statistics counts to 0.
151      */
152     public static void resetAllStatistics() {
153         totalDistributionCount = 0L;
154         distributionSuccessCount = 0L;
155         distributionFailureCount = 0L;
156         totalDownloadCount = 0L;
157         downloadSuccessCount = 0L;
158         downloadFailureCount = 0L;
159     }
160 }