X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-dom-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fdom%2Fbroker%2Fimpl%2FRoutedDOMRpcRoutingTableEntry.java;fp=opendaylight%2Fmd-sal%2Fsal-dom-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fdom%2Fbroker%2Fimpl%2FRoutedDOMRpcRoutingTableEntry.java;h=0000000000000000000000000000000000000000;hb=2611e6a728e586ea34dd891f30a473bf54d6cbd8;hp=14fccc05bcf09e5b3ff5708f535d23ac954d32a0;hpb=aaea3e9a92ae9d6fac04c4a065db4b35cbca9ed0;p=controller.git diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/RoutedDOMRpcRoutingTableEntry.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/RoutedDOMRpcRoutingTableEntry.java deleted file mode 100644 index 14fccc05bc..0000000000 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/RoutedDOMRpcRoutingTableEntry.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2015 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.controller.md.sal.dom.broker.impl; - -import static java.util.Objects.requireNonNull; - -import com.google.common.util.concurrent.CheckedFuture; -import com.google.common.util.concurrent.Futures; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import org.opendaylight.controller.md.sal.dom.api.DOMRpcException; -import org.opendaylight.controller.md.sal.dom.api.DOMRpcIdentifier; -import org.opendaylight.controller.md.sal.dom.api.DOMRpcImplementation; -import org.opendaylight.controller.md.sal.dom.api.DOMRpcImplementationNotAvailableException; -import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult; -import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; -import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; -import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodes; -import org.opendaylight.yangtools.yang.model.api.RpcDefinition; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@Deprecated(forRemoval = true) -final class RoutedDOMRpcRoutingTableEntry extends AbstractDOMRpcRoutingTableEntry { - private static final Logger LOG = LoggerFactory.getLogger(RoutedDOMRpcRoutingTableEntry.class); - private final DOMRpcIdentifier globalRpcId; - private final YangInstanceIdentifier keyId; - - private RoutedDOMRpcRoutingTableEntry(final DOMRpcIdentifier globalRpcId, final YangInstanceIdentifier keyId, - final Map> impls) { - super(globalRpcId.getType(), impls); - this.keyId = requireNonNull(keyId); - this.globalRpcId = requireNonNull(globalRpcId); - } - - RoutedDOMRpcRoutingTableEntry(final RpcDefinition def, final YangInstanceIdentifier keyId, - final Map> impls) { - super(def.getPath(), impls); - this.keyId = requireNonNull(keyId); - this.globalRpcId = DOMRpcIdentifier.create(def.getPath()); - } - - @Override - protected CheckedFuture invokeRpc(final NormalizedNode input) { - final Optional> maybeKey = NormalizedNodes.findNode(input, keyId); - - // Routing key is present, attempt to deliver as a routed RPC - if (maybeKey.isPresent()) { - final NormalizedNode key = maybeKey.get(); - final Object value = key.getValue(); - if (value instanceof YangInstanceIdentifier) { - final YangInstanceIdentifier iid = (YangInstanceIdentifier) value; - - // Find a DOMRpcImplementation for a specific iid - final List specificImpls = getImplementations(iid); - if (specificImpls != null) { - return specificImpls.get(0).invokeRpc(DOMRpcIdentifier.create(getSchemaPath(), iid), input); - } - - LOG.debug("No implementation for context {} found will now look for wildcard id", iid); - - // Find a DOMRpcImplementation for a wild card. Usually remote-rpc-connector would register an - // implementation this way - final List mayBeRemoteImpls = getImplementations(YangInstanceIdentifier.empty()); - - if (mayBeRemoteImpls != null) { - return mayBeRemoteImpls.get(0).invokeRpc(DOMRpcIdentifier.create(getSchemaPath(), iid), input); - } - - } else { - LOG.warn("Ignoring wrong context value {}", value); - } - } - - final List impls = getImplementations(null); - if (impls != null) { - return impls.get(0).invokeRpc(globalRpcId, input); - } else { - return Futures.immediateFailedCheckedFuture( - new DOMRpcImplementationNotAvailableException("No implementation of RPC %s available", - getSchemaPath())); - } - } - - @Override - protected RoutedDOMRpcRoutingTableEntry newInstance( - final Map> impls) { - return new RoutedDOMRpcRoutingTableEntry(globalRpcId, keyId, impls); - } -}