Migrate away from deprecated methods 78/20578/1
authorRobert Varga <rovarga@cisco.com>
Fri, 15 May 2015 23:34:26 +0000 (01:34 +0200)
committerRobert Varga <rovarga@cisco.com>
Fri, 15 May 2015 23:34:26 +0000 (01:34 +0200)
Objects is going away, as is Rpcs.

Change-Id: If4bff97d0f3ec20d7e5a6ed1695bc6ab38213caa
Signed-off-by: Robert Varga <rovarga@cisco.com>
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/connection/AbstractRpcListener.java
openflow-protocol-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/openflow/_switch/connection/provider/impl/rev140328/SwitchConnectionProviderModule.java

index 79708f65d647fcb8b6609506e91f4b05c8b648be..115f9205ead2a4c6af552624df5e36d42b2321e0 100644 (file)
@@ -7,24 +7,22 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.core.connection;
 
+import com.google.common.base.Preconditions;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.SettableFuture;
 import io.netty.util.concurrent.Future;
 import io.netty.util.concurrent.GenericFutureListener;
-
 import java.util.Collections;
-
 import org.opendaylight.controller.sal.common.util.RpcErrors;
 import org.opendaylight.controller.sal.common.util.Rpcs;
 import org.opendaylight.yangtools.yang.common.RpcError;
 import org.opendaylight.yangtools.yang.common.RpcError.ErrorSeverity;
 import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
 import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.SettableFuture;
-
 /**
  * This class holds all the context we need for sending a single message down the tube.
  * A MessageHolder (used in queue) and the actual listener. It is not a thing of beauty,
@@ -98,9 +96,6 @@ abstract class AbstractRpcListener<T> implements GenericFutureListener<Future<Vo
     }
 
     protected final void successfulRpc(final T value) {
-        result.set(Rpcs.getRpcResult(
-                true,
-                value,
-                Collections.<RpcError>emptyList()));
+        result.set(RpcResultBuilder.success(value).build());
     }
 }
index 68edb2a3e9ed2529002c1550625d48595688d20d..9cbd9c964b794ee8d394673702a9b3e1d601cf2f 100644 (file)
@@ -9,9 +9,9 @@
 */
 package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow._switch.connection.provider.impl.rev140328;
 
+import com.google.common.base.MoreObjects;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
-
 import org.opendaylight.openflowjava.protocol.api.connection.ConnectionConfiguration;
 import org.opendaylight.openflowjava.protocol.api.connection.ThreadConfiguration;
 import org.opendaylight.openflowjava.protocol.api.connection.TlsConfiguration;
@@ -22,8 +22,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.T
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.Objects;
-
 /**
 *
 */
@@ -37,7 +35,7 @@ public final class SwitchConnectionProviderModule extends org.opendaylight.yang.
      * @param identifier
      * @param dependencyResolver
      */
-    public SwitchConnectionProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+    public SwitchConnectionProviderModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
         super(identifier, dependencyResolver);
     }
 
@@ -47,8 +45,8 @@ public final class SwitchConnectionProviderModule extends org.opendaylight.yang.
      * @param oldModule
      * @param oldInstance
      */
-    public SwitchConnectionProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
-            SwitchConnectionProviderModule oldModule, java.lang.AutoCloseable oldInstance) {
+    public SwitchConnectionProviderModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+            final SwitchConnectionProviderModule oldModule, final java.lang.AutoCloseable oldInstance) {
         super(identifier, dependencyResolver, oldModule, oldInstance);
     }
 
@@ -103,39 +101,39 @@ public final class SwitchConnectionProviderModule extends org.opendaylight.yang.
                 return new TlsConfiguration() {
                     @Override
                     public KeystoreType getTlsTruststoreType() {
-                        return Objects.firstNonNull(tlsConfig.getTruststoreType(), null);
+                        return MoreObjects.firstNonNull(tlsConfig.getTruststoreType(), null);
                     }
                     @Override
                     public String getTlsTruststore() {
-                        return Objects.firstNonNull(tlsConfig.getTruststore(), null);
+                        return MoreObjects.firstNonNull(tlsConfig.getTruststore(), null);
                     }
                     @Override
                     public KeystoreType getTlsKeystoreType() {
-                        return Objects.firstNonNull(tlsConfig.getKeystoreType(), null);
+                        return MoreObjects.firstNonNull(tlsConfig.getKeystoreType(), null);
                     }
                     @Override
                     public String getTlsKeystore() {
-                        return Objects.firstNonNull(tlsConfig.getKeystore(), null);
+                        return MoreObjects.firstNonNull(tlsConfig.getKeystore(), null);
                     }
                     @Override
                     public org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.PathType getTlsKeystorePathType() {
-                        return Objects.firstNonNull(tlsConfig.getKeystorePathType(), null);
+                        return MoreObjects.firstNonNull(tlsConfig.getKeystorePathType(), null);
                     }
                     @Override
                     public org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.PathType getTlsTruststorePathType() {
-                        return Objects.firstNonNull(tlsConfig.getTruststorePathType(), null);
+                        return MoreObjects.firstNonNull(tlsConfig.getTruststorePathType(), null);
                     }
                     @Override
                     public String getKeystorePassword() {
-                        return Objects.firstNonNull(tlsConfig.getKeystorePassword(), null);
+                        return MoreObjects.firstNonNull(tlsConfig.getKeystorePassword(), null);
                     }
                     @Override
                     public String getCertificatePassword() {
-                        return Objects.firstNonNull(tlsConfig.getCertificatePassword(), null);
+                        return MoreObjects.firstNonNull(tlsConfig.getCertificatePassword(), null);
                     }
                     @Override
                     public String getTruststorePassword() {
-                        return Objects.firstNonNull(tlsConfig.getTruststorePassword(), null);
+                        return MoreObjects.firstNonNull(tlsConfig.getTruststorePassword(), null);
                     }
                 };
             }
@@ -174,7 +172,7 @@ public final class SwitchConnectionProviderModule extends org.opendaylight.yang.
      * @return
      * @throws UnknownHostException
      */
-    private static InetAddress extractIpAddressBin(IpAddress address) throws UnknownHostException {
+    private static InetAddress extractIpAddressBin(final IpAddress address) throws UnknownHostException {
         byte[] addressBin = null;
         if (address != null) {
             if (address.getIpv4Address() != null) {
@@ -195,7 +193,7 @@ public final class SwitchConnectionProviderModule extends org.opendaylight.yang.
      * @param value
      * @return
      */
-    private static byte[] address2bin(String value) {
+    private static byte[] address2bin(final String value) {
         //TODO: translate ipv4 or ipv6 into byte[]
         return null;
     }