resolved checkstyle warnings
[vpnservice.git] / vpnmanager-impl / src / main / java / org / opendaylight / vpnservice / VpnserviceProvider.java
index ef4223ff91e7635c4c19ce9ffa0be295cb0208b0..84b18382729ab885674c994e7216cd2eb427bf80 100644 (file)
@@ -1,29 +1,41 @@
-/*
- * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.vpnservice;
-
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
-import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class VpnserviceProvider implements BindingAwareProvider, AutoCloseable {
-
-    private static final Logger LOG = LoggerFactory.getLogger(VpnserviceProvider.class);
-
-    @Override
-    public void onSessionInitiated(ProviderContext session) {
-        LOG.info("VpnserviceProvider Session Initiated");
-    }
-
-    @Override
-    public void close() throws Exception {
-        LOG.info("VpnserviceProvider Closed");
-    }
-
-}
+/*\r
+ * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+package org.opendaylight.vpnservice;\r
+\r
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;\r
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;\r
+import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;\r
+\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+\r
+public class VpnserviceProvider implements BindingAwareProvider,\r
+                                                       AutoCloseable {\r
+\r
+    private static final Logger LOG = LoggerFactory.getLogger(VpnserviceProvider.class);\r
+    private VpnInterfaceManager vpnInterfaceManager;\r
+    private VpnManager vpnManager;\r
+\r
+    @Override\r
+    public void onSessionInitiated(ProviderContext session) {\r
+        LOG.info("VpnserviceProvider Session Initiated");\r
+        try {\r
+            final  DataBroker dataBroker = session.getSALService(DataBroker.class);\r
+            vpnManager = new VpnManager(dataBroker);\r
+            vpnInterfaceManager = new VpnInterfaceManager(dataBroker);\r
+        } catch (Exception e) {\r
+            LOG.error("Error initializing services", e);\r
+        }\r
+    }\r
+\r
+    @Override\r
+    public void close() throws Exception {\r
+        vpnManager.close();\r
+        vpnInterfaceManager.close();\r
+    }\r
+}\r