/* 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;

import java.io.Serializable;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.Queue;
import javax.jms.Topic;

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

public abstract class JMSDestination implements Destination,
        Queue,
        Topic,
        Serializable {
    private String name;

    public JMSDestination(String name) {
        this.name = name;
    }

    public String toString() {
        return "JFoxMS [" + (isTopic() ? "Topic" : "Queue") + "] " + getName();
    }

    protected String getName() {
        return name;
    }

    public String getQueueName() throws JMSException {
        return getName();
    }

    public String getTopicName() throws JMSException {
        return getName();
    }

    protected abstract boolean isTopic();


    public static void main(String[] args) {

    }
}
