/* JFox, the OpenSource J2EE Application Server
 *
 * Distributable under GNU LGPL license by gun.org
 * more details please visit http://www.huihoo.org/jfox
 */

package org.jfox.jms.connector;

import java.io.Serializable;

/**
 * @author <a href="mailto:young_yy@hotmail.com">Young Yang</a>
 */

public class Protocol implements Serializable {

    public static final Protocol JRMP = new Protocol("jrmp");
    public static final Protocol JRMP_SSL = new Protocol("jrmp_ssl");
    public static final Protocol SOAP = new Protocol("soap");
    public static final Protocol LOCAL = new Protocol("soap");

    private String protocol = "jrmp";

    private Protocol(String protocol) {
        this.protocol = protocol;
    }

    public String getProtocol() {
        return protocol.toLowerCase();
    }

    public String toString() {
        return protocol.toLowerCase();
    }

    public boolean equals(Object o) {
        if(this == o) return true;
        if(!(o instanceof Protocol)) return false;

        final Protocol prot = (Protocol) o;

        if(!protocol.equals(prot.protocol)) return false;

        return true;
    }

    public int hashCode() {
        return protocol.hashCode();
    }

    public static void main(String[] args) {

    }
}
