/*
 * Copyright 2012 Jeanfrancois Arcand
 *
 * 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 org.atmosphere.wasync;

/**
 * Configure the underlying WebSocket/HTTP provider
 *
 * @author Jeanfrancois Arcand
 */
public class Options {

    private final OptionsBuilder b;

    private Options(OptionsBuilder b) {
        this.b = b;
    }

    public Transport transport() {
        return b.transport;
    }

    public boolean reconnect(){
        return b.reconnect;
    }

    public int reconnectInSeconds(){
        return b.reconnectInSecond;
    }

    public long waitBeforeUnlocking() {
        return b.waitBeforeUnlocking;
    }

    public final static class OptionsBuilder {

        private Transport transport;
        private boolean reconnect = true;
        private int reconnectInSecond = 1;
        public long waitBeforeUnlocking = 2500;

        public OptionsBuilder registerTransport(Transport transport) {
            this.transport = transport;
            return this;
        }

        public OptionsBuilder reconnect(boolean reconnect) {
            this.reconnect = reconnect;
            return this;
        }

        public OptionsBuilder pauseBeforeReconnectInSeconds(int reconnectInSecond) {
            this.reconnectInSecond = reconnectInSecond;
            return this;
        }

        public OptionsBuilder waitBeforeUnlocking(long waitBeforeUnlocking) {
            this.waitBeforeUnlocking = waitBeforeUnlocking;
            return this;
        }

        public Options build(){
            return new Options(this);
        }
    }
}

@@ -1379,460 +1379,1585 @@
     
-public OptionsBuilder registerTransport(Transport transport) %7B%0A            this.transport = transport;%0A            return this;%0A        %7D%0A%0A        public OptionsBuilder reconnect(boolean reconnect) %7B%0A            this.reconnect = reconnect;%0A            return this;%0A        %7D%0A%0A        public OptionsBuilder pauseBeforeReconnectInSeconds(int reconnectInSecond) %7B%0A            this.reconnectInSecond = reconnectInSecond;%0A            return this;%0A        %7D%0A
+/**%0A         * Register a new %7B@link Transport%7D implementation. Register a transport only if you are planning to use%0A         * a different transport than the supported one.%0A         * @param transport %7B@link Transport%7D%0A         * @return this%0A         */%0A        public OptionsBuilder registerTransport(Transport transport) %7B%0A            this.transport = transport;%0A            return this;%0A        %7D%0A%0A        /**%0A         * Automatically reconnect in case the connection get closed. Default is %3Ctt%3Etrue%3C/tt%3E%0A         * @param reconnect reconnect in case the connection get closed. Default is %3Ctt%3Etrue%3C/tt%3E%0A         * @return this%0A         */%0A        public OptionsBuilder reconnect(boolean reconnect) %7B%0A            this.reconnect = reconnect;%0A            return this;%0A        %7D%0A%0A        /**%0A         * The time in second, before the reconnection occurs. Default is 1 second%0A         * @param reconnectInSecond time in second, before the reconnection occurs. Default is 1 second%0A         * @return this%0A         */%0A        public OptionsBuilder pauseBeforeReconnectInSeconds(int reconnectInSecond) %7B%0A            this.reconnectInSecond = reconnectInSecond;%0A            return this;%0A        %7D%0A%0A        /**%0A         * For streaming and long-polling, the server may not send the headers so the client never knows%0A         * if the connection succeeded or not. By defaul the library will wait for 2500 milliseconds before%0A         * considering the connection established.%0A         *%0A         * @param waitBeforeUnlocking the time in millisecond%0A         * @return this%0A         */
 %0A   

Add Javadoc