X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-dom-spi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fdom%2Fbroker%2Fspi%2Frpc%2FRpcRoutingStrategy.java;h=f55cb87e51b6c786337fe1288150fa7aaa576b87;hp=6c8f37b66b28dcf851c68430bf6b284742eeeda2;hb=4ad8e1880cfee424eac9e4f12e461d98445a6e44;hpb=531621aac4cff9d39cbd8668a53bdeba8a0e6d81 diff --git a/opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/md/sal/dom/broker/spi/rpc/RpcRoutingStrategy.java b/opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/md/sal/dom/broker/spi/rpc/RpcRoutingStrategy.java index 6c8f37b66b..f55cb87e51 100644 --- a/opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/md/sal/dom/broker/spi/rpc/RpcRoutingStrategy.java +++ b/opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/md/sal/dom/broker/spi/rpc/RpcRoutingStrategy.java @@ -7,8 +7,10 @@ */ package org.opendaylight.controller.md.sal.dom.broker.spi.rpc; +import static java.util.Objects.requireNonNull; + import com.google.common.base.Optional; -import com.google.common.base.Preconditions; +import org.gaul.modernizer_maven_annotations.SuppressModernizer; import org.opendaylight.yangtools.concepts.Identifiable; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode; @@ -16,32 +18,32 @@ import org.opendaylight.yangtools.yang.model.api.DataSchemaNode; import org.opendaylight.yangtools.yang.model.api.RpcDefinition; import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode; +@Deprecated public abstract class RpcRoutingStrategy implements Identifiable { + private static final QName CONTEXT_REFERENCE = QName.create("urn:opendaylight:yang:extension:yang-ext", + "2013-07-09", "context-reference").intern(); - private static final QName CONTEXT_REFERENCE = QName.cachedReference(QName.create("urn:opendaylight:yang:extension:yang-ext", - "2013-07-09", "context-reference")); private final QName identifier; private RpcRoutingStrategy(final QName identifier) { - this.identifier = Preconditions.checkNotNull(identifier); + this.identifier = requireNonNull(identifier); } /** - * Returns leaf QName in which RPC Route is stored - * + * Returns leaf QName in which RPC Route is stored. * * @return leaf QName in which RPC Route is stored * @throws UnsupportedOperationException If RPC is not content routed. - * ({@link #isContextBasedRouted()} returned false) + * ({@link #isContextBasedRouted()} returned false) */ public abstract QName getLeaf(); /** - * Returns identity QName which represents RPC Routing context + * Returns identity QName which represents RPC Routing context. * * @return identity QName which represents RPC Routing context * @throws UnsupportedOperationException If RPC is not content routed. - * ({@link #isContextBasedRouted()} returned false) + * ({@link #isContextBasedRouted()} returned false) */ public abstract QName getContext(); @@ -70,6 +72,7 @@ public abstract class RpcRoutingStrategy implements Identifiable { return new GlobalRpcStrategy(rpc.getQName()); } + @SuppressModernizer public static Optional getRoutingContext(final DataSchemaNode schemaNode) { for (UnknownSchemaNode extension : schemaNode.getUnknownSchemaNodes()) { if (CONTEXT_REFERENCE.equals(extension.getNodeType())) { @@ -85,8 +88,8 @@ public abstract class RpcRoutingStrategy implements Identifiable { private RoutedRpcStrategy(final QName identifier, final QName ctx, final QName leaf) { super(identifier); - this.context = Preconditions.checkNotNull(ctx); - this.leaf = Preconditions.checkNotNull(leaf); + this.context = requireNonNull(ctx); + this.leaf = requireNonNull(leaf); } @Override @@ -106,8 +109,7 @@ public abstract class RpcRoutingStrategy implements Identifiable { } private static final class GlobalRpcStrategy extends RpcRoutingStrategy { - - public GlobalRpcStrategy(final QName identifier) { + GlobalRpcStrategy(final QName identifier) { super(identifier); } @@ -126,4 +128,4 @@ public abstract class RpcRoutingStrategy implements Identifiable { throw new UnsupportedOperationException("Non-routed strategy does not have a context"); } } -} \ No newline at end of file +}