org.exolab.jms.server
Class AdminConnection

java.lang.Object
  |
  +--org.exolab.jms.server.AdminConnection

public class AdminConnection
extends java.lang.Object

A connection is created for every adminclient connecting to the JmsServer.

Version:
$Revision: 1.7 $ $Date: 2005/12/23 12:17:45 $
Author:
Knut Lerpold
See Also:
AdminConnectionManager

Constructor Summary
protected AdminConnection(Configuration config, AuthenticationMgr authenticator, DestinationManager destinations, ConsumerManager consumers, DatabaseService database, Services services)
          Construct a new AdminConnection.
 
Method Summary
 boolean addDestination(java.lang.String name, java.lang.Boolean queue)
          Add an administered destination with the specified name.
 boolean addDurableConsumer(java.lang.String topic, java.lang.String name)
          Add the specified durable consumer to the database.
 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 admin connection
 boolean destinationExists(java.lang.String name)
          Check whether the specified destination exists
 boolean durableConsumerExists(java.lang.String name)
          Check if the 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.
 int getDurableConsumerMessageCount(java.lang.String topic, java.lang.String name)
          Return the number of messages for a durable consumer.
 java.util.Vector getDurableConsumers(java.lang.String topic)
          Return the collection of durable consumer names for a particular topic destination.
 int getQueueMessageCount(java.lang.String queue)
          First use the destination manager to return the number of persistent and non-persistent messages in a queue.
 boolean isConnected(java.lang.String name)
          Check to see if the given consumer is currently connected to the OpenJMSServer.
 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 consumer attached to the specified destination and with the passed in name.
 boolean removeUser(java.lang.String username)
          Remove the specified user
 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

AdminConnection

protected AdminConnection(Configuration config,
                          AuthenticationMgr authenticator,
                          DestinationManager destinations,
                          ConsumerManager consumers,
                          DatabaseService database,
                          Services services)
Construct a new AdminConnection.
Parameters:
config - the configuration
authenticator - the authentication manager
destinations - the destination manager
database - the database service
services - the services
Method Detail

close

public void close()
Close the admin connection

getDurableConsumerMessageCount

public int getDurableConsumerMessageCount(java.lang.String topic,
                                          java.lang.String name)
Return the number of messages for a durable consumer.
Parameters:
topic - name of the topic
name - consumer name
Returns:
int number of unsent or unacked messages

getQueueMessageCount

public int getQueueMessageCount(java.lang.String queue)
First use the destination manager to return the number of persistent and non-persistent messages in a queue.
Parameters:
queue - name of the queue
Returns:
int - the number of messages for that destination or -1 if the destination is invalid

addDurableConsumer

public boolean addDurableConsumer(java.lang.String topic,
                                  java.lang.String name)
Add the specified durable consumer to the database.
Parameters:
topic - name of the destination
name - name of the consumer
Returns:
boolean true if successful

removeDurableConsumer

public boolean removeDurableConsumer(java.lang.String name)
Remove the consumer attached to the specified destination and with the passed in name.
Parameters:
name - name of the consumer
Returns:
boolean true if successful

durableConsumerExists

public boolean durableConsumerExists(java.lang.String name)
Check if the durable consumer exists.
Parameters:
name - name of the durable conusmer
Returns:
boolean true if it exists and false otherwise

getDurableConsumers

public java.util.Vector getDurableConsumers(java.lang.String topic)
Return the collection of durable consumer names for a particular topic destination.
Parameters:
topic - the topic name
Returns:
Vector collection of strings

unregisterConsumer

public boolean unregisterConsumer(java.lang.String name)
De-Activate an active persistent consumer.
Parameters:
name - name of the consumer
Returns:
boolean true if successful

isConnected

public boolean isConnected(java.lang.String name)
Check to see if the given consumer is currently connected to the OpenJMSServer. This is only valid when in online mode.
Parameters:
name - The name of the onsumer.
Returns:
boolean True if the consumer is connected.

getAllDestinations

public java.util.Vector getAllDestinations()
Return a list of all registered destinations.
Returns:
Vector collection of strings

addDestination

public boolean addDestination(java.lang.String name,
                              java.lang.Boolean queue)
Add an administered destination with the specified name.
Parameters:
name - destination name
queue - whether it is queue or a topic
Returns:
boolean true if successful

removeDestination

public boolean removeDestination(java.lang.String name)
Destroy the specified destination and all associated messsages and consumers. This is a very dangerous operation to execute while there are clients online
Parameters:
name - destination to destroy
Returns:
boolean true if successful

destinationExists

public boolean destinationExists(java.lang.String name)
Check whether the specified destination exists
Parameters:
name - - the name of the destination to check
Returns:
boolean - true if it does and false otherwise

stopServer

public void stopServer()
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

purgeMessages

public int purgeMessages()
Purge all processed messages from the database
Returns:
int number of messages purged

addUser

public boolean addUser(java.lang.String username,
                       java.lang.String password)
Add a user with the specified name
Parameters:
username - the users name
password - the users password
Returns:
true if the user is added otherwise false

changePassword

public boolean changePassword(java.lang.String username,
                              java.lang.String password)
Change password for the specified user
Parameters:
username - the users name
password - the users password
Returns:
true if the password is changed otherwise false

removeUser

public boolean removeUser(java.lang.String username)
Remove the specified user
Parameters:
username - the users name
Returns:
true if the user is removed otherwise false

getAllUsers

public java.util.Vector getAllUsers()
Return a list of all registered users.
Returns:
Vector of users


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