Ditch blueplrint-maven-plugin from southbound-impl 82/94582/1
authorRobert Varga <robert.varga@pantheon.tech>
Sat, 9 Jan 2021 22:46:08 +0000 (23:46 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Sun, 10 Jan 2021 08:53:06 +0000 (09:53 +0100)
The use of this plugin was a mis-step, we really want do deal with
OSGi using Declarative Services. As a first step, freeze all wiring
in the explicit blueprint.xml and put in FIXMES for near future.

Change-Id: Ib2cd99d1b0c4b1057adb6531a7005546be468a5c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
hwvtepsouthbound/hwvtepsouthbound-impl/pom.xml
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepSouthboundProvider.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepSouthboundUtil.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/InstanceIdentifierCodec.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/resources/OSGI-INF/blueprint/hwvtepsouthbound.xml

index 0e7cfbd9f3aa66bcf5ad22dd76a7dcddd96e8cad..60de039256f24bc8bf698fedbd3b84a5b112d55a 100644 (file)
@@ -48,11 +48,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
       <scope>provided</scope>
       <optional>true</optional>
     </dependency>
-    <dependency>
-      <groupId>org.apache.aries.blueprint</groupId>
-      <artifactId>blueprint-maven-plugin-annotation</artifactId>
-      <optional>true</optional>
-    </dependency>
     <!-- project specific dependencies -->
     <dependency>
       <groupId>${project.groupId}</groupId>
@@ -106,13 +101,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
 
   <build>
     <plugins>
-      <plugin>
-        <groupId>org.apache.aries.blueprint</groupId>
-        <artifactId>blueprint-maven-plugin</artifactId>
-        <configuration>
-          <scanPaths>org.opendaylight.ovsdb.hwvtepsouthbound</scanPaths>
-        </configuration>
-      </plugin>
       <plugin>
         <groupId>org.apache.felix</groupId>
         <artifactId>maven-bundle-plugin</artifactId>
index 71fcb7a5614dffcc42101459b85017cb342a51e7..c34eb44929b6b6e0d0f2ecb3e6a58c5e6b200c29 100644 (file)
@@ -17,8 +17,6 @@ import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
 import javax.inject.Inject;
 import javax.inject.Singleton;
-import org.apache.aries.blueprint.annotation.service.Reference;
-import org.apache.aries.blueprint.annotation.service.Service;
 import org.opendaylight.mdsal.binding.api.ClusteredDataTreeChangeListener;
 import org.opendaylight.mdsal.binding.api.DataBroker;
 import org.opendaylight.mdsal.binding.api.DataTreeIdentifier;
@@ -52,7 +50,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 @Singleton
-@Service(classes = HwvtepSouthboundProviderInfo.class)
 public class HwvtepSouthboundProvider
         implements HwvtepSouthboundProviderInfo, ClusteredDataTreeChangeListener<Topology>, AutoCloseable {
 
@@ -74,19 +71,17 @@ public class HwvtepSouthboundProvider
     private final UpgradeState upgradeState;
 
     @Inject
-    public HwvtepSouthboundProvider(@Reference final DataBroker dataBroker,
-            @Reference final EntityOwnershipService entityOwnershipServiceDependency,
-            @Reference final OvsdbConnection ovsdbConnection,
-            @Reference final DOMSchemaService schemaService,
-            @Reference final BindingNormalizedNodeSerializer bindingNormalizedNodeSerializer,
-            @Reference final UpgradeState upgradeState) {
+    public HwvtepSouthboundProvider(final DataBroker dataBroker, final EntityOwnershipService entityOwnership,
+            final OvsdbConnection ovsdbConnection, final DOMSchemaService schemaService,
+            final BindingNormalizedNodeSerializer serializer,
+            final UpgradeState upgradeState) {
         this.dataBroker = dataBroker;
-        this.entityOwnershipService = entityOwnershipServiceDependency;
+        this.entityOwnershipService = entityOwnership;
         registration = null;
         this.ovsdbConnection = ovsdbConnection;
         this.upgradeState = upgradeState;
-        HwvtepSouthboundUtil.setInstanceIdentifierCodec(new InstanceIdentifierCodec(schemaService,
-                bindingNormalizedNodeSerializer));
+        // FIXME: eliminate this static wiring
+        HwvtepSouthboundUtil.setInstanceIdentifierCodec(new InstanceIdentifierCodec(schemaService, serializer));
         LOG.info("HwvtepSouthboundProvider ovsdbConnectionService: {}", ovsdbConnection);
     }
 
index 8a1d3098f0254829f6521eb8a8bb2ab7a91a991f..1549109cbb1200e709cdedf27c63957fba3ceb98 100644 (file)
@@ -54,18 +54,23 @@ public final class HwvtepSouthboundUtil {
         // Prevent instantiating a utility class
     }
 
+    // FIXME: eliminate this static wiring by encaspulating the codec into a service
+    @Deprecated
     public static void setInstanceIdentifierCodec(InstanceIdentifierCodec iidc) {
         instanceIdentifierCodec = iidc;
     }
 
+    // FIXME: this should be an instance method
     public static InstanceIdentifierCodec getInstanceIdentifierCodec() {
         return instanceIdentifierCodec;
     }
 
+    // FIXME: this should be an instance method
     public static String serializeInstanceIdentifier(InstanceIdentifier<?> iid) {
         return instanceIdentifierCodec.serialize(iid);
     }
 
+    // FIXME: this should be an instance method
     public static InstanceIdentifier<?> deserializeInstanceIdentifier(String iidString) {
         InstanceIdentifier<?> result = null;
         try {
index 47c4b9d35174f5d1017283f82bb00cb3f86b7474..c7e2e6a408c8b664653291a8d2d32371f83c831b 100644 (file)
@@ -20,12 +20,16 @@ import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContextListener;
 import org.opendaylight.yangtools.yang.model.api.Module;
 
-public class InstanceIdentifierCodec extends AbstractModuleStringInstanceIdentifierCodec
-    implements EffectiveModelContextListener {
+public class InstanceIdentifierCodec
+        // FIXME: this really wants to be wired as yangtools-data-codec-gson's codecs, because ...
+        extends AbstractModuleStringInstanceIdentifierCodec implements EffectiveModelContextListener {
+
+    // FIXME: this is not the only interface exposed from binding-dom-codec-api, something different might be more
+    //        appropriate.
+    private final BindingNormalizedNodeSerializer bindingNormalizedNodeSerializer;
 
     private DataSchemaContextTree dataSchemaContextTree;
     private EffectiveModelContext context;
-    private final BindingNormalizedNodeSerializer bindingNormalizedNodeSerializer;
 
     public InstanceIdentifierCodec(final DOMSchemaService schemaService,
             final BindingNormalizedNodeSerializer bindingNormalizedNodeSerializer) {
@@ -33,6 +37,7 @@ public class InstanceIdentifierCodec extends AbstractModuleStringInstanceIdentif
         this.bindingNormalizedNodeSerializer = bindingNormalizedNodeSerializer;
     }
 
+    // ... all of this is dynamic lookups based on injection. OSGi lifecycle gives us this for free ...
     @Override
     protected DataSchemaContextTree getDataContextTree() {
         return dataSchemaContextTree;
@@ -55,6 +60,7 @@ public class InstanceIdentifierCodec extends AbstractModuleStringInstanceIdentif
         this.dataSchemaContextTree = DataSchemaContextTree.from(schemaContext);
     }
 
+    // FIXME: ... and then this is a separate service built on top of dynamic lifecycle.
     public String serialize(final InstanceIdentifier<?> iid) {
         YangInstanceIdentifier normalizedIid = bindingNormalizedNodeSerializer.toYangInstanceIdentifier(iid);
         return serialize(normalizedIid);
@@ -64,7 +70,7 @@ public class InstanceIdentifierCodec extends AbstractModuleStringInstanceIdentif
         return bindingNormalizedNodeSerializer.toYangInstanceIdentifier(iid);
     }
 
-    public  InstanceIdentifier<?> bindingDeserializer(final String iidString) throws DeserializationException {
+    public InstanceIdentifier<?> bindingDeserializer(final String iidString) throws DeserializationException {
         YangInstanceIdentifier normalizedYangIid = deserialize(iidString);
         return bindingNormalizedNodeSerializer.fromYangInstanceIdentifier(normalizedYangIid);
     }
index c1345d0e49623b98a6a1831d388cf4266e9b1a24..90946521a07bcdd7e18b92ba020f596a59c706e3 100644 (file)
@@ -1,5 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+    <!-- FIXME: Auto-generated, to be migrated -->
+    <reference id="dataBroker" interface="org.opendaylight.mdsal.binding.api.DataBroker"/>
+    <reference id="bindingNormalizedNodeSerializer" interface="org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer"/>
+    <reference id="dOMSchemaService" interface="org.opendaylight.mdsal.dom.api.DOMSchemaService"/>
+    <reference id="entityOwnershipService" interface="org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService"/>
+    <reference id="ovsdbConnection" interface="org.opendaylight.ovsdb.lib.OvsdbConnection"/>
+    <reference id="upgradeState" interface="org.opendaylight.serviceutils.upgrade.UpgradeState"/>
+    <bean id="hwvtepSouthboundProvider" class="org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundProvider" init-method="init" destroy-method="close">
+        <argument ref="dataBroker"/>
+        <argument ref="entityOwnershipService"/>
+        <argument ref="ovsdbConnection"/>
+        <argument ref="dOMSchemaService"/>
+        <argument ref="bindingNormalizedNodeSerializer"/>
+        <argument ref="upgradeState"/>
+    </bean>
+    <service ref="hwvtepSouthboundProvider" interface="org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundProviderInfo"/>
+
     <!-- FIXME: convert these to proper Karaf commands -->
     <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
     <command>