KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > joram > client > jms > admin > DeadMQueue


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):
23  */

24 package org.objectweb.joram.client.jms.admin;
25
26 import org.objectweb.joram.client.jms.Queue;
27 import org.objectweb.joram.client.jms.Destination;
28
29 import java.net.ConnectException JavaDoc;
30
31
32 /**
33  * The <code>DeadMQueue</code> class allows administrators to manipulate
34  * dead message queues.
35  */

36 public class DeadMQueue extends org.objectweb.joram.client.jms.Queue {
37
38   private final static String JavaDoc DMQ_TYPE = "queue.dmq";
39
40   public static boolean isDeadMQueue(String JavaDoc type) {
41     return Destination.isAssignableTo(type, DMQ_TYPE);
42   }
43
44   /**
45    * Admin method creating and deploying a dead message queue on a given
46    * server.
47    * <p>
48    * The request fails if the target server does not belong to the platform,
49    * or if the destination deployement fails server side.
50    *
51    * @param serverId The identifier of the server where deploying the queue.
52    *
53    * @exception ConnectException If the admin connection is closed or broken.
54    * @exception AdminException If the request fails.
55    */

56   public static Queue create(int serverId) throws ConnectException JavaDoc, AdminException {
57     DeadMQueue dmq = new DeadMQueue();
58     doCreate(serverId,
59              null,
60              "org.objectweb.joram.mom.dest.DeadMQueue",
61              null,
62              dmq,
63              DMQ_TYPE);
64     return dmq;
65   }
66
67   public static Queue create(int serverId, String JavaDoc name) throws ConnectException JavaDoc, AdminException {
68     DeadMQueue dmq = new DeadMQueue();
69     doCreate(serverId,
70              name,
71              "org.objectweb.joram.mom.dest.DeadMQueue",
72              null,
73              dmq,
74              DMQ_TYPE);
75     return dmq;
76   }
77
78   /**
79    * Admin method creating and deploying a dead message queue on the
80    * local server.
81    * <p>
82    * The request fails if the destination deployement fails server side.
83    *
84    * @exception ConnectException If the admin connection is closed or broken.
85    * @exception AdminException If the request fails.
86    */

87   public static Queue create() throws ConnectException JavaDoc, AdminException
88   {
89     return create(AdminModule.getLocalServerId());
90   }
91
92   // Used by jndi2 SoapObjectHelper
93
public DeadMQueue() {}
94   
95   public DeadMQueue(String JavaDoc name) {
96     super(name, DMQ_TYPE);
97   }
98
99   public String JavaDoc toString() {
100     return "DeadMQueue:" + agentId;
101   }
102 }
103
Popular Tags