Make idle timeout configurable in ssh proxy server
[controller.git] / opendaylight / netconf / netconf-ssh / src / main / java / org / opendaylight / controller / netconf / ssh / SshProxyServerConfigurationBuilder.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.controller.netconf.ssh;
10
11 import io.netty.channel.local.LocalAddress;
12 import java.net.InetSocketAddress;
13 import org.apache.sshd.common.KeyPairProvider;
14 import org.apache.sshd.server.PasswordAuthenticator;
15
16 public final class SshProxyServerConfigurationBuilder {
17     private InetSocketAddress bindingAddress;
18     private LocalAddress localAddress;
19     private PasswordAuthenticator authenticator;
20     private KeyPairProvider keyPairProvider;
21     private int idleTimeout;
22
23     public SshProxyServerConfigurationBuilder setBindingAddress(final InetSocketAddress bindingAddress) {
24         this.bindingAddress = bindingAddress;
25         return this;
26     }
27
28     public SshProxyServerConfigurationBuilder setLocalAddress(final LocalAddress localAddress) {
29         this.localAddress = localAddress;
30         return this;
31     }
32
33     public SshProxyServerConfigurationBuilder setAuthenticator(final PasswordAuthenticator authenticator) {
34         this.authenticator = authenticator;
35         return this;
36     }
37
38     public SshProxyServerConfigurationBuilder setKeyPairProvider(final KeyPairProvider keyPairProvider) {
39         this.keyPairProvider = keyPairProvider;
40         return this;
41     }
42
43     public SshProxyServerConfigurationBuilder setIdleTimeout(final int idleTimeout) {
44         this.idleTimeout = idleTimeout;
45         return this;
46     }
47
48     public SshProxyServerConfiguration createSshProxyServerConfiguration() {
49         return new SshProxyServerConfiguration(bindingAddress, localAddress, authenticator, keyPairProvider, idleTimeout);
50     }
51
52     public SshProxyServerConfigurationBuilder create () {
53         return new SshProxyServerConfigurationBuilder();
54     }
55 }