Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: /jms4spread/src/java/org/tigris/jms4spread/

jms4spread
Discussion topic

Back to topic list

CVS update: /jms4spread/src/java/org/tigris/jms4spread/

Reply

Author dlr
Full name Daniel Rall
Date 2002-07-21 18:05:48 PDT
Message User: dlr
Date: 02/07/21 18:05:48

Added
 /jms4spread/src/java​/org/tigris/jms4spre​ad/
  JMSConnection.java

Log
 Interface to a <code>SpreadCo​nnection</code​> object. Still need to
 implement start() and stop().

File Changes:

Directory: /jms4spread/src/java​/org/tigris/jms4spre​ad/
====================​====================​==============

File [added]: JMSConnection.java
Url: http://jms4spread.ti​gris.org/source/brow​se/jms4spread/src/ja​va/org/tigris/jms4sp​read/JMSConnection.j​ava?rev=1.1&cont​ent-type=text/x-cvsw​eb-markup
Added lines: 117
----------------
package org.tigris.jms4spread;

import javax.jms.ConnectionMetaData;
import javax.jms.ExceptionListener;
import javax.jms.InvalidCli​entIDException;
import javax.jms.JMSException;
import javax.jms.Connection;

import spread.SpreadConnection;
import spread.SpreadException;

/**
 * Interface to a <code>SpreadCo​nnection</code​> object.
 *
 * @author <a href="mailto:dlr@fin​emaltcoding.com">​Daniel Rall</a>
 * @since 0.1
 */
public abstract class JMSConnection
    implements Connection
{
    private SpreadConnection conn;

    /**
     * The client identifier for this connection. Passed to the
     * <code>SpreadCo​nnection.connect()​</code> method. This reference
     * is necessary because <code>SpreadCo​nnection</code​> does not
     * provide an accessor method.
     */
    private String privateName;

    private ExceptionListener listener;

    protected JMSConnection(SpreadConnection conn)
    {
        this.conn = conn;
        privateName = null;
    }

    protected JMSConnection()
    {
        this(new SpreadConnection());
    }

    public void close()
        throws JMSException
    {
        try
        {
            conn.disconnect();
        }
        catch (SpreadException e)
        {
            // TODO: Include stack trace
            throw new JMSException(e.getMessage());
        }
    }

    public String getClientID()
        throws JMSException
    {
        return privateName;
    }

    /**
     * Spread imposes a ten character limit on the length of
     * <code>clientID​</code>.
     *
     * @throws IllegalStateException Client id already set.
     * @throws InvalidClientIDException Client id exceeds length
     * limitations.
     */
    public synchronized void setClientID(String clientID)
        throws JMSException
    {
        if (privateName != null)
        {
            throw new IllegalStateException("Client id may only be set once");
        }

        if (clientID.length() > 10)
        {
            throw new InvalidClientIDException
                ("Max client id length is 10 characters");
        }

        privateName = clientID;
    }

    public ExceptionListener getExceptionListener()
    {
        return listener;
    }

    public void setExceptionListener​(ExceptionListener listener)
        throws JMSException
    {
        this.listener = listener;
    }

    public ConnectionMetaData getMetaData()
        throws JMSException
    {
        return JMSConnectionMetaDat​a.getInstance();
    }

    public void start()
        throws JMSException
    {
        // TODO
    }

    public void stop()
        throws JMSException
    {
        // TODO
    }
}




--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: cvs-unsubscribe@jms4​spread.tigris.org
For additional commands, e-mail: cvs-help at jms4spread dot tigris dot org

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

CVS update: /jms4spread/src/java/org/tigris/jms4spread/ dlr Daniel Rall 2002-07-21 18:05:48 PDT
Messages per page: