Replace Preconditions.CheckNotNull per RequireNonNull
[bgpcep.git] / pcep / topology-provider / src / main / java / org / opendaylight / bgpcep / pcep / topology / provider / TopologyRPCs.java
index 070bfe171e1631aafaff96806b91faee4637faa0..56d9ab7c70dc87308202618a1c437ce0c7d670c2 100644 (file)
@@ -7,60 +7,62 @@
  */
 package org.opendaylight.bgpcep.pcep.topology.provider;
 
-import java.util.concurrent.Future;
+import static java.util.Objects.requireNonNull;
 
+import com.google.common.base.Function;
+import com.google.common.base.Preconditions;
+import com.google.common.util.concurrent.Futures;
+import java.util.concurrent.Future;
 import org.opendaylight.bgpcep.programming.spi.SuccessfulRpcResult;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.AddLspInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.AddLspOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.AddLspOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.EnsureLspOperationalInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.EnsureLspOperationalOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.EnsureLspOperationalOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.NetworkTopologyPcepService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.OperationResult;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.RemoveLspInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.RemoveLspOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.RemoveLspOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.TriggerSyncInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.TriggerSyncOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.TriggerSyncOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.UpdateLspInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.UpdateLspOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.UpdateLspOutputBuilder;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 
-import com.google.common.base.Function;
-import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.Futures;
-
 final class TopologyRPCs implements NetworkTopologyPcepService {
-       private final ServerSessionManager manager;
+    private final ServerSessionManager manager;
+
+    TopologyRPCs(final ServerSessionManager manager) {
+        this.manager = requireNonNull(manager);
+    }
+
+    @Override
+    public Future<RpcResult<AddLspOutput>> addLsp(final AddLspInput input) {
+        return Futures.transform(this.manager.addLsp(input), (Function<OperationResult, RpcResult<AddLspOutput>>) input1 -> SuccessfulRpcResult.create(new AddLspOutputBuilder(input1).build()));
+    }
 
-       TopologyRPCs(final ServerSessionManager manager) {
-               this.manager = Preconditions.checkNotNull(manager);
-       }
+    @Override
+    public Future<RpcResult<RemoveLspOutput>> removeLsp(final RemoveLspInput input) {
+        return Futures.transform(this.manager.removeLsp(input), (Function<OperationResult, RpcResult<RemoveLspOutput>>) input1 -> SuccessfulRpcResult.create(new RemoveLspOutputBuilder(input1).build()));
+    }
 
-       @Override
-       public Future<RpcResult<AddLspOutput>> addLsp(final AddLspInput input) {
-               return Futures.transform(manager.realAddLsp(input), new Function<OperationResult, RpcResult<AddLspOutput>>() {
-                       @Override
-                       public RpcResult<AddLspOutput> apply(final OperationResult input) {
-                               return SuccessfulRpcResult.create(new AddLspOutputBuilder(input).build());
-                       }
-               });
-       }
+    @Override
+    public Future<RpcResult<TriggerSyncOutput>> triggerSync(final TriggerSyncInput input) {
+        return Futures.transform(this.manager.triggerSync(input), (Function<OperationResult, RpcResult<TriggerSyncOutput>>) input1 -> SuccessfulRpcResult.create(new TriggerSyncOutputBuilder(input1).build()));
+    }
 
-       @Override
-       public Future<RpcResult<RemoveLspOutput>> removeLsp(final RemoveLspInput input) {
-               return Futures.transform(manager.realRemoveLsp(input), new Function<OperationResult, RpcResult<RemoveLspOutput>>() {
-                       @Override
-                       public RpcResult<RemoveLspOutput> apply(final OperationResult input) {
-                               return SuccessfulRpcResult.create(new RemoveLspOutputBuilder(input).build());
-                       }
-               });
-       }
+    @Override
+    public Future<RpcResult<UpdateLspOutput>> updateLsp(final UpdateLspInput input) {
+        return Futures.transform(this.manager.updateLsp(input), (Function<OperationResult, RpcResult<UpdateLspOutput>>) input1 -> SuccessfulRpcResult.create(new UpdateLspOutputBuilder(input1).build()));
+    }
 
-       @Override
-       public Future<RpcResult<UpdateLspOutput>> updateLsp(final UpdateLspInput input) {
-               return Futures.transform(manager.realUpdateLsp(input), new Function<OperationResult, RpcResult<UpdateLspOutput>>() {
-                       @Override
-                       public RpcResult<UpdateLspOutput> apply(final OperationResult input) {
-                               return SuccessfulRpcResult.create(new UpdateLspOutputBuilder(input).build());
-                       }
-               });
-       }
+    @Override
+    public Future<RpcResult<EnsureLspOperationalOutput>> ensureLspOperational(final EnsureLspOperationalInput input) {
+        return Futures.transform(this.manager.ensureLspOperational(input),
+            (Function<OperationResult, RpcResult<EnsureLspOperationalOutput>>) input1 -> SuccessfulRpcResult.create(new EnsureLspOperationalOutputBuilder(input1).build()));
+    }
 }