User: chirino 
  Date: 01/07/10 19:28:34

  Added:       src/main/org/jbossmq/il/jvm JVMClientIL.java
                        JVMClientILService.java JVMServerIL.java
                        JVMServerILService.java
                        JVMServerILServiceMBean.java
  Log:
  This is the il package which now holds interfaces that are more straitfoward to 
understand
  and implement.  Under this package we place the other ils that have been implemented.
  All the ILs are now MBeans and are managed though JMX.
  
  Revision  Changes    Path
  1.1                  jbossmq/src/main/org/jbossmq/il/jvm/JVMClientIL.java
  
  Index: JVMClientIL.java
  ===================================================================
  /*
   * JBossMQ, the OpenSource JMS implementation
   *
   * Distributable under LGPL license.
   * See terms of license at gnu.org.
   */
  package org.jbossmq.il.jvm;
  
  import javax.jms.Destination;
  import javax.jms.JMSException;
  
  import org.jbossmq.ReceiveRequest;
  import org.jbossmq.SpyDestination;
  import org.jbossmq.Connection;
  import org.jbossmq.il.ClientIL;
  
  /**
   *    The RMI implementation of the ConnectionReceiver object
   *      
   *    @author Norbert Lataille ([EMAIL PROTECTED])
   *    @author Hiram Chirino ([EMAIL PROTECTED])
   * 
   *    @version $Revision: 1.1 $
   */
  public class JVMClientIL implements ClientIL {
  
        // A reference to the connection
        Connection connection;
        // Are we running
        boolean stopped= true;
  
        JVMClientIL(Connection c) {
                connection= c;
        }
  
        public void close() throws Exception {
                if (stopped)
                        throw new IllegalStateException("The client IL is stopped");
                connection.asynchClose();
        }
  
        //One TemporaryDestination has been deleted
        public void deleteTemporaryDestination(SpyDestination dest) throws 
JMSException {
                if (stopped)
                        throw new IllegalStateException("The client IL is stopped");
                connection.asynchDeleteTemporaryDestination(dest);
        }
  
        public void receive(ReceiveRequest messages[]) throws Exception {
                if (stopped)
                        throw new IllegalStateException("The client IL is stopped");
                connection.asynchDeliver(messages);
        }
  }
  
  
  1.1                  jbossmq/src/main/org/jbossmq/il/jvm/JVMClientILService.java
  
  Index: JVMClientILService.java
  ===================================================================
  /*
   * JBossMQ, the OpenSource JMS implementation
   *
   * Distributable under LGPL license.
   * See terms of license at gnu.org.
   */
  package org.jbossmq.il.jvm;
  
  import javax.jms.Destination;
  import javax.jms.JMSException;
  
  import org.jbossmq.ReceiveRequest;
  import org.jbossmq.SpyDestination;
  import org.jbossmq.Connection;
  import org.jbossmq.il.ClientIL;
  import org.jbossmq.il.ClientILService;
  
  /**
   *    The RMI implementation of the ConnectionReceiver object
   *      
   *    @author Norbert Lataille ([EMAIL PROTECTED])
   *    @author Hiram Chirino ([EMAIL PROTECTED])
   * 
   *    @version $Revision: 1.1 $
   */
  public class JVMClientILService implements org.jbossmq.il.ClientILService {
  
        //the client IL
        JVMClientIL clientIL;
  
        /**
         * getClientIL method comment.
         */
        public org.jbossmq.il.ClientIL getClientIL() throws java.lang.Exception {
                return clientIL;
        }
  
        /**
         * init method comment.
         */
        public void init(org.jbossmq.Connection connection, java.util.Properties 
props) throws java.lang.Exception {
                clientIL= new JVMClientIL(connection);
        }
  
        /**
         * start method comment.
         */
        public void start() throws java.lang.Exception {
                clientIL.stopped= false;
        }
  
        /**
         * 
         */
        public void stop() throws java.lang.Exception {
                clientIL.stopped= false;
        }
  }
  
  
  1.1                  jbossmq/src/main/org/jbossmq/il/jvm/JVMServerIL.java
  
  Index: JVMServerIL.java
  ===================================================================
  /*
   * JBossMQ, the OpenSource JMS implementation
   *
   * Distributable under LGPL license.
   * See terms of license at gnu.org.
   */
  package org.jbossmq.il.jvm;
  
  import javax.jms.JMSException;
  import javax.jms.Destination;
  import javax.jms.Topic;
  import javax.jms.Queue;
  import javax.jms.TemporaryTopic;
  import javax.jms.TemporaryQueue;
  
  import org.jbossmq.TransactionRequest;
  import org.jbossmq.SpyMessage;
  import org.jbossmq.AcknowledgementRequest;
  import org.jbossmq.SpyDestination;
  import org.jbossmq.ConnectionToken;
  import org.jbossmq.il.ServerIL;
  import org.jbossmq.server.JMSServer;
  
  /**
   *    The JVM implementation of the ServerIL object
   *      
   *    @author Hiram Chirino ([EMAIL PROTECTED])
   *    @author Norbert Lataille ([EMAIL PROTECTED])
   * 
   *    @version $Revision: 1.1 $
   */
  public class JVMServerIL implements ServerIL, java.io.Serializable {
  
        //The server implementation
        transient private JMSServer server;
  
        public JVMServerIL(JMSServer s) {
                server= s;
        }
  
        /**
         * No need to clone because there are no instance variables tha can get
         * clobbered.  All Multiple connections can share the same JVMServerIL object
         */
        public ServerIL cloneServerIL() {
                return this;
        }
        
        public void setConnectionToken(ConnectionToken newConnectionToken) {
                // We cannot try to cache the token since this IL is stateless
        }
  
        public String getID() throws JMSException {
                return server.getID();
        }
  
        public void addMessage(ConnectionToken dc, SpyMessage val) throws JMSException 
{
                server.addMessage(dc, val);
        }
  
        public Topic createTopic(ConnectionToken dc, String dest) throws JMSException {
                return server.createTopic(dc, dest);
        }
  
        public Queue createQueue(ConnectionToken dc, String dest) throws JMSException {
                return server.createQueue(dc, dest);
        }
  
        public void deleteTemporaryDestination(ConnectionToken dc, SpyDestination 
dest) throws JMSException {
                server.deleteTemporaryDestination(dc, dest);
        }
  
        public void checkID(String ID) throws JMSException {
                server.checkID(ID);
        }
  
        public void connectionClosing(ConnectionToken dc) throws JMSException {
                server.connectionClosing(dc);
        }
  
        public TemporaryQueue getTemporaryQueue(ConnectionToken dc) throws 
JMSException {
                return server.getTemporaryQueue(dc);
        }
  
        public TemporaryTopic getTemporaryTopic(ConnectionToken dc) throws 
JMSException {
                return server.getTemporaryTopic(dc);
        }
  
        public void acknowledge(ConnectionToken dc, AcknowledgementRequest item) 
throws Exception {
                server.acknowledge(dc, item);
        }
  
        public SpyMessage[] browse(ConnectionToken dc, Destination dest, String 
selector) throws Exception {
                return server.browse(dc, dest, selector);
        }
  
        public void listenerChange(ConnectionToken dc, int subscriberId, boolean 
state) throws Exception {
                server.listenerChange(dc, subscriberId, state);
        }
  
        public SpyMessage receive(ConnectionToken dc, int subscriberId, long wait) 
throws Exception {
                return server.receive(dc, subscriberId, wait);
        }
  
        public void setEnabled(ConnectionToken dc, boolean enabled) throws Exception {
                server.setEnabled(dc, enabled);
        }
  
        public void unsubscribe(ConnectionToken dc, int subscriptionId) throws 
Exception {
                server.unsubscribe(dc, subscriptionId);
        }
  
        public String checkUser(String userName, String password) throws JMSException {
                return server.checkUser(userName, password);
        }
  
        public void subscribe(ConnectionToken dc, org.jbossmq.Subscription s) throws 
Exception {
                server.subscribe(dc, s);
        }
  
        public void transact(org.jbossmq.ConnectionToken dc, TransactionRequest t) 
throws JMSException {
                server.transact(dc, t);
        }
  
  }
  
  
  1.1                  jbossmq/src/main/org/jbossmq/il/jvm/JVMServerILService.java
  
  Index: JVMServerILService.java
  ===================================================================
  /*
   * JBossMQ, the OpenSource JMS implementation
   *
   * Distributable under LGPL license.
   * See terms of license at gnu.org.
   */
  package org.jbossmq.il.jvm;
  
  import java.util.Properties;
  import javax.naming.InitialContext;
  import javax.management.*;
  
  import org.jboss.util.ServiceMBeanSupport;
  
  import org.jbossmq.GenericConnectionFactory;
  import org.jbossmq.il.ServerILJMXService;
  import org.jbossmq.il.ServerIL;
  import org.jbossmq.server.JMSServer;
  
  /**
   *    Implements the ServerILJMXService which is used to 
   *  manage the JVM IL.
   *
   *    @author Hiram Chirino ([EMAIL PROTECTED])
   *    @version $Revision: 1.1 $
   */
  public class JVMServerILService extends ServerILJMXService implements 
JVMServerILServiceMBean {
  
        JVMServerIL serverIL;
  
        /**
         * Gives this JMX service a name.
         */
        public String getName() {
                return "JBossMQ-JVMServerIL";
        }
  
        /**
         * Used to construct the GenericConnectionFactory (bindJNDIReferences() builds 
it)
         *  @returns ServerIL the instance of this IL
         */
        public ServerIL getServerIL() {
                return serverIL;
        }
  
        /**
         * Starts this IL, and binds it to JNDI
         */
        public void startService() throws Exception {
  
                serverIL= new JVMServerIL(lookupJMSServer());
                bindJNDIReferences();
  
        }
  
        /**
         * Stops this IL, and unbinds it from JNDI
         */
        public void stopService() {
                try {
                        unbindJNDIReferences();
                } catch (Exception e) {
                        e.printStackTrace();
                }
        }
  
        /**
         * Used to construct the GenericConnectionFactory (bindJNDIReferences() builds 
it)
         * Sets up the connection properties need by a client to use this
         * IL
         */
        public java.util.Properties getClientConnectionProperties() {
                Properties rc= new Properties();
                rc.setProperty(GenericConnectionFactory.CLIENT_IL_SERVICE_KEY, 
"org.jbossmq.il.jvm.JVMClientILService");
                return rc;
        }
  }
  
  
  1.1                  jbossmq/src/main/org/jbossmq/il/jvm/JVMServerILServiceMBean.java
  
  Index: JVMServerILServiceMBean.java
  ===================================================================
  /*
   * JBossMQ, the OpenSource JMS implementation
   *
   * Distributable under LGPL license.
   * See terms of license at gnu.org.
   */
  package org.jbossmq.il.jvm;
  
  import java.lang.Object;
  
  /**
   * This interface is used to define which methods will be exposed
   * via JMX.
   */
  public interface JVMServerILServiceMBean extends 
org.jbossmq.il.ServerILJMXServiceMBean
  {
     public static final String OBJECT_NAME = "JBossMQ:service=JVMServerIL";
  }
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to