User: norbert 
  Date: 00/05/31 11:10:14

  Added:       src/java/org/spydermq/distributed
                        ConnectionReceiverFactory.java
                        JMSServerFactory.java
                        SpyQueueConnectionFactory.java
                        SpyTopicConnectionFactory.java
  Log:
  Change the directory name
  
  Revision  Changes    Path
  1.1                  
spyderMQ/src/java/org/spydermq/distributed/ConnectionReceiverFactory.java
  
  Index: ConnectionReceiverFactory.java
  ===================================================================
  /*
   * spyderMQ, the OpenSource JMS implementation
   *
   * Distributable under GPL license.
   * See terms of license at gnu.org.
   */
  package org.spydermq.distributed;
  
  import org.spydermq.distributed.interfaces.ConnectionReceiver;
  import org.spydermq.SpyConnection;
  import org.spydermq.SpyDistributedConnection;
  import java.util.Properties;
  import java.rmi.server.UnicastRemoteObject;
  import java.rmi.Remote;
  
  /**
   *    This is a factory for the ConnectionReceiver interface
   *      
   *    @author Norbert Lataille ([EMAIL PROTECTED])
   * 
   *    @version $Revision: 1.1 $
   */
  public class ConnectionReceiverFactory
  {
            
        // Static -------------------------------------------------------
  
        public static ConnectionReceiver createConnectionReceiver(SpyConnection 
c,String crClassName) throws Exception
        {
                ConnectionReceiver cr = 
(ConnectionReceiver)Class.forName(crClassName).newInstance();
                cr.setConnection(c);
                return cr;
        }
        
        public static void close(SpyDistributedConnection dc) throws Exception
        {
                dc.cr.close();                  
                UnicastRemoteObject.unexportObject((Remote)dc.cr,true);
        }
  }
  
  
  
  1.1                  spyderMQ/src/java/org/spydermq/distributed/JMSServerFactory.java
  
  Index: JMSServerFactory.java
  ===================================================================
  /*
   * spyderMQ, the OpenSource JMS implementation
   *
   * Distributable under GPL license.
   * See terms of license at gnu.org.
   */
  package org.spydermq.distributed;
  
  import org.spydermq.distributed.interfaces.DistributedJMSServer;
  import org.spydermq.JMSServer;
  import java.util.Properties;
  
  /**
   *    This is a factory for the JMSServer interface
   *      
   *    @author Norbert Lataille ([EMAIL PROTECTED])
   * 
   *    @version $Revision: 1.1 $
   */
  public class JMSServerFactory
  {
        // Static -------------------------------------------------------
  
        public static DistributedJMSServer createJMSServer(JMSServer s,Properties 
prop) throws Exception
        {
                String className=(String)prop.get("DistributedJMSServerClassName");
                DistributedJMSServer jmss = 
(DistributedJMSServer)Class.forName(className).newInstance();
                jmss.setServer(s);
                return jmss;
        }
  }
  
  
  
  1.1                  
spyderMQ/src/java/org/spydermq/distributed/SpyQueueConnectionFactory.java
  
  Index: SpyQueueConnectionFactory.java
  ===================================================================
  /*
   * spyderMQ, the OpenSource JMS implementation
   *
   * Distributable under GPL license.
   * See terms of license at gnu.org.
   */
  package org.spydermq.distributed;
  
  import javax.jms.QueueConnection;
  import javax.jms.QueueConnectionFactory;
  import javax.jms.JMSException;
  import org.spydermq.Log;
  import org.spydermq.security.SecurityManager;
  import org.spydermq.distributed.interfaces.DistributedJMSServer;
  import org.spydermq.distributed.interfaces.DistributedQueueConnectionFactory;
  import java.io.Serializable;
  import java.util.Properties;
  
  /**
   *    This is a factory for the SpyQueueConnection interface
   *      
   *    @author Norbert Lataille ([EMAIL PROTECTED])
   * 
   *    @version $Revision: 1.1 $
   */
  public class SpyQueueConnectionFactory 
        implements QueueConnectionFactory, Serializable
  { 
        // Attributes ----------------------------------------------------
  
        private DistributedQueueConnectionFactory factory;
  
        // Constructor ---------------------------------------------------
           
        public SpyQueueConnectionFactory( DistributedQueueConnectionFactory factory) 
throws Exception
        {               
                this.factory = factory;
        }
  
        // Public --------------------------------------------------------
  
      public QueueConnection createQueueConnection() throws JMSException
        {
                try {
                        return factory.createQueueConnection();
                } catch (JMSException e) {
                        throw e;
                } catch (Exception e) {
                        failureHandler(e,"createQueueConnection has failed !");
                        return null;
                }
        }
                
      public QueueConnection createQueueConnection(String userName, String password) 
throws JMSException
        {
                try {
                        return factory.createQueueConnection(userName,password);
                } catch (JMSException e) {
                        throw e;
                } catch (Exception e) {
                        failureHandler(e,"createQueueConnection has failed !");
                        return null;
                }
        }
                
        //private
        
        private void failureHandler(Exception e,String reason) throws JMSException
        {
                Log.error(e);
                throw new JMSException(reason);
        }
        
  }
  
  
  
  1.1                  
spyderMQ/src/java/org/spydermq/distributed/SpyTopicConnectionFactory.java
  
  Index: SpyTopicConnectionFactory.java
  ===================================================================
  /*
   * spyderMQ, the OpenSource JMS implementation
   *
   * Distributable under GPL license.
   * See terms of license at gnu.org.
   */
  package org.spydermq.distributed;
  
  import javax.jms.TopicConnection;
  import javax.jms.TopicConnectionFactory;
  import javax.jms.JMSException;
  import org.spydermq.distributed.interfaces.DistributedJMSServer;
  import org.spydermq.distributed.interfaces.DistributedTopicConnectionFactory;
  import org.spydermq.Log;
  import org.spydermq.security.SecurityManager;
  import java.io.Serializable;
  import java.util.Properties;
  
  /**
   *    This is a factory for the SpyTopicConnection interface
   *      
   *    @author Norbert Lataille ([EMAIL PROTECTED])
   * 
   *    @version $Revision: 1.1 $
   */
  public class SpyTopicConnectionFactory 
        implements TopicConnectionFactory, Serializable
  { 
        // Attributes ----------------------------------------------------
  
        private DistributedTopicConnectionFactory factory;
  
        // Constructor ---------------------------------------------------
           
        public SpyTopicConnectionFactory(DistributedTopicConnectionFactory factory) 
throws Exception
        {               
                this.factory = factory;
        }
  
        // Public --------------------------------------------------------
  
      public TopicConnection createTopicConnection() throws JMSException
        {
                try {
                        return factory.createTopicConnection();
                } catch (JMSException e) {
                        throw e;
                } catch (Exception e) {
                        failureHandler(e,"createTopicConnection has failed !");
                        return null;
                }
        }
                
      public TopicConnection createTopicConnection(String userName, String password) 
throws JMSException
        {
                try {
                        return factory.createTopicConnection(userName,password);
                } catch (JMSException e) {
                        throw e;
                } catch (Exception e) {
                        failureHandler(e,"createTopicConnection has failed !");
                        return null;
                }
        }
        
        //private
        
        private void failureHandler(Exception e,String reason) throws JMSException
        {
                Log.error(e);
                throw new JMSException(reason);
        }
  }
  
  
  

Reply via email to