jrun.jms.core.server.rmi
Class RmiJmsServerSession

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--jrun.jms.core.server.rmi.RmiJmsServerSession
All Implemented Interfaces:
JmsMessageListener, java.rmi.Remote, RemoteJmsServerSessionIfc, java.io.Serializable

public class RmiJmsServerSession
extends java.rmi.server.UnicastRemoteObject
implements RemoteJmsServerSessionIfc, JmsMessageListener

This is an implementation of the RemoteJmsServerSessionIfc which delegates all requests to the JmsServerSession class. Actually, an instsnce of this class cannot be created without a JmsServerSession object.

Version:
$Revision: 1.23 $ $Date: 2001/10/12 07:55:32 $
Author:
Jim Alateras
See Also:
org.exolab.jms.server.JmsServerSession, org.exolab.jms.server.rmi.RemoteJmsServerConnectionIfc, Serialized Form

Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
RmiJmsServerSession(JmsServerSession session, int port)
          Instantiate an instance of this class given a JmsServerSession.
 
Method Summary
 void acknowledgeMessage(long clientId, java.lang.String messageId)
          Acknowledge that the message id for the specified client identity.
 void close()
          Close and release any resource allocated to this session.
 void commit()
          Commit the session
 void commit(java.lang.String[] messages)
          Commit group of messages on the session
 void createBrowser(JmsQueue queue, long clientId, java.lang.String selector)
          Create a queue browser for this session.
 void createPublisher(JmsTopic topic)
          Create a publisher endpoint for this session.
 void createQueue(JmsQueue queue)
          Create a queue with the specified name.
 void createReceiver(JmsQueue queue, long clientId, java.lang.String selector)
          Create a receiver endpoint for this session.
 void createSender(JmsQueue queue)
          Create a sender endpoint for this session.
 void createSubscriber(JmsTopic topic, java.lang.String name, long clientId, java.lang.String selector, boolean noLocal)
          Create a subscriber endpoint for this session.
 void createTopic(JmsTopic topic)
          Create a topic with the specified name.
 void deleteBrowser(long clientId)
          Delete the queue browser associated with the specified queue from the session.
 void deletePublisher(JmsTopic topic)
          Delete the publisher for the specified topic.
 void deleteReceiver(long clientId)
          Delete the receiver for the specified queue.
 void deleteSender(long clientId)
          Delete the sender for the specified queue.
 void deleteSubscriber(long clientId)
          Delete the subscriber for the specified topic.
 void enableAsynchronousDelivery(long clientId, long id, boolean enable)
          Enable or disable asynchronous message delivery for a particular consumer
 java.lang.String getClientId()
          Return a reference to the client id.
 java.lang.String getSessionId()
          Return a reference to the session id
 void onMessage(javax.jms.Message message)
           
 void onMessages(java.util.Vector messages)
          Send the specified collection of messages to the client
 javax.jms.Message receiveMessage(long clientId, long wait)
          Return the next message for the specified client.
 java.util.Vector receiveMessages(long clientId, int count)
          Return upto count messages from the endpoint with the specified client identity.
 void recover()
          Recover the session
 void rollback()
          Rollback the session
 void rollback(java.lang.String[] messages)
          Rollback group of messages on the session
 void sendMessage(javax.jms.Message message)
          Send the specified message to the server.
 void sendMessages(java.util.Vector messages)
          Send the specified messages to the server.
 void setMessageListener(RemoteJmsMessageListenerIfc listener)
          All server side sessions register with the consumer manager for message consumption (i.e push-model).
 void startMessageDelivery()
          Start message delivery to this session.
 void stopMessageDelivery()
          Stop message delivery to this session.
 void unsubscribe(java.lang.String name)
          Unsubscribe a durable subscription
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RmiJmsServerSession

public RmiJmsServerSession(JmsServerSession session,
                           int port)
                    throws javax.jms.JMSException,
                           java.rmi.RemoteException
Instantiate an instance of this class given a JmsServerSession. object. If the session object is null then throw the JMSException exception
Parameters:
session -  
Throws:
JMSException -  
java.rmi.RemoteException -  
Method Detail

getClientId

public java.lang.String getClientId()
                             throws java.rmi.RemoteException
Return a reference to the client id.
Specified by:
getClientId in interface RemoteJmsServerSessionIfc
Returns:
String client id
Throws:
java.rmi.RemoteException -  

getSessionId

public java.lang.String getSessionId()
                              throws javax.jms.JMSException,
                                     java.rmi.RemoteException
Return a reference to the session id
Specified by:
getSessionId in interface RemoteJmsServerSessionIfc
Returns:
String session id
Throws:
java.rmi.RemoteException -  

close

public void close()
           throws javax.jms.JMSException,
                  java.rmi.RemoteException
Close and release any resource allocated to this session. Throw the JMSException exception is a problem is encountered
Specified by:
close in interface RemoteJmsServerSessionIfc
Throws:
JMSException -  
java.rmi.RemoteException -  

acknowledgeMessage

public void acknowledgeMessage(long clientId,
                               java.lang.String messageId)
                        throws javax.jms.JMSException,
                               java.rmi.RemoteException
Acknowledge that the message id for the specified client identity. If the acknowledgement faisl then throw JMSException
Specified by:
acknowledgeMessage in interface RemoteJmsServerSessionIfc
Parameters:
clientId - the client identity.
messageId - identity of the message
Throws:
JMSException - if method does not complete
java.rmi.RemoteException -  

sendMessage

public void sendMessage(javax.jms.Message message)
                 throws javax.jms.JMSException,
                        java.rmi.RemoteException
Send the specified message to the server. If there is any problem then throw the JMSException exception
Specified by:
sendMessage in interface RemoteJmsServerSessionIfc
Parameters:
message - message to send
Throws:
JMSException -  
java.rmi.RemoteException -  

sendMessages

public void sendMessages(java.util.Vector messages)
                  throws javax.jms.JMSException,
                         java.rmi.RemoteException
Send the specified messages to the server. If there is any problem then throw the JMSException exception
Specified by:
sendMessages in interface RemoteJmsServerSessionIfc
Parameters:
messages - messages to send
Throws:
JMSException -  
java.rmi.RemoteException -  

receiveMessage

public javax.jms.Message receiveMessage(long clientId,
                                        long wait)
                                 throws javax.jms.JMSException,
                                        java.rmi.RemoteException
Return the next message for the specified client. The wait parameter indicates how long many milliseconds to wait for a message before returning. If wait is 0 then do not wait at all. If wait is -1 then wait indefinitely for the next message
Specified by:
receiveMessage in interface RemoteJmsServerSessionIfc
Parameters:
clientId - the client identity
wait - number of ms to wait
Returns:
Message the next message or null
Throws:
JMSException - if there is an app level problem
java.rmi.RemoteException - if there is a RMI based exception.

receiveMessages

public java.util.Vector receiveMessages(long clientId,
                                        int count)
                                 throws javax.jms.JMSException,
                                        java.rmi.RemoteException
Description copied from interface: RemoteJmsServerSessionIfc
Return upto count messages from the endpoint with the specified client identity.
Specified by:
receiveMessages in interface RemoteJmsServerSessionIfc
Following copied from interface: jrun.jms.core.server.rmi.RemoteJmsServerSessionIfc
Parameters:
clientId - the client identity
count - max number of messages to receive
Returns:
Message the next message or null
Throws:
JMSException - if there is an app level problem
java.rmi.RemoteException - if there is a RMI based exception.

createQueue

public void createQueue(JmsQueue queue)
                 throws javax.jms.JMSException,
                        java.rmi.RemoteException
Create a queue with the specified name. If the queue already exists then simply return a reference to it. If the queue does not exist then create it. If it cannot create the queue then throw the JMSException exception
Specified by:
createQueue in interface RemoteJmsServerSessionIfc
Parameters:
queue - queue to create
Throws:
JMSException -  
java.rmi.RemoteException -  

createTopic

public void createTopic(JmsTopic topic)
                 throws javax.jms.JMSException,
                        java.rmi.RemoteException
Create a topic with the specified name. If the topic already exists then simply return a reference to it. If the topic does not exist then create it. If it cannot create the topic then throw the JMSException exception
Specified by:
createTopic in interface RemoteJmsServerSessionIfc
Parameters:
topic - topic to create
Throws:
JMSException -  
java.rmi.RemoteException -  

createReceiver

public void createReceiver(JmsQueue queue,
                           long clientId,
                           java.lang.String selector)
                    throws javax.jms.JMSException,
                           java.rmi.RemoteException
Create a receiver endpoint for this session. A reciever is a message consumer specific to the queue message model. The receiver is associated with a queue.

You cannot create more than one receiver for the same destination

Specified by:
createReceiver in interface RemoteJmsServerSessionIfc
Parameters:
queue - receiver destination
clientId - the session allocated identifier of this consumer
selector - the selector to filter messages. This may be null.
Throws:
JMSException. -  
java.rmi.RemoteException -  

createSender

public void createSender(JmsQueue queue)
                  throws javax.jms.JMSException,
                         java.rmi.RemoteException
Create a sender endpoint for this session. A sender is a message publisher specific to the queue message model. The sender is associated with a queue.

You cannot create more than one receiver for the same destination

Specified by:
createSender in interface RemoteJmsServerSessionIfc
Parameters:
queue - receiver destination
Throws:
JMSException. -  
java.rmi.RemoteException -  

createBrowser

public void createBrowser(JmsQueue queue,
                          long clientId,
                          java.lang.String selector)
                   throws javax.jms.JMSException
Create a queue browser for this session. This allows clients to browse a queue without removing any messages.

You cannot create more than one queue browser for the same queue in a single session.

Specified by:
createBrowser in interface RemoteJmsServerSessionIfc
Parameters:
queue - queue to browse
clientId - the client identity
selector - message selector. This may be null
Throws:
JMSException -  

deleteReceiver

public void deleteReceiver(long clientId)
                    throws javax.jms.JMSException,
                           java.rmi.RemoteException
Delete the receiver for the specified queue. If the receiver does not exist or cannot be deleted throw JMSException
Specified by:
deleteReceiver in interface RemoteJmsServerSessionIfc
Parameters:
id - identity of receiver
Throws:
JMSException. -  
java.rmi.RemoteException -  

deleteSender

public void deleteSender(long clientId)
                  throws javax.jms.JMSException,
                         java.rmi.RemoteException
Delete the sender for the specified queue. If the sender does not exist or the sender cannot be deleted then throw JMSException
Specified by:
deleteSender in interface RemoteJmsServerSessionIfc
Parameters:
clientId - identity of client to delete
Throws:
JMSException. -  
java.rmi.RemoteException -  

deleteBrowser

public void deleteBrowser(long clientId)
                   throws javax.jms.JMSException
Delete the queue browser associated with the specified queue from the session. If the corresponding queue does not exist or it cannot be deleted, then throw a JMSException.
Specified by:
deleteBrowser in interface RemoteJmsServerSessionIfc
Parameters:
clientId - the identity of the client
Throws:
JMSException -  

createSubscriber

public void createSubscriber(JmsTopic topic,
                             java.lang.String name,
                             long clientId,
                             java.lang.String selector,
                             boolean noLocal)
                      throws javax.jms.JMSException,
                             java.rmi.RemoteException
Create a subscriber endpoint for this session. A subscriber is a message consumer specific to the topic message model. The subscriber is associated with a topic. The consumer name must be specfied for persistent delivery but can be null otherwise

You cannot create more than one subscriber for the same destination

Specified by:
createSubscriber in interface RemoteJmsServerSessionIfc
Parameters:
topic - subscriber destination
name - name of the cnsumer; can be null
clientId - the session allocated identifier of this consumer
selector - the selector to filter messages. This may be null.
noLocal - inhibit consuming messages on same connection.
Returns:
the unique consumer identifier
Throws:
JMSException -  
java.rmi.RemoteException -  

createPublisher

public void createPublisher(JmsTopic topic)
                     throws javax.jms.JMSException,
                            java.rmi.RemoteException
Create a publisher endpoint for this session. A publisher is a message publisher specific to the topic message model. The publisher is associated with a topic.

You cannot create more than one publisher for the same destination

Specified by:
createPublisher in interface RemoteJmsServerSessionIfc
Parameters:
topic - receiver destination
Throws:
JMSException. -  
java.rmi.RemoteException -  

deleteSubscriber

public void deleteSubscriber(long clientId)
                      throws javax.jms.JMSException,
                             java.rmi.RemoteException
Delete the subscriber for the specified topic. If this subscriber does not exist or the cannot be deleted then throw JMSException.
Specified by:
deleteSubscriber in interface RemoteJmsServerSessionIfc
Parameters:
clientId - the identity of the client
Throws:
JMSException. -  

deletePublisher

public void deletePublisher(JmsTopic topic)
                     throws javax.jms.JMSException,
                            java.rmi.RemoteException
Delete the publisher for the specified topic. If the publisher does not exist or cannot be deleted then throw JMSException
Specified by:
deletePublisher in interface RemoteJmsServerSessionIfc
Parameters:
topic - topic object
Throws:
JMSException. -  
RemoteException. -  

unsubscribe

public void unsubscribe(java.lang.String name)
                 throws javax.jms.JMSException
Unsubscribe a durable subscription
Specified by:
unsubscribe in interface RemoteJmsServerSessionIfc
Parameters:
name - the name used to identify the subscription
Throws:
JMSException - if the subscription cannot be removed

stopMessageDelivery

public void stopMessageDelivery()
                         throws javax.jms.JMSException,
                                java.rmi.RemoteException
Stop message delivery to this session. If there are any problems completing the request then throw the JMSException exception
Specified by:
stopMessageDelivery in interface RemoteJmsServerSessionIfc
Throws:
JMSException -  
RemoteException. -  

startMessageDelivery

public void startMessageDelivery()
                          throws javax.jms.JMSException,
                                 java.rmi.RemoteException
Start message delivery to this session. If there are any problems completing this request then throw the JMSException exception
Specified by:
startMessageDelivery in interface RemoteJmsServerSessionIfc
Throws:
JMSException -  
RemoteException. -  

recover

public void recover()
             throws javax.jms.JMSException,
                    java.rmi.RemoteException
Recover the session
Specified by:
recover in interface RemoteJmsServerSessionIfc
Throws:
JMSException -  
RemoteException. -  

commit

public void commit(java.lang.String[] messages)
            throws javax.jms.JMSException,
                   java.rmi.RemoteException
Commit group of messages on the session
Specified by:
commit in interface RemoteJmsServerSessionIfc
Parameters:
messages - - ids of the messages to rollback
Throws:
JMSException -  
RemoteException. -  

commit

public void commit()
            throws javax.jms.JMSException,
                   java.rmi.RemoteException
Commit the session
Specified by:
commit in interface RemoteJmsServerSessionIfc
Throws:
JMSException -  
RemoteException. -  

rollback

public void rollback()
              throws javax.jms.JMSException,
                     java.rmi.RemoteException
Rollback the session
Specified by:
rollback in interface RemoteJmsServerSessionIfc
Throws:
JMSException -  
RemoteException. -  

rollback

public void rollback(java.lang.String[] messages)
              throws javax.jms.JMSException,
                     java.rmi.RemoteException
Rollback group of messages on the session
Specified by:
rollback in interface RemoteJmsServerSessionIfc
Parameters:
messages - - ids of the messages to rollback
Throws:
JMSException -  
RemoteException. -  

setMessageListener

public void setMessageListener(RemoteJmsMessageListenerIfc listener)
                        throws javax.jms.JMSException,
                               java.rmi.RemoteException
All server side sessions register with the consumer manager for message consumption (i.e push-model). When a message arrives this server-side instance will send it down to the client side stub for further processing.

If the listener is null then throw JMSException

Specified by:
setMessageListener in interface RemoteJmsServerSessionIfc
Parameters:
listener - listener to delivery messages too.
Throws:
JMSException -  
RemoteException. -  

enableAsynchronousDelivery

public void enableAsynchronousDelivery(long clientId,
                                       long id,
                                       boolean enable)
                                throws javax.jms.JMSException,
                                       java.rmi.RemoteException
Enable or disable asynchronous message delivery for a particular consumer
Specified by:
enableAsynchronousDelivery in interface RemoteJmsServerSessionIfc
Parameters:
clientId - - the id of the client to check
id - - the last message asynchronously delivered to consumer
enable - - true to enable; false to disable

onMessage

public void onMessage(javax.jms.Message message)

onMessages

public void onMessages(java.util.Vector messages)
Description copied from interface: JmsMessageListener
Send the specified collection of messages to the client
Specified by:
onMessages in interface JmsMessageListener
Following copied from interface: jrun.jms.core.client.JmsMessageListener
Parameters:
messages - - collection of MessageHandle objects


Copyright � 2002 Macromedia Corporation. All Rights Reserved.