User: user57  
  Date: 02/02/16 21:49:00

  Modified:    src/main/org/jboss/jms/ra JmsConnectionFactoryImpl.java
                        JmsConnectionManager.java
                        JmsConnectionRequestInfo.java JmsCred.java
                        JmsLocalTransaction.java JmsMCFProperties.java
                        JmsManagedConnection.java
                        JmsManagedConnectionFactory.java JmsMetaData.java
                        JmsSession.java JmsSessionFactoryImpl.java
                        TestClient.java package.html
  Added:       src/main/org/jboss/jms/ra JmsConnectionFactory.java
                        JmsSessionFactory.java
  Removed:     src/main/org/jboss/jms/ra JmsLogger.java Level.java
                        StringUtil.java
  Log:
   o Nix silly logging.  This might not be 100% JCA compliant cause we
     ignore the LogWriter crap, but whatever...
   o Nix extra client package, since there isn't a real client that will
     use these.
  
  Revision  Changes    Path
  1.3       +88 -93    jboss/src/main/org/jboss/jms/ra/JmsConnectionFactoryImpl.java
  
  Index: JmsConnectionFactoryImpl.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/jms/ra/JmsConnectionFactoryImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JmsConnectionFactoryImpl.java     18 Jun 2001 20:01:26 -0000      1.2
  +++ JmsConnectionFactoryImpl.java     17 Feb 2002 05:48:59 -0000      1.3
  @@ -1,20 +1,12 @@
  -/*
  - * Copyright (c) 2001 Peter Antman Tim <[EMAIL PROTECTED]>
  - *
  - * 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
  - */
  +/***************************************
  + *                                     *
  + *  JBoss: The OpenSource J2EE WebOS   *
  + *                                     *
  + *  Distributable under LGPL license.  *
  + *  See terms of license at gnu.org.   *
  + *                                     *
  + ***************************************/
  +
   package org.jboss.jms.ra;
   
   import java.io.Serializable;
  @@ -30,88 +22,91 @@
   import javax.jms.QueueConnection;
   import javax.jms.TopicConnection;
   
  -import org.jboss.jms.ra.client.JmsConnectionFactory;
   /**
  - * JmsConnectionFactoryImpl.java
  - *
  + * ???
    *
    * Created: Thu Apr 26 17:02:50 2001
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Peter Antman</a>.
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
  -
   public class JmsConnectionFactoryImpl 
  -    implements JmsConnectionFactory,Serializable, Referenceable {
  -    private Reference reference;
  -
  -    /**
  -     * JmsRa own factory
  -     */
  -    private ManagedConnectionFactory mcf;
  -
  -    /**
  -     * Hook to the appserver
  -     */
  -    private ConnectionManager cm;
  +   implements JmsConnectionFactory, Serializable, Referenceable
  +{
  +   private Reference reference;
  +
  +   /**
  +    * JmsRa own factory
  +    */
  +   private ManagedConnectionFactory mcf;
  +
  +   /**
  +    * Hook to the appserver
  +    */
  +   private ConnectionManager cm;
       
  -    public JmsConnectionFactoryImpl(ManagedConnectionFactory mcf,
  -                                 ConnectionManager cm) 
  -    {
  -     this.mcf = mcf;
  -     this.cm = cm;
  -        if (cm == null) {
  -         // This is standalone usage, no appserver
  -            this.cm = new JmsConnectionManager();
  -        } else {
  -            this.cm = cm;
  -        }
  -    }
  -
  -    public void setReference(Reference reference) 
  -    {
  -     this.reference = reference;
  -    }
  +   public JmsConnectionFactoryImpl(ManagedConnectionFactory mcf,
  +                                   ConnectionManager cm) 
  +   {
  +      this.mcf = mcf;
  +      this.cm = cm;
  +      if (cm == null) {
  +         // This is standalone usage, no appserver
  +         this.cm = new JmsConnectionManager();
  +      } else {
  +         this.cm = cm;
  +      }
  +   }
  +
  +   public void setReference(Reference reference) 
  +   {
  +      this.reference = reference;
  +   }
       
  -    public Reference getReference() 
  -    {
  -        return reference;
  -    }
  -    // --- QueueConnectionFactory
  -    public QueueConnection createQueueConnection() 
  -     throws JMSException 
  -    {
  -     JmsSessionFactoryImpl s = new JmsSessionFactoryImpl(mcf,cm);
  -     s.isTopic(Boolean.FALSE);
  -     return s;
  -    } 
  -    public QueueConnection createQueueConnection(String userName,
  -                                              String password) 
  -     throws JMSException 
  -    {
  -     JmsSessionFactoryImpl s = new JmsSessionFactoryImpl(mcf,cm);
  -     s.isTopic(Boolean.FALSE);
  -     s.setUserName(userName);
  -     s.setPassword(password);
  -     return s;
  -    } 
  -
  -    // --- TopicConnectionFactory
  -    public TopicConnection createTopicConnection() 
  -     throws JMSException 
  -    {
  -     JmsSessionFactoryImpl s = new JmsSessionFactoryImpl(mcf,cm);
  -     s.isTopic(Boolean.TRUE);
  -     return s;
  -    } 
  -    public TopicConnection createTopicConnection(String userName,
  -                                              String password) 
  -     throws JMSException 
  -    {
  -     JmsSessionFactoryImpl s = new JmsSessionFactoryImpl(mcf,cm);
  -     s.isTopic(Boolean.TRUE);
  -     s.setUserName(userName);
  -     s.setPassword(password);
  -     return s;
  -    }
  -} // JmsConnectionFactoryImpl
  +   public Reference getReference() 
  +   {
  +      return reference;
  +   }
  +   
  +   // --- QueueConnectionFactory
  +   
  +   public QueueConnection createQueueConnection() 
  +      throws JMSException 
  +   {
  +      JmsSessionFactoryImpl s = new JmsSessionFactoryImpl(mcf,cm);
  +      s.isTopic(Boolean.FALSE);
  +      return s;
  +   }
  +   
  +   public QueueConnection createQueueConnection(String userName,
  +                                                String password) 
  +      throws JMSException 
  +   {
  +      JmsSessionFactoryImpl s = new JmsSessionFactoryImpl(mcf,cm);
  +      s.isTopic(Boolean.FALSE);
  +      s.setUserName(userName);
  +      s.setPassword(password);
  +      return s;
  +   } 
  +
  +   // --- TopicConnectionFactory
  +   
  +   public TopicConnection createTopicConnection() 
  +      throws JMSException 
  +   {
  +      JmsSessionFactoryImpl s = new JmsSessionFactoryImpl(mcf,cm);
  +      s.isTopic(Boolean.TRUE);
  +      return s;
  +   }
  +   
  +   public TopicConnection createTopicConnection(String userName,
  +                                                String password) 
  +      throws JMSException 
  +   {
  +      JmsSessionFactoryImpl s = new JmsSessionFactoryImpl(mcf,cm);
  +      s.isTopic(Boolean.TRUE);
  +      s.setUserName(userName);
  +      s.setPassword(password);
  +      return s;
  +   }
  +}
  
  
  
  1.4       +10 -18    jboss/src/main/org/jboss/jms/ra/JmsConnectionManager.java
  
  Index: JmsConnectionManager.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/jms/ra/JmsConnectionManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JmsConnectionManager.java 20 Jul 2001 23:04:32 -0000      1.3
  +++ JmsConnectionManager.java 17 Feb 2002 05:48:59 -0000      1.4
  @@ -1,20 +1,12 @@
  -/*
  - * Copyright (c) 2001 Peter Antman Tim <[EMAIL PROTECTED]>
  - *
  - * 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
  - */
  +/***************************************
  + *                                     *
  + *  JBoss: The OpenSource J2EE WebOS   *
  + *                                     *
  + *  Distributable under LGPL license.  *
  + *  See terms of license at gnu.org.   *
  + *                                     *
  + ***************************************/
  +
   package org.jboss.jms.ra;
   
   import javax.resource.ResourceException;
  @@ -32,7 +24,7 @@
    * <p>Created: Thu Mar 29 16:09:26 2001
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Peter Antman</a>.
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
    */
   public class JmsConnectionManager
      implements ConnectionManager
  
  
  
  1.4       +34 -36    jboss/src/main/org/jboss/jms/ra/JmsConnectionRequestInfo.java
  
  Index: JmsConnectionRequestInfo.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/jms/ra/JmsConnectionRequestInfo.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JmsConnectionRequestInfo.java     27 Sep 2001 13:25:22 -0000      1.3
  +++ JmsConnectionRequestInfo.java     17 Feb 2002 05:48:59 -0000      1.4
  @@ -1,39 +1,33 @@
  -/*
  - * Copyright (c) 2001 Peter Antman Tim <[EMAIL PROTECTED]>
  - *
  - * 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
  - */
  +/***************************************
  + *                                     *
  + *  JBoss: The OpenSource J2EE WebOS   *
  + *                                     *
  + *  Distributable under LGPL license.  *
  + *  See terms of license at gnu.org.   *
  + *                                     *
  + ***************************************/
  +
   package org.jboss.jms.ra;
   
   import javax.resource.spi.ConnectionRequestInfo;
   
   import javax.jms.Session;
   
  +import org.jboss.util.Strings;
  +
   /**
  - * JmsConnectionRequestInfo.java
  - *
  + * ???
    *
    * Created: Thu Mar 29 16:29:55 2001
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Peter Antman</a>.
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
    */
  -
  -public class JmsConnectionRequestInfo implements ConnectionRequestInfo {
  -   private String userName = null;
  -   private String password = null;
  +public class JmsConnectionRequestInfo
  +   implements ConnectionRequestInfo
  +{
  +   private String userName;
  +   private String password;
   
      private boolean transacted = true;
      private int acknowledgeMode = Session.AUTO_ACKNOWLEDGE;
  @@ -42,7 +36,8 @@
      /**
       * Creats with the MCF configured properties.
       */
  -   public JmsConnectionRequestInfo(JmsMCFProperties prop) {
  +   public JmsConnectionRequestInfo(JmsMCFProperties prop)
  +   {
         this.userName = prop.getUserName();
         this.password = prop.getPassword();
         this.isTopic = prop.isTopic();
  @@ -53,8 +48,8 @@
       */
      public JmsConnectionRequestInfo(boolean transacted, 
                                   int acknowledgeMode,
  -                                boolean isTopic
  -                                ) {
  +                                boolean isTopic)
  +   {
         this.transacted = transacted;
         this.acknowledgeMode = acknowledgeMode;
         this.isTopic = isTopic;
  @@ -63,7 +58,8 @@
      /**
       * Fill in default values if missing. Only applies to user and password.
       */
  -   public void setDefaults(JmsMCFProperties prop) {
  +   public void setDefaults(JmsMCFProperties prop)
  +   {
         if (userName == null)
         userName = prop.getUserName();//May be null there to
         if (password == null) 
  @@ -106,15 +102,16 @@
   
      public boolean equals(Object obj) {
         if (obj == null) return false;
  -      if (obj instanceof JmsConnectionRequestInfo) {
  +      if (obj instanceof JmsConnectionRequestInfo)
  +      {
         JmsConnectionRequestInfo you = (JmsConnectionRequestInfo) obj;
         return (this.transacted == you.isTransacted() &&
                 this.acknowledgeMode == you.getAcknowledgeMode() &&
                 this.isTopic == you.isTopic() &&
  -              StringUtil.compare(userName, you.getUserName()) &&
  -              StringUtil.compare(password, you.getPassword())
  -              );
  -      } else {
  +              Strings.compare(userName, you.getUserName()) &&
  +              Strings.compare(password, you.getPassword()));
  +      }
  +      else {
         return false;
         }
      }
  @@ -125,7 +122,9 @@
         return result.hashCode();
      }
       
  -   // May be used if we fill in username and password later 
  +   /**
  +    * May be used if we fill in username and password later.
  +    */
      private boolean isEqual(Object o1, Object o2) {
         if (o1 == null) {
         return (o2 == null);
  @@ -133,5 +132,4 @@
         return o1.equals(o2);
         }
      }
  -
  -} // JmsConnectionRequestInfo
  +}
  
  
  
  1.3       +65 -68    jboss/src/main/org/jboss/jms/ra/JmsCred.java
  
  Index: JmsCred.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/jms/ra/JmsCred.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JmsCred.java      18 Jun 2001 20:01:26 -0000      1.2
  +++ JmsCred.java      17 Feb 2002 05:48:59 -0000      1.3
  @@ -1,20 +1,12 @@
  -/*
  - * Copyright (c) 2001 Peter Antman Tim <[EMAIL PROTECTED]>
  - *
  - * 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
  - */
  +/***************************************
  + *                                     *
  + *  JBoss: The OpenSource J2EE WebOS   *
  + *                                     *
  + *  Distributable under LGPL license.  *
  + *  See terms of license at gnu.org.   *
  + *                                     *
  + ***************************************/
  +
   package org.jboss.jms.ra;
   
   import java.util.Set;
  @@ -27,61 +19,66 @@
   import javax.resource.spi.ConnectionRequestInfo;
   
   import javax.resource.spi.security.PasswordCredential;
  +
   /**
  - * JmsCred.java
  - *
  + * ???
    *
    * Created: Sat Mar 31 03:23:30 2001
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Peter Antman</a>.
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
  -
  -public class JmsCred  {
  -    public String name;
  -    public String pwd;
  -    
  -    public JmsCred() {
  -     
  -    }
  -
  +public class JmsCred
  +{
  +   public String name;
  +   public String pwd;
       
  -    /**
  -     * Get our own simple cred
  -     */
  -    public static JmsCred getJmsCred(ManagedConnectionFactory mcf,
  -                                          Subject subject, 
  -                                          ConnectionRequestInfo info) 
  -     throws SecurityException {
  -
  -     JmsCred jc = new JmsCred();
  -     if (subject == null && info !=null ) {
  -         // Credentials specifyed on connection request
  -         jc.name = ((JmsConnectionRequestInfo)info).getUserName();
  -         jc.pwd = ((JmsConnectionRequestInfo)info).getPassword();
  -     } else if (subject != null) {
  -         // Credentials from appserver
  -         Set creds = 
  -             subject.getPrivateCredentials(PasswordCredential.class);
  -         PasswordCredential pwdc = null;
  -         Iterator credentials = creds.iterator();
  -         while(credentials.hasNext()) {
  -             PasswordCredential curCred = 
  -                 (PasswordCredential) credentials.next();
  -             if (curCred.getManagedConnectionFactory().equals(mcf)) {
  -                 pwdc = curCred;
  -                 break;
  -             }
  -         }
  -         if(pwdc == null) {
  -             // No hit - we do need creds
  -             throw new SecurityException("No Passwdord credentials found");
  -         }
  -         jc.name = pwdc.getUserName();
  -         jc.pwd = new String(pwdc.getPassword());
  -     } else {
  -         throw new SecurityException("No Subject or ConnectionRequestInfo set, 
could not get credentials");
  -     }
  -     return jc;
  -    }
  -} // JmsCred
  +   public JmsCred() {
  +      // empty
  +   }
  +
  +   /**
  +    * Get our own simple cred
  +    */
  +   public static JmsCred getJmsCred(ManagedConnectionFactory mcf,
  +                                    Subject subject, 
  +                                    ConnectionRequestInfo info) 
  +      throws SecurityException
  +   {
  +      JmsCred jc = new JmsCred();
  +      if (subject == null && info !=null )
  +      {
  +         // Credentials specifyed on connection request
  +         jc.name = ((JmsConnectionRequestInfo)info).getUserName();
  +         jc.pwd = ((JmsConnectionRequestInfo)info).getPassword();
  +      }
  +      else if (subject != null)
  +      {
  +         // Credentials from appserver
  +         Set creds = 
  +            subject.getPrivateCredentials(PasswordCredential.class);
  +         PasswordCredential pwdc = null;
  +         Iterator credentials = creds.iterator();
  +         while (credentials.hasNext())
  +         {
  +            PasswordCredential curCred = 
  +               (PasswordCredential) credentials.next();
  +            if (curCred.getManagedConnectionFactory().equals(mcf)) {
  +               pwdc = curCred;
  +               break;
  +            }
  +         }
  +         
  +         if (pwdc == null) {
  +            // No hit - we do need creds
  +            throw new SecurityException("No Passwdord credentials found");
  +         }
  +         jc.name = pwdc.getUserName();
  +         jc.pwd = new String(pwdc.getPassword());
  +      }
  +      else {
  +         throw new SecurityException("No Subject or ConnectionRequestInfo set, 
could not get credentials");
  +      }
  +      return jc;
  +   }
  +}
  
  
  
  1.3       +53 -55    jboss/src/main/org/jboss/jms/ra/JmsLocalTransaction.java
  
  Index: JmsLocalTransaction.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/jms/ra/JmsLocalTransaction.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JmsLocalTransaction.java  18 Jun 2001 20:01:26 -0000      1.2
  +++ JmsLocalTransaction.java  17 Feb 2002 05:48:59 -0000      1.3
  @@ -1,20 +1,12 @@
  -/*
  - * Copyright (c) 2001 Peter Antman Tim <[EMAIL PROTECTED]>
  - *
  - * 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
  - */
  +/***************************************
  + *                                     *
  + *  JBoss: The OpenSource J2EE WebOS   *
  + *                                     *
  + *  Distributable under LGPL license.  *
  + *  See terms of license at gnu.org.   *
  + *                                     *
  + ***************************************/
  +
   package org.jboss.jms.ra;
   
   import javax.jms.JMSException;
  @@ -23,53 +15,59 @@
   import javax.resource.spi.LocalTransaction;
   import javax.resource.spi.ConnectionEvent;
   import javax.resource.spi.EISSystemException;
  +
   /**
  - * JmsLocalTransaction.java
  - *
  + * ???
    *
    * Created: Tue Apr 17 23:44:05 2001
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Peter Antman</a>.
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
  +public class JmsLocalTransaction
  +   implements LocalTransaction
  +{
  +   protected JmsManagedConnection mc;
  +   
  +   public JmsLocalTransaction(final JmsManagedConnection mc) {
  +      this.mc = mc;
  +   }
   
  -public class JmsLocalTransaction implements LocalTransaction {
  -    JmsManagedConnection mc;
  -    public JmsLocalTransaction(JmsManagedConnection mc) {
  -     this.mc = mc;
  -    }
  -
  -    public void begin() throws ResourceException {
  -     // NOOP - begin is automatic in JMS
  -     // Should probably send event
  -     ConnectionEvent ev = new ConnectionEvent(mc, 
ConnectionEvent.LOCAL_TRANSACTION_STARTED);
  -     mc.sendEvent(ev);
  -    }
  +   public void begin() throws ResourceException {
  +      // NOOP - begin is automatic in JMS
  +      // Should probably send event
  +      ConnectionEvent ev = new ConnectionEvent(mc, 
ConnectionEvent.LOCAL_TRANSACTION_STARTED);
  +      mc.sendEvent(ev);
  +   }
       
  -    public void commit() throws ResourceException {
  -     try {
  -         mc.getSession().commit();
  -         ConnectionEvent ev = new ConnectionEvent(mc, 
ConnectionEvent.LOCAL_TRANSACTION_COMMITTED);
  -         mc.sendEvent(ev);
  -     }catch(JMSException ex) {
  -         ResourceException re = new EISSystemException("Could not commit 
LocalTransaction : " + ex.getMessage());
  -            re.setLinkedException(ex);
  -            throw re;
  -     }
  -
  -    }
  -    public void rollback() throws ResourceException {
  -     try {
  -         mc.getSession().rollback();
  -         ConnectionEvent ev = new ConnectionEvent(mc, 
ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK);
  -         mc.sendEvent(ev);
  -     }catch(JMSException ex) {
  -         ResourceException re = new EISSystemException("Could not rollback 
LocalTransaction : " + ex.getMessage());
  -            re.setLinkedException(ex);
  -            throw re;
  -     }
  +   public void commit() throws ResourceException {
  +      try {
  +         mc.getSession().commit();
  +         ConnectionEvent ev = new ConnectionEvent(mc, 
ConnectionEvent.LOCAL_TRANSACTION_COMMITTED);
  +         mc.sendEvent(ev);
  +      }
  +      catch (JMSException ex) {
  +         ResourceException re =
  +            new EISSystemException("Could not commit LocalTransaction : " + 
ex.getMessage());
  +         re.setLinkedException(ex);
  +         throw re;
  +      }
       }
  -} // JmsLocalTransaction
  +   
  +   public void rollback() throws ResourceException {
  +      try {
  +         mc.getSession().rollback();
  +         ConnectionEvent ev = new ConnectionEvent(mc, 
ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK);
  +         mc.sendEvent(ev);
  +      }
  +      catch (JMSException ex) {
  +         ResourceException re =
  +            new EISSystemException("Could not rollback LocalTransaction : " + 
ex.getMessage());
  +         re.setLinkedException(ex);
  +         throw re;
  +      }
  +   }
  +}
   
   
   
  
  
  
  1.2       +47 -40    jboss/src/main/org/jboss/jms/ra/JmsMCFProperties.java
  
  Index: JmsMCFProperties.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/jms/ra/JmsMCFProperties.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JmsMCFProperties.java     27 Sep 2001 13:25:22 -0000      1.1
  +++ JmsMCFProperties.java     17 Feb 2002 05:48:59 -0000      1.2
  @@ -1,40 +1,44 @@
  -/*
  -* JBoss, the OpenSource EJB server
  -*
  -* Distributable under LGPL license.
  -* See terms of license at gnu.org.
  -*/
  +/***************************************
  + *                                     *
  + *  JBoss: The OpenSource J2EE WebOS   *
  + *                                     *
  + *  Distributable under LGPL license.  *
  + *  See terms of license at gnu.org.   *
  + *                                     *
  + ***************************************/
  +
   package org.jboss.jms.ra;
   
   import javax.resource.ResourceException;
   
  +import org.jboss.util.Strings;
  +
   /**
  - * <p>The MCF default properties, settable in ra.xml or in deployer.
  - *
  + * The MCF default properties, settable in ra.xml or in deployer.
    *
    * Created: Thu Sep 27 10:01:25 2001
    *
    * @author Peter Antman
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
  -
  -public class JmsMCFProperties  {
  +public class JmsMCFProperties
  +{
      final static String QUEUE_TYPE = "javax.jms.Queue";
      final static String TOPIC_TYPE = "javax.jms.Topic";
   
  -   String userName = null;
  -   String password = null;
  +   String userName;
  +   String password;
      String providerJNDI = "java:DefaultJMSProvider";
      boolean isTopic = true;
      
      public JmsMCFProperties() {
  -      
  +      // empty
      }
      
      /**
       * Set userName, null by default.
       */
  -   public void setUserName(String userName) {
  +   public void setUserName(final String userName) {
         this.userName = userName;
      }
   
  @@ -48,9 +52,10 @@
      /**
       * Set password, null by default.
       */
  -   public void setPassword(String password) {
  +   public void setPassword(final String password) {
         this.password = password;
      }
  +   
      /**
       * Get password, may be null.
       */
  @@ -59,11 +64,11 @@
      }
   
      /**
  -    * <p>Set providerJNDI, the JMS provider adapter to use.
  +    * Set providerJNDI, the JMS provider adapter to use.
       *
       * <p>Defaults to java:DefaultJMSProvider.
       */
  -   public void setProviderJNDI(String providerJNDI) {
  +   public void setProviderJNDI(final String providerJNDI) {
         this.providerJNDI  = providerJNDI;
      }
   
  @@ -94,15 +99,17 @@
       * @param type either javax.jms.Topic or javax.jms.Queue
       * @exception ResourceException if type was not a valid type.
       */
  -   public void setSessionDefaultType(String type) throws ResourceException {
  +   public void setSessionDefaultType(String type) throws ResourceException
  +   {
         if (type.equals(QUEUE_TYPE)) {
         isTopic = false;
  -      }else if(type.equals(TOPIC_TYPE)) {
  +      }
  +      else if(type.equals(TOPIC_TYPE)) {
         isTopic = true;
  -      } else {
  +      }
  +      else {
         throw new  ResourceException(type + " is not a recogniced JMS session type");
         }
  -      
      }
   
      public String getSessionDefaultType() {
  @@ -113,25 +120,25 @@
       * Test for equality of all attributes.
       */
      public boolean equals(Object obj) {
  -        if (obj == null) return false;
  -        if (obj instanceof JmsMCFProperties) {
  -            JmsMCFProperties you = (JmsMCFProperties) obj;
  -            return (StringUtil.compare(userName, you.getUserName()) &&
  -                 StringUtil.compare(password, you.getPassword()) &&
  -                 StringUtil.compare(providerJNDI, you.getProviderJNDI()) &&
  -                 this.isTopic == you.isTopic()
  -                 );
  -        } else {
  -            return false;
  -        }
  -    }
  +      if (obj == null) return false;
  +      
  +      if (obj instanceof JmsMCFProperties) {
  +         JmsMCFProperties you = (JmsMCFProperties) obj;
  +         return (Strings.compare(userName, you.getUserName()) &&
  +                 Strings.compare(password, you.getPassword()) &&
  +                 Strings.compare(providerJNDI, you.getProviderJNDI()) &&
  +                 this.isTopic == you.isTopic());
  +      }
  +      
  +      return false;
  +   }
    
      /**
       * Simple hashCode of all attributes. 
       */
  -    public int hashCode() {
  -        String result = "" + userName + password + providerJNDI + isTopic;
  -        return result.hashCode();
  -    }
  -   
  -} // JmsMCFProperties
  +   public int hashCode() {
  +      // FIXME
  +      String result = "" + userName + password + providerJNDI + isTopic;
  +      return result.hashCode();
  +   }
  +}
  
  
  
  1.8       +47 -64    jboss/src/main/org/jboss/jms/ra/JmsManagedConnection.java
  
  Index: JmsManagedConnection.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/jms/ra/JmsManagedConnection.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- JmsManagedConnection.java 22 Sep 2001 14:00:42 -0000      1.7
  +++ JmsManagedConnection.java 17 Feb 2002 05:48:59 -0000      1.8
  @@ -1,20 +1,12 @@
  -/*
  - * Copyright (c) 2001 Peter Antman Tim <[EMAIL PROTECTED]>
  - *
  - * 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
  - */
  +/***************************************
  + *                                     *
  + *  JBoss: The OpenSource J2EE WebOS   *
  + *                                     *
  + *  Distributable under LGPL license.  *
  + *  See terms of license at gnu.org.   *
  + *                                     *
  + ***************************************/
  +
   package org.jboss.jms.ra;
   
   import java.util.Vector;
  @@ -49,6 +41,8 @@
   import org.jboss.jms.ConnectionFactoryHelper;
   import org.jboss.jms.jndi.JMSProviderAdapter;
   
  +import org.jboss.logging.Logger;
  +
   /**
    * Managed Connection, manages one or more JMS sessions.
    * 
  @@ -114,11 +108,13 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Peter Antman</a>.
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason Dillon</a>
  - * @version $Revision: 1.7 $
  + * @version $Revision: 1.8 $
    */
   public class JmsManagedConnection
      implements ManagedConnection
   {
  +   private static final Logger log = Logger.getLogger(JmsManagedConnection.class);
  +   
      private JmsManagedConnectionFactory mcf;
      private JmsConnectionRequestInfo info;
      private String user; // = null;
  @@ -134,10 +130,6 @@
      private XAResource xaResource;
      private boolean xaTransacted; // = false;
   
  -   /** Should we have one for each connection */
  -   private PrintWriter logWriter; // = null;
  -   private JmsLogger logger = new JmsLogger();
  -    
      /** Holds all current JmsSession handles. */
      private Set handles = new HashSet();
   
  @@ -161,6 +153,8 @@
         throws ResourceException 
      {
         this.mcf = mcf;
  +
  +      // seem like its asking for trouble here
         this.info = (JmsConnectionRequestInfo)info;
         this.user = user;
         this.pwd = pwd;
  @@ -318,8 +312,11 @@
       * @param l   The connection event listener to be added.
       */
      public void addConnectionEventListener(final ConnectionEventListener l) {
  -      logger.log(Level.FINE,"ConnectionEvent listener added");
         listeners.addElement(l);
  +      
  +      if (log.isDebugEnabled()) {
  +         log.debug("ConnectionEvent listener added: " + l);
  +      }
      }
   
      /**
  @@ -355,7 +352,7 @@
               xaResource = xaQueueSession.getXAResource();
            }
         }
  -      logger.log(Level.FINE, "Leaving out XAResource");
  +      log.debug("Leaving out XAResource");
   
         return xaResource;
      }
  @@ -368,7 +365,7 @@
       * @throws ResourceException
       */
      public LocalTransaction getLocalTransaction() throws ResourceException {
  -      logger.log(Level.FINE, "Leaving out LocalTransaction");
  +      log.debug("Leaving out LocalTransaction");
         return new JmsLocalTransaction(this);
      }
   
  @@ -396,19 +393,16 @@
       * @throws ResourceException
       */
      public void setLogWriter(final PrintWriter out) throws ResourceException {
  -      this.logWriter = out;
  -      if (out != null) {
  -         logger.setLogWriter(out);
  -      }
  +      log.debug("Ignoring call to setLogWriter()");
      }
       
      /**
       * Get the log writer for this connection.
       *
  -    * @return   The log writer for this connection.
  +    * @return   Always null
       */
      public PrintWriter getLogWriter() throws ResourceException {
  -      return logWriter;
  +      return null;
      }
   
      // --- Api to JmsSession
  @@ -421,27 +415,20 @@
      protected Session getSession() {
         if (info.isTopic()) {
            return topicSession;
  -      } else {
  +      }
  +      else {
            return queueSession;
         }
      }
   
      /**
  -    * Get the logger for this connection.
  -    *
  -    * @return    The logger for this connection.
  -    */
  -   protected JmsLogger getLogger() {
  -      return logger;
  -   }
  -
  -   /**
       * Send an event.
       *
       * @param event    The event to send.
       */
      protected void sendEvent(final ConnectionEvent event) {
  -      logger.log(Level.FINE,"Sending connection event: " + event.getId());
  +      log.debug("Sending connection event: " + event.getId());
  +
         Vector list = (Vector) listeners.clone();
         int size = list.size();
         
  @@ -567,7 +554,7 @@
               con = ConnectionFactoryHelper.createTopicConnection(factory,
                                                                   user,
                                                                   pwd);
  -            logger.log(Level.FINE, "created connection: " + con);
  +            log.debug("created connection: " + con);
   
               if (con instanceof XATopicConnection) {
                  xaTopicSession = ((XATopicConnection)con).createXATopicSession();
  @@ -577,26 +564,24 @@
               else if (con instanceof TopicConnection) {
                  topicSession =
                     ((TopicConnection)con).createTopicSession(transacted, ack);
  -               logger.log(Level.WARNING,
  -                          "Using a non-XA TopicConnection.  " +
  -                          "It will not be able to participate in a Global UOW");
  +               log.debug("Using a non-XA TopicConnection.  " +
  +                         "It will not be able to participate in a Global UOW");
               }
               else {
  -               logger.log(Level.SEVERE,
  -                          "Error in getting session for con: " + con);
  -                    throw new ResourceException
  -                       ("Connection was not reconizable: " + con);
  +               log.error("Error in getting session for con: " + con);
  +               throw new ResourceException
  +                  ("Connection was not reconizable: " + con);
               }
   
  -            logger.log(Level.FINE, "xaTopicSession: " + xaTopicSession);
  -            logger.log(Level.FINE, "topicSession: " + topicSession);
  +            log.debug("xaTopicSession: " + xaTopicSession);
  +            log.debug("topicSession: " + topicSession);
            }
            else { // isQueue
               factory = context.lookup(adapter.getQueueFactoryRef());
               con = ConnectionFactoryHelper.createQueueConnection(factory,
                                                                   user,
                                                                   pwd);
  -            logger.log(Level.FINE, "created connection: " + con);
  +            log.debug("created connection: " + con);
   
               if (con instanceof XAQueueConnection) {
                  xaQueueSession =
  @@ -607,23 +592,21 @@
               else if (con instanceof QueueConnection) {
                  queueSession =
                     ((QueueConnection)con).createQueueSession(transacted, ack);
  -               logger.log(Level.WARNING,
  -                          "Using a non-XA QueueConnection.  " +
  -                          "It will not be able to participate in a Global UOW");
  +               log.debug("Using a non-XA QueueConnection.  " +
  +                         "It will not be able to participate in a Global UOW");
               }
               else {
  -               logger.log(Level.SEVERE,
  -                          "Error in getting session for con: " + con);
  -                    throw new ResourceException
  -                       ("Connection was not reconizable: " + con);
  +               log.error("Error in getting session for con: " + con);
  +               throw new ResourceException
  +                  ("Connection was not reconizable: " + con);
               }
   
  -            logger.log(Level.FINE, "xaQueueSession: " + xaQueueSession);
  -            logger.log(Level.FINE, "queueSession: " + queueSession);
  +            log.debug("xaQueueSession: " + xaQueueSession);
  +            log.debug("queueSession: " + queueSession);
            }
         con.start();
  -         logger.log(Level.FINE, "transacted: " + transacted);
  -         logger.log(Level.FINE, "ack mode: " + ack);
  +         log.debug("transacted: " + transacted);
  +         log.debug("ack mode: " + ack);
         }
         catch (NamingException e) {
            CommException ce = new CommException(e.toString());
  
  
  
  1.5       +37 -49    jboss/src/main/org/jboss/jms/ra/JmsManagedConnectionFactory.java
  
  Index: JmsManagedConnectionFactory.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/jms/ra/JmsManagedConnectionFactory.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JmsManagedConnectionFactory.java  27 Sep 2001 13:25:22 -0000      1.4
  +++ JmsManagedConnectionFactory.java  17 Feb 2002 05:48:59 -0000      1.5
  @@ -1,20 +1,12 @@
  -/*
  - * Copyright (c) 2001 Peter Antman Tim <[EMAIL PROTECTED]>
  - *
  - * 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
  - */
  +/***************************************
  + *                                     *
  + *  JBoss: The OpenSource J2EE WebOS   *
  + *                                     *
  + *  Distributable under LGPL license.  *
  + *  See terms of license at gnu.org.   *
  + *                                     *
  + ***************************************/
  +
   package org.jboss.jms.ra;
   
   import java.util.Set;
  @@ -37,27 +29,29 @@
   
   import org.jboss.jms.jndi.JMSProviderAdapter;
   
  +import org.jboss.logging.Logger;
  +
   /**
  - * JmsManagedConnectionFactory.java
  - *
  + * ???
    *
    * Created: Sat Mar 31 03:08:35 2001
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Peter Antman</a>.
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
    */
   public class JmsManagedConnectionFactory
      implements ManagedConnectionFactory
   {
  -   private PrintWriter logWriter = null;
  -   private JmsLogger logger = new JmsLogger();
  +   private static final Logger log = Logger.getLogger(JmsManagedConnection.class);
  +
      /** Settable attributes in ra.xml */
      private JmsMCFProperties mcfProperties = new JmsMCFProperties();
   
  -   //For local access
  +   /** For local access. */
      private JMSProviderAdapter adapter;
      
      public JmsManagedConnectionFactory() {
  +      // empty
      }
      
      /**
  @@ -89,8 +83,10 @@
         // OK we got autentication stuff
         JmsManagedConnection mc = new JmsManagedConnection
            (this, info,cred.name, cred.pwd);
  +
         // Set default logwriter according to spec
  -      mc.setLogWriter(logWriter);
  +      // user57: screw the logWriter stuff for now it sucks ass
  +      
         return mc;
   
      }
  @@ -127,15 +123,12 @@
               // FIXME, Here we have a problem, jms connection 
               // may be anonymous, have a user name
                
  -            if (
  -                (mc.getUserName() == null || 
  +            if ((mc.getUserName() == null || 
                    (mc.getUserName() != null && 
  -                  mc.getUserName().equals(cred.name))
  -                 ) &&
  -                mcf.equals(this)) {
  +                  mc.getUserName().equals(cred.name))) && mcf.equals(this))
  +            {
                  // Now check if ConnectionInfo equals
                  if (info.equals( mc.getInfo() )) {
  -
                     return mc;
                  }
               }
  @@ -144,24 +137,17 @@
         return null;
      }
   
  -   /**
  -    * 
  -    */
      public void setLogWriter(PrintWriter out)
  -      throws ResourceException {
  -      this.logWriter = out;
  -      logger.setLogWriter(out);
  +      throws ResourceException
  +   {
  +      log.debug("Ignoring call to setLogWriter()");
      }
      
  -   /**
  -    * 
  -    */
  +
      public PrintWriter getLogWriter() throws ResourceException {
  -      return logWriter;    
  +      return null;
      }
   
  -
  -
      /**
       * Checks for equality ower the configured properties.
       */
  @@ -169,7 +155,8 @@
         if (obj == null) return false;
         if (obj instanceof JmsManagedConnectionFactory) {
         return mcfProperties.equals( 
((JmsManagedConnectionFactory)obj).getProperties());
  -      } else {
  +      }
  +      else {
            return false;
         }
      }
  @@ -179,6 +166,7 @@
      }
   
      // --- Connfiguration API ---
  +   
      public void setJmsProviderAdapterJNDI(String jndi) {
         mcfProperties.setProviderJNDI(jndi);
      }
  @@ -214,12 +202,11 @@
         return  mcfProperties.getPassword();
      }
   
  -
  -
      /**
       * Set the default session typ
       *
       * @param type either javax.jms.Topic or javax.jms.Queue
  +    * 
       * @exception ResourceException if type was not a valid type.
       */
      public void setSessionDefaultType(String type) throws ResourceException {
  @@ -233,7 +220,7 @@
      /**
       * For local access
       */
  -   public void setJmsProviderAdapter(JMSProviderAdapter adapter) {
  +   public void setJmsProviderAdapter(final JMSProviderAdapter adapter) {
         this.adapter = adapter;
      }
       
  @@ -241,12 +228,12 @@
         return adapter;
      }
   
  -   //---- Private helper methods
      private ConnectionRequestInfo getInfo(ConnectionRequestInfo info) {   
         if (info == null) {
         // Create a default one
         return new JmsConnectionRequestInfo(mcfProperties);
  -      } else {
  +      }
  +      else {
         // Fill the one with any defaults
         ((JmsConnectionRequestInfo)info).setDefaults(mcfProperties);
         return info;
  @@ -254,7 +241,8 @@
      }
      
      //---- MCF to MCF API
  +   
      protected JmsMCFProperties getProperties() {
         return mcfProperties;
      }
  -} // JmsManagedConnectionFactory
  +}
  
  
  
  1.3       +35 -43    jboss/src/main/org/jboss/jms/ra/JmsMetaData.java
  
  Index: JmsMetaData.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/jms/ra/JmsMetaData.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JmsMetaData.java  18 Jun 2001 20:01:26 -0000      1.2
  +++ JmsMetaData.java  17 Feb 2002 05:48:59 -0000      1.3
  @@ -1,57 +1,49 @@
  -/*
  - * Copyright (c) 2001 Peter Antman Tim <[EMAIL PROTECTED]>
  - *
  - * 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
  - */
  +/***************************************
  + *                                     *
  + *  JBoss: The OpenSource J2EE WebOS   *
  + *                                     *
  + *  Distributable under LGPL license.  *
  + *  See terms of license at gnu.org.   *
  + *                                     *
  + ***************************************/
  +
   package org.jboss.jms.ra;
   
   import javax.resource.ResourceException;
   import javax.resource.spi.ManagedConnectionMetaData;
   
   /**
  - * JmsMetaData.java
  - *
  + * ???
    *
    * Created: Sat Mar 31 03:36:27 2001
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Peter Antman</a>.
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
  +public class JmsMetaData
  +   implements ManagedConnectionMetaData
  +{
  +   private JmsManagedConnection mc;
  +   
  +   public JmsMetaData(final JmsManagedConnection mc) {
  +      this.mc = mc;
  +   }
  +   
  +   public String getEISProductName() throws ResourceException {
  +      return "JMS CA Resource Adapter";
  +   }
   
  -public class JmsMetaData  implements ManagedConnectionMetaData {
  -    
  -    private JmsManagedConnection mc;
  -    
  -    public JmsMetaData(JmsManagedConnection mc) {
  -     this.mc = mc;
  -    }
  -    public String getEISProductName() throws ResourceException {
  -     return "JMS CA Resource Adapter";
  -    }
  -
  -    public String getEISProductVersion() throws ResourceException {
  -     return "0.1";//Is this possible to get another way
  -    }
  +   public String getEISProductVersion() throws ResourceException {
  +      return "0.1";//Is this possible to get another way
  +   }
   
  -    public int getMaxConnections() throws ResourceException {
  -     // Dont know how to get this, from Jms, we
  -     // set it to unlimited
  -     return 0;
  -    }
  +   public int getMaxConnections() throws ResourceException {
  +      // Dont know how to get this, from Jms, we
  +      // set it to unlimited
  +      return 0;
  +   }
       
  -    public String getUserName() throws ResourceException {
  -        return mc.getUserName();
  -    }
  -} // JmsMetaData
  +   public String getUserName() throws ResourceException {
  +      return mc.getUserName();
  +   }
  +}
  
  
  
  1.5       +24 -25    jboss/src/main/org/jboss/jms/ra/JmsSession.java
  
  Index: JmsSession.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/jms/ra/JmsSession.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JmsSession.java   9 Aug 2001 20:34:44 -0000       1.4
  +++ JmsSession.java   17 Feb 2002 05:48:59 -0000      1.5
  @@ -1,20 +1,11 @@
  -/*
  - * Copyright (c) 2001 Peter Antman Tim <[EMAIL PROTECTED]>
  - *
  - * 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
  - */
  +/***************************************
  + *                                     *
  + *  JBoss: The OpenSource J2EE WebOS   *
  + *                                     *
  + *  Distributable under LGPL license.  *
  + *  See terms of license at gnu.org.   *
  + *                                     *
  + ***************************************/
   
   package org.jboss.jms.ra;
   
  @@ -23,6 +14,11 @@
   
   import javax.resource.spi.ConnectionEvent;
   
  +import org.jboss.logging.Logger;
  +
  +// make sure we throw the jmx variety
  +import javax.jms.IllegalStateException;
  +
   /**
    * Adapts the JMS QueueSession and TopicSession API to a JmsManagedConnection.
    *
  @@ -30,11 +26,13 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Peter Antman</a>.
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason Dillon</a>.
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
    */
   public class JmsSession
      implements QueueSession, TopicSession
   {
  +   private static final Logger log = Logger.getLogger(JmsSession.class);
  +   
      /** The managed connection for this session. */
      private JmsManagedConnection mc; // = null;
   
  @@ -52,12 +50,12 @@
       *
       * @return    The session
       *
  -    * @throws javax.jms.IllegalStateException    The session is closed
  +    * @throws IllegalStateException    The session is closed
       */
      private Session getSession() throws JMSException {
         // ensure that the connection is opened
         if (mc == null)
  -         throw new javax.jms.IllegalStateException("The session is closed");
  +         throw new IllegalStateException("The session is closed");
   
         return mc.getSession();
      }
  @@ -113,22 +111,22 @@
      /**
       * Always throws an Exception.
       *
  -    * @throws javax.jms.IllegalStateException     Method not allowed.
  +    * @throws IllegalStateException     Method not allowed.
       */
      public MessageListener getMessageListener() throws JMSException
      {
  -      throw new javax.jms.IllegalStateException("Method not allowed");      
  +      throw new IllegalStateException("Method not allowed");      
      }
       
      /**
       * Always throws an Exception.
       *
  -    * @throws javax.jms.IllegalStateException     Method not allowed.
  +    * @throws IllegalStateException     Method not allowed.
       */
      public void setMessageListener(MessageListener listener)
         throws JMSException
      {
  -      throw new javax.jms.IllegalStateException("Method not allowed");
  +      throw new IllegalStateException("Method not allowed");
      }
   
      /**
  @@ -150,7 +148,8 @@
      public void close() throws JMSException
      {
         if (mc != null) {
  -         mc.getLogger().log(Level.FINE, "Closing session");
  +         log.debug("Closing session");
  +
            // Special stuff FIXME
            mc.removeHandle(this);
            ConnectionEvent ev =
  
  
  
  1.5       +17 -20    jboss/src/main/org/jboss/jms/ra/JmsSessionFactoryImpl.java
  
  Index: JmsSessionFactoryImpl.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/jms/ra/JmsSessionFactoryImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JmsSessionFactoryImpl.java        8 Aug 2001 00:11:41 -0000       1.4
  +++ JmsSessionFactoryImpl.java        17 Feb 2002 05:48:59 -0000      1.5
  @@ -1,20 +1,12 @@
  -/*
  - * Copyright (c) 2001 Peter Antman Tim <[EMAIL PROTECTED]>
  - *
  - * 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
  - */
  +/***************************************
  + *                                     *
  + *  JBoss: The OpenSource J2EE WebOS   *
  + *                                     *
  + *  Distributable under LGPL license.  *
  + *  See terms of license at gnu.org.   *
  + *                                     *
  + ***************************************/
  +
   package org.jboss.jms.ra;
   
   import java.io.Serializable;
  @@ -37,7 +29,7 @@
   import javax.jms.ExceptionListener;
   import javax.jms.ConnectionMetaData;
   
  -import org.jboss.jms.ra.client.JmsSessionFactory;
  +import org.jboss.logging.Logger;
   
   /**
    * Implements the JMS Connection API and produces {@link JmsSession} objects.
  @@ -45,11 +37,13 @@
    * <p>Created: Thu Mar 29 15:36:51 2001
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Peter Antman</a>.
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
    */
   public class JmsSessionFactoryImpl
      implements JmsSessionFactory, Serializable, Referenceable
   {
  +   private static final Logger log = Logger.getLogger(JmsSessionFactoryImpl.class);
  +   
      private static final String ISE =
         "This method is not applicatable in JMS resource adapter";
   
  @@ -125,7 +119,8 @@
            return (QueueSession)cm.allocateConnection(mcf, info);
         }
         catch (ResourceException e) {
  -         e.printStackTrace();
  +         log.error("could not create session", e);
  +
            JMSException je =
               new JMSException("Could not create a session: " + e);
            je.setLinkedException(e);
  @@ -164,6 +159,8 @@
            return (TopicSession)cm.allocateConnection(mcf, info);
         }
         catch (ResourceException e) {
  +         log.error("could not create session", e);
  +         
            JMSException je = new JMSException
               ("Could not create a session: " + e);
            je.setLinkedException(e);
  
  
  
  1.3       +42 -55    jboss/src/main/org/jboss/jms/ra/TestClient.java
  
  Index: TestClient.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/jms/ra/TestClient.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestClient.java   18 Jun 2001 20:01:26 -0000      1.2
  +++ TestClient.java   17 Feb 2002 05:48:59 -0000      1.3
  @@ -1,68 +1,55 @@
  -/*
  - * Copyright (c) 2001 Peter Antman Tim <[EMAIL PROTECTED]>
  - *
  - * 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
  - */
  +/***************************************
  + *                                     *
  + *  JBoss: The OpenSource J2EE WebOS   *
  + *                                     *
  + *  Distributable under LGPL license.  *
  + *  See terms of license at gnu.org.   *
  + *                                     *
  + ***************************************/
  +
   package org.jboss.jms.ra;
   
   import javax.jms.*;
   import javax.naming.InitialContext;
   
  -import org.jboss.jms.ra.client.*;
   /**
    * TestClient for stand alone use. Basically verry uninteresting.
    *
  - *
    * Created: Sun Apr 22 19:10:27 2001
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Peter Antman</a>.
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
  -
  -public class TestClient {
  -    
  -    public TestClient() {
  -     
  -    }
  -    
  -    public static void main(String[] args) {
  -     try {
  -            JmsManagedConnectionFactory f = new JmsManagedConnectionFactory();
  -            f.setJmsProviderAdapter( new org.jboss.jms.jndi.JBossMQProvider());
  -            //f.setLogging("true");
  -            JmsConnectionFactory cf = 
(JmsConnectionFactory)f.createConnectionFactory();
  -
  -         //FIXME - how to get LocalTransaction for standalone usage?
  -         TopicConnection con = cf.createTopicConnection();
  -            TopicSession ses = con.createTopicSession(true, 
Session.AUTO_ACKNOWLEDGE);
  -         Topic topic = (Topic)new InitialContext().lookup("topic/testTopic");
  -
  -
  -         TopicPublisher pub = ses.createPublisher(topic);
  -
  -         TextMessage m = ses.createTextMessage("Hello world!");
  -         pub.publish(m);
  -         ses.commit();
  -
  -            ses.close();
  -
  -
  -        }catch(Exception ex) {
  -            System.err.println("Error: " + ex);
  -            ex.printStackTrace();
  -        }
  -    }
  +public class TestClient
  +{
  +   public TestClient() {
  +      // empty
  +   }
       
  -} // TestClient
  +   public static void main(String[] args) {
  +      try {
  +         JmsManagedConnectionFactory f = new JmsManagedConnectionFactory();
  +         f.setJmsProviderAdapter( new org.jboss.jms.jndi.JBossMQProvider());
  +         //f.setLogging("true");
  +         JmsConnectionFactory cf = 
(JmsConnectionFactory)f.createConnectionFactory();
  +         
  +         //FIXME - how to get LocalTransaction for standalone usage?
  +         TopicConnection con = cf.createTopicConnection();
  +         TopicSession ses = con.createTopicSession(true, Session.AUTO_ACKNOWLEDGE);
  +         Topic topic = (Topic)new InitialContext().lookup("topic/testTopic");
  +         
  +         
  +         TopicPublisher pub = ses.createPublisher(topic);
  +         
  +         TextMessage m = ses.createTextMessage("Hello world!");
  +         pub.publish(m);
  +         ses.commit();
  +         
  +         ses.close();
  +      }
  +      catch(Exception ex) {
  +         System.err.println("Error: " + ex);
  +         ex.printStackTrace();
  +      }
  +   }
  +}
  
  
  
  1.3       +11 -18    jboss/src/main/org/jboss/jms/ra/package.html
  
  Index: package.html
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/jms/ra/package.html,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- package.html      3 Aug 2001 17:15:52 -0000       1.2
  +++ package.html      17 Feb 2002 05:48:59 -0000      1.3
  @@ -1,30 +1,19 @@
   <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
   <html>
     <head>
  -    <!-- $Id: package.html,v 1.2 2001/08/03 17:15:52 mnf999 Exp $ -->
  +    <!-- $Id: package.html,v 1.3 2002/02/17 05:48:59 user57 Exp $ -->
       <!--
   
  -    This file is part of JBoss; the OpenSource J2EE webOS.
  -                                                                              
  -    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   
  +    JBoss: The OpenSource J2EE WebOS 
  +
  +    Distributable under LGPL license.
  +    See terms of license at gnu.org.
   
       -->
     </head>
   
     <body bgcolor="white">
  -    <p>Provides an EJB resource adapter for JMS.
  +    <p>JMS Resource Adapter
   
       <h2>Package Specification</h2>
       <ul>
  @@ -41,8 +30,12 @@
         <li><font color="green"><b>STABLE</b></font>
       </ul>
   
  +    <h2>Todo</h2>
  +    <ul>
  +      <li>???
  +    </ul>
  +
       <!-- Put @see and @since tags down here. -->
   
     </body>
   </html>
  -
  
  
  
  1.1                  jboss/src/main/org/jboss/jms/ra/JmsConnectionFactory.java
  
  Index: JmsConnectionFactory.java
  ===================================================================
  /***************************************
   *                                     *
   *  JBoss: The OpenSource J2EE WebOS   *
   *                                     *
   *  Distributable under LGPL license.  *
   *  See terms of license at gnu.org.   *
   *                                     *
   ***************************************/
  
  package org.jboss.jms.ra;
  
  import javax.jms.TopicConnectionFactory;
  import javax.jms.QueueConnectionFactory;
  
  /**
   * JmsConnectionFactory.java
   *
   * <p>Created: Thu Apr 26 17:01:35 2001
   *
   * @author  <a href="mailto:[EMAIL PROTECTED]";>Peter Antman</a>.
   * @version <pre>$Revision: 1.1 $</pre>
   */
  public interface JmsConnectionFactory 
     extends TopicConnectionFactory, QueueConnectionFactory
  {
     // empty
  }
  
  
  
  1.1                  jboss/src/main/org/jboss/jms/ra/JmsSessionFactory.java
  
  Index: JmsSessionFactory.java
  ===================================================================
  /***************************************
   *                                     *
   *  JBoss: The OpenSource J2EE WebOS   *
   *                                     *
   *  Distributable under LGPL license.  *
   *  See terms of license at gnu.org.   *
   *                                     *
   ***************************************/
  
  package org.jboss.jms.ra;
  
  import javax.jms.TopicConnection;
  import javax.jms.QueueConnection;
  
  /**
   * A marker interface to join topics and queues into one factory.
   *
   * <p>Created: Thu Mar 29 15:37:21 2001
   *
   * @author  <a href="mailto:[EMAIL PROTECTED]";>Peter Antman</a>.
   * @version <pre>$Revision: 1.1 $</pre>
   */
  public interface JmsSessionFactory
     extends TopicConnection, QueueConnection
  {
     // empty
  }
  
  
  

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

Reply via email to