import akka.pattern.AskTimeoutException;
import akka.pattern.Patterns;
import akka.util.Timeout;
+import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
-import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.mdsal.common.api.ReadFailedException;
import org.opendaylight.mdsal.dom.api.DOMRpcResult;
}
@Override
- public ListenableFuture<Optional<NormalizedNode<?, ?>>> get(final YangInstanceIdentifier path) {
+ public ListenableFuture<Optional<NormalizedNode>> get(final YangInstanceIdentifier path) {
LOG.debug("{}: Get {} {} via actor {}", id, OPERATIONAL, path, masterActor);
final Future<Object> future = Patterns.ask(masterActor, new GetRequest(path), askTimeout);
return read(future, OPERATIONAL, path);
}
@Override
- public ListenableFuture<Optional<NormalizedNode<?, ?>>> get(final YangInstanceIdentifier path,
+ public ListenableFuture<Optional<NormalizedNode>> get(final YangInstanceIdentifier path,
final List<YangInstanceIdentifier> fields) {
LOG.debug("{}: Get {} {} with fields {} via actor {}", id, OPERATIONAL, path, fields, masterActor);
final Future<Object> future = Patterns.ask(masterActor, new GetWithFieldsRequest(path, fields), askTimeout);
}
@Override
- public ListenableFuture<Optional<NormalizedNode<?, ?>>> getConfig(final YangInstanceIdentifier path) {
+ public ListenableFuture<Optional<NormalizedNode>> getConfig(final YangInstanceIdentifier path) {
LOG.debug("{}: GetConfig {} {} via actor {}", id, CONFIGURATION, path, masterActor);
final Future<Object> future = Patterns.ask(masterActor, new GetConfigRequest(path), askTimeout);
return read(future, CONFIGURATION, path);
}
@Override
- public ListenableFuture<Optional<NormalizedNode<?, ?>>> getConfig(final YangInstanceIdentifier path,
+ public ListenableFuture<Optional<NormalizedNode>> getConfig(final YangInstanceIdentifier path,
final List<YangInstanceIdentifier> fields) {
LOG.debug("{}: GetConfig {} {} with fields {} via actor {}", id, CONFIGURATION, path, fields, masterActor);
final Future<Object> future = Patterns.ask(masterActor,
@Override
public ListenableFuture<? extends DOMRpcResult> merge(final LogicalDatastoreType store,
- final YangInstanceIdentifier path, final NormalizedNode<?, ?> data,
+ final YangInstanceIdentifier path, final NormalizedNode data,
final Optional<ModifyAction> defaultOperation) {
LOG.debug("{}: Merge {} {} via actor {}", id, store, path, masterActor);
masterActor.tell(new MergeEditConfigRequest(
@Override
public ListenableFuture<? extends DOMRpcResult> replace(final LogicalDatastoreType store,
- final YangInstanceIdentifier path, final NormalizedNode<?, ?> data,
+ final YangInstanceIdentifier path, final NormalizedNode data,
final Optional<ModifyAction> defaultOperation) {
LOG.debug("{}: Replace {} {} via actor {}", id, store, path, masterActor);
@Override
public ListenableFuture<? extends DOMRpcResult> create(final LogicalDatastoreType store,
- final YangInstanceIdentifier path, final NormalizedNode<?, ?> data,
+ final YangInstanceIdentifier path, final NormalizedNode data,
final Optional<ModifyAction> defaultOperation) {
LOG.debug("{}: Create {} {} via actor {}", id, store, path, masterActor);
masterActor.tell(new CreateEditConfigRequest(
}
@Override
- public @NonNull Object getDeviceId() {
+ public Object getDeviceId() {
return id;
}
- private SettableFuture<Optional<NormalizedNode<?, ?>>> read(final Future<Object> future,
- final LogicalDatastoreType store,
- final YangInstanceIdentifier path) {
- final SettableFuture<Optional<NormalizedNode<?, ?>>> settableFuture = SettableFuture.create();
+ private SettableFuture<Optional<NormalizedNode>> read(final Future<Object> future, final LogicalDatastoreType store,
+ final YangInstanceIdentifier path) {
+ final SettableFuture<Optional<NormalizedNode>> settableFuture = SettableFuture.create();
future.onComplete(new OnComplete<>() {
@Override
public void onComplete(final Throwable failure, final Object response) {
return settableFuture;
}
- @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
- justification = "https://github.com/spotbugs/spotbugs/issues/811")
private Throwable processFailure(final Throwable failure) {
return failure instanceof AskTimeoutException
? NetconfTopologyUtils.createMasterIsDownException(id, (Exception) failure) : failure;
}
- private ListenableFuture<? extends DOMRpcResult> createResult() {
- final SettableFuture<DOMRpcResult> settableFuture = SettableFuture.create();
- settableFuture.set(new DefaultDOMRpcResult());
- return settableFuture;
+ // FIXME: this is being used in contexts where we should be waiting for a reply
+ private static ListenableFuture<? extends DOMRpcResult> createResult() {
+ return Futures.immediateFuture(new DefaultDOMRpcResult());
}
- @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
- justification = "https://github.com/spotbugs/spotbugs/issues/811")
private static DOMRpcResult mapInvokeRpcMessageReplyToDOMRpcResult(final InvokeRpcMessageReply reply) {
if (reply.getNormalizedNodeMessage() == null) {
return new DefaultDOMRpcResult(new ArrayList<>(reply.getRpcErrors()));