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.nettyutil.handler.ssh.authentication.AuthenticationHandler;
14 import org.opendaylight.protocol.framework.ReconnectStrategy;
15 import org.opendaylight.protocol.framework.ReconnectStrategyFactory;
17 public class NetconfReconnectingClientConfigurationBuilder extends NetconfClientConfigurationBuilder {
19 private ReconnectStrategyFactory connectStrategyFactory;
21 private NetconfReconnectingClientConfigurationBuilder() {
24 public static NetconfReconnectingClientConfigurationBuilder create() {
25 return new NetconfReconnectingClientConfigurationBuilder();
29 public NetconfReconnectingClientConfigurationBuilder withConnectStrategyFactory(
30 final ReconnectStrategyFactory connectStrategyFactory) {
31 this.connectStrategyFactory = connectStrategyFactory;
36 public NetconfReconnectingClientConfiguration build() {
37 return new NetconfReconnectingClientConfiguration(getProtocol(), getAddress(), getConnectionTimeoutMillis(),
38 getAdditionalHeader(), getSessionListener(), getReconnectStrategy(), connectStrategyFactory,
42 // Override setter methods to return subtype
45 public NetconfReconnectingClientConfigurationBuilder withAddress(final InetSocketAddress address) {
46 return (NetconfReconnectingClientConfigurationBuilder) super.withAddress(address);
50 public NetconfReconnectingClientConfigurationBuilder withConnectionTimeoutMillis(
51 final long connectionTimeoutMillis) {
52 return (NetconfReconnectingClientConfigurationBuilder)
53 super.withConnectionTimeoutMillis(connectionTimeoutMillis);
57 public NetconfReconnectingClientConfigurationBuilder withAdditionalHeader(
58 final NetconfHelloMessageAdditionalHeader additionalHeader) {
59 return (NetconfReconnectingClientConfigurationBuilder) super.withAdditionalHeader(additionalHeader);
63 public NetconfReconnectingClientConfigurationBuilder withSessionListener(
64 final NetconfClientSessionListener sessionListener) {
65 return (NetconfReconnectingClientConfigurationBuilder) super.withSessionListener(sessionListener);
69 public NetconfReconnectingClientConfigurationBuilder withReconnectStrategy(
70 final ReconnectStrategy reconnectStrategy) {
71 return (NetconfReconnectingClientConfigurationBuilder) super.withReconnectStrategy(reconnectStrategy);
75 public NetconfReconnectingClientConfigurationBuilder withAuthHandler(final AuthenticationHandler authHandler) {
76 return (NetconfReconnectingClientConfigurationBuilder) super.withAuthHandler(authHandler);
80 public NetconfReconnectingClientConfigurationBuilder withProtocol(
81 NetconfClientConfiguration.NetconfClientProtocol clientProtocol) {
82 return (NetconfReconnectingClientConfigurationBuilder) super.withProtocol(clientProtocol);