KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > mq > SpyTemporaryQueue


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.mq;
23
24 import javax.jms.JMSException JavaDoc;
25 import javax.jms.TemporaryQueue JavaDoc;
26
27 /**
28  * This class implements javax.jms.TemporaryQueue
29  *
30  * @author Norbert Lataille (Norbert.Lataille@m4x.org)
31  * @author Hiram Chirino (Cojonudo14@hotmail.com)
32  * @author <a HREF="mailto:adrian@jboss.org">Adrian Brock</a>
33  * @version $Revision: 37459 $
34  */

35 public class SpyTemporaryQueue extends SpyQueue implements TemporaryQueue JavaDoc
36 {
37    // Constants -----------------------------------------------------
38

39    /** The serialVersionUID */
40    static final long serialVersionUID = 1216493383395688001L;
41    
42    // Attributes ----------------------------------------------------
43

44    /** The DistributedConnection of its creator */
45    ConnectionToken dc;
46
47    /** Connection to the creator used from the client side */
48    private transient Connection con = null;
49    
50    // Static --------------------------------------------------------
51

52    // Constructors --------------------------------------------------
53

54    /**
55     * Create a new SpyTemporaryQueue
56     *
57     * @param queueName the queue name
58     * @param dc_ the connection token
59     */

60    public SpyTemporaryQueue(String JavaDoc queueName, ConnectionToken dc_)
61    {
62       super(queueName);
63       dc = dc_;
64    }
65    
66    // Public --------------------------------------------------------
67

68    /**
69     * Client-side temporary queues need a reference to the connection that
70     * created them in case delete() is called.
71     *
72     * @param con the connection
73     */

74    public void setConnection(Connection con)
75    {
76       this.con = con;
77    }
78    
79    // TemporaryQueue implementation ---------------------------------
80

81    public void delete() throws JMSException JavaDoc
82    {
83       try
84       {
85          con.deleteTemporaryDestination(this);
86       }
87       catch (Exception JavaDoc e)
88       {
89          throw new SpyJMSException("Cannot delete the TemporaryQueue", e);
90       }
91    }
92    
93    // Package protected ---------------------------------------------
94

95    // Protected -----------------------------------------------------
96

97    // Private -------------------------------------------------------
98

99    // Inner classes -------------------------------------------------
100
}
Popular Tags