Do not use blueprint-maven-plugin in library 21/97621/1
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 24 Sep 2021 15:05:43 +0000 (17:05 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 24 Sep 2021 15:15:34 +0000 (17:15 +0200)
blueprint-maven-plugin is unmaintained upstream. Generated wiring is
quite simple and should be converted to OSGi DS. As a first step capture
autowire.xml content so we know what we are dealing with.

Change-Id: I355136ee1a5475184c3f52906e4e9b9df2f92fa1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
library/impl/pom.xml
library/impl/src/main/java/org/opendaylight/ovsdb/lib/impl/OvsdbConnectionService.java
library/impl/src/main/resources/OSGI-INF/blueprint/library.xml

index 5915db054c0e291e8794e9a7d82bb9aa5b7f180a..eb838eb9400b3de37314f1ffb2606393c80ad0e7 100644 (file)
@@ -33,11 +33,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
   </properties>
 
   <dependencies>
-    <dependency>
-      <groupId>org.apache.aries.blueprint</groupId>
-      <artifactId>blueprint-maven-plugin-annotation</artifactId>
-      <optional>true</optional>
-    </dependency>
     <dependency>
       <groupId>com.fasterxml.jackson.core</groupId>
       <artifactId>jackson-annotations</artifactId>
@@ -114,13 +109,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
       </testResource>
     </testResources>
     <plugins>
-      <plugin>
-        <groupId>org.apache.aries.blueprint</groupId>
-        <artifactId>blueprint-maven-plugin</artifactId>
-        <configuration>
-          <scanPaths>org.opendaylight.ovsdb.lib</scanPaths>
-        </configuration>
-      </plugin>
       <plugin>
         <groupId>org.apache.felix</groupId>
         <artifactId>maven-bundle-plugin</artifactId>
index 8d03975f95a520bce1811d5a074a50edf04fa08f..8eac2efa8932aefd9570bda9ae296c58e5eab407 100644 (file)
@@ -46,9 +46,6 @@ import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLEngine;
 import javax.net.ssl.SSLEngineResult.HandshakeStatus;
 import javax.net.ssl.SSLPeerUnverifiedException;
-import org.apache.aries.blueprint.annotation.service.Reference;
-import org.apache.aries.blueprint.annotation.service.Service;
-import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.aaa.cert.api.ICertificateManager;
 import org.opendaylight.ovsdb.lib.OvsdbClient;
 import org.opendaylight.ovsdb.lib.OvsdbConnection;
@@ -78,7 +75,6 @@ import org.slf4j.LoggerFactory;
  * and a Singleton object in a non-OSGi environment.
  */
 @Singleton
-@Service(classes = OvsdbConnection.class)
 public class OvsdbConnectionService implements AutoCloseable, OvsdbConnection {
     private class ClientChannelInitializer extends ChannelInitializer<SocketChannel> {
         @Override
@@ -198,7 +194,7 @@ public class OvsdbConnectionService implements AutoCloseable, OvsdbConnection {
             .newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat("OVSDBConnNotifSer-%d").build());
 
     private static final StalePassiveConnectionService STALE_PASSIVE_CONNECTION_SERVICE =
-            new StalePassiveConnectionService((client) -> {
+            new StalePassiveConnectionService(client -> {
                 notifyListenerForPassiveConnection(client);
                 return null;
             });
@@ -220,7 +216,7 @@ public class OvsdbConnectionService implements AutoCloseable, OvsdbConnection {
 
     @Inject
     public OvsdbConnectionService(final NettyBootstrapFactory bootstrapFactory,
-            @Reference(filter = "type=default-certificate-manager") final ICertificateManager certManagerSrv) {
+            final ICertificateManager certManagerSrv) {
         this.bootstrapFactory = requireNonNull(bootstrapFactory);
         this.certManagerSrv = certManagerSrv;
     }
@@ -326,8 +322,8 @@ public class OvsdbConnectionService implements AutoCloseable, OvsdbConnection {
      */
     @Override
     public synchronized boolean startOvsdbManager() {
-        final int ovsdbListenerPort = this.listenerPort;
-        final String ovsdbListenerIp = this.listenerIp;
+        final int ovsdbListenerPort = listenerPort;
+        final String ovsdbListenerIp = listenerIp;
         if (singletonCreated.getAndSet(true)) {
             return false;
         }
@@ -410,11 +406,11 @@ public class OvsdbConnectionService implements AutoCloseable, OvsdbConnection {
     @SuppressWarnings("checkstyle:IllegalCatch")
     private static void handleNewPassiveConnection(final OvsdbClient client) {
         ListenableFuture<List<String>> echoFuture = client.echo();
-        LOG.debug("Send echo message to probe the OVSDB switch {}",client.getConnectionInfo());
+        LOG.debug("Send echo message to probe the OVSDB switch {}", client.getConnectionInfo());
         Futures.addCallback(echoFuture, new FutureCallback<List<String>>() {
             @Override
-            public void onSuccess(@Nullable List<String> result) {
-                LOG.info("Probe was successful to OVSDB switch {}",client.getConnectionInfo());
+            public void onSuccess(final List<String> result) {
+                LOG.info("Probe was successful to OVSDB switch {}", client.getConnectionInfo());
                 //List<OvsdbClient> clientsFromSameNode = getPassiveClientsFromSameNode(client);
                 try {
                     getPassiveClientsFromSameNode(client);
index 7d0133d40c639af4f757d6b599dbdbfbd4701bde..eefe7ed3bac5ccc49772aa781a8a28d342d38985 100644 (file)
     <property name="jsonRpcDecoderMaxFrameLength" value="${json-rpc-decoder-max-frame-length}"/>
   </bean>
 
+  <reference id="certificateManager" interface="org.opendaylight.aaa.cert.api.ICertificateManager"
+             filter="type=default-certificate-manager"/>
+
+  <bean id="nettyBootstrapFactory" class="org.opendaylight.ovsdb.lib.impl.NettyBootstrapFactory" destroy-method="close"/>
+  <bean id="ovsdbConnectionService" class="org.opendaylight.ovsdb.lib.impl.OvsdbConnectionService">
+    <argument ref="nettyBootstrapFactory"/>
+    <argument ref="certificateManager"/>
+  </bean>
+
+  <service ref="ovsdbConnectionService" interface="org.opendaylight.ovsdb.lib.OvsdbConnection"/>
 </blueprint>