/*
 * Copyright 2015 the original author or authors.
 *
 * 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 net.kuujo.copycat;

import net.kuujo.copycat.raft.ManagedProtocol;
import net.kuujo.copycat.raft.RaftClient;

/**
 * Copycat client.
 *
 * @author <a href="http://github.com/kuujo">Jordan Halterman</a>
 */
public class CopycatClient extends Copycat {

  /**
   * Returns a new Copycat client builder.
   *
   * @return A new Copycat client builder.
   */
  public static Builder builder() {
    return new Builder();
  }

  public CopycatClient(ManagedProtocol protocol, ClassLoader classLoader) {
    super(protocol, classLoader);
  }

  /**
   * Client builder.
   */
  public static class Builder implements Copycat.Builder<CopycatClient> {
    private final RaftClient.Builder builder = RaftClient.builder();
    private ClassLoader classLoader = Thread.currentThread().getContextClassLoader();

    private Builder() {
    }

    /**
     * Sets the Copycat class loader.
     *
     * @param classLoader The Copycat class loader.
     * @return The Copycat builder.
     */
    public Builder withClassLoader(ClassLoader classLoader) {
      this.classLoader = classLoader;
      return this;
    }

    @Override
    public CopycatClient build() {
      return new CopycatClient(builder.build(), classLoader);
    }
  }

}

@@ -632,16 +632,65 @@
 pycat;%0A%0A
+import net.kuujo.copycat.cluster.ManagedMembers;%0A
 import n
@@ -728,16 +728,16 @@
 otocol;%0A
-
 import n
@@ -771,16 +771,55 @@
 lient;%0A%0A
+import java.util.concurrent.TimeUnit;%0A%0A
 /**%0A * C
@@ -1500,16 +1500,16 @@
 der();%0A%0A
-
     priv
@@ -1527,24 +1527,1066 @@
 () %7B%0A    %7D%0A%0A
+    /**%0A     * Sets the interval at which to send keep alive requests.%0A     *%0A     * @param keepAliveInterval The interval at which to send keep alive requests.%0A     * @return The client builder.%0A     */%0A    public Builder withKeepAliveInterval(long keepAliveInterval) %7B%0A      builder.withKeepAliveInterval(keepAliveInterval);%0A      return this;%0A    %7D%0A%0A    /**%0A     * Sets the interval at which to send keep alive requests.%0A     *%0A     * @param keepAliveInterval The interval at which to send keep alive requests.%0A     * @param unit The keep alive interval time unit.%0A     * @return The client builder.%0A     */%0A    public Builder withKeepAliveInterval(long keepAliveInterval, TimeUnit unit) %7B%0A      builder.withKeepAliveInterval(keepAliveInterval, unit);%0A      return this;%0A    %7D%0A%0A    /**%0A     * Sets the client seed members.%0A     *%0A     * @param members The client seed members.%0A     * @return The client builder.%0A     */%0A    public Builder withMembers(ManagedMembers members) %7B%0A      builder.withMembers(members);%0A      return this;%0A    %7D%0A%0A
     /**%0A    

Add members configuration to CopycatClient.