KickJava   Java API By Example, From Geeks To Geeks.

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


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 java.io.Serializable JavaDoc;
25
26 import javax.jms.Queue JavaDoc;
27 import javax.naming.Reference JavaDoc;
28 import javax.naming.Referenceable JavaDoc;
29 import javax.naming.StringRefAddr JavaDoc;
30
31 /**
32  * This class implements javax.jms.Queue
33  *
34  * @author Norbert Lataille (Norbert.Lataille@m4x.org)
35  * @author Hiram Chirino (Cojonudo14@hotmail.com)
36  * @author David Maplesden (David.Maplesden@orion.co.nz)
37  * @author <a HREF="mailto:adrian@jboss.org">Adrian Brock</a>
38  * @version $Revision: 37459 $
39  */

40 public class SpyQueue extends SpyDestination implements Serializable JavaDoc, Queue JavaDoc, Referenceable JavaDoc
41 {
42    // Constants -----------------------------------------------------
43

44    /** The serialVersionUID */
45    static final long serialVersionUID = 3040902899515975733L;
46    
47    // Attributes ----------------------------------------------------
48

49    /** added cached toString string for efficiency */
50    private String JavaDoc toStringStr;
51    // Static --------------------------------------------------------
52

53    // Constructors --------------------------------------------------
54

55    
56    /**
57     * Create a new SpyQueue
58     *
59     * @param queueName the queue name
60     */

61    public SpyQueue(String JavaDoc queueName)
62    {
63       super(queueName);
64       toStringStr = "QUEUE." + name;
65       hash++;
66    }
67    
68    // Public --------------------------------------------------------
69

70    // Queue implementation ------------------------------------------
71

72    public String JavaDoc getQueueName()
73    {
74       return name;
75    }
76    
77    // Referenceable implementation ----------------------------------
78

79    public Reference JavaDoc getReference() throws javax.naming.NamingException JavaDoc
80    {
81
82       return new Reference JavaDoc("org.jboss.mq.SpyQueue", new StringRefAddr JavaDoc("name", name),
83             "org.jboss.mq.referenceable.SpyDestinationObjectFactory", null);
84    }
85
86    // Object overrides ----------------------------------------------
87

88    public String JavaDoc toString()
89    {
90       return toStringStr;
91    }
92    
93    public boolean equals(Object JavaDoc obj)
94    {
95       if (!(obj instanceof SpyQueue))
96          return false;
97       if (obj.hashCode() != hash)
98          return false;
99       return ((SpyQueue) obj).name.equals(name);
100    }
101    
102    // Package protected ---------------------------------------------
103

104    // Protected -----------------------------------------------------
105

106    // Private -------------------------------------------------------
107

108    // Inner classes -------------------------------------------------
109
}
Popular Tags