Remove unused routedRpcRegistration
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / services / sal / SalBundleServiceImpl.java
index d1c223a0813d04227ba72becf9f5e56be69964fa..25a88e5b0b9c357df4fe60b58e77d0aa9b0371ca 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.openflowplugin.impl.services.sal;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
@@ -28,6 +29,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.on
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.send.experimenter.input.experimenter.message.of.choice.BundleControlSalBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.send.experimenter.input.experimenter.message.of.choice.bundle.add.message.sal.SalAddMessageDataBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.send.experimenter.input.experimenter.message.of.choice.bundle.control.sal.SalControlDataBuilder;
+import org.opendaylight.yangtools.yang.common.ErrorTag;
+import org.opendaylight.yangtools.yang.common.ErrorType;
 import org.opendaylight.yangtools.yang.common.RpcError;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
@@ -39,15 +42,16 @@ import org.slf4j.LoggerFactory;
  */
 public class SalBundleServiceImpl implements SalBundleService {
     private static final Logger LOG = LoggerFactory.getLogger(SalBundleServiceImpl.class);
+
     private final SalExperimenterMessageService experimenterMessageService;
 
     public SalBundleServiceImpl(final SalExperimenterMessageService experimenterMessageService) {
-        this.experimenterMessageService = Preconditions
-                .checkNotNull(experimenterMessageService, "SalExperimenterMessageService can not be null!");
+        this.experimenterMessageService = requireNonNull(experimenterMessageService,
+            "SalExperimenterMessageService can not be null!");
     }
 
     @Override
-    public ListenableFuture<RpcResult<ControlBundleOutput>> controlBundle(ControlBundleInput input) {
+    public ListenableFuture<RpcResult<ControlBundleOutput>> controlBundle(final ControlBundleInput input) {
         LOG.debug("Control message for device {} and bundle type {}", input.getNode(), input.getType());
         final SendExperimenterInputBuilder experimenterInputBuilder = new SendExperimenterInputBuilder();
         experimenterInputBuilder.setNode(input.getNode());
@@ -64,7 +68,7 @@ public class SalBundleServiceImpl implements SalBundleService {
     }
 
     @Override
-    public ListenableFuture<RpcResult<AddBundleMessagesOutput>> addBundleMessages(AddBundleMessagesInput input) {
+    public ListenableFuture<RpcResult<AddBundleMessagesOutput>> addBundleMessages(final AddBundleMessagesInput input) {
         final List<ListenableFuture<RpcResult<SendExperimenterOutput>>> partialResults = new ArrayList<>();
         final SendExperimenterInputBuilder experimenterInputBuilder = new SendExperimenterInputBuilder();
         final BundleAddMessageSalBuilder bundleAddMessageBuilder = new BundleAddMessageSalBuilder();
@@ -89,13 +93,14 @@ public class SalBundleServiceImpl implements SalBundleService {
         Futures.addCallback(Futures.successfulAsList(partialResults),new FutureCallback<
                 List<RpcResult<SendExperimenterOutput>>>() {
             @Override
-            public void onSuccess(List<RpcResult<SendExperimenterOutput>> results) {
+            public void onSuccess(final List<RpcResult<SendExperimenterOutput>> results) {
                 final ArrayList<RpcError> errors = new ArrayList<>();
                 final RpcResultBuilder<AddBundleMessagesOutput> rpcResultBuilder;
                 for (RpcResult<SendExperimenterOutput> res : results) {
                     if (res == null) {
-                        errors.add(RpcResultBuilder.newError(RpcError.ErrorType.APPLICATION, "BundleExtensionService",
-                                                             "RpcResult is null."));
+                        // FIXME: this should never happen
+                        errors.add(RpcResultBuilder.newError(ErrorType.APPLICATION,
+                            new ErrorTag("BundleExtensionService"), "RpcResult is null."));
                     } else if (!res.isSuccessful()) {
                         errors.addAll(res.getErrors());
                     }
@@ -109,7 +114,7 @@ public class SalBundleServiceImpl implements SalBundleService {
             }
 
             @Override
-            public void onFailure(Throwable throwable) {
+            public void onFailure(final Throwable throwable) {
                 RpcResultBuilder<AddBundleMessagesOutput> rpcResultBuilder = RpcResultBuilder.failed();
                 result.set(rpcResultBuilder.build());
             }