1 /***
2 * Redistribution and use of this software and associated documentation
3 * ("Software"), with or without modification, are permitted provided
4 * that the following conditions are met:
5 *
6 * 1. Redistributions of source code must retain copyright
7 * statements and notices. Redistributions must also contain a
8 * copy of this document.
9 *
10 * 2. Redistributions in binary form must reproduce the
11 * above copyright notice, this list of conditions and the
12 * following disclaimer in the documentation and/or other
13 * materials provided with the distribution.
14 *
15 * 3. The name "Exolab" must not be used to endorse or promote
16 * products derived from this Software without prior written
17 * permission of Exoffice Technologies. For written permission,
18 * please contact info@exolab.org.
19 *
20 * 4. Products derived from this Software may not be called "Exolab"
21 * nor may "Exolab" appear in their names without prior written
22 * permission of Exoffice Technologies. Exolab is a registered
23 * trademark of Exoffice Technologies.
24 *
25 * 5. Due credit should be given to the Exolab Project
26 * (http://www.exolab.org/).
27 *
28 * THIS SOFTWARE IS PROVIDED BY EXOFFICE TECHNOLOGIES AND CONTRIBUTORS
29 * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
30 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
31 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
32 * EXOFFICE TECHNOLOGIES OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
33 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
34 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
35 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
37 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
38 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
39 * OF THE POSSIBILITY OF SUCH DAMAGE.
40 *
41 * Copyright 2000-2001,2003 (C) Exoffice Technologies Inc. All Rights Reserved.
42 *
43 * $Id: IntravmJmsAdminConnection.java,v 1.11 2003/08/17 01:32:21 tanderson Exp $
44 */
45 package org.exolab.jms.administration.intravm;
46
47 import java.util.Vector;
48
49 import javax.jms.JMSException;
50
51 import org.apache.commons.logging.Log;
52 import org.apache.commons.logging.LogFactory;
53
54 import org.exolab.core.service.ServiceManager;
55 import org.exolab.jms.administration.JmsAdminServerIfc;
56 import org.exolab.jms.server.AdminConnection;
57 import org.exolab.jms.server.AdminConnectionManager;
58 import org.exolab.jms.util.UUID;
59
60
61 /***
62 * This class is repsonsible for an admin connection to the intravm server
63 *
64 * @version $Revision: 1.11 $ $Date: 2003/08/17 01:32:21 $
65 * @author <a href="mailto:tima@Tim Anderson</a>
66 */
67 public class IntravmJmsAdminConnection implements JmsAdminServerIfc,
68 org.exolab.jms.administration.AdminConnection {
69
70 /***
71 * The logger
72 */
73 private static final Log _log =
74 LogFactory.getLog(IntravmJmsAdminConnection.class);
75
76 /***
77 * The adminConnection
78 */
79 private AdminConnection _admin;
80
81
82 /***
83 * Construct a new <code>IntravmJmsAdminConnection</code>
84 *
85 * @param username the admin user name
86 * @param password the admin password
87 * @throws JMSEXception if the client cannot be authenticated
88 */
89 public IntravmJmsAdminConnection(String username, String password)
90 throws JMSException {
91
92 String clientId = UUID.next();
93 _admin = AdminConnectionManager.instance().createConnection(
94 clientId, username, password);
95 }
96
97 // implementation of JmsAdminServerIfc.addDurableConsumer
98 public boolean addDurableConsumer(String topic, String name)
99 throws JMSException {
100 return _admin.addDurableConsumer(topic, name);
101 }
102
103 // implementation of JmsAdminServerIfc.removeDurableConsumer
104 public boolean removeDurableConsumer(String name) throws JMSException {
105 return _admin.removeDurableConsumer(name);
106 }
107
108 // implementation of JmsAdminServerIfc.durableConsumerExists
109 public boolean durableConsumerExists(String name) throws JMSException {
110 return _admin.durableConsumerExists(name);
111 }
112
113 // implementation of JmsAdminServerIfc.getDurableConsumers
114 public Vector getDurableConsumers(String topic) throws JMSException {
115 return _admin.getDurableConsumers(topic);
116 }
117
118 // implementation of JmsAdminServerIfc.removeDurableConsumer
119 public boolean unregisterConsumer(String name) throws JMSException {
120 return _admin.unregisterConsumer(name);
121 }
122
123 // implementation of JmsAdminServerIfc.isConnected
124 public boolean isConnected(String name) throws JMSException {
125 return _admin.isConnected(name);
126 }
127
128 // implementation of JmsAdminServerIfc.addDestination
129 public boolean addDestination(String destination, Boolean queue)
130 throws JMSException {
131 return _admin.addDestination(destination, queue);
132 }
133
134 // implementation of JmsAdminServerIfc.removeDestination
135 public boolean removeDestination(String name) throws JMSException {
136 return _admin.removeDestination(name);
137 }
138
139 // implementation of JmsAdminServerIfc.destinationExists
140 public boolean destinationExists(String name) throws JMSException {
141 return _admin.destinationExists(name);
142 }
143
144 // implementation of JmsAdminServerIfc.getAllDestinations
145 public Vector getAllDestinations() throws JMSException {
146 return _admin.getAllDestinations();
147 }
148
149 // implementation of JmsAdminServerIfc.getDurableConsumerMessageCount
150 public int getDurableConsumerMessageCount(String topic, String name)
151 throws JMSException {
152 return _admin.getDurableConsumerMessageCount(topic, name);
153 }
154
155 // implementation of JmsAdminServerIfc.getDurableConsumerMessageCount
156 public int getQueueMessageCount(String queue) throws JMSException {
157 return _admin.getQueueMessageCount(queue);
158 }
159
160 // implementation of JmsAdminServerIfc.purgeMessages
161 public int purgeMessages() throws JMSException {
162 return _admin.purgeMessages();
163 }
164
165 // implementation of JmsAdminServerIfc.stopServer
166 public void stopServer() throws JMSException {
167 // TODO: shouldn't need to do this directly - should be
168 // done via the admin interface. Unfortunately,
169 // JmsAdmin.stopServer() invokes System.exit()
170 ServiceManager.instance().removeAll();
171 }
172
173 // implementation of JmsAdminServerIfc.close
174 public void close() {
175 }
176
177 // implementation of JmsAdminServerIfc.addUser
178 public boolean addUser(String username, String password)
179 throws JMSException {
180 return _admin.addUser(username, password);
181 }
182
183 // implementation of JmsAdminServerIfc.getAllUsers
184 public Vector getAllUsers() throws JMSException {
185 return _admin.getAllUsers();
186 }
187
188 // implementation of JmsAdminServerIfc.removeUser
189 public boolean removeUser(String username) throws JMSException {
190 return _admin.removeUser(username);
191 }
192
193 // implementation of JmsAdminServerIfc.changePassword
194 public boolean changePassword(String username, String password)
195 throws JMSException {
196 return _admin.changePassword(username, password);
197 }
198
199 } //-- IntravmJmsAdminConnection
This page was automatically generated by Maven