KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > scalagent > kjoram > Queue


1 /*
2  * JORAM: Java(TM) Open Reliable Asynchronous Messaging
3  * Copyright (C) 2001 - ScalAgent Distributed Technologies
4  * Copyright (C) 1996 - Dyade
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA.
20  *
21  * Initial developer(s): Frederic Maistre (INRIA)
22  * Contributor(s): Nicolas Tachker (ScalAgent)
23  */

24 package com.scalagent.kjoram;
25
26 import com.scalagent.kjoram.admin.AdministeredObject;
27
28 import java.util.Vector JavaDoc;
29 import java.util.Hashtable JavaDoc;
30
31 import com.scalagent.kjoram.excepts.JMSException;
32
33
34 public class Queue extends Destination
35 {
36   /**
37    * Constructs a queue.
38    *
39    * @param agentId Identifier of the queue agent.
40    */

41   public Queue(String JavaDoc agentId)
42   {
43     super(agentId);
44   }
45
46   /**
47    * Constructs an empty queue.
48    */

49   public Queue()
50   {}
51
52   /** Returns a String image of the queue. */
53   public String JavaDoc toString()
54   {
55     return "Queue:" + agentId;
56   }
57
58   /**
59    * API method.
60    *
61    * @exception JMSException Actually never thrown.
62    */

63   public String JavaDoc getQueueName() throws JMSException
64   {
65     return agentId;
66   }
67
68   public Hashtable JavaDoc code() {
69      return super.code();
70   }
71
72   public static Object JavaDoc decode(Hashtable JavaDoc h) {
73     Queue ret =
74       new Queue((String JavaDoc) h.get("agentId"));
75     //ret.setId(ret.getClass().getName() + ":" + agentId);
76
ret.addInstanceTable(ret.getId(), ret);
77     return ret;
78   }
79 }
80
Popular Tags