8ddd0e7c97611a9c859deffb119774801737f5e0
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / OpenFlowPluginProviderFactoryImpl.java
1 /*
2  * Copyright (c) 2016, 2017 Brocade Communications Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.openflowplugin.impl;
9
10 import java.util.List;
11 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
12 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
13 import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
14 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
15 import org.opendaylight.infrautils.diagstatus.DiagStatusService;
16 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
17 import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
18 import org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProvider;
19 import org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProviderFactory;
20 import org.opendaylight.openflowplugin.api.openflow.configuration.ConfigurationService;
21 import org.opendaylight.openflowplugin.api.openflow.mastership.MastershipChangeServiceManager;
22 import org.slf4j.Logger;
23 import org.slf4j.LoggerFactory;
24
25 /**
26  * Implementation of OpenFlowPluginProviderFactory.
27  *
28  * @author Thomas Pantelis
29  */
30 public class OpenFlowPluginProviderFactoryImpl implements OpenFlowPluginProviderFactory {
31     private static final Logger LOG = LoggerFactory.getLogger(OpenFlowPluginProviderFactoryImpl.class);
32
33     @Override
34     public OpenFlowPluginProvider newInstance(final ConfigurationService configurationService,
35                                               final DataBroker dataBroker,
36                                               final RpcProviderRegistry rpcRegistry,
37                                               final NotificationPublishService notificationPublishService,
38                                               final EntityOwnershipService entityOwnershipService,
39                                               final List<SwitchConnectionProvider> switchConnectionProviders,
40                                               final ClusterSingletonServiceProvider singletonServiceProvider,
41                                               final MastershipChangeServiceManager mastershipChangeServiceManager,
42                                               final DiagStatusService diagStatusService) {
43         LOG.info("Initializing new OFP southbound.");
44         final OpenFlowPluginProvider openflowPluginProvider = new OpenFlowPluginProviderImpl(
45                 configurationService,
46                 switchConnectionProviders,
47                 dataBroker,
48                 rpcRegistry,
49                 notificationPublishService,
50                 singletonServiceProvider,
51                 entityOwnershipService,
52                 mastershipChangeServiceManager,
53                 diagStatusService);
54
55         openflowPluginProvider.initialize();
56         return openflowPluginProvider;
57     }
58 }