Fix sal-netconf-connector's pom.xml
[controller.git] / opendaylight / netconf / config-persister-impl / src / main / java / org / opendaylight / controller / netconf / persist / impl / ConfigPusherConfigurationBuilder.java
1 /*
2  * Copyright (c) 2013 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 package org.opendaylight.controller.netconf.persist.impl;
9
10 import io.netty.channel.EventLoopGroup;
11
12 import java.net.InetSocketAddress;
13
14 public class ConfigPusherConfigurationBuilder {
15     InetSocketAddress netconfAddress;
16     EventLoopGroup eventLoopGroup;
17
18     long netconfCapabilitiesWaitTimeoutMs = ConfigPusherConfiguration.DEFAULT_NETCONF_CAPABILITIES_WAIT_TIMEOUT_MS;
19     int netconfSendMessageDelayMs = ConfigPusherConfiguration.DEFAULT_NETCONF_SEND_MESSAGE_DELAY_MS;
20     int netconfSendMessageMaxAttempts = ConfigPusherConfiguration.DEFAULT_NETCONF_SEND_MESSAGE_MAX_ATTEMPTS;
21     int connectionAttemptDelayMs = ConfigPusherConfiguration.DEFAULT_CONNECTION_ATTEMPT_DELAY_MS;
22     long connectionAttemptTimeoutMs = ConfigPusherConfiguration.DEFAULT_CONNECTION_ATTEMPT_TIMEOUT_MS;
23     int netconfPushConfigAttempts = ConfigPusherConfiguration.DEFAULT_NETCONF_PUSH_CONFIG_ATTEMPTS;
24     long netconfPushConfigDelayMs = ConfigPusherConfiguration.DEFAULT_NETCONF_PUSH_CONFIG_DELAY_MS;
25
26     private ConfigPusherConfigurationBuilder() {
27     }
28
29     public static ConfigPusherConfigurationBuilder aConfigPusherConfiguration() {
30         return new ConfigPusherConfigurationBuilder();
31     }
32
33     public ConfigPusherConfigurationBuilder withNetconfAddress(InetSocketAddress netconfAddress) {
34         this.netconfAddress = netconfAddress;
35         return this;
36     }
37
38     public ConfigPusherConfigurationBuilder withNetconfCapabilitiesWaitTimeoutMs(long netconfCapabilitiesWaitTimeoutMs) {
39         this.netconfCapabilitiesWaitTimeoutMs = netconfCapabilitiesWaitTimeoutMs;
40         return this;
41     }
42
43     public ConfigPusherConfigurationBuilder withNetconfSendMessageDelayMs(int netconfSendMessageDelayMs) {
44         this.netconfSendMessageDelayMs = netconfSendMessageDelayMs;
45         return this;
46     }
47
48     public ConfigPusherConfigurationBuilder withNetconfSendMessageMaxAttempts(int netconfSendMessageMaxAttempts) {
49         this.netconfSendMessageMaxAttempts = netconfSendMessageMaxAttempts;
50         return this;
51     }
52
53     public ConfigPusherConfigurationBuilder withConnectionAttemptDelayMs(int connectionAttemptDelayMs) {
54         this.connectionAttemptDelayMs = connectionAttemptDelayMs;
55         return this;
56     }
57
58     public ConfigPusherConfigurationBuilder withConnectionAttemptTimeoutMs(long connectionAttemptTimeoutMs) {
59         this.connectionAttemptTimeoutMs = connectionAttemptTimeoutMs;
60         return this;
61     }
62
63     public ConfigPusherConfigurationBuilder withEventLoopGroup(EventLoopGroup eventLoopGroup) {
64         this.eventLoopGroup = eventLoopGroup;
65         return this;
66     }
67
68     public ConfigPusherConfigurationBuilder withNetconfPushConfigAttempts(int netconfPushConfigAttempts) {
69         this.netconfPushConfigAttempts = netconfPushConfigAttempts;
70         return this;
71     }
72
73     public ConfigPusherConfigurationBuilder withNetconfPushConfigDelayMs(long netconfPushConfigDelayMs) {
74         this.netconfPushConfigDelayMs = netconfPushConfigDelayMs;
75         return this;
76     }
77
78     public ConfigPusherConfiguration build() {
79         ConfigPusherConfiguration configPusherConfiguration = new ConfigPusherConfiguration(netconfAddress,
80                 netconfCapabilitiesWaitTimeoutMs, netconfSendMessageDelayMs, netconfSendMessageMaxAttempts,
81                 connectionAttemptDelayMs, connectionAttemptTimeoutMs, eventLoopGroup, netconfPushConfigAttempts,
82                 netconfPushConfigDelayMs);
83         return configPusherConfiguration;
84     }
85 }