org.exolab.jms.administration.mipc
Class IpcJmsAdminConnection

java.lang.Object
  |
  +--org.exolab.jms.administration.mipc.IpcJmsAdminConnection
All Implemented Interfaces:
AdminConnection, JmsAdminServerIfc
Direct Known Subclasses:
HttpJmsAdminConnection, SslIpcJmsAdminConnection

public class IpcJmsAdminConnection
extends java.lang.Object
implements JmsAdminServerIfc, AdminConnection

This class is repsonsible for opening a TCP connection to the server and passing and packing all requests for delivery.

Version:
$Revision: 1.17 $ $Date: 2003/08/16 09:45:46 $
Author:
Jim Mourikis

Constructor Summary
protected IpcJmsAdminConnection(java.lang.String host, int port)
          Construct a new IpcJmsAdminConnection, without establishing a connection
  IpcJmsAdminConnection(java.lang.String host, int port, java.lang.String username, java.lang.String password)
          Construct a new IpcJmsAdminConnection, establishing a connection to the server
 
Method Summary
 boolean addDestination(java.lang.String destination, java.lang.Boolean queue)
          Add a specific destination with the specified name
 boolean addDurableConsumer(java.lang.String topic, java.lang.String name)
          Add a durable consumer for the specified name the passed in name
 boolean addUser(java.lang.String username, java.lang.String password)
          Add a user with the specified name
 boolean changePassword(java.lang.String username, java.lang.String password)
          Change password for the specified user
 void close()
          Close the connection.
protected  void connect(java.lang.String username, java.lang.String password)
          Opens an authenticated connection to the server
protected  org.exolab.core.mipc.MultiplexConnectionIfc createClientConnection(java.lang.String host, int port)
          Create an MIPC client connection
 boolean destinationExists(java.lang.String name)
          Determine if the specified destination exists
 boolean durableConsumerExists(java.lang.String name)
          Check if the specified durable consumer exists
 java.util.Vector getAllDestinations()
          Return a list of all registered destinations.
 java.util.Vector getAllUsers()
          Return a list of all registered users.
protected  org.exolab.core.ipc.IpcIfc getConnection()
          Returns the underlying connection
 int getDurableConsumerMessageCount(java.lang.String topic, java.lang.String name)
          Return the number of outstanding messages for a particular destination.
 java.util.Vector getDurableConsumers(java.lang.String topic)
          Return the collection of durable consumer names for a particular topic destination.
protected  java.lang.String getHost()
          Returns the server host
protected  int getPort()
          Returns the server port
 int getQueueMessageCount(java.lang.String queue)
          Return the number of outstanding messages for a particular queue.
 boolean isConnected(java.lang.String name)
          Check to see if the given consumer is currently connected
protected  void openConnection()
          Opens a connection to the server.
 int purgeMessages()
          Purge all processed messages from the database
 boolean removeDestination(java.lang.String name)
          Destroy the specified destination and all associated messsages and consumers.
 boolean removeDurableConsumer(java.lang.String name)
          Remove the the specified durable consumer
 boolean removeUser(java.lang.String username)
          Remove the specified user
protected  void setConnection(org.exolab.core.ipc.IpcIfc connection)
          Sets the underlying connection
 void stopServer()
          Terminate the JMS Server.
 boolean unregisterConsumer(java.lang.String name)
          De-Activate an active persistent consumer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IpcJmsAdminConnection

protected IpcJmsAdminConnection(java.lang.String host,
                                int port)
Construct a new IpcJmsAdminConnection, without establishing a connection
Parameters:
host - the server host
port - the server port

IpcJmsAdminConnection

public IpcJmsAdminConnection(java.lang.String host,
                             int port,
                             java.lang.String username,
                             java.lang.String password)
                      throws javax.jms.JMSException
Construct a new IpcJmsAdminConnection, establishing a connection to the server
Parameters:
host - the server host
port - the server port
username - the admin user name
password - the admin password
Throws:
JMSEXception - if a connection cannot be established
Method Detail

addDurableConsumer

public boolean addDurableConsumer(java.lang.String topic,
                                  java.lang.String name)
                           throws javax.jms.JMSException
Description copied from interface: JmsAdminServerIfc
Add a durable consumer for the specified name the passed in name
Specified by:
addDurableConsumer in interface JmsAdminServerIfc
Following copied from interface: org.exolab.jms.administration.JmsAdminServerIfc
Parameters:
topic - name of the destination
name - name of the consumer
Returns:
boolean true if successful
Throws:
javax.jms.JMSException -  

removeDurableConsumer

public boolean removeDurableConsumer(java.lang.String name)
                              throws javax.jms.JMSException
Description copied from interface: JmsAdminServerIfc
Remove the the specified durable consumer
Specified by:
removeDurableConsumer in interface JmsAdminServerIfc
Following copied from interface: org.exolab.jms.administration.JmsAdminServerIfc
Parameters:
name - name of the consumer
Returns:
boolean true if successful
Throws:
javax.jms.JMSException -  

getDurableConsumers

public java.util.Vector getDurableConsumers(java.lang.String topic)
                                     throws javax.jms.JMSException
Description copied from interface: JmsAdminServerIfc
Return the collection of durable consumer names for a particular topic destination.
Specified by:
getDurableConsumers in interface JmsAdminServerIfc
Following copied from interface: org.exolab.jms.administration.JmsAdminServerIfc
Parameters:
topic - the topic name
Returns:
Vector collection of strings
Throws:
javax.jms.JMSException -  

durableConsumerExists

public boolean durableConsumerExists(java.lang.String name)
                              throws javax.jms.JMSException
Description copied from interface: JmsAdminServerIfc
Check if the specified durable consumer exists
Specified by:
durableConsumerExists in interface JmsAdminServerIfc
Following copied from interface: org.exolab.jms.administration.JmsAdminServerIfc
Parameters:
name - durable consumer to query
Returns:
boolean true if it exists
Throws:
javax.jms.JMSException -  

isConnected

public boolean isConnected(java.lang.String name)
                    throws javax.jms.JMSException
Check to see if the given consumer is currently connected
Specified by:
isConnected in interface JmsAdminServerIfc
Parameters:
name - the name of the onsumer.
Returns:
true if the consumer is connected
Throws:
javax.jms.JMSException -  

unregisterConsumer

public boolean unregisterConsumer(java.lang.String name)
                           throws javax.jms.JMSException
Description copied from interface: JmsAdminServerIfc
De-Activate an active persistent consumer.
Specified by:
unregisterConsumer in interface JmsAdminServerIfc
Following copied from interface: org.exolab.jms.administration.JmsAdminServerIfc
Parameters:
name - name of the consumer
Returns:
boolean true if successful
Throws:
javax.jms.JMSException -  

addDestination

public boolean addDestination(java.lang.String destination,
                              java.lang.Boolean queue)
                       throws javax.jms.JMSException
Description copied from interface: JmsAdminServerIfc
Add a specific destination with the specified name
Specified by:
addDestination in interface JmsAdminServerIfc
Following copied from interface: org.exolab.jms.administration.JmsAdminServerIfc
Parameters:
name - destination name
queue - whether it is queue or a topic
Returns:
boolean true if successful
Throws:
javax.jms.JMSException -  

removeDestination

public boolean removeDestination(java.lang.String name)
                          throws javax.jms.JMSException
Description copied from interface: JmsAdminServerIfc
Destroy the specified destination and all associated messsages and consumers. This is a very dangerous operation to execute while there are clients online
Specified by:
removeDestination in interface JmsAdminServerIfc
Following copied from interface: org.exolab.jms.administration.JmsAdminServerIfc
Parameters:
destination - destination to destroy
Throws:
javax.jms.JMSException -  

destinationExists

public boolean destinationExists(java.lang.String name)
                          throws javax.jms.JMSException
Description copied from interface: JmsAdminServerIfc
Determine if the specified destination exists
Specified by:
destinationExists in interface JmsAdminServerIfc
Following copied from interface: org.exolab.jms.administration.JmsAdminServerIfc
Parameters:
name - - the destination to check
Returns:
boolean - true if it exists
Throws:
javax.jms.JMSException -  

getAllDestinations

public java.util.Vector getAllDestinations()
                                    throws javax.jms.JMSException
Description copied from interface: JmsAdminServerIfc
Return a list of all registered destinations.
Specified by:
getAllDestinations in interface JmsAdminServerIfc
Following copied from interface: org.exolab.jms.administration.JmsAdminServerIfc
Returns:
a collection of javax.jms.Destination instances
Throws:
javax.jms.JMSException -  

getDurableConsumerMessageCount

public int getDurableConsumerMessageCount(java.lang.String topic,
                                          java.lang.String name)
                                   throws javax.jms.JMSException
Description copied from interface: JmsAdminServerIfc
Return the number of outstanding messages for a particular destination.
Specified by:
getDurableConsumerMessageCount in interface JmsAdminServerIfc
Following copied from interface: org.exolab.jms.administration.JmsAdminServerIfc
Parameters:
topic - name of the topic
name - durable consumer name
Returns:
int message count
Throws:
javax.jms.JMSException -  

getQueueMessageCount

public int getQueueMessageCount(java.lang.String queue)
                         throws javax.jms.JMSException
Description copied from interface: JmsAdminServerIfc
Return the number of outstanding messages for a particular queue.
Specified by:
getQueueMessageCount in interface JmsAdminServerIfc
Following copied from interface: org.exolab.jms.administration.JmsAdminServerIfc
Parameters:
queue - the queue name
Returns:
int message count
Throws:
javax.jms.JMSException -  

purgeMessages

public int purgeMessages()
                  throws javax.jms.JMSException
Description copied from interface: JmsAdminServerIfc
Purge all processed messages from the database
Specified by:
purgeMessages in interface JmsAdminServerIfc
Following copied from interface: org.exolab.jms.administration.JmsAdminServerIfc
Returns:
int number of purged messages
Throws:
javax.jms.JMSException -  

stopServer

public void stopServer()
                throws javax.jms.JMSException
Description copied from interface: JmsAdminServerIfc
Terminate the JMS Server. If it is running as a standalone application then exit the application. It is running as an embedded application then just terminate the thread
Specified by:
stopServer in interface JmsAdminServerIfc
Following copied from interface: org.exolab.jms.administration.AdminConnection
Throws:
javax.jms.JMSException -  

close

public void close()
Description copied from interface: JmsAdminServerIfc
Close the connection.
Specified by:
close in interface JmsAdminServerIfc

addUser

public boolean addUser(java.lang.String username,
                       java.lang.String password)
                throws javax.jms.JMSException
Description copied from interface: JmsAdminServerIfc
Add a user with the specified name
Specified by:
addUser in interface JmsAdminServerIfc
Following copied from interface: org.exolab.jms.administration.JmsAdminServerIfc
Parameters:
username - the users name
password - the users password
Returns:
true if the user is added otherwise false

getAllUsers

public java.util.Vector getAllUsers()
                             throws javax.jms.JMSException
Description copied from interface: JmsAdminServerIfc
Return a list of all registered users.
Specified by:
getAllUsers in interface JmsAdminServerIfc
Following copied from interface: org.exolab.jms.administration.JmsAdminServerIfc
Returns:
Vector of users
Throws:
javax.jms.JMSException -  

removeUser

public boolean removeUser(java.lang.String username)
                   throws javax.jms.JMSException
Description copied from interface: JmsAdminServerIfc
Remove the specified user
Specified by:
removeUser in interface JmsAdminServerIfc
Following copied from interface: org.exolab.jms.administration.JmsAdminServerIfc
Parameters:
username - the users name
Returns:
true if the user is removed otherwise false

changePassword

public boolean changePassword(java.lang.String username,
                              java.lang.String password)
                       throws javax.jms.JMSException
Description copied from interface: JmsAdminServerIfc
Change password for the specified user
Specified by:
changePassword in interface JmsAdminServerIfc
Following copied from interface: org.exolab.jms.administration.JmsAdminServerIfc
Parameters:
username - the users name
password - the users password
Returns:
true if the password is changed otherwise false

getHost

protected java.lang.String getHost()
Returns the server host
Returns:
the server host

getPort

protected int getPort()
Returns the server port
Returns:
the server port

getConnection

protected org.exolab.core.ipc.IpcIfc getConnection()
Returns the underlying connection

setConnection

protected void setConnection(org.exolab.core.ipc.IpcIfc connection)
Sets the underlying connection
Parameters:
connection - the underlying connection

openConnection

protected void openConnection()
                       throws javax.jms.JMSException
Opens a connection to the server.
Throws:
javax.jms.JMSException - if an error occurs

connect

protected void connect(java.lang.String username,
                       java.lang.String password)
                throws javax.jms.JMSException
Opens an authenticated connection to the server
Parameters:
username - the user's name
password - the user's password
Throws:
javax.jms.JMSException - if the connection cannot be established

createClientConnection

protected org.exolab.core.mipc.MultiplexConnectionIfc createClientConnection(java.lang.String host,
                                                                             int port)
                                                                      throws java.io.IOException
Create an MIPC client connection
Parameters:
host - the host of the server
port - the port number to use
Returns:
a new connection
Throws:
java.io.IOException - if the server fails to initialise the ip service


Copyright © 1999-2004 The OpenJMS Group. All Rights Reserved.