2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.netconf.client.conf;
10 import java.net.InetSocketAddress;
11 import org.opendaylight.netconf.api.messages.NetconfHelloMessageAdditionalHeader;
12 import org.opendaylight.netconf.client.NetconfClientSessionListener;
13 import org.opendaylight.netconf.client.SslHandlerFactory;
14 import org.opendaylight.netconf.nettyutil.handler.ssh.authentication.AuthenticationHandler;
15 import org.opendaylight.protocol.framework.ReconnectStrategy;
16 import org.opendaylight.protocol.framework.ReconnectStrategyFactory;
18 public final class NetconfReconnectingClientConfigurationBuilder extends NetconfClientConfigurationBuilder {
20 private ReconnectStrategyFactory connectStrategyFactory;
22 private NetconfReconnectingClientConfigurationBuilder() {
25 public static NetconfReconnectingClientConfigurationBuilder create() {
26 return new NetconfReconnectingClientConfigurationBuilder();
29 @SuppressWarnings("checkstyle:hiddenField")
30 public NetconfReconnectingClientConfigurationBuilder withConnectStrategyFactory(
31 final ReconnectStrategyFactory connectStrategyFactory) {
32 this.connectStrategyFactory = connectStrategyFactory;
37 public NetconfReconnectingClientConfiguration build() {
38 return new NetconfReconnectingClientConfiguration(getProtocol(), getAddress(), getConnectionTimeoutMillis(),
39 getAdditionalHeader(), getSessionListener(), getReconnectStrategy(), connectStrategyFactory,
40 getAuthHandler(), getSslHandlerFactory());
43 // Override setter methods to return subtype
46 public NetconfReconnectingClientConfigurationBuilder withAddress(final InetSocketAddress address) {
47 return (NetconfReconnectingClientConfigurationBuilder) super.withAddress(address);
51 public NetconfReconnectingClientConfigurationBuilder withConnectionTimeoutMillis(
52 final long connectionTimeoutMillis) {
53 return (NetconfReconnectingClientConfigurationBuilder)
54 super.withConnectionTimeoutMillis(connectionTimeoutMillis);
58 public NetconfReconnectingClientConfigurationBuilder withAdditionalHeader(
59 final NetconfHelloMessageAdditionalHeader additionalHeader) {
60 return (NetconfReconnectingClientConfigurationBuilder) super.withAdditionalHeader(additionalHeader);
64 public NetconfReconnectingClientConfigurationBuilder withSessionListener(
65 final NetconfClientSessionListener sessionListener) {
66 return (NetconfReconnectingClientConfigurationBuilder) super.withSessionListener(sessionListener);
70 public NetconfReconnectingClientConfigurationBuilder withReconnectStrategy(
71 final ReconnectStrategy reconnectStrategy) {
72 return (NetconfReconnectingClientConfigurationBuilder) super.withReconnectStrategy(reconnectStrategy);
76 public NetconfReconnectingClientConfigurationBuilder withAuthHandler(final AuthenticationHandler authHandler) {
77 return (NetconfReconnectingClientConfigurationBuilder) super.withAuthHandler(authHandler);
81 public NetconfReconnectingClientConfigurationBuilder withProtocol(
82 NetconfClientConfiguration.NetconfClientProtocol clientProtocol) {
83 return (NetconfReconnectingClientConfigurationBuilder) super.withProtocol(clientProtocol);
87 public NetconfReconnectingClientConfigurationBuilder withSslHandlerFactory(
88 final SslHandlerFactory sslHandlerFactory) {
89 return (NetconfReconnectingClientConfigurationBuilder) super.withSslHandlerFactory(sslHandlerFactory);