2 * Copyright (c) 2013 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.controller.netconf.persist.impl;
10 import io.netty.channel.EventLoopGroup;
12 import java.net.InetSocketAddress;
14 public class ConfigPusherConfigurationBuilder {
15 InetSocketAddress netconfAddress;
16 EventLoopGroup eventLoopGroup;
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;
26 private ConfigPusherConfigurationBuilder() {
29 public static ConfigPusherConfigurationBuilder aConfigPusherConfiguration() {
30 return new ConfigPusherConfigurationBuilder();
33 public ConfigPusherConfigurationBuilder withNetconfAddress(InetSocketAddress netconfAddress) {
34 this.netconfAddress = netconfAddress;
38 public ConfigPusherConfigurationBuilder withNetconfCapabilitiesWaitTimeoutMs(long netconfCapabilitiesWaitTimeoutMs) {
39 this.netconfCapabilitiesWaitTimeoutMs = netconfCapabilitiesWaitTimeoutMs;
43 public ConfigPusherConfigurationBuilder withNetconfSendMessageDelayMs(int netconfSendMessageDelayMs) {
44 this.netconfSendMessageDelayMs = netconfSendMessageDelayMs;
48 public ConfigPusherConfigurationBuilder withNetconfSendMessageMaxAttempts(int netconfSendMessageMaxAttempts) {
49 this.netconfSendMessageMaxAttempts = netconfSendMessageMaxAttempts;
53 public ConfigPusherConfigurationBuilder withConnectionAttemptDelayMs(int connectionAttemptDelayMs) {
54 this.connectionAttemptDelayMs = connectionAttemptDelayMs;
58 public ConfigPusherConfigurationBuilder withConnectionAttemptTimeoutMs(long connectionAttemptTimeoutMs) {
59 this.connectionAttemptTimeoutMs = connectionAttemptTimeoutMs;
63 public ConfigPusherConfigurationBuilder withEventLoopGroup(EventLoopGroup eventLoopGroup) {
64 this.eventLoopGroup = eventLoopGroup;
68 public ConfigPusherConfigurationBuilder withNetconfPushConfigAttempts(int netconfPushConfigAttempts) {
69 this.netconfPushConfigAttempts = netconfPushConfigAttempts;
73 public ConfigPusherConfigurationBuilder withNetconfPushConfigDelayMs(long netconfPushConfigDelayMs) {
74 this.netconfPushConfigDelayMs = netconfPushConfigDelayMs;
78 public ConfigPusherConfiguration build() {
79 ConfigPusherConfiguration configPusherConfiguration = new ConfigPusherConfiguration(netconfAddress,
80 netconfCapabilitiesWaitTimeoutMs, netconfSendMessageDelayMs, netconfSendMessageMaxAttempts,
81 connectionAttemptDelayMs, connectionAttemptTimeoutMs, eventLoopGroup, netconfPushConfigAttempts,
82 netconfPushConfigDelayMs);
83 return configPusherConfiguration;