User: user57  
  Date: 01/04/17 14:27:14

  Modified:    src/main/org/jboss/jms/jndi JBossMQProvider.java
  Added:       src/main/org/jboss/jms/jndi AbstractJMSProviderAdapter.java
  Removed:     src/main/org/jboss/jms/jndi OpenJMSProvider.java
  Log:
   o Removing files OpenJMS specific files that have been migrated to the
     contrib/openjms CVS module.
   o Added AbstractJMSProviderAdapter, which provides most of the bits that
     are required to implement a JMS provider.
   o Modified JBossMQProvider (and OpenJMSProvider in contrib/openjms) to
     extend AbstractJMSProviderAdapter.
  
  Revision  Changes    Path
  1.3       +25 -33    jboss/src/main/org/jboss/jms/jndi/JBossMQProvider.java
  
  Index: JBossMQProvider.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/jms/jndi/JBossMQProvider.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JBossMQProvider.java      2001/02/28 09:25:46     1.2
  +++ JBossMQProvider.java      2001/04/17 21:27:14     1.3
  @@ -22,53 +22,45 @@
   import javax.naming.Context;
   import javax.naming.InitialContext;
   import javax.naming.NamingException;
  +
   /**
  - * JBossMQProvider.java
  - *
  + * A JMS provider adapter for <em>JBossMQ</em>.
    *
    * Created: Fri Dec 22 09:34:04 2000
    *
    * @author Peter Antman
    * @version
    */
  -
  -public class JBossMQProvider implements JMSProviderAdapter, java.io.Serializable{
  -    public static final String TOPIC_CONNECTION_FACTORY="XATopicConnectionFactory";
  -    public static final String QUEUE_CONNECTION_FACTORY="XAQueueConnectionFactory";
  +public class JBossMQProvider 
  +   extends AbstractJMSProviderAdapter
  +{
  +    public static final String TOPIC_CONNECTION_FACTORY = 
"XATopicConnectionFactory";
  +    public static final String QUEUE_CONNECTION_FACTORY = 
"XAQueueConnectionFactory";
       public static final String INITIAL_CONTEXT_FACTORY = 
"org.jnp.interfaces.NamingContextFactory";
       public static final String URL_PKG_PREFIXES = "org.jboss.naming";
  -    private static final String SECURITY_MANAGER="java.naming.rmi.security.manager";
  +    private static final String SECURITY_MANAGER = 
"java.naming.rmi.security.manager";
   
       private String hasJndiSecurityManager = "yes";
  -    private String name;
  -    private String url;
  +
       public JBossMQProvider() {
  -     
  +        super(QUEUE_CONNECTION_FACTORY, TOPIC_CONNECTION_FACTORY);
       }
  -    
  -    public void setProviderUrl(String url) {
  -     this.url = url;
   
  -    }
  -    public String getProviderUrl() { return url;    }
  -    public void setName(String name) {this.name = name;}
  -    public String getName() {return name;}
       public Context getInitialContext() throws NamingException {
  -     Context ctx = null;
  -     if (url == null) {
  -         // Use default
  -         ctx = new InitialContext();//Only for Jboss embedded now
  -     } else {
  -         //Try another location
  -         Hashtable props = new Hashtable();
  -         props.put(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY);
  -         props.put(Context.PROVIDER_URL, url);
  -         props.put(SECURITY_MANAGER, hasJndiSecurityManager);
  -         props.put(Context.URL_PKG_PREFIXES, URL_PKG_PREFIXES);
  -         ctx = new InitialContext(props);
  -     }
  -     return ctx;
  +        Context ctx = null;
  +        if (providerURL == null) {
  +            // Use default
  +            ctx = new InitialContext(); // Only for JBoss embedded now
  +        } else {
  +            // Try another location
  +            Hashtable props = new Hashtable();
  +            props.put(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY);
  +            props.put(Context.PROVIDER_URL, providerURL);
  +            props.put(SECURITY_MANAGER, hasJndiSecurityManager);
  +            props.put(Context.URL_PKG_PREFIXES, URL_PKG_PREFIXES);
  +            ctx = new InitialContext(props);
  +        }
  +        return ctx;
       }
  -    public  String getTopicFactoryName(){return TOPIC_CONNECTION_FACTORY;}
  -    public String getQueueFactoryName(){return QUEUE_CONNECTION_FACTORY;}
  +
   } // JBossMQProvider
  
  
  
  1.1                  
jboss/src/main/org/jboss/jms/jndi/AbstractJMSProviderAdapter.java
  
  Index: AbstractJMSProviderAdapter.java
  ===================================================================
  /**
   * JBoss, the OpenSource EJB server.
   *
   * This library is free software; you can redistribute it and/or
   * modify it under the terms of the GNU Lesser General Public
   * License as published by the Free Software Foundation; either
   * version 2 of the License, or (at your option) any later version
   * 
   * This library is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   * Lesser General Public License for more details.
   * 
   * You should have received a copy of the GNU Lesser General Public
   * License along with this library; if not, write to the Free Software
   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   */
  package org.jboss.jms.jndi;
  
  import javax.naming.Context;
  import javax.naming.NamingException;
  
  /**
   * An abstract implementaion of {@link JMSProviderAdapter}.  Sub-classes must
   * provide connection names via instance initialzation and provide an 
   * implementaion of {@link #getInitialContext}.
   *
   * @version <pre>$id$</pre>
   * @author  Jason Dillon <a 
href="mailto:[EMAIL PROTECTED]">&lt;[EMAIL PROTECTED]&gt;</a>
   */
  public abstract class AbstractJMSProviderAdapter
     implements JMSProviderAdapter, java.io.Serializable
  {
     /** The queue factory name to use. */
     protected String queueFactoryName;
  
     /** The topic factory name to use. */
     protected String topicFactoryName;
  
     /** The name of the provider. */
     protected String name;
  
     /** The provider url. */
     protected String providerURL;
  
     /**
      * Initialize.
      *
      * @param queueFactoryName    The name of the queue factory to use.
      * @param topicFactoryName    The name of the topic factory to use.
      */
     protected AbstractJMSProviderAdapter(final String queueFactoryName,
                                          final String topicFactoryName)
     {
        this.queueFactoryName = queueFactoryName;
        System.out.println("queue factory name: " + this.queueFactoryName);
        this.topicFactoryName = topicFactoryName;
        System.out.println("topic factory name: " + this.topicFactoryName);
     }
  
     /**
      * Set the name of the provider.
      *
      * @param name    The provider name.
      */
     public void setName(final String name) {
        this.name = name;
     }
  
     /**
      * Get the name of the provider.
      *
      * @return  The provider name.
      */
     public final String getName() {
        return name;
     }
  
     /**
      * Set the URL that will be used to connect to the JNDI provider.
      *
      * @param url  The URL that will be used to connect.
      */
     public void setProviderUrl(final String url) {
        this.providerURL = url;
     }
  
     /**
      * Get the URL that is currently being used to connect to the JNDI 
      * provider.
      *
      * @return     The URL that is currently being used.
      */
     public final String getProviderUrl() {
        return providerURL;
     }
  
     /**
      * Get the JNDI name of the queue factory connection to use.
      *
      * @return  JNDI name of the queue factory connection to use.
      */
     public final String getQueueFactoryName() {
        return queueFactoryName;
     }
  
     /**
      * Get the JNDI name of the topic factory connection to use.
      *
      * @return  JNDI name of the topic factory connection to use.
      */
     public final String getTopicFactoryName() {
        return topicFactoryName;
     }
  }
  
  
  

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

Reply via email to