Extract mastership blueprint service
[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.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
16 import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
17 import org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProvider;
18 import org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProviderFactory;
19 import org.opendaylight.openflowplugin.api.openflow.configuration.ConfigurationService;
20 import org.opendaylight.openflowplugin.api.openflow.mastership.MastershipChangeServiceManager;
21 import org.slf4j.Logger;
22 import org.slf4j.LoggerFactory;
23
24 /**
25  * Implementation of OpenFlowPluginProviderFactory.
26  *
27  * @author Thomas Pantelis
28  */
29 public class OpenFlowPluginProviderFactoryImpl implements OpenFlowPluginProviderFactory {
30     private static final Logger LOG = LoggerFactory.getLogger(OpenFlowPluginProviderFactoryImpl.class);
31
32     @Override
33     public OpenFlowPluginProvider newInstance(final ConfigurationService configurationService,
34                                               final DataBroker dataBroker,
35                                               final RpcProviderRegistry rpcRegistry,
36                                               final NotificationPublishService notificationPublishService,
37                                               final EntityOwnershipService entityOwnershipService,
38                                               final List<SwitchConnectionProvider> switchConnectionProviders,
39                                               final ClusterSingletonServiceProvider singletonServiceProvider,
40                                               final MastershipChangeServiceManager mastershipChangeServiceManager) {
41         LOG.info("Initializing new OFP southbound.");
42         final OpenFlowPluginProvider openflowPluginProvider = new OpenFlowPluginProviderImpl(
43                 configurationService,
44                 switchConnectionProviders,
45                 dataBroker,
46                 rpcRegistry,
47                 notificationPublishService,
48                 singletonServiceProvider,
49                 entityOwnershipService,
50                 mastershipChangeServiceManager);
51
52         openflowPluginProvider.initialize();
53         return openflowPluginProvider;
54     }
55 }