📄 intravmjmsadminconnection.java
字号:
/**
* Redistribution and use of this software and associated documentation
* ("Software"), with or without modification, are permitted provided
* that the following conditions are met:
*
* 1. Redistributions of source code must retain copyright
* statements and notices. Redistributions must also contain a
* copy of this document.
*
* 2. Redistributions in binary form must reproduce the
* above copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. The name "Exolab" must not be used to endorse or promote
* products derived from this Software without prior written
* permission of Exoffice Technologies. For written permission,
* please contact info@exolab.org.
*
* 4. Products derived from this Software may not be called "Exolab"
* nor may "Exolab" appear in their names without prior written
* permission of Exoffice Technologies. Exolab is a registered
* trademark of Exoffice Technologies.
*
* 5. Due credit should be given to the Exolab Project
* (http://www.exolab.org/).
*
* THIS SOFTWARE IS PROVIDED BY EXOFFICE TECHNOLOGIES AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* EXOFFICE TECHNOLOGIES OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Copyright 2000-2001,2003 (C) Exoffice Technologies Inc. All Rights Reserved.
*
* $Id: IntravmJmsAdminConnection.java,v 1.11 2003/08/17 01:32:21 tanderson Exp $
*/
package org.exolab.jms.administration.intravm;
import java.util.Vector;
import javax.jms.JMSException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.exolab.core.service.ServiceManager;
import org.exolab.jms.administration.JmsAdminServerIfc;
import org.exolab.jms.server.AdminConnection;
import org.exolab.jms.server.AdminConnectionManager;
import org.exolab.jms.util.UUID;
/**
* This class is repsonsible for an admin connection to the intravm server
*
* @version $Revision: 1.11 $ $Date: 2003/08/17 01:32:21 $
* @author <a href="mailto:tima@Tim Anderson</a>
*/
public class IntravmJmsAdminConnection implements JmsAdminServerIfc,
org.exolab.jms.administration.AdminConnection {
/**
* The logger
*/
private static final Log _log =
LogFactory.getLog(IntravmJmsAdminConnection.class);
/**
* The adminConnection
*/
private AdminConnection _admin;
/**
* Construct a new <code>IntravmJmsAdminConnection</code>
*
* @param username the admin user name
* @param password the admin password
* @throws JMSEXception if the client cannot be authenticated
*/
public IntravmJmsAdminConnection(String username, String password)
throws JMSException {
String clientId = UUID.next();
_admin = AdminConnectionManager.instance().createConnection(
clientId, username, password);
}
// implementation of JmsAdminServerIfc.addDurableConsumer
public boolean addDurableConsumer(String topic, String name)
throws JMSException {
return _admin.addDurableConsumer(topic, name);
}
// implementation of JmsAdminServerIfc.removeDurableConsumer
public boolean removeDurableConsumer(String name) throws JMSException {
return _admin.removeDurableConsumer(name);
}
// implementation of JmsAdminServerIfc.durableConsumerExists
public boolean durableConsumerExists(String name) throws JMSException {
return _admin.durableConsumerExists(name);
}
// implementation of JmsAdminServerIfc.getDurableConsumers
public Vector getDurableConsumers(String topic) throws JMSException {
return _admin.getDurableConsumers(topic);
}
// implementation of JmsAdminServerIfc.removeDurableConsumer
public boolean unregisterConsumer(String name) throws JMSException {
return _admin.unregisterConsumer(name);
}
// implementation of JmsAdminServerIfc.isConnected
public boolean isConnected(String name) throws JMSException {
return _admin.isConnected(name);
}
// implementation of JmsAdminServerIfc.addDestination
public boolean addDestination(String destination, Boolean queue)
throws JMSException {
return _admin.addDestination(destination, queue);
}
// implementation of JmsAdminServerIfc.removeDestination
public boolean removeDestination(String name) throws JMSException {
return _admin.removeDestination(name);
}
// implementation of JmsAdminServerIfc.destinationExists
public boolean destinationExists(String name) throws JMSException {
return _admin.destinationExists(name);
}
// implementation of JmsAdminServerIfc.getAllDestinations
public Vector getAllDestinations() throws JMSException {
return _admin.getAllDestinations();
}
// implementation of JmsAdminServerIfc.getDurableConsumerMessageCount
public int getDurableConsumerMessageCount(String topic, String name)
throws JMSException {
return _admin.getDurableConsumerMessageCount(topic, name);
}
// implementation of JmsAdminServerIfc.getDurableConsumerMessageCount
public int getQueueMessageCount(String queue) throws JMSException {
return _admin.getQueueMessageCount(queue);
}
// implementation of JmsAdminServerIfc.purgeMessages
public int purgeMessages() throws JMSException {
return _admin.purgeMessages();
}
// implementation of JmsAdminServerIfc.stopServer
public void stopServer() throws JMSException {
// TODO: shouldn't need to do this directly - should be
// done via the admin interface. Unfortunately,
// JmsAdmin.stopServer() invokes System.exit()
ServiceManager.instance().removeAll();
}
// implementation of JmsAdminServerIfc.close
public void close() {
}
// implementation of JmsAdminServerIfc.addUser
public boolean addUser(String username, String password)
throws JMSException {
return _admin.addUser(username, password);
}
// implementation of JmsAdminServerIfc.getAllUsers
public Vector getAllUsers() throws JMSException {
return _admin.getAllUsers();
}
// implementation of JmsAdminServerIfc.removeUser
public boolean removeUser(String username) throws JMSException {
return _admin.removeUser(username);
}
// implementation of JmsAdminServerIfc.changePassword
public boolean changePassword(String username, String password)
throws JMSException {
return _admin.changePassword(username, password);
}
} //-- IntravmJmsAdminConnection
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -