package org.mockejb.jms;

import java.util.Enumeration;
import java.util.NoSuchElementException;

import javax.jms.ConnectionMetaData;
import javax.jms.JMSException;

/**
 * Connection meta data for MockEjb JMS implementation.
 * 
 * @author Dimitar Gospodinov
 * @see javax.jms.ConnectionMetaData
 */
class ConnectionMetaDataImpl implements ConnectionMetaData {

    /**
     * @see javax.jms.ConnectionMetaData#getJMSVersion()
     */
    public String getJMSVersion() throws JMSException {
        return getJMSMajorVersion() + "." + getJMSMinorVersion();
    }

    /**
     * @see javax.jms.ConnectionMetaData#getJMSMajorVersion()
     */
    public int getJMSMajorVersion() throws JMSException {
        return 1;
    }

    /**
     * @see javax.jms.ConnectionMetaData#getJMSMinorVersion()
     */
    public int getJMSMinorVersion() throws JMSException {
        return 1;
    }

    /**
     * @see javax.jms.ConnectionMetaData#getJMSProviderName()
     */
    public String getJMSProviderName() throws JMSException {
        return "MockEjb";
    }

    /**
     * @see javax.jms.ConnectionMetaData#getProviderVersion()
     */
    public String getProviderVersion() throws JMSException {
        return getProviderMajorVersion() + "." + getProviderMinorVersion();
    }

    /**
     * @see javax.jms.ConnectionMetaData#getProviderMajorVersion()
     */
    public int getProviderMajorVersion() throws JMSException {
        return 1;
    }

    /**
     * @see javax.jms.ConnectionMetaData#getProviderMinorVersion()
     */
    public int getProviderMinorVersion() throws JMSException {
        return 0;
    }

    /**
     * Returns empty <code>Enumeration</code>
     * @see javax.jms.ConnectionMetaData#getJMSXPropertyNames()
     */
    public Enumeration getJMSXPropertyNames() throws JMSException {
        return new Enumeration() {
            public boolean hasMoreElements() {
                return false;
            }
            public Object nextElement() {
                throw new NoSuchElementException();
            }
        };
    }

}