Fix Sonar complains
[oam/nf-oam-adopter.git] / ves-nf-oam-adopter / ves-nf-oam-adopter-snmp-manager / src / main / java / org / o / ran / oam / nf / oam / adopter / snmp / manager / configurations / SnmpManagerConfig.java
1 /*
2  *  ============LICENSE_START=======================================================
3  *  O-RAN-SC
4  *  ================================================================================
5  *  Copyright © 2021 AT&T Intellectual Property. All rights reserved.
6  *  ================================================================================
7  *  Licensed under the Apache License, Version 2.0 (the "License");
8  *  you may not use this file except in compliance with the License.
9  *  You may obtain a copy of the License at
10  *        http://www.apache.org/licenses/LICENSE-2.0
11  *
12  *  Unless required by applicable law or agreed to in writing, software
13  *  distributed under the License is distributed on an "AS IS" BASIS,
14  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  *  See the License for the specific language governing permissions and
16  *  limitations under the License.
17  *  ============LICENSE_END=========================================================
18  */
19
20 package org.o.ran.oam.nf.oam.adopter.snmp.manager.configurations;
21
22 import org.o.ran.oam.nf.oam.adopter.api.VesEventNotifier;
23 import org.o.ran.oam.nf.oam.adopter.snmp.manager.SnmpManager;
24 import org.o.ran.oam.nf.oam.adopter.snmp.manager.api.TimeZoneOffsetService;
25 import org.o.ran.oam.nf.oam.adopter.snmp.manager.mapper.SnmpMapper;
26 import org.o.ran.oam.nf.oam.adopter.snmp.manager.properties.SnmpManagerProperties;
27 import org.springframework.beans.factory.annotation.Autowired;
28 import org.springframework.boot.context.properties.EnableConfigurationProperties;
29 import org.springframework.context.annotation.Bean;
30 import org.springframework.context.annotation.Configuration;
31
32 @Configuration
33 @EnableConfigurationProperties
34 public class SnmpManagerConfig {
35     private final SnmpManagerProperties snmpManagerProperties;
36     private final SnmpMapper snmpMapper;
37     private final VesEventNotifier vesEventNotifier;
38     private final TimeZoneOffsetService timeZoneOffsetService;
39
40     /**
41      * Snmp Manager Configuration Constructor.
42      */
43     @Autowired
44     public SnmpManagerConfig(final SnmpManagerProperties snmpManagerProperties, final SnmpMapper snmpMapper,
45             final VesEventNotifier vesEventNotifier, final TimeZoneOffsetService timeZoneOffsetService) {
46         this.snmpManagerProperties = snmpManagerProperties;
47         this.snmpMapper = snmpMapper;
48         this.vesEventNotifier = vesEventNotifier;
49         this.timeZoneOffsetService = timeZoneOffsetService;
50     }
51
52     @Bean
53     public SnmpManager getSnmpManagerService() {
54         return new SnmpManager(snmpManagerProperties.getHost(), snmpManagerProperties.getPort(), snmpMapper,
55                 vesEventNotifier, timeZoneOffsetService);
56     }
57 }