View Javadoc

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-2004 (C) Exoffice Technologies Inc. All Rights Reserved.
42   *
43   * $Id: JmsAdminConnectionImpl.java,v 1.2 2005/03/18 04:07:02 tanderson Exp $
44   */
45  package org.exolab.jms.server.net;
46  
47  import java.rmi.RemoteException;
48  import java.util.Vector;
49  
50  import org.exolab.jms.net.orb.ORB;
51  import org.exolab.jms.net.orb.UnicastObject;
52  import org.exolab.jms.server.AdminConnection;
53  import org.exolab.jms.server.AdminConnection;
54  
55  
56  /***
57   * This class implements the RemoteJmsAdminServerIfc and simply delegates all
58   * the request to the JmsAdmin singleton instance.
59   *
60   * @version     $Revision: 1.2 $ $Date: 2005/03/18 04:07:02 $
61   * @author      <a href="mailto:jima@exoffice.com">Jim Alateras</a>
62   * @see         java.rmi.Remote
63   **/
64  public class JmsAdminConnectionImpl
65      extends UnicastObject
66      implements RemoteJmsAdminConnectionIfc {
67  
68      /***
69       * The connection to delegate calls to
70       */
71      protected AdminConnection _connection;
72  
73      /***
74       * Construct a new <code>JmsAdminConnectionImpl</code>
75       *
76       * @param connection the connection to calls delegate to
77       * @param orb the ORB to export this with
78       * @throws RemoteException if this can't be exported
79       */
80      protected JmsAdminConnectionImpl(AdminConnection connection, ORB orb)
81          throws RemoteException {
82          super(orb, null, true);
83          if (connection == null) {
84              throw new IllegalArgumentException("Argument connection is null");
85          }
86  
87          _connection = connection;
88      }
89  
90      // implementation of RemoteJmsAdminServerIfc.removeDurableConsumer
91      public boolean addDurableConsumer(String topic, String name)
92          throws RemoteException {
93          return _connection.addDurableConsumer(topic, name);
94      }
95  
96      // implementation of RemoteJmsAdminServerIfc.removeDurableConsumer
97      public boolean removeDurableConsumer(String name)
98          throws RemoteException {
99          return _connection.removeDurableConsumer(name);
100     }
101 
102     // implementation of RemoteJmsAdminServerIfc.durableConsumerExists
103     public boolean durableConsumerExists(String name)
104         throws RemoteException {
105         return _connection.durableConsumerExists(name);
106     }
107 
108 
109     // implementation of RemoteJmsAdminServerIfc.removeDurableConsumer
110     public boolean unregisterConsumer(String name)
111         throws RemoteException {
112         return _connection.unregisterConsumer(name);
113     }
114 
115     // implementation of RemoteJmsAdminServerIfc.isConnected
116     public boolean isConnected(String name)
117         throws RemoteException {
118         return _connection.isConnected(name);
119     }
120 
121     // implementation of RemoteJmsAdminServerIfc.getAllDestinations
122     public Vector getAllDestinations()
123         throws RemoteException {
124         return _connection.getAllDestinations();
125     }
126 
127     // implementation of RemoteJmsAdminServerIfc.addDestination
128     public boolean addDestination(String destination, Boolean queue)
129         throws RemoteException {
130         return _connection.addDestination(destination, queue);
131     }
132 
133     // implementation of RemoteJmsAdminServerIfc.getDurableConsumerMessageCount
134     public int getDurableConsumerMessageCount(String topic, String name)
135         throws RemoteException {
136         return _connection.getDurableConsumerMessageCount(topic, name);
137     }
138 
139     // implementation of RemoteJmsAdminServerIfc.getDurableConsumerMessageCount
140     public int getQueueMessageCount(String queue)
141         throws RemoteException {
142         return _connection.getQueueMessageCount(queue);
143     }
144 
145     // implementation of RemoteJmsAdminServerIfc.getDurableConsumers
146     public Vector getDurableConsumers(String topic)
147         throws RemoteException {
148         return _connection.getDurableConsumers(topic);
149     }
150 
151     // implementation of RemoteJmsAdminServerIfc.removeDestination
152     public boolean removeDestination(String name)
153         throws RemoteException {
154         return _connection.removeDestination(name);
155     }
156 
157     // implementation of RemoteJmsAdminServerIfc.removeDestination
158     public boolean destinationExists(String name)
159         throws RemoteException {
160         return _connection.destinationExists(name);
161     }
162 
163     // implementation of RemoteJmsAdminServerIfc.purgeMessages
164     public int purgeMessages()
165         throws RemoteException {
166         return _connection.purgeMessages();
167     }
168 
169     // implementation of RemoteJmsAdminServerIfc.stopServer
170     public void stopServer()
171         throws RemoteException {
172         _connection.stopServer();
173     }
174 
175     // implementation of RemoteJmsAdminServerIfc.addUser
176     public boolean addUser(String username, String password)
177         throws RemoteException {
178         return _connection.addUser(username, password);
179     }
180 
181     // implementation of RemoteJmsAdminServerIfc.changePassword
182     public boolean changePassword(String username, String password)
183         throws RemoteException {
184         return _connection.changePassword(username, password);
185     }
186 
187     // implementation of RemoteJmsAdminServerIfc.removeUser
188     public boolean removeUser(String username) throws RemoteException {
189         return _connection.removeUser(username);
190     }
191 
192     // implementation of RemoteJmsAdminServerIfc.getAllUsers
193     public Vector getAllUsers() throws RemoteException {
194         return _connection.getAllUsers();
195     }
196 
197 }
198 
199 
200