// Path: core/src/main/java/com/comcast/viper/flume2storm/F2SConfigurationException.java
// @SuppressWarnings("javadoc")
// public class F2SConfigurationException extends Exception {
//   private static final long serialVersionUID = 4941423443352427505L;
// 
//   /**
//    * @param config
//    *          The configuration that contains the invalid parameter
//    * @param parameter
//    *          The name of the configuration parameter that is invalid
//    * @param throwable
//    *          The exception that occurred when setting the parameter's value
//    * @return The newly built F2SConfigurationException related to a specific
//    *         invalid parameter
//    */
//   public static F2SConfigurationException with(Configuration config, String parameter, Throwable throwable) {
//     return F2SConfigurationException.with(parameter, config.getProperty(parameter), throwable);
//   }
// 
//   /**
//    * @param parameter
//    *          The name of the configuration parameter that is invalid
//    * @param value
//    *          The configured value of the parameter
//    * @param throwable
//    *          The exception that occurred when setting the parameter's value
//    * @return The newly built F2SConfigurationException related to a specific
//    *         invalid parameter
//    */
//   public static F2SConfigurationException with(String parameter, Object value, Throwable throwable) {
//     return new F2SConfigurationException(buildErrorMessage(parameter, value, throwable), throwable);
//   }
// 
//   protected static final String buildErrorMessage(String parameter, Object value, Throwable throwable) {
//     return new StringBuilder("Configuration attribute \"").append(parameter).append("\" has invalid value (\"")
//         .append(value).append("\"). ").append(throwable.getClass().getSimpleName()).append(": ")
//         .append(throwable.getLocalizedMessage()).toString();
//   }
// 
//   /**
//    * @param parameter
//    *          The name of the configuration parameter that is missing
//    * @return The newly built F2SConfigurationException related to a specific
//    *         missing parameter
//    */
//   public static F2SConfigurationException missing(String parameter) {
//     return new F2SConfigurationException(new StringBuilder("Configuration attribute \"").append(parameter)
//         .append("\" is required but not specified").toString());
//   }
// 
//   public F2SConfigurationException() {
//     super();
//   }
// 
//   public F2SConfigurationException(String message) {
//     super(message);
//   }
// 
//   public F2SConfigurationException(Throwable throwable) {
//     super(throwable);
//   }
// 
//   public F2SConfigurationException(String message, Throwable throwable) {
//     super(message, throwable);
//   }
// }


import java.io.Serializable;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.comcast.viper.flume2storm.F2SConfigurationException;
import com.google.common.base.Preconditions;
/**
 * Copyright 2014 Comcast Cable Communications Management, LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.comcast.viper.flume2storm.connection;




/**
 * Configuration for the KryoNet sender and receiver
 */
public class KryoNetParameters implements Serializable {
  private static final long serialVersionUID = -5348116647457735026L;
  /** Configuration attribute base name */
  public static final String CONFIG_BASE_NAME = "kryonet";
  /** Configuration attribute name for {@link #getConnectionTimeout()} */
  public static final String CONNECTION_TIMEOUT = "connection.timeout.in.ms";
  /** Default value for {@value #CONNECTION_TIMEOUT} */
  public static final int CONNECTION_TIMEOUT_DEFAULT = 10000;
  /** Configuration attribute name for {@link #getRetrySleepDelay()} */
  public static final String RETRY_SLEEP_DELAY = "retry.sleep.delay.in.ms";
  /** Default value for {@value #RETRY_SLEEP_DELAY} */
  public static final int RETRY_SLEEP_DELAY_DEFAULT = 50;
  /** Configuration attribute name for {@link #getReconnectionDelay()} */
  public static final String RECONNECTION_DELAY = "reconnection.delay.in.ms";
  /** Default value for {@value #RECONNECTION_DELAY} */
  public static final int RECONNECTION_DELAY_DEFAULT = 2000;
  /** Configuration attribute name for {@link #getTerminationTimeout()} */
  public static final String TERMINATION_TO = "termination.timeout.in.ms";
  /** Default value for {@value #TERMINATION_TO} */
  public static final int TERMINATION_TO_DEFAULT = 10000;
  /** Configuration attribute name for {@link #getMaxRetries()} */
  public static final String MAX_RETRIES = "max.retries";
  /** Default value for {@value #MAX_RETRIES} */
  public static final int MAX_RETRIES_DEFAULT = 3;

  protected int connectionTimeout;
  protected int retrySleepDelay;
  protected int reconnectionDelay;
  protected int terminationTimeout;
  protected int maxRetries;

  /**
   * Builds a new {@link KryoNetParameters} based on a Configuration
   * 
   * @param config
   *          The configuration to use
   * @return The newly created {@link KryoNetParameters}
   * @throws F2SConfigurationException
   *           If the configuration specified is invalid
   */
// Path: core/src/main/java/com/comcast/viper/flume2storm/F2SConfigurationException.java
// @SuppressWarnings("javadoc")
// public class F2SConfigurationException extends Exception {
//   private static final long serialVersionUID = 4941423443352427505L;
// 
//   /**
//    * @param config
//    *          The configuration that contains the invalid parameter
//    * @param parameter
//    *          The name of the configuration parameter that is invalid
//    * @param throwable
//    *          The exception that occurred when setting the parameter's value
//    * @return The newly built F2SConfigurationException related to a specific
//    *         invalid parameter
//    */
//   public static F2SConfigurationException with(Configuration config, String parameter, Throwable throwable) {
//     return F2SConfigurationException.with(parameter, config.getProperty(parameter), throwable);
//   }
// 
//   /**
//    * @param parameter
//    *          The name of the configuration parameter that is invalid
//    * @param value
//    *          The configured value of the parameter
//    * @param throwable
//    *          The exception that occurred when setting the parameter's value
//    * @return The newly built F2SConfigurationException related to a specific
//    *         invalid parameter
//    */
//   public static F2SConfigurationException with(String parameter, Object value, Throwable throwable) {
//     return new F2SConfigurationException(buildErrorMessage(parameter, value, throwable), throwable);
//   }
// 
//   protected static final String buildErrorMessage(String parameter, Object value, Throwable throwable) {
//     return new StringBuilder("Configuration attribute \"").append(parameter).append("\" has invalid value (\"")
//         .append(value).append("\"). ").append(throwable.getClass().getSimpleName()).append(": ")
//         .append(throwable.getLocalizedMessage()).toString();
//   }
// 
//   /**
//    * @param parameter
//    *          The name of the configuration parameter that is missing
//    * @return The newly built F2SConfigurationException related to a specific
//    *         missing parameter
//    */
//   public static F2SConfigurationException missing(String parameter) {
//     return new F2SConfigurationException(new StringBuilder("Configuration attribute \"").append(parameter)
//         .append("\" is required but not specified").toString());
//   }
// 
//   public F2SConfigurationException() {
//     super();
//   }
// 
//   public F2SConfigurationException(String message) {
//     super(message);
//   }
// 
//   public F2SConfigurationException(Throwable throwable) {
//     super(throwable);
//   }
// 
//   public F2SConfigurationException(String message, Throwable throwable) {
//     super(message, throwable);
//   }
// }


// Path: kryonet-flume2storm/src/main/java/com/comcast/viper/flume2storm/connection/KryoNetParameters.java
import java.io.Serializable;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.comcast.viper.flume2storm.F2SConfigurationException;
import com.google.common.base.Preconditions;

/**
 * Copyright 2014 Comcast Cable Communications Management, LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.comcast.viper.flume2storm.connection;




/**
 * Configuration for the KryoNet sender and receiver
 */
public class KryoNetParameters implements Serializable {
  private static final long serialVersionUID = -5348116647457735026L;
  /** Configuration attribute base name */
  public static final String CONFIG_BASE_NAME = "kryonet";
  /** Configuration attribute name for {@link #getConnectionTimeout()} */
  public static final String CONNECTION_TIMEOUT = "connection.timeout.in.ms";
  /** Default value for {@value #CONNECTION_TIMEOUT} */
  public static final int CONNECTION_TIMEOUT_DEFAULT = 10000;
  /** Configuration attribute name for {@link #getRetrySleepDelay()} */
  public static final String RETRY_SLEEP_DELAY = "retry.sleep.delay.in.ms";
  /** Default value for {@value #RETRY_SLEEP_DELAY} */
  public static final int RETRY_SLEEP_DELAY_DEFAULT = 50;
  /** Configuration attribute name for {@link #getReconnectionDelay()} */
  public static final String RECONNECTION_DELAY = "reconnection.delay.in.ms";
  /** Default value for {@value #RECONNECTION_DELAY} */
  public static final int RECONNECTION_DELAY_DEFAULT = 2000;
  /** Configuration attribute name for {@link #getTerminationTimeout()} */
  public static final String TERMINATION_TO = "termination.timeout.in.ms";
  /** Default value for {@value #TERMINATION_TO} */
  public static final int TERMINATION_TO_DEFAULT = 10000;
  /** Configuration attribute name for {@link #getMaxRetries()} */
  public static final String MAX_RETRIES = "max.retries";
  /** Default value for {@value #MAX_RETRIES} */
  public static final int MAX_RETRIES_DEFAULT = 3;

  protected int connectionTimeout;
  protected int retrySleepDelay;
  protected int reconnectionDelay;
  protected int terminationTimeout;
  protected int maxRetries;

  /**
   * Builds a new {@link KryoNetParameters} based on a Configuration
   * 
   * @param config
   *          The configuration to use
   * @return The newly created {@link KryoNetParameters}
   * @throws F2SConfigurationException
   *           If the configuration specified is invalid
   */
  public static KryoNetParameters from(final Configuration config) throws F2SConfigurationException {