Add single layer deserialization support
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / statistics / services / direct / singlelayer / SingleLayerDirectStatisticsProviderInitializer.java
diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/SingleLayerDirectStatisticsProviderInitializer.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/SingleLayerDirectStatisticsProviderInitializer.java
new file mode 100644 (file)
index 0000000..9749940
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. 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.openflowplugin.impl.statistics.services.direct.singlelayer;
+
+import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
+import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
+import org.opendaylight.openflowplugin.impl.datastore.MultipartWriterProvider;
+import org.opendaylight.openflowplugin.impl.statistics.services.direct.AbstractFlowDirectStatisticsService;
+import org.opendaylight.openflowplugin.impl.statistics.services.direct.AbstractGroupDirectStatisticsService;
+import org.opendaylight.openflowplugin.impl.statistics.services.direct.AbstractMeterDirectStatisticsService;
+import org.opendaylight.openflowplugin.impl.statistics.services.direct.AbstractPortDirectStatisticsService;
+import org.opendaylight.openflowplugin.impl.statistics.services.direct.AbstractQueueDirectStatisticsService;
+import org.opendaylight.openflowplugin.impl.statistics.services.direct.OpendaylightDirectStatisticsServiceProvider;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
+
+/**
+ * Utility class for instantiating #{@link org.opendaylight.openflowplugin.impl.statistics.services.direct.OpendaylightDirectStatisticsServiceProvider}
+ * with all multi-layer services already in
+ */
+public class SingleLayerDirectStatisticsProviderInitializer {
+
+    public static OpendaylightDirectStatisticsServiceProvider createProvider(
+        final RequestContextStack requestContextStack,
+        final DeviceContext deviceContext,
+        final ConvertorExecutor convertorExecutor,
+        final MultipartWriterProvider statisticsWriterProvider) {
+
+        final OpendaylightDirectStatisticsServiceProvider provider = new OpendaylightDirectStatisticsServiceProvider();
+
+        provider.register(AbstractFlowDirectStatisticsService.class, new FlowDirectStatisticsService(
+            requestContextStack, deviceContext, convertorExecutor, statisticsWriterProvider));
+        provider.register(AbstractGroupDirectStatisticsService.class, new FlowDirectStatisticsService(
+            requestContextStack, deviceContext, convertorExecutor, statisticsWriterProvider));
+        provider.register(AbstractMeterDirectStatisticsService.class, new MeterDirectStatisticsService(
+            requestContextStack, deviceContext, convertorExecutor, statisticsWriterProvider));
+        provider.register(AbstractPortDirectStatisticsService.class, new PortDirectStatisticsService(
+            requestContextStack, deviceContext, convertorExecutor, statisticsWriterProvider));
+        provider.register(AbstractQueueDirectStatisticsService.class, new QueueDirectStatisticsService(
+            requestContextStack, deviceContext, convertorExecutor, statisticsWriterProvider));
+
+        return provider;
+    }
+
+}