resolved checkstyle warnings
[vpnservice.git] / vpnmanager-impl / src / main / java / org / opendaylight / vpnservice / VpnserviceProvider.java
1 /*\r
2  * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.\r
3  *\r
4  * This program and the accompanying materials are made available under the\r
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
6  * and is available at http://www.eclipse.org/legal/epl-v10.html\r
7  */\r
8 package org.opendaylight.vpnservice;\r
9 \r
10 import org.opendaylight.controller.md.sal.binding.api.DataBroker;\r
11 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;\r
12 import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;\r
13 \r
14 import org.slf4j.Logger;\r
15 import org.slf4j.LoggerFactory;\r
16 \r
17 public class VpnserviceProvider implements BindingAwareProvider,\r
18                                                        AutoCloseable {\r
19 \r
20     private static final Logger LOG = LoggerFactory.getLogger(VpnserviceProvider.class);\r
21     private VpnInterfaceManager vpnInterfaceManager;\r
22     private VpnManager vpnManager;\r
23 \r
24     @Override\r
25     public void onSessionInitiated(ProviderContext session) {\r
26         LOG.info("VpnserviceProvider Session Initiated");\r
27         try {\r
28             final  DataBroker dataBroker = session.getSALService(DataBroker.class);\r
29             vpnManager = new VpnManager(dataBroker);\r
30             vpnInterfaceManager = new VpnInterfaceManager(dataBroker);\r
31         } catch (Exception e) {\r
32             LOG.error("Error initializing services", e);\r
33         }\r
34     }\r
35 \r
36     @Override\r
37     public void close() throws Exception {\r
38         vpnManager.close();\r
39         vpnInterfaceManager.close();\r
40     }\r
41 }\r