From: Robert Varga Date: Fri, 15 May 2015 23:34:26 +0000 (+0200) Subject: Migrate away from deprecated methods X-Git-Tag: release/lithium~30 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=96ae2f8565bcf8bbe20eac0370fcc0a20258c5fd;p=openflowjava.git Migrate away from deprecated methods Objects is going away, as is Rpcs. Change-Id: If4bff97d0f3ec20d7e5a6ed1695bc6ab38213caa Signed-off-by: Robert Varga --- diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/connection/AbstractRpcListener.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/connection/AbstractRpcListener.java index 79708f65..115f9205 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/connection/AbstractRpcListener.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/connection/AbstractRpcListener.java @@ -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 implements GenericFutureListeneremptyList())); + result.set(RpcResultBuilder.success(value).build()); } } diff --git a/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 b/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 68edb2a3..9cbd9c96 100644 --- a/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 +++ b/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 @@ -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; }