001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.mq;
023:
024: import java.io.Serializable;
025:
026: import javax.jms.Queue;
027: import javax.naming.Reference;
028: import javax.naming.Referenceable;
029: import javax.naming.StringRefAddr;
030:
031: /**
032: * This class implements javax.jms.Queue
033: *
034: * @author Norbert Lataille (Norbert.Lataille@m4x.org)
035: * @author Hiram Chirino (Cojonudo14@hotmail.com)
036: * @author David Maplesden (David.Maplesden@orion.co.nz)
037: * @author <a href="mailto:adrian@jboss.org">Adrian Brock</a>
038: * @version $Revision: 57198 $
039: */
040: public class SpyQueue extends SpyDestination implements Serializable,
041: Queue, Referenceable {
042: // Constants -----------------------------------------------------
043:
044: /** The serialVersionUID */
045: static final long serialVersionUID = 3040902899515975733L;
046:
047: // Attributes ----------------------------------------------------
048:
049: /** added cached toString string for efficiency */
050: private String toStringStr;
051:
052: // Static --------------------------------------------------------
053:
054: // Constructors --------------------------------------------------
055:
056: /**
057: * Create a new SpyQueue
058: *
059: * @param queueName the queue name
060: */
061: public SpyQueue(String queueName) {
062: super (queueName);
063: toStringStr = "QUEUE." + name;
064: hash++;
065: }
066:
067: // Public --------------------------------------------------------
068:
069: // Queue implementation ------------------------------------------
070:
071: public String getQueueName() {
072: return name;
073: }
074:
075: // Referenceable implementation ----------------------------------
076:
077: public Reference getReference() throws javax.naming.NamingException {
078:
079: return new Reference(
080: "org.jboss.mq.SpyQueue",
081: new StringRefAddr("name", name),
082: "org.jboss.mq.referenceable.SpyDestinationObjectFactory",
083: null);
084: }
085:
086: // Object overrides ----------------------------------------------
087:
088: public String toString() {
089: return toStringStr;
090: }
091:
092: public boolean equals(Object obj) {
093: if (!(obj instanceof SpyQueue))
094: return false;
095: if (obj.hashCode() != hash)
096: return false;
097: return ((SpyQueue) obj).name.equals(name);
098: }
099:
100: // Package protected ---------------------------------------------
101:
102: // Protected -----------------------------------------------------
103:
104: // Private -------------------------------------------------------
105:
106: // Inner classes -------------------------------------------------
107: }
|