1 package org.onap.vid.scheduler;
3 import org.onap.vid.aai.ExceptionWithRequestInfo;
4 import org.onap.vid.model.probes.ErrorMetadata;
5 import org.onap.vid.model.probes.ExternalComponentStatus;
6 import org.onap.vid.model.probes.HttpRequestMetadata;
7 import org.onap.vid.mso.RestObjectWithRequestInfo;
8 import org.onap.vid.services.ChangeManagementService;
9 import org.onap.vid.utils.Logging;
10 import org.springframework.beans.factory.annotation.Autowired;
12 public class SchedulerServiceImpl implements SchedulerService{
14 private final ChangeManagementService changeManagementService;
18 public SchedulerServiceImpl(ChangeManagementService changeManagementService) {
19 this.changeManagementService = changeManagementService;
23 public ExternalComponentStatus probeGetSchedulerChangeManagements() {
24 long startTime = System.currentTimeMillis();
26 RestObjectWithRequestInfo response = this.changeManagementService.getSchedulerChangeManagementsWithRequestInfo();
27 return new ExternalComponentStatus(
28 ExternalComponentStatus.Component.SCHEDULER,
30 new HttpRequestMetadata(response, "OK", startTime)
32 } catch (ExceptionWithRequestInfo e) {
33 long duration = System.currentTimeMillis() - startTime;
34 return new ExternalComponentStatus(ExternalComponentStatus.Component.SCHEDULER,
36 new HttpRequestMetadata(e, duration));
37 } catch (Exception e) {
38 long duration = System.currentTimeMillis() - startTime;
39 return new ExternalComponentStatus(ExternalComponentStatus.Component.SCHEDULER, false,
40 new ErrorMetadata(Logging.exceptionToDescription(e), duration));