-/*-
/*-
* ============LICENSE_START=======================================================
* ONAP Policy API
* ================================================================================
* Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2022 Bell Canada. All rights reserved.
* ================================================================================
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
package org.onap.policy.api.main.rest.provider;
-import org.onap.policy.api.main.rest.ApiStatisticsManager;
import org.onap.policy.api.main.rest.StatisticsReport;
-import org.onap.policy.api.main.startstop.ApiActivator;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
/**
* Class to fetch API statistics.
*
* @author Chenfei Gao (cgao@research.att.com)
*/
+@Service
public class StatisticsProvider {
+ @Autowired
+ private StatisticsReport report;
+
/**
* Return the current API statistics.
*
* @return Report containing API statistics
*/
public StatisticsReport fetchCurrentStatistics() {
- final var report = ApiStatisticsManager.getInstance().getReport();
- report.setCode(ApiActivator.isAlive() ? 200 : 500);
+ report.setCode(200);
return report;
}
-}
-
+}
\ No newline at end of file