d5cb35f905e12353e202295282f51d30e141b7e7
[appc.git] / appc-inbound / appc-design-services / provider / src / main / java / org / onap / appc / design / services / DesignServiceProvider.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP : APPC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Copyright (C) 2017 Amdocs
8  * =============================================================================
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  * 
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  * 
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  * 
21  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22  * ============LICENSE_END=========================================================
23  */
24
25 package org.onap.appc.design.services;
26
27 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
28 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
29 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
30 import org.opendaylight.yang.gen.v1.org.onap.appc.rev170627.DesignServicesService;
31 import org.onap.appc.design.services.impl.DesignServicesImpl;
32
33 import com.att.eelf.configuration.EELFLogger;
34 import com.att.eelf.configuration.EELFManager;
35
36 public class DesignServiceProvider{
37
38     private static final EELFLogger log = EELFManager.getInstance().getLogger(DesignServiceProvider.class);
39
40     private final DataBroker dataBroker;
41     private final RpcProviderRegistry rpcProviderRegistry;
42     private RpcRegistration <DesignServicesService> serviceRegistration;
43     
44
45     public DesignServiceProvider(final DataBroker dataBroker, RpcProviderRegistry rpcProviderRegistry) {
46         this.dataBroker = dataBroker;
47         this.rpcProviderRegistry = rpcProviderRegistry;
48     }
49
50     /**
51      * Method called when the blueprint container is created.
52      */
53     public void init() {
54         // initialize data broker
55         this.serviceRegistration = this.rpcProviderRegistry.addRpcImplementation(DesignServicesService.class, new DesignServicesImpl());
56         log.info("DesignServicesImpl Session Initiated");
57     }
58
59     /**
60      * Method called when the blueprint container is destroyed.
61      */
62     public void close() {
63         if(this.serviceRegistration != null){
64             this.serviceRegistration.close();
65         }
66         log.info("DesignServicesImpl Closed");
67     }
68
69
70 }