*/
package org.opendaylight.netconf.client.conf;
+import static com.google.common.base.Preconditions.checkArgument;
+
import java.net.InetSocketAddress;
+import java.util.List;
+import org.checkerframework.checker.index.qual.NonNegative;
import org.opendaylight.netconf.api.messages.NetconfHelloMessageAdditionalHeader;
import org.opendaylight.netconf.client.NetconfClientSessionListener;
+import org.opendaylight.netconf.client.SslHandlerFactory;
+import org.opendaylight.netconf.nettyutil.AbstractNetconfSessionNegotiator;
+import org.opendaylight.netconf.nettyutil.ReconnectStrategy;
import org.opendaylight.netconf.nettyutil.handler.ssh.authentication.AuthenticationHandler;
-import org.opendaylight.protocol.framework.ReconnectStrategy;
+import org.opendaylight.netconf.nettyutil.handler.ssh.client.NetconfSshClient;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
public class NetconfClientConfigurationBuilder {
private ReconnectStrategy reconnectStrategy;
private AuthenticationHandler authHandler;
private NetconfClientConfiguration.NetconfClientProtocol clientProtocol = DEFAULT_CLIENT_PROTOCOL;
+ private SslHandlerFactory sslHandlerFactory;
+ private NetconfSshClient sshClient;
+ private List<Uri> odlHelloCapabilities;
+ private @NonNegative int maximumIncomingChunkSize =
+ AbstractNetconfSessionNegotiator.DEFAULT_MAXIMUM_INCOMING_CHUNK_SIZE;
protected NetconfClientConfigurationBuilder() {
}
return new NetconfClientConfigurationBuilder();
}
+ @SuppressWarnings("checkstyle:hiddenField")
public NetconfClientConfigurationBuilder withAddress(final InetSocketAddress address) {
this.address = address;
return this;
}
+ @SuppressWarnings("checkstyle:hiddenField")
public NetconfClientConfigurationBuilder withConnectionTimeoutMillis(final long connectionTimeoutMillis) {
this.connectionTimeoutMillis = connectionTimeoutMillis;
return this;
}
+ @SuppressWarnings("checkstyle:hiddenField")
public NetconfClientConfigurationBuilder withProtocol(
final NetconfClientConfiguration.NetconfClientProtocol clientProtocol) {
this.clientProtocol = clientProtocol;
return this;
}
+ @SuppressWarnings("checkstyle:hiddenField")
public NetconfClientConfigurationBuilder withAdditionalHeader(
final NetconfHelloMessageAdditionalHeader additionalHeader) {
this.additionalHeader = additionalHeader;
return this;
}
+ @SuppressWarnings("checkstyle:hiddenField")
public NetconfClientConfigurationBuilder withSessionListener(final NetconfClientSessionListener sessionListener) {
this.sessionListener = sessionListener;
return this;
}
+ @SuppressWarnings("checkstyle:hiddenField")
public NetconfClientConfigurationBuilder withReconnectStrategy(final ReconnectStrategy reconnectStrategy) {
this.reconnectStrategy = reconnectStrategy;
return this;
}
+ @SuppressWarnings("checkstyle:hiddenField")
public NetconfClientConfigurationBuilder withAuthHandler(final AuthenticationHandler authHandler) {
this.authHandler = authHandler;
return this;
}
+ @SuppressWarnings("checkstyle:hiddenField")
+ public NetconfClientConfigurationBuilder withSslHandlerFactory(final SslHandlerFactory sslHandlerFactory) {
+ this.sslHandlerFactory = sslHandlerFactory;
+ return this;
+ }
+
+ @SuppressWarnings("checkstyle:hiddenField")
+ public NetconfClientConfigurationBuilder withSshClient(final NetconfSshClient sshClient) {
+ this.sshClient = sshClient;
+ return this;
+ }
+
+ @SuppressWarnings("checkstyle:hiddenField")
+ public NetconfClientConfigurationBuilder withOdlHelloCapabilities(final List<Uri> odlHelloCapabilities) {
+ this.odlHelloCapabilities = odlHelloCapabilities;
+ return this;
+ }
+
+ @SuppressWarnings("checkstyle:hiddenField")
+ public NetconfClientConfigurationBuilder withMaximumIncomingChunkSize(
+ final @NonNegative int maximumIncomingChunkSize) {
+ checkArgument(maximumIncomingChunkSize > 0);
+ this.maximumIncomingChunkSize = maximumIncomingChunkSize;
+ return this;
+ }
+
final InetSocketAddress getAddress() {
return address;
}
return clientProtocol;
}
+ final SslHandlerFactory getSslHandlerFactory() {
+ return sslHandlerFactory;
+ }
+
+ public NetconfSshClient getSshClient() {
+ return sshClient;
+ }
+
+ final List<Uri> getOdlHelloCapabilities() {
+ return odlHelloCapabilities;
+ }
+
+ final @NonNegative int getMaximumIncomingChunkSize() {
+ return maximumIncomingChunkSize;
+ }
+
public NetconfClientConfiguration build() {
return new NetconfClientConfiguration(clientProtocol, address, connectionTimeoutMillis, additionalHeader,
- sessionListener, reconnectStrategy, authHandler);
+ sessionListener, reconnectStrategy, authHandler, sslHandlerFactory, sshClient, odlHelloCapabilities,
+ maximumIncomingChunkSize);
}
}