Bug 618 - convert xtend to java in md-sal/inventory-manager
[controller.git] / opendaylight / md-sal / inventory-manager / src / main / java / org / opendaylight / controller / md / inventory / manager / InventoryActivator.java
diff --git a/opendaylight/md-sal/inventory-manager/src/main/java/org/opendaylight/controller/md/inventory/manager/InventoryActivator.java b/opendaylight/md-sal/inventory-manager/src/main/java/org/opendaylight/controller/md/inventory/manager/InventoryActivator.java
new file mode 100644 (file)
index 0000000..6c06088
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * Copyright (c) 2014 Cisco Systems, Inc. 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.controller.md.inventory.manager;
+
+import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
+import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
+import org.osgi.framework.BundleContext;
+
+public class InventoryActivator extends AbstractBindingAwareProvider {
+
+    private static FlowCapableInventoryProvider provider = new FlowCapableInventoryProvider();
+
+    @Override
+    public void onSessionInitiated(final ProviderContext session) {
+        DataProviderService salDataService = session.<DataProviderService> getSALService(DataProviderService.class);
+        NotificationProviderService salNotifiService =
+                session.<NotificationProviderService> getSALService(NotificationProviderService.class);
+        InventoryActivator.provider.setDataService(salDataService);
+        InventoryActivator.provider.setNotificationService(salNotifiService);
+        InventoryActivator.provider.start();
+    }
+
+    @Override
+    protected void stopImpl(final BundleContext context) {
+        InventoryActivator.provider.close();
+    }
+}