KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * JORAM: Java(TM) Open Reliable Asynchronous Messaging
3  * Copyright (C) 2004 - Bull SA
4  * Copyright (C) 2004 - ScalAgent Distributed Technologies
5  * Copyright (C) 2004 - France Telecom R&D
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or any later version.
11  *
12  * This library 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 library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20  * USA.
21  *
22  * Initial developer(s): Nicolas Tachker (ScalAgent)
23  * Contributor(s): Frederic Maistre (Bull SA)
24  */

25 package org.objectweb.joram.client.jms.admin;
26
27 import org.objectweb.joram.client.jms.Destination;
28 import org.objectweb.joram.client.jms.Queue;
29 import org.objectweb.joram.client.jms.Topic;
30 import org.objectweb.joram.shared.admin.*;
31
32 import java.net.ConnectException JavaDoc;
33
34
35 /**
36  * The <code>AdminHelper</code> class is a utility class providing methods
37  * for building special configurations such as topics cluster or hierarchy,
38  * queues cluster, etc.
39  */

40 public class AdminHelper
41 {
42   /**
43    * Links two given topics in a cluster relationship.
44    * <p>
45    * The request fails if one or both of the topics are deleted, or
46    * can't belong to a cluster.
47    *
48    * @param clusterTopic Topic part of the cluster, or chosen as the
49    * initiator of the cluster.
50    * @param joiningTopic Topic joining the cluster.
51    *
52    * @exception ConnectException If the admin connection is closed or broken.
53    * @exception AdminException If the request fails.
54    * @deprecated
55    */

56   public static void setClusterLink(Topic clusterTopic, Topic joiningTopic)
57          throws ConnectException JavaDoc, AdminException
58   {
59     AdminModule.doRequest(new SetCluster(clusterTopic.getName(),
60                                          joiningTopic.getName()));
61   }
62
63   /**
64    * Removes a topic from the cluster it is part of.
65    * <p>
66    * The request fails if the topic does not exist or is not part of any
67    * cluster.
68    *
69    * @param topic Topic leaving the cluster it is part of.
70    *
71    * @exception ConnectException If the admin connection is closed or broken.
72    * @exception AdminException If the request fails.
73    * @deprecated
74    */

75   public static void unsetClusterLink(Topic topic)
76          throws ConnectException JavaDoc, AdminException
77   {
78     AdminModule.doRequest(new UnsetCluster(topic.getName()));
79   }
80
81   /**
82    * Links two given topics in a hierarchical relationship.
83    * <p>
84    * The request fails if one of the topics does not exist or can't be part
85    * of a hierarchy.
86    *
87    * @param father Father.
88    * @param son Son.
89    *
90    * @exception ConnectException If the admin connection is closed or broken.
91    * @exception AdminException If the request fails.
92    * @deprecated
93    */

94   public static void setHierarchicalLink(Topic father, Topic son)
95          throws ConnectException JavaDoc, AdminException
96   {
97     AdminModule.doRequest(new SetFather(father.getName(), son.getName()));
98   }
99
100   /**
101    * Unsets the father of a given topic.
102    * <p>
103    * The request fails if the topic does not exist or is not part of any
104    * hierarchy.
105    *
106    * @param topic Topic which father is unset.
107    *
108    * @exception ConnectException If the admin connection is closed or broken.
109    * @exception AdminException If the request fails.
110    * @deprecated
111    */

112   public static void unsetHierarchicalLink(Topic topic)
113          throws ConnectException JavaDoc, AdminException
114   {
115     AdminModule.doRequest(new UnsetFather(topic.getName()));
116   }
117
118
119   /**
120    * Adds a queue to a cluster.
121    * <p>
122    * The request fails if one or both of the queues are deleted, or
123    * can't belong to a cluster.
124    *
125    * @param clusterQueue Queue part of the cluster, or chosen as the
126    * initiator of the cluster.
127    * @param joiningQueue Queue joining the cluster.
128    *
129    * @exception ConnectException If the admin connection is closed or broken.
130    * @exception AdminException If the request fails.
131    * @deprecated
132    */

133   public static void setQueueCluster(Queue clusterQueue, Queue joiningQueue)
134     throws ConnectException JavaDoc, AdminException {
135     AdminModule.doRequest(
136       new AddQueueCluster(clusterQueue.getName(), joiningQueue.getName()));
137   }
138
139   public static void setQueueCluster(Destination clusterQueue,
140                                      Queue joiningQueue)
141     throws ConnectException JavaDoc, AdminException {
142     AdminModule.doRequest(
143       new AddQueueCluster(clusterQueue.getName(), joiningQueue.getName()));
144   }
145
146   /**
147    * Removes a queue from the cluster Queue it is part of.
148    * <p>
149    * The request fails if the queue does not exist or is not part of any
150    * cluster.
151    *
152    * @param clusterQueue the cluster Queue.
153    * @param leaveQueue Queue leaving the cluster Queue it is part of.
154    *
155    * @exception ConnectException If the admin connection is closed or broken.
156    * @exception AdminException If the request fails.
157    * @deprecated
158    */

159   public static void leaveQueueCluster(Queue clusterQueue, Queue leaveQueue)
160     throws ConnectException JavaDoc, AdminException {
161     AdminModule.doRequest(
162       new RemoveQueueCluster(clusterQueue.getName(), leaveQueue.getName()));
163   }
164
165   /**
166    * List a cluster queue.
167    *
168    * @param clusterQueue the cluster Queue.
169    *
170    * @exception ConnectException If the admin connection is closed or broken.
171    * @exception AdminException If the request fails.
172    * @deprecated
173    */

174   public static AdminReply listQueueCluster(Queue clusterQueue)
175     throws ConnectException JavaDoc, AdminException {
176     return AdminModule.doRequest(
177       new ListClusterQueue(clusterQueue.getName()));
178   }
179 }
180
Popular Tags