Remove Handler interface 65/96165/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 13 May 2021 13:03:27 +0000 (15:03 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 13 May 2021 13:05:23 +0000 (15:05 +0200)
This interface is utterly useless now, remove it and mark its
implementations for further evolution -- which really means eliminating
them.

JIRA: NETCONF-773
Change-Id: If6dadcaa47aa3eb77ac5b394b40e6946f09975b7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/handlers/ActionServiceHandler.java
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/handlers/DOMDataBrokerHandler.java
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/handlers/DOMMountPointServiceHandler.java
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/handlers/Handler.java [deleted file]
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/handlers/NotificationServiceHandler.java
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/handlers/RpcServiceHandler.java
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/handlers/SchemaContextHandler.java
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/handlers/SchemaContextListenerHandler.java [deleted file]
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/handlers/TransactionChainHandler.java

index b6b5eb10add438d958dfcf880ad29de949027722..6e83d9166f6786639a94fb19ed1a9e98e6410d15 100644 (file)
@@ -18,8 +18,9 @@ import org.opendaylight.mdsal.dom.api.DOMActionService;
 /**
  * Implementation of {@link ActionServiceHandler}.
  */
+// FIXME: remove this class
 @Singleton
-public class ActionServiceHandler implements Handler<DOMActionService> {
+public class ActionServiceHandler {
     private final @NonNull DOMActionService actionService;
 
     /**
@@ -33,7 +34,6 @@ public class ActionServiceHandler implements Handler<DOMActionService> {
         this.actionService = requireNonNull(actionService);
     }
 
-    @Override
     public @NonNull DOMActionService get() {
         return this.actionService;
     }
index 8702c4ab3ff41d31dd99d78a6d4c4021944eaa15..73623c6041a4fe3b65e0a809ba0bd8244e591b78 100644 (file)
@@ -7,25 +7,27 @@
  */
 package org.opendaylight.restconf.nb.rfc8040.handlers;
 
+import static java.util.Objects.requireNonNull;
+
 import javax.inject.Inject;
 import javax.inject.Singleton;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.mdsal.dom.api.DOMDataBroker;
 
 /**
  * Implementation of {@link DOMDataBrokerHandler}.
  */
+// FIXME: remove this class
 @Singleton
-public class DOMDataBrokerHandler implements Handler<DOMDataBroker> {
-
+public class DOMDataBrokerHandler {
     private final DOMDataBroker broker;
 
     @Inject
     public DOMDataBrokerHandler(final DOMDataBroker broker) {
-        this.broker = broker;
+        this.broker = requireNonNull(broker);
     }
 
-    @Override
-    public DOMDataBroker get() {
-        return this.broker;
+    public @NonNull DOMDataBroker get() {
+        return broker;
     }
 }
index 6a89d29b9949e96e1f1acf098dededa34b5506d7..7d969059b2cc180d23466768be9e7fb614f9951c 100644 (file)
@@ -12,13 +12,15 @@ import static java.util.Objects.requireNonNull;
 import javax.inject.Inject;
 import javax.inject.Singleton;
 import org.apache.aries.blueprint.annotation.service.Reference;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.mdsal.dom.api.DOMMountPointService;
 
 /**
  * Implementation of {@link DOMMountPointServiceHandler}.
  */
+// FIXME: remove this class
 @Singleton
-public final class DOMMountPointServiceHandler implements Handler<DOMMountPointService> {
+public final class DOMMountPointServiceHandler {
     private final DOMMountPointService domMountPointService;
 
     /**
@@ -32,8 +34,7 @@ public final class DOMMountPointServiceHandler implements Handler<DOMMountPointS
         this.domMountPointService = requireNonNull(domMountPointService);
     }
 
-    @Override
-    public DOMMountPointService get() {
+    public @NonNull DOMMountPointService get() {
         return this.domMountPointService;
     }
 }
diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/handlers/Handler.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/handlers/Handler.java
deleted file mode 100644 (file)
index 258c68a..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco Systems, 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.restconf.nb.rfc8040.handlers;
-
-/**
- * Handler for handling object prepared by provider for Restconf services.
- *
- * @param <T> specific type go object for handling it
- */
-interface Handler<T> {
-
-    /**
-     * Get prepared object.
-     *
-     * @return T
-     */
-    T get();
-
-    /**
-     * Update object.
-     *
-     * @param object new object to update old object
-     */
-    default void update(final T object) {
-
-    }
-}
index 378f891404d598bb51cd40ed91fd480fce1f351c..ea5cd7bb08563958a93cb459538eccdb7b4b5912 100644 (file)
@@ -12,9 +12,9 @@ import javax.inject.Singleton;
 import org.apache.aries.blueprint.annotation.service.Reference;
 import org.opendaylight.mdsal.dom.api.DOMNotificationService;
 
+// FIXME: remove this class
 @Singleton
-public class NotificationServiceHandler implements Handler<DOMNotificationService> {
-
+public class NotificationServiceHandler {
     private final DOMNotificationService notificationService;
 
     /**
@@ -28,7 +28,6 @@ public class NotificationServiceHandler implements Handler<DOMNotificationServic
         this.notificationService = notificationService;
     }
 
-    @Override
     public DOMNotificationService get() {
         return this.notificationService;
     }
index 44141f49fea9fab1486643df6d58f44aa289e184..d6e2d32b665ba518739741bc24781c56f9a18fa7 100644 (file)
@@ -15,8 +15,9 @@ import org.opendaylight.mdsal.dom.api.DOMRpcService;
 /**
  * Implementation of {@link RpcServiceHandler}.
  */
+// FIXME: remove this class
 @Singleton
-public class RpcServiceHandler implements Handler<DOMRpcService> {
+public class RpcServiceHandler {
     private final DOMRpcService rpcService;
 
     @Inject
@@ -24,7 +25,6 @@ public class RpcServiceHandler implements Handler<DOMRpcService> {
         this.rpcService = rpcService;
     }
 
-    @Override
     public DOMRpcService get() {
         return this.rpcService;
     }
index 5c126d4dbfaf72f07b6bbb7e7b44bf3d0a13678b..f177962866ae7e580927f43c08135498205f77c5 100644 (file)
@@ -35,6 +35,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.ConflictingModificationAppliedException;
 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContextListener;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -42,8 +43,11 @@ import org.slf4j.LoggerFactory;
 /**
  * Implementation of {@link SchemaContextHandler}.
  */
+// FIXME: this really is a service which is maintaining ietf-yang-library contents inside the datastore. It really
+//        should live in MD-SAL and be a dynamic store fragment. As a first step we should be turning this into a
+//        completely standalone application.
 @Singleton
-public class SchemaContextHandler implements SchemaContextListenerHandler, AutoCloseable {
+public class SchemaContextHandler implements EffectiveModelContextListener, AutoCloseable {
     private static final Logger LOG = LoggerFactory.getLogger(SchemaContextHandler.class);
 
     private final AtomicInteger moduleSetId = new AtomicInteger(0);
@@ -94,7 +98,6 @@ public class SchemaContextHandler implements SchemaContextListenerHandler, AutoC
         }
     }
 
-    @Override
     public EffectiveModelContext get() {
         return schemaContext;
     }
diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/handlers/SchemaContextListenerHandler.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/handlers/SchemaContextListenerHandler.java
deleted file mode 100644 (file)
index 9b17436..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco Systems, 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.restconf.nb.rfc8040.handlers;
-
-import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
-import org.opendaylight.yangtools.yang.model.api.EffectiveModelContextListener;
-
-interface SchemaContextListenerHandler extends Handler<EffectiveModelContext>, EffectiveModelContextListener {
-
-}
index 28830dd3417e2ef9afb936ea7a9307b7bbe8b989..2d7008d7fd60bc43f08f7ebd1a45e563b16095b2 100644 (file)
@@ -24,8 +24,9 @@ import org.slf4j.LoggerFactory;
 /**
  * Implementation of {@link TransactionChainHandler}.
  */
+// FIXME: untangle this class, what good is it, really?!
 @Singleton
-public class TransactionChainHandler implements Handler<DOMTransactionChain>, AutoCloseable {
+public class TransactionChainHandler implements AutoCloseable {
     private static final Logger LOG = LoggerFactory.getLogger(TransactionChainHandler.class);
 
     private final DOMTransactionChainListener transactionChainListener = new DOMTransactionChainListener() {
@@ -61,7 +62,6 @@ public class TransactionChainHandler implements Handler<DOMTransactionChain>, Au
      * After use, is important to close transactionChain by method {@link DOMTransactionChain#close()}.
      * @return new instance of object {@link DOMTransactionChain}
      */
-    @Override
     public DOMTransactionChain get() {
         final DOMTransactionChain transactionChain = dataBroker.createTransactionChain(transactionChainListener);
         this.transactionChainList.add(transactionChain);
@@ -72,7 +72,7 @@ public class TransactionChainHandler implements Handler<DOMTransactionChain>, Au
     @Override
     @PreDestroy
     public synchronized void close() {
-        for (DOMTransactionChain transactionChain: this.transactionChainList) {
+        for (DOMTransactionChain transactionChain : this.transactionChainList) {
             transactionChain.close();
             LOG.trace("Closed TransactionChain({})", transactionChain);
         }