44faa8761ac3d57595cd456e430d9d51458b5b77
[ccsdk/sli/adaptors.git] /
1 /*
2  * ============LICENSE_START==========================================
3  * Copyright (c) 2019 PANTHEON.tech s.r.o.
4  * ===================================================================
5  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
11  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
12  * OF ANY KIND, either express or implied. See the License for the specific language governing permissions and
13  * limitations under the License.
14  * ============LICENSE_END============================================
15  *
16  */
17 package org.onap.ccsdk.sli.adaptors.resource.mdsal.lighty;
18
19 import io.lighty.core.controller.api.AbstractLightyModule;
20 import org.onap.ccsdk.sli.adaptors.resource.mdsal.ConfigResource;
21 import org.onap.ccsdk.sli.adaptors.resource.mdsal.MdsalResourcePropertiesProviderImpl;
22 import org.onap.ccsdk.sli.adaptors.resource.mdsal.OperationalResource;
23
24 /**
25  * The implementation of the {@link io.lighty.core.controller.api.LightyModule} that manages and provides services from
26  * the mdsal-resource-provider artifact.
27  */
28 public class MdsalResourceModule extends AbstractLightyModule {
29
30     private MdsalResourcePropertiesProviderImpl mdsalResourcePropertiesProvider;
31     private ConfigResource configResource;
32     private OperationalResource operationalResource;
33
34     @Override
35     protected boolean initProcedure() {
36         this.mdsalResourcePropertiesProvider = new MdsalResourcePropertiesProviderImpl();
37         this.configResource = new ConfigResource(mdsalResourcePropertiesProvider);
38         this.operationalResource = new OperationalResource(mdsalResourcePropertiesProvider);
39         return true;
40     }
41
42     @Override
43     protected boolean stopProcedure() {
44         return true;
45     }
46
47     public MdsalResourcePropertiesProviderImpl getMdsalResourcePropertiesProviderImpl() {
48         return this.mdsalResourcePropertiesProvider;
49     }
50
51     public ConfigResource getConfigResource() {
52         return configResource;
53     }
54
55     public OperationalResource getOperationalResource() {
56         return this.operationalResource;
57     }
58 }