Remove SwitchConnectionProviderList 59/111759/3
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 20 May 2024 16:14:58 +0000 (18:14 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 20 May 2024 20:47:27 +0000 (22:47 +0200)
This is an utterly-superfluous construct. Revert to explicit injection
of references and construct the argument List in
openflowplugin-impl.xml.

This allows us to ditch Aries-specific blueprint extension and rely on
proper interfaces instead.

JIRA: OPNFLWPLUG-1129
Change-Id: I093cfe3eae3067945bcdc5ea370a0e96488334b0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
openflowjava/openflow-protocol-spi/src/main/java/org/opendaylight/openflowjava/protocol/spi/connection/SwitchConnectionProviderList.java [deleted file]
openflowjava/openflowjava-blueprint-config/src/main/resources/OSGI-INF/blueprint/openflowjava.xml
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/OpenFlowPluginProviderImpl.java
openflowplugin-impl/src/main/resources/OSGI-INF/blueprint/openflowplugin-impl.xml
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/OpenFlowPluginProviderImplTest.java

diff --git a/openflowjava/openflow-protocol-spi/src/main/java/org/opendaylight/openflowjava/protocol/spi/connection/SwitchConnectionProviderList.java b/openflowjava/openflow-protocol-spi/src/main/java/org/opendaylight/openflowjava/protocol/spi/connection/SwitchConnectionProviderList.java
deleted file mode 100644 (file)
index da8bf0c..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2018 Red Hat, 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.openflowjava.protocol.spi.connection;
-
-import com.google.common.collect.ForwardingList;
-import java.util.List;
-
-/**
- * {@link List} of {@link SwitchConnectionProvider}.
- * This is useful for strongly typed dependency injection,
- * and makes it simpler to have a common single source of truth
- * between Blueprint and other DI frameworks in a standalone environment.
- *
- * @author Michael Vorburger.ch
- */
-public class SwitchConnectionProviderList extends ForwardingList<SwitchConnectionProvider> {
-
-    private final List<SwitchConnectionProvider> switchConnectionProviders;
-
-    public SwitchConnectionProviderList(List<SwitchConnectionProvider> switchConnectionProviders) {
-        this.switchConnectionProviders = switchConnectionProviders;
-    }
-
-    @Override
-    protected List<SwitchConnectionProvider> delegate() {
-        return switchConnectionProviders;
-    }
-}
index 146faabec6147051932fb6dd50b830034ecb861b..0b8dffac68728380752352af65dc133288145085 100644 (file)
   </bean>
   <service ref="legacySwitchConnProvider" interface="org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider"
           odl:type="openflow-switch-connection-provider-legacy-impl"/>
-
-  <bean id="switchConnectionProviders" class="org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProviderList">
-      <argument>
-          <list>
-              <ref component-id="defaultSwitchConnProvider"/>
-              <ref component-id="legacySwitchConnProvider"/>
-          </list>
-      </argument>
-  </bean>
-  <service ref="switchConnectionProviders" interface="org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProviderList"/>
 </blueprint>
index f5b4afd14b7c14f3d2aa1609cd16e8d0dff28699..93ce99e6bf0bdca8061d98986a9c98197960229d 100644 (file)
@@ -46,7 +46,6 @@ import org.opendaylight.mdsal.binding.api.RpcProviderService;
 import org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService;
 import org.opendaylight.mdsal.singleton.api.ClusterSingletonServiceProvider;
 import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
-import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProviderList;
 import org.opendaylight.openflowplugin.api.openflow.FlowGroupInfoHistories;
 import org.opendaylight.openflowplugin.api.openflow.FlowGroupInfoHistory;
 import org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProvider;
@@ -136,7 +135,7 @@ public class OpenFlowPluginProviderImpl implements
 
     @Inject
     public OpenFlowPluginProviderImpl(final ConfigurationService configurationService,
-                               final SwitchConnectionProviderList switchConnectionProviders,
+                               final List<SwitchConnectionProvider> switchConnectionProviders,
                                final PingPongDataBroker pingPongDataBroker,
                                final RpcProviderService rpcProviderRegistry,
                                final NotificationPublishService notificationPublishService,
index 24e9cde4031bec80f1220e5b76e9d71d9fcd9877..0371850e2f2068073843321608695e0976497d5c 100644 (file)
@@ -1,8 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
-           xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"
-           xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
            xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
+           xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
            odl:use-default-for-reference-types="true">
 
   <bean id="openFlowPluginProviderImpl"
@@ -10,7 +9,12 @@
         init-method="initialize"
         destroy-method="close">
     <argument ref="configurationService"/>
-    <argument ref="switchConnectionProviderList"/>
+    <argument>
+        <list>
+            <ref component-id="defaultSwitchConnProvider"/>
+            <ref component-id="legacySwitchConnProvider"/>
+        </list>
+    </argument>
     <argument ref="pingPongDataBroker"/>
     <argument ref="rpcProviderService"/>
     <argument ref="notificationPublishService"/>
   <reference id="ppDB"
              interface="org.opendaylight.mdsal.binding.api.DataBroker"/>
 
-  <reference id="switchConnectionProviderList"
-             interface="org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProviderList"
-             ext:proxy-method="classes"/>
+  <reference id="defaultSwitchConnProvider"
+             interface="org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider"
+             odl:type="openflow-switch-connection-provider-default-impl"/>
+  <reference id="legacySwitchConnProvider"
+             interface="org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider"
+             odl:type="openflow-switch-connection-provider-legacy-impl"/>
   <reference id="rpcProviderService"
              interface="org.opendaylight.mdsal.binding.api.RpcProviderService"/>
   <reference id="notificationPublishService"
index 0bef9563a1d61268365d7630fc40fca60a317008..3be51d33cfd1095c61e874bde9fac922e3474f9e 100644 (file)
@@ -13,8 +13,8 @@ import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
-import com.google.common.collect.Lists;
 import com.google.common.util.concurrent.Futures;
+import java.util.List;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -28,7 +28,6 @@ import org.opendaylight.mdsal.common.api.CommitInfo;
 import org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService;
 import org.opendaylight.mdsal.singleton.api.ClusterSingletonServiceProvider;
 import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
-import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProviderList;
 import org.opendaylight.openflowplugin.api.openflow.configuration.ConfigurationProperty;
 import org.opendaylight.openflowplugin.api.openflow.configuration.ConfigurationService;
 import org.opendaylight.openflowplugin.api.openflow.mastership.MastershipChangeServiceManager;
@@ -108,7 +107,7 @@ public class OpenFlowPluginProviderImplTest {
     public void testInitializeAndClose() {
         final OpenFlowPluginProviderImpl provider = new OpenFlowPluginProviderImpl(
                 configurationService,
-                new SwitchConnectionProviderList(Lists.newArrayList(switchConnectionProvider)),
+                List.of(switchConnectionProvider),
                 dataBroker,
                 rpcProviderRegistry,
                 notificationPublishService,