axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject cvs commit: xml-axis/java/samples/jms server-config.wsdd JMSTest.java client_deploy.wsdd build.xml
Date Tue, 17 Sep 2002 16:50:36 GMT
jmsnell     2002/09/17 09:50:36

  Modified:    java     buildSamples.xml .cvsignore build.xml
               java/xmls targets.xml
  Added:       java/src/org/apache/axis/transport/jms
                        SimpleJMSListener.java JMSConnector.java
                        SonicConstants.java TopicConnector.java
                        JMSEndpoint.java MapUtils.java Subscription.java
                        JMSConstants.java InvokeTimeoutException.java
                        JMSTransport.java InvokeException.java
                        QueueConnector.java JMSConnectorFactory.java
                        SimpleJMSWorker.java JMSSender.java
               java/samples/jms server-config.wsdd JMSTest.java
                        client_deploy.wsdd build.xml
  Log:
  Adding Sonic's JMS transport to the main source
  
  Revision  Changes    Path
  1.13      +4 -0      xml-axis/java/buildSamples.xml
  
  Index: buildSamples.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/buildSamples.xml,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- buildSamples.xml	11 Sep 2002 14:35:38 -0000	1.12
  +++ buildSamples.xml	17 Sep 2002 16:50:35 -0000	1.13
  @@ -103,6 +103,10 @@
       <ant inheritAll="true" antfile="${axis.home}/samples/jaxrpc/build.xml"/>
     </target>
   
  +  <target name="jms" depends="setenv">
  +    <ant inheritAll="true" antfile="${axis.home}/samples/jms/build.xml"/>
  +  </target>
  +
   <!-- =========================================================================== -->
     <target name="copy"/>
   
  
  
  
  1.7       +3 -0      xml-axis/java/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/.cvsignore,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- .cvsignore	16 Aug 2002 22:51:21 -0000	1.6
  +++ .cvsignore	17 Sep 2002 16:50:35 -0000	1.7
  @@ -7,3 +7,6 @@
   bin
   .project
   .classpath
  +buildit.bat
  +testit.bat
  +GetQuote.wsdl
  
  
  
  1.188     +1 -0      xml-axis/java/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/build.xml,v
  retrieving revision 1.187
  retrieving revision 1.188
  diff -u -r1.187 -r1.188
  --- build.xml	12 Sep 2002 21:04:24 -0000	1.187
  +++ build.xml	17 Sep 2002 16:50:35 -0000	1.188
  @@ -106,6 +106,7 @@
         <exclude name="**/org/apache/axis/transport/http/ServletEndpointContextImpl.java" unless="servlet.present"/>
         <exclude name="**/org/apache/axis/transport/configuration/EngineConfigurationFactoryServlet.java" unless="servlet.present"/>
         <exclude name="**/org/apache/axis/transport/http/CommonsHTTPSender.java" unless="commons-httpclient.present"/>
  +      <exclude name="**/org/apache/axis/transport/jms/*" unless="jms.present"/>
         <exclude name="**/org/apache/axis/server/JNDIAxisServerFactory.java" unless="servlet.present"/>
         <exclude name="**/org/apache/axis/security/servlet/*" unless="servlet.present"/>
         <exclude name="**/javax/xml/soap/*.java" unless="attachments.present"/>
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/transport/jms/SimpleJMSListener.java
  
  Index: SimpleJMSListener.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001, 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.axis.transport.jms;
  
  import java.io.InputStream;
  import java.io.ByteArrayInputStream;
  import java.io.ByteArrayOutputStream;
  
  import java.util.HashMap;
  
  import javax.jms.MessageListener;
  import javax.jms.BytesMessage;
  import javax.jms.Destination;
  import javax.jms.JMSException;
  
  import org.apache.axis.Message;
  import org.apache.axis.MessageContext;
  import org.apache.axis.AxisFault;
  
  import org.apache.axis.server.AxisServer;
  
  import org.apache.axis.utils.Options;
  import org.apache.axis.utils.Messages;
  
  import org.apache.commons.logging.Log;
  import org.apache.axis.components.logger.LogFactory;
  
  /**
   * SimpleJMSListener implements the javax.jms.MessageListener interface. Its
   *   basic purpose is listen asynchronously for messages and to pass them off
   *   to SimpleJMSWorker for processing.
   *
   * Note: This is a simple JMS listener that does not pool worker threads and
   *   is not otherwise tuned for performance. As such, its intended use is not
   *   for production code, but for demos, debugging, and performance profiling.
   *
   * @author Jaime Meritt  (jmeritt@sonicsoftware.com)
   * @author Richard Chung (rchung@sonicsoftware.com)
   * @author Dave Chappell (chappell@sonicsoftware.com)
   */
  public class SimpleJMSListener implements MessageListener
  {
      protected static Log log =
              LogFactory.getLog(SimpleJMSListener.class.getName());
  
      // Do we use (multiple) threads to process incoming messages?
      private static boolean doThreads = true;
  
      private JMSConnector connector;
      private JMSEndpoint endpoint;
      private AxisServer server;
  
      public SimpleJMSListener(Options options)
          throws Exception
      {
          HashMap cfMap = new HashMap();
          cfMap.put(SonicConstants.BROKER_URL, options.isValueSet('b'));
  
          // do we have a jndi name?
          String jndiName = options.isValueSet('n');
          if (jndiName != null) {
              cfMap.put(JMSConstants.CONNECTION_FACTORY_JNDI_NAME, jndiName);
          } else {
              // topics or queues?
              String cf = null;
              if (options.isFlagSet('t') > 0) {
                  cf = SonicConstants.TCF_CLASS;
              } else {
                  cf = SonicConstants.QCF_CLASS;
              }
              cfMap.put(JMSConstants.CONNECTION_FACTORY_CLASS, cf);
          }
  
          // single-threaded?
          if (options.isFlagSet('s') > 0) {
              doThreads = false;
          }
  
          try {
              connector = JMSConnectorFactory.
                                  createServerConnector(null,
                                                        cfMap,
                                                        options.getUser(),
                                                        options.getPassword());
          } catch (Exception e) {
              log.error(Messages.getMessage("exception00"), e);
              throw e;
          }
  
          // create the appropriate endpoint for the indicated destination
          endpoint = connector.createEndpoint(options.isValueSet('d'));
          endpoint.registerListener(this);
      }
  
      // Axis server (shared between instances)
      private static AxisServer myAxisServer = new AxisServer();
  
      protected static AxisServer getAxisServer()
      {
          return myAxisServer;
      }
  
      protected JMSConnector getConnector()
      {
          return connector;
      }
  
      /**
       * This method is called asynchronously whenever a message arrives.
       * @param message
       */
      public void onMessage(javax.jms.Message message)
      {
          try
          {
              // pass off the message to a worker as a BytesMessage
              SimpleJMSWorker worker = new SimpleJMSWorker(this, (BytesMessage)message);
  
              //should pool
  
              // do we allow multi-threaded workers?
              if (doThreads) {
                  Thread t = new Thread(worker);
                  t.start();
              } else {
                  worker.run();
              }
          }
          catch(ClassCastException cce)
          {
              log.error(Messages.getMessage("exception00"), cce);
              cce.printStackTrace();
              return;
          }
      }
  
      public void start()
      {
          connector.start();
      }
  
      public void shutdown()
      {
          connector.stop();
          connector.shutdown();
      }
  
      public static void main(String[] args) throws Exception
      {
          Options options = new Options(args);
  
          // first check if we should print usage
          if ((options.isFlagSet('?') > 0) || (options.isFlagSet('h') > 0)) {
              printUsage();
          }
  
          SimpleJMSListener listener = new SimpleJMSListener(options);
      }
  
      public static void printUsage()
      {
          System.out.println("Usage: SimpleJMSListener [options]");
          System.out.println(" Opts: -? this message");
          System.out.println();
          System.out.println("       -b brokerurl");
          System.out.println("       -u username");
          System.out.println("       -w password");
          System.out.println();
          System.out.println("       -d destination");
          System.out.println("       -t topic [absence of -t indicates queue]");
          System.out.println();
          System.out.println("       -n jndi name for connection factory");
          System.out.println("          [jndi name obviates need for -t option]");
          System.out.println();
          System.out.println("       -s single-threaded listener");
          System.out.println("          [absence of option => multithreaded]");
  
          System.exit(1);
      }
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/transport/jms/JMSConnector.java
  
  Index: JMSConnector.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001, 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.axis.transport.jms;
  
  import java.util.Map;
  import java.util.HashMap;
  import java.util.LinkedList;
  import java.util.Iterator;
  
  import java.io.ByteArrayOutputStream;
  
  import javax.jms.JMSException;
  import javax.jms.JMSSecurityException;
  import javax.jms.InvalidDestinationException;
  import javax.jms.ExceptionListener;
  import javax.jms.ConnectionFactory;
  import javax.jms.MessageConsumer;
  import javax.jms.MessageProducer;
  import javax.jms.MessageListener;
  import javax.jms.Destination;
  import javax.jms.Session;
  import javax.jms.Message;
  import javax.jms.BytesMessage;
  
  import javax.naming.Context;
  import javax.naming.NamingException;
  
  // No vendor dependent exception classes
  //import progress.message.client.EUserAlreadyConnected;
  //import progress.message.jclient.ErrorCodes;
  
  /**
   * JMSConnector is an abstract class that encapsulates the work of connecting
   *   to JMS destinations. Its subclasses are TopicConnector and QueueConnector
   *   which further specialize connections to the pub-sub and the ptp domains.
   *   It also implements the capability to retry connections in the event of
   *   failures.
   *
   * @author Jaime Meritt  (jmeritt@sonicsoftware.com)
   * @author Richard Chung (rchung@sonicsoftware.com)
   * @author Dave Chappell (chappell@sonicsoftware.com)
   */
  public abstract class JMSConnector
  {
      protected int             m_numRetries;
      protected long            m_connectRetryInterval;
      protected long            m_interactRetryInterval;
      protected long            m_timeoutTime;
      protected long            m_poolTimeout;
      protected AsyncConnection m_receiveConnection;
      protected SyncConnection  m_sendConnection;
      protected int             m_numSessions;
      protected boolean         m_allowReceive;
      private   Context         m_context;
  
      public JMSConnector(ConnectionFactory connectionFactory,
                          int numRetries,
                          int numSessions,
                          long connectRetryInterval,
                          long interactRetryInterval,
                          long timeoutTime,
                          boolean allowReceive,
                          String clientID,
                          String username,
                          String password,
                          Context context)
          throws JMSException
      {
          m_numRetries = numRetries;
          m_connectRetryInterval = connectRetryInterval;
          m_interactRetryInterval = interactRetryInterval;
          m_timeoutTime = timeoutTime;
          m_poolTimeout = timeoutTime/(long)numRetries;
          m_numSessions = numSessions;
          m_allowReceive = allowReceive;
          m_context = context;
  
          // try to connect initially so we can fail fast
          // in the case of irrecoverable errors.
          // If we fail in a recoverable fashion we will retry
          javax.jms.Connection sendConnection = createConnectionWithRetry(
                                                                  connectionFactory,
                                                                  username,
                                                                  password);
          m_sendConnection = createSyncConnection(connectionFactory, sendConnection,
                                                  m_numSessions, "SendThread",
                                                  clientID,
                                                  username,
                                                  password);
  
          m_sendConnection.start();
  
          if(m_allowReceive)
          {
              javax.jms.Connection receiveConnection = createConnectionWithRetry(
                                                              connectionFactory,
                                                              username,
                                                              password);
              m_receiveConnection = createAsyncConnection(connectionFactory,
                                                          receiveConnection,
                                                          "ReceiveThread",
                                                          clientID,
                                                          username,
                                                          password);
              m_receiveConnection.start();
          }
      }
  
      protected javax.jms.Connection createConnectionWithRetry(
                                              ConnectionFactory connectionFactory,
                                              String username,
                                              String password)
          throws JMSException
      {
          javax.jms.Connection connection = null;
          for(int numTries = 1; connection == null; numTries++)
          {
              try
              {
                  connection = internalConnect(connectionFactory, username, password);
              }
              catch(JMSException jmse)
              {
                  if(isIrrecoverable(jmse) || numTries == m_numRetries)
                      throw jmse;
                  else
                      try{Thread.sleep(m_connectRetryInterval);}catch(InterruptedException ie){};
              }
          }
          return connection;
      }
  
      public void stop()
      {
          m_sendConnection.stopConnection();
          if(m_allowReceive)
              m_receiveConnection.stopConnection();
      }
  
      public void start()
      {
          m_sendConnection.startConnection();
          if(m_allowReceive)
              m_receiveConnection.startConnection();
      }
  
      public void shutdown()
      {
          m_sendConnection.shutdown();
          if(m_allowReceive)
              m_receiveConnection.shutdown();
      }
  
      public JMSEndpoint createEndpoint(String destinationName)
          throws JMSException, NamingException
      {
          if(m_context == null)
              return internalCreateEndpoint(destinationName);
          else
          {
              Destination destination = (Destination)m_context.lookup(destinationName);
              return createEndpoint(destination);
          }
      }
  
      protected abstract JMSEndpoint internalCreateEndpoint(String destinationName)
          throws JMSException;
  
      public abstract JMSEndpoint createEndpoint(Destination destination)
          throws JMSException;
  
  
      /**
       *
       * @todo decide what constitutes an irrecoverable error
       */
      private boolean isIrrecoverable(JMSException jmsException)
      {
          return jmsException instanceof JMSSecurityException;
      }
  
      protected abstract javax.jms.Connection internalConnect(
                                                  ConnectionFactory connectionFactory,
                                                  String username,
                                                  String password)
          throws JMSException;
  
      private abstract class Connection extends Thread implements ExceptionListener
      {
          private ConnectionFactory m_connectionFactory;
          protected javax.jms.Connection m_connection;
  
          protected boolean m_isActive;
          private boolean m_needsToConnect;
          private boolean m_startConnection;
          private String m_clientID;
          private String m_username;
          private String m_password;
  
          private Object m_jmsLock;
          private Object m_lifecycleLock;
  
  
          protected Connection(ConnectionFactory connectionFactory,
                               javax.jms.Connection connection,
                               String threadName,
                               String clientID,
                               String username,
                               String password)
              throws JMSException
          {
              super(threadName);
              m_connectionFactory = connectionFactory;
  
              m_clientID = clientID;
              m_username = username;
              m_password = password;
  
              m_jmsLock = new Object();
              m_lifecycleLock = new Object();
  
              if (connection != null)
              {
                  m_needsToConnect = false;
                  m_connection = connection;
                  m_connection.setExceptionListener(this);
                  if(m_clientID != null)
                      m_connection.setClientID(m_clientID);
              }
              else
              {
                  m_needsToConnect = true;
              }
  
              m_isActive = true;
          }
  
          /**
           * @todo handle non-recoverable errors
           */
  
          public void run()
          {
              // loop until a connection is made and when a connection is made (re)establish
              // any subscriptions
              while (m_isActive)
              {
                  if (m_needsToConnect)
                  {
                      m_connection = null;
                      try
                      {
                          m_connection = internalConnect(m_connectionFactory,
                                                         m_username, m_password);
                          m_connection.setExceptionListener(this);
                          if(m_clientID != null)
                              m_connection.setClientID(m_clientID);
                      }
                      catch(JMSException e)
                      {
                          // simply backoff for a while and then retry
                          try { Thread.sleep(m_connectRetryInterval); } catch(InterruptedException ie) { }
                          continue;
                      }
                  }
                  else
                      m_needsToConnect = true; // When we'll get to the "if (needsToConnect)" statement the next time it will be because
                                             // we lost the connection
  
                  // we now have a valid connection so establish some context
                  try
                  {
                      internalOnConnect();
                  }
                  catch(JMSException e)
                  {
                      // insert code to handle non recoverable errors
                      // simply retry
                      continue;
                  }
  
                  synchronized(m_jmsLock)
                  {
                      try { m_jmsLock.wait(); } catch(InterruptedException ie) { } // until notified due to some change in status
                  }
              }
  
              // no longer staying connected, so see what we can cleanup
              internalOnShutdown();
          }
  
  
  
          void startConnection()
          {
              synchronized(m_lifecycleLock)
              {
                  if(m_startConnection)
                      return;
                  m_startConnection = true;
                  try {m_connection.start();}catch(Throwable e) { } // ignore
              }
          }
  
          void stopConnection()
          {
              synchronized(m_lifecycleLock)
              {
                  if(!m_startConnection)
                      return;
                  m_startConnection = false;
                  try {m_connection.stop();}catch(Throwable e) { } // ignore
              }
          }
  
          void shutdown()
          {
              m_isActive = false;
              synchronized(m_jmsLock)
              {
                  m_jmsLock.notifyAll();
              }
          }
  
  
  
          public void onException(JMSException exception)
          {
              //right now we will blindly reconnect even if the connection hasn't
              //dropped.  This is an area that can be improved with a vendor
              //specific exception mapping like the one below
  
              //let's see if the connection really dropped
              //this could be another type of problem that
              //doesn't require the reestablishment of context
              //if(!ErrorCodes.testException(exception, ErrorCodes.ERR_CONNECTION_DROPPED))
              //    return;
  
              onException();
              synchronized(m_jmsLock)
              {
                  m_jmsLock.notifyAll();
              }
          }
  
          private final void internalOnConnect()
              throws JMSException
          {
              onConnect();
              synchronized(m_lifecycleLock)
              {
                  if(m_startConnection)
                  {
                      try {m_connection.start();}catch(Throwable e) { } // ignore
                  }
              }
          }
  
          private final void internalOnShutdown()
          {
              stopConnection();
              onShutdown();
              try { m_connection.close(); } catch(Throwable e) { } // ignore
          }
  
          protected abstract void onConnect()throws JMSException;
          protected abstract void onShutdown();
          protected abstract void onException();
      }
  
      protected abstract SyncConnection createSyncConnection(ConnectionFactory factory,
                                                             javax.jms.Connection connection,
                                                             int numSessions,
                                                             String threadName,
                                                             String clientID,
                                                             String username,
                                                             String password)
  
          throws JMSException;
  
      SyncConnection getSendConnection()
      {
          return m_sendConnection;
      }
  
      protected abstract class SyncConnection extends Connection
      {
          LinkedList m_senders;
          int        m_numSessions;
          Object     m_senderLock;
  
          SyncConnection(ConnectionFactory connectionFactory,
                         javax.jms.Connection connection,
                         int numSessions,
                         String threadName,
                         String clientID,
                         String username,
                         String password)
              throws JMSException
          {
              super(connectionFactory, connection, threadName,
                    clientID, username, password);
              m_senders = new LinkedList();
              m_numSessions = numSessions;
              m_senderLock = new Object();
          }
  
          protected abstract SendSession createSendSession(javax.jms.Connection connection)
              throws JMSException;
  
          protected void onConnect()
            throws JMSException
          {
              synchronized(m_senderLock)
              {
                  for(int i = 0; i < m_numSessions; i++)
                  {
                      m_senders.add(createSendSession(m_connection));
                  }
                  m_senderLock.notifyAll();
              }
          }
  
          byte[] call(JMSEndpoint endpoint, byte[] message, long timeout, HashMap properties)
              throws JMSException
          {
              long timeoutTime = System.currentTimeMillis() + timeout;
              while(true)
              {
                  if(System.currentTimeMillis() > timeoutTime)
                  {
                      throw new InvokeTimeoutException("Unable to complete call in time allotted");
                  }
  
                  SendSession sendSession = null;
                  try
                  {
                      sendSession = getSessionFromPool(m_poolTimeout);
                      byte[] response =  sendSession.call(endpoint,
                                                          message,
                                                          timeoutTime - System.currentTimeMillis(),
                                                          properties);
                      returnSessionToPool(sendSession);
                      if(response == null)
                      {
                          throw new InvokeTimeoutException("Unable to complete call in time allotted");
                      }
                      return response;
                  }
                  catch(JMSException jmse)
                  {
                      //for now we will assume this is a reconnect related issue
                      //and let the sender be collected
                      if(jmse instanceof JMSSecurityException ||
                         jmse instanceof InvalidDestinationException)
                      {
                          //this we cannot recover from
                          //but it does not invalidate the session
                          returnSessionToPool(sendSession);
                          throw jmse;
                      }
  
                      //give the reconnect thread a chance to fill the pool
                      Thread.yield();
                      continue;
                  }
                  catch(NullPointerException npe)
                  {
                      Thread.yield();
                      continue;
                  }
              }
          }
  
          /** @todo add in handling for security exceptions
           *  @todo add support for timeouts */
          void send(JMSEndpoint endpoint, byte[] message, HashMap properties)
              throws JMSException
          {
              long timeoutTime = System.currentTimeMillis() + m_timeoutTime;
              while(true)
              {
                  if(System.currentTimeMillis() > timeoutTime)
                  {
                      throw new InvokeTimeoutException("Cannot complete send in time allotted");
                  }
  
                  SendSession sendSession = null;
                  try
                  {
                      sendSession = getSessionFromPool(m_poolTimeout);
                      sendSession.send(endpoint, message, properties);
                      returnSessionToPool(sendSession);
                  }
                  catch(JMSException jmse)
                  {
                      //for now we will assume this is a reconnect related issue
                      //and let the sender be collected
                      if(jmse instanceof JMSSecurityException ||
                         jmse instanceof InvalidDestinationException)
                      {
                          //this we cannot recover from
                          //but it does not invalidate the session
                          returnSessionToPool(sendSession);
                          throw jmse;
                      }
                      //give the reconnect thread a chance to fill the pool
                      Thread.yield();
                      continue;
                  }
                  catch(NullPointerException npe)
                  {
                      //give the reconnect thread a chance to fill the pool
                      Thread.yield();
                      continue;
                  }
                  break;
              }
          }
  
          protected void onException()
          {
              synchronized(m_senderLock)
              {
                  m_senders.clear();
              }
          }
  
          protected void onShutdown()
          {
              synchronized(m_senderLock)
              {
                  Iterator senders = m_senders.iterator();
                  while(senders.hasNext())
                  {
                      SendSession session = (SendSession)senders.next();
                      session.cleanup();
                  }
                  m_senders.clear();
              }
          }
  
          private SendSession getSessionFromPool(long timeout)
          {
              synchronized(m_senderLock)
              {
                  while(m_senders.size() == 0)
                  {
                      try
                      {
                          m_senderLock.wait(timeout);
                          if(m_senders.size() == 0)
                          {
                              return null;
                          }
                      }
                      catch(InterruptedException ignore)
                      {
                          return null;
                      }
                  }
                  return (SendSession)m_senders.removeFirst();
              }
          }
  
          private void returnSessionToPool(SendSession sendSession)
          {
              synchronized(m_senderLock)
              {
                  m_senders.addLast(sendSession);
                  m_senderLock.notifyAll();
              }
          }
  
          protected abstract class SendSession extends ConnectorSession
          {
              MessageProducer m_producer;
  
              SendSession(Session session,
                          MessageProducer producer)
                throws JMSException
              {
                  super(session);
                  m_producer = producer;
              }
  
              protected abstract Destination createTemporaryDestination()
                  throws JMSException;
  
              protected abstract void deleteTemporaryDestination(Destination destination)
                  throws JMSException;
  
              protected abstract MessageConsumer createConsumer(Destination destination)
                  throws JMSException;
  
              protected abstract void send(Destination destination,
                                           Message message,
                                           int deliveryMode,
                                           int priority,
                                           long timeToLive)
                  throws JMSException;
  
              void send(JMSEndpoint endpoint, byte[] message, HashMap properties)
                  throws JMSException
              {
                  BytesMessage jmsMessage = m_session.createBytesMessage();
                  jmsMessage.writeBytes(message);
                  int deliveryMode = extractDeliveryMode(properties);
                  int priority = extractPriority(properties);
                  long timeToLive = extractTimeToLive(properties);
  
                  if(properties != null && !properties.isEmpty())
                      setProperties(properties, jmsMessage);
  
                  send(endpoint.getDestination(m_session), jmsMessage, deliveryMode,
                       priority, timeToLive);
              }
  
  
              void cleanup()
              {
                  try{m_producer.close();}catch(Throwable t){}
                  try{m_session.close();}catch(Throwable t){}
              }
  
              byte[] call(JMSEndpoint endpoint, byte[] message, long timeout,
                          HashMap properties)
                  throws JMSException
              {
                  Destination reply = createTemporaryDestination();
                  MessageConsumer subscriber = createConsumer(reply);
                  BytesMessage jmsMessage = m_session.createBytesMessage();
                  jmsMessage.writeBytes(message);
                  jmsMessage.setJMSReplyTo(reply);
  
                  int deliveryMode = extractDeliveryMode(properties);
                  int priority = extractPriority(properties);
                  long timeToLive = extractTimeToLive(properties);
  
                  if(properties != null && !properties.isEmpty())
                      setProperties(properties, jmsMessage);
  
                  send(endpoint.getDestination(m_session), jmsMessage, deliveryMode,
                       priority, timeToLive);
                  BytesMessage response = null;
                  try {
                      response = (BytesMessage)subscriber.receive(timeout);
                  } catch (ClassCastException cce) {
                      throw new InvokeException
                              ("Error: unexpected message type received - expected BytesMessage");
                  }
                  byte[] respBytes = null;
                  if(response != null)
                  {
                      byte[] buffer = new byte[8 * 1024];
                      ByteArrayOutputStream out = new ByteArrayOutputStream();
                      for(int bytesRead = response.readBytes(buffer);
                          bytesRead != -1; bytesRead = response.readBytes(buffer))
                      {
                          out.write(buffer, 0, bytesRead);
                      }
                      respBytes = out.toByteArray();
                  }
                  subscriber.close();
                  deleteTemporaryDestination(reply);
                  return respBytes;
              }
  
              private int extractPriority(HashMap properties)
              {
                  return MapUtils.removeIntProperty(properties, JMSConstants.PRIORITY,
                                           JMSConstants.DEFAULT_PRIORITY);
              }
  
              private int extractDeliveryMode(HashMap properties)
              {
                  return MapUtils.removeIntProperty(properties, JMSConstants.DELIVERY_MODE,
                                           JMSConstants.DEFAULT_DELIVERY_MODE);
              }
  
              private long extractTimeToLive(HashMap properties)
              {
                  return MapUtils.removeLongProperty(properties, JMSConstants.TIME_TO_LIVE,
                                            JMSConstants.DEFAULT_TIME_TO_LIVE);
              }
  
              private void setProperties(HashMap properties, Message message)
                  throws JMSException
              {
                  Iterator propertyIter = properties.entrySet().iterator();
                  while(propertyIter.hasNext())
                  {
                      Map.Entry property = (Map.Entry)propertyIter.next();
                      setProperty((String)property.getKey(), property.getValue(),
                                  message);
                  }
              }
  
              private void setProperty(String property, Object value, Message message)
                  throws JMSException
              {
                  if(property == null)
                      return;
                  if(property.equals(JMSConstants.JMS_CORRELATION_ID))
                      message.setJMSCorrelationID((String)value);
                  else if(property.equals(JMSConstants.JMS_CORRELATION_ID_AS_BYTES))
                      message.setJMSCorrelationIDAsBytes((byte[])value);
                  else if(property.equals(JMSConstants.JMS_TYPE))
                      message.setJMSType((String)value);
                  else
                      message.setObjectProperty(property, value);
              }
          }
      }
  
      AsyncConnection getReceiveConnection()
      {
          return m_receiveConnection;
      }
  
      protected abstract AsyncConnection createAsyncConnection(ConnectionFactory factory,
                                                               javax.jms.Connection connection,
                                                               String threadName,
                                                               String clientID,
                                                               String username,
                                                               String password)
  
          throws JMSException;
  
      protected abstract class AsyncConnection extends Connection
      {
          HashMap m_subscriptions;
          Object m_subscriptionLock;
  
          protected AsyncConnection(ConnectionFactory connectionFactory,
                                    javax.jms.Connection connection,
                                    String threadName,
                                    String clientID,
                                    String username,
                                    String password)
              throws JMSException
          {
              super(connectionFactory, connection, threadName,
                    clientID, username, password);
              m_subscriptions = new HashMap();
              m_subscriptionLock = new Object();
          }
  
          protected abstract ListenerSession createListenerSession(
                                                  javax.jms.Connection connection,
                                                  Subscription subscription)
              throws JMSException;
  
          protected void onShutdown()
          {
              synchronized(m_subscriptionLock)
              {
                  Iterator subscriptions = m_subscriptions.keySet().iterator();
                  while(subscriptions.hasNext())
                  {
                      Subscription subscription = (Subscription)subscriptions.next();
                      ListenerSession session  = (ListenerSession)
                                                  m_subscriptions.get(subscription);
                      if(session != null)
                      {
                          session.cleanup();
                      }
  
                  }
                  m_subscriptions.clear();
              }
          }
  
          /**
           * @todo add in security exception propagation
           * @param subscription
           */
          void subscribe(Subscription subscription)
              throws JMSException
          {
              long timeoutTime = System.currentTimeMillis() + m_timeoutTime;
              synchronized(m_subscriptionLock)
              {
                  if(m_subscriptions.containsKey(subscription))
                      return;
                  while(true)
                  {
                      if(System.currentTimeMillis() > timeoutTime)
                      {
                          throw new InvokeTimeoutException("Cannot subscribe listener");
                      }
  
                      try
                      {
                          ListenerSession session = createListenerSession(m_connection,
                                                                          subscription);
                          m_subscriptions.put(subscription, session);
                          break;
                      }
                      catch(JMSException jmse)
                      {
                          //we MAY be reconnecting or something else is screwy
                          if(jmse instanceof JMSSecurityException ||
                             jmse instanceof InvalidDestinationException)
                          {
                              throw jmse;
                          }
                          /* If we had a vendor specific exception mapping this
                          would help when doing stuff like this
                          String message = jmse.getMessage();
                          if(message != null && message.startsWith("Queue not found"))
                          {
                              throw jmse;
                          }
                          Exception linkedException = jmse.getLinkedException();
                          if(linkedException != null &&
                             linkedException instanceof EUserAlreadyConnected)
                          {
                              throw jmse;
                          }*/
                          try{m_subscriptionLock.wait(m_interactRetryInterval);}
                          catch(InterruptedException ignore){}
                          //give reconnect a chance
                          Thread.yield();
                          continue;
                      }
                      catch(NullPointerException jmse)
                      {
                          //we ARE reconnecting
                          try{m_subscriptionLock.wait(m_interactRetryInterval);}
                          catch(InterruptedException ignore){}
                          //give reconnect a chance
                          Thread.yield();
                          continue;
                      }
                  }
              }
          }
  
          void unsubscribe(Subscription subscription)
          {
              long timeoutTime = System.currentTimeMillis() + m_timeoutTime;
              synchronized(m_subscriptionLock)
              {
                  if(!m_subscriptions.containsKey(subscription))
                      return;
                  while(true)
                  {
                      if(System.currentTimeMillis() > timeoutTime)
                      {
                          throw new InvokeTimeoutException("Cannot unsubscribe listener");
                      }
  
                      //give reconnect a chance
                      Thread.yield();
                      try
                      {
                          ListenerSession session = (ListenerSession)
                                                  m_subscriptions.get(subscription);
                          session.cleanup();
                          m_subscriptions.remove(subscription);
                          break;
                      }
                      catch(NullPointerException jmse)
                      {
                          //we are reconnecting
                          try{m_subscriptionLock.wait(m_interactRetryInterval);}
                          catch(InterruptedException ignore){}
                          continue;
                      }
                  }
              }
          }
  
          protected void onConnect()
              throws JMSException
          {
              synchronized(m_subscriptionLock)
              {
                  Iterator subscriptions = m_subscriptions.keySet().iterator();
                  while(subscriptions.hasNext())
                  {
                      Subscription subscription = (Subscription)subscriptions.next();
  
                      if(m_subscriptions.get(subscription) == null)
                      {
                          m_subscriptions.put(subscription,
                              createListenerSession(m_connection, subscription));
                      }
                  }
                  m_subscriptionLock.notifyAll();
              }
          }
  
          protected void onException()
          {
              synchronized(m_subscriptionLock)
              {
                  Iterator subscriptions = m_subscriptions.keySet().iterator();
                  while(subscriptions.hasNext())
                  {
                      Subscription subscription = (Subscription)subscriptions.next();
                      m_subscriptions.put(subscription, null);
                  }
              }
          }
  
  
  
          protected class ListenerSession extends ConnectorSession
          {
              protected MessageConsumer m_consumer;
              protected Subscription    m_subscription;
  
              ListenerSession(Session session,
                              MessageConsumer consumer,
                              Subscription subscription)
                  throws JMSException
              {
                  super(session);
                  m_subscription = subscription;
                  m_consumer = consumer;
                  Destination destination = subscription.m_endpoint.getDestination(m_session);
                  m_consumer.setMessageListener(subscription.m_listener);
              }
  
              void cleanup()
              {
                  try{m_consumer.close();}catch(Exception ignore){}
                  try{m_session.close();}catch(Exception ignore){}
              }
  
          }
      }
  
  
  
      private abstract class ConnectorSession
      {
          Session m_session;
  
          ConnectorSession(Session session)
            throws JMSException
          {
              m_session = session;
          }
  
      }
  
  }
  
  
  1.1                  xml-axis/java/src/org/apache/axis/transport/jms/SonicConstants.java
  
  Index: SonicConstants.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001, 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.axis.transport.jms;
  
  import java.util.HashMap;
  import java.util.Iterator;
  import java.lang.reflect.Method;
  import java.lang.reflect.InvocationTargetException;
  
  import javax.jms.TopicConnectionFactory;
  import javax.jms.QueueConnectionFactory;
  import javax.jms.ConnectionFactory;
  
  /**
   * SonicConstants contains constants for Sonic-specific parameters.
   *
   * @author Jaime Meritt  (jmeritt@sonicsoftware.com)
   * @author Richard Chung (rchung@sonicsoftware.com)
   * @author Dave Chappell (chappell@sonicsoftware.com)
   */
  public interface SonicConstants
  {
      public final static String QCF_CLASS =
          "progress.message.jclient.QueueConnectionFactory";
  
      public final static String TCF_CLASS =
          "progress.message.jclient.TopicConnectionFactory";
  
      /**
       * <code>SonicConnectionFactory</code> parameter valid for either domain.  This should
       * be used as a key in the environment map passed into calls to
       * <code>createConnector</code> in <code>JMSConnectorFactory</code>.
       * This is a required property.
       * The value must be a <code>java.lang.String</code>
       * See the SonicMQ documentation for information on this property
       */
      public final static String BROKER_URL              = "brokerURL";
  
      /**
       * <code>SonicConnectionFactory</code> parameter valid for either domains.  This should
       * be used as a key in the environment map passed into calls to
       * <code>createConnector</code> in <code>JMSConnectorFactory</code>
       * This is a required property for secure brokers.
       * The value must be a <code>java.lang.String</code>
       * See the SonicMQ documentation for information on this property
       */
      public final static String DEFAULT_USERNAME = "defaultUser";
  
      /**
       * <code>SonicConnectionFactory</code> parameter valid for either domain.  This should
       * be used as a key in the environment map passed into calls to
       * <code>createConnector</code> in <code>JMSConnectorFactory</code>
       * This is a required property for secure brokers.
       * The value must be a <code>java.lang.String</code>
       * See the SonicMQ documentation for information on this property
       */
      public final static String DEFAULT_PASSWORD        = "defaultPassword";
      /**
       * <code>SonicConnectionFactory</code> parameter valid for either domain.  This should
       * be used as a key in the environment map passed into calls to
       * <code>createConnector</code> in <code>JMSConnectorFactory</code>
       * The value must be a <code>java.lang.Long</code>
       * See the SonicMQ documentation for information on this property
       */
      public final static String PING_INTERVAL           = "pingIntervalLong";
      /**
       * <code>SonicConnectionFactory</code> parameter valid for either domain.  This should
       * be used as a key in the environment map passed into calls to
       * <code>createConnector</code> in <code>JMSConnectorFactory</code>
       * The value must be a <code>java.lang.Integer</code>
       * See the SonicMQ documentation for information on this property
       */
      public final static String RECONNECT_INTERVAL      = "reconnectIntervalInteger";
      /**
       * <code>SonicConnectionFactory</code> parameter valid for either domain.  This should
       * be used as a key in the environment map passed into calls to
       * <code>createConnector</code> in <code>JMSConnectorFactory</code>
       * The value must be a <code>java.lang.Integer</code>
       * See the SonicMQ documentation for information on this property
       */
      public final static String RECONNECT_TIMEOUT       = "reconnectTimeoutInteger";
      /**
       * <code>SonicConnectionFactory</code> parameter valid for either domain.  This should
       * be used as a key in the environment map passed into calls to
       * <code>createConnector</code> in <code>JMSConnectorFactory</code>
       * The value must be a <code>java.lang.String</code>
       * See the SonicMQ documentation for information on this property
       */
      public final static String CONNECT_ID              = "connectID";
      /**
       * <code>SonicConnectionFactory</code> parameter valid for either domain.  This should
       * be used as a key in the environment map passed into calls to
       * <code>createConnector</code> in <code>JMSConnectorFactory</code>
       * The value must be a <code>java.lang.String</code>
       * See the SonicMQ documentation for information on this property
       */
      public final static String CONNECTION_URLS         = "connectionURLs";
      /**
       * <code>SonicConnectionFactory</code> parameter valid for either domain.  This should
       * be used as a key in the environment map passed into calls to
       * <code>createConnector</code> in <code>JMSConnectorFactory</code>
       * The value must be a <code>java.lang.Boolean</code>
       * See the SonicMQ documentation for information on this property
       */
      public final static String LOAD_BALANCING          = "loadBalancingBoolean";
      /**
       * <code>SonicConnectionFactory</code> parameter valid for either domain.  This should
       * be used as a key in the environment map passed into calls to
       * <code>createConnector</code> in <code>JMSConnectorFactory</code>
       * The value must be a <code>java.lang.Long</code>
       * See the SonicMQ documentation for information on this property
       */
      public final static String MONITOR_INTERVAL        = "monitorInterval";
      /**
       * <code>SonicConnectionFactory</code> parameter valid for either domain.  This should
       * be used as a key in the environment map passed into calls to
       * <code>createConnector</code> in <code>JMSConnectorFactory</code>
       * The value must be a <code>java.lang.Boolean</code>
       * See the SonicMQ documentation for information on this property
       */
      public final static String PERSISTENT_DELIVERY     = "persistentDeliveryBoolean";
      /**
       * <code>SonicConnectionFactory</code> parameter valid for either domain.  This should
       * be used as a key in the environment map passed into calls to
       * <code>createConnector</code> in <code>JMSConnectorFactory</code>
       * The value must be a <code>java.lang.Boolean</code>
       * See the SonicMQ documentation for information on this property
       */
      public final static String SEQUENTIAL              = "sequentialBoolean";
  
      /**
       * <code>SonicConnectionFactory</code> parameter valid for the PTP domain.  This should
       * be used as a key in the environment map passed into calls to
       * <code>createConnector</code> in <code>JMSConnectorFactory</code>
       * The value must be a <code>java.lang.Integer</code>
       * See the SonicMQ documentation for information on this property
       */
      public final static String PREFETCH_COUNT          = "prefetchCountInteger";
      /**
       * <code>SonicConnectionFactory</code> parameter valid for the PTP domain.  This should
       * be used as a key in the environment map passed into calls to
       * <code>createConnector</code> in <code>JMSConnectorFactory</code>
       * The value must be a <code>java.lang.Integer</code>
       * See the SonicMQ documentation for information on this property
       */
      public final static String PREFETCH_THRESHOLD      = "prefetchThresholdInteger";
  
  
      /**
       * <code>SonicConnectionFactory</code> parameter valid for the PubSub domain.  This should
       * be used as a key in the environment map passed into calls to
       * <code>createConnector</code> in <code>JMSConnectorFactory</code>
       * The value must be a <code>java.lang.Boolean</code>
       * See the SonicMQ documentation for information on this property
       */
      public final static String SELECTOR_AT_BROKER      = "selectorAtBroker";
  
  }
  
  
  1.1                  xml-axis/java/src/org/apache/axis/transport/jms/TopicConnector.java
  
  Index: TopicConnector.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001, 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.axis.transport.jms;
  
  import java.lang.reflect.InvocationTargetException;
  
  import java.util.Iterator;
  import java.util.Map;
  import java.util.HashMap;
  import java.util.LinkedList;
  
  import javax.jms.MessageListener;
  import javax.jms.Message;
  import javax.jms.MessageProducer;
  import javax.jms.MessageConsumer;
  import javax.jms.TextMessage;
  import javax.jms.Topic;
  import javax.jms.TemporaryTopic;
  import javax.jms.Destination;
  import javax.jms.Session;
  import javax.jms.TopicSession;
  import javax.jms.TopicPublisher;
  import javax.jms.TopicSubscriber;
  import javax.jms.Connection;
  import javax.jms.TopicConnection;
  import javax.jms.TopicConnectionFactory;
  import javax.jms.ConnectionFactory;
  import javax.jms.JMSException;
  import javax.jms.ExceptionListener;
  
  import javax.naming.Context;
  
  /**
   * TopicConnector is a concrete JMSConnector subclass that specifically handles
   *   connections to topics (pub-sub domain).
   *
   * @author Jaime Meritt  (jmeritt@sonicsoftware.com)
   * @author Richard Chung (rchung@sonicsoftware.com)
   * @author Dave Chappell (chappell@sonicsoftware.com)
   */
  public class TopicConnector extends JMSConnector
  {
      public TopicConnector(TopicConnectionFactory factory,
                            int numRetries,
                            int numSessions,
                            long connectRetryInterval,
                            long interactRetryInterval,
                            long timeoutTime,
                            boolean allowReceive,
                            String clientID,
                            String username,
                            String password,
                            Context context)
          throws JMSException
      {
          super(factory, numRetries, numSessions, connectRetryInterval,
                interactRetryInterval, timeoutTime, allowReceive,
                clientID, username, password, context);
      }
  
      protected Connection internalConnect(ConnectionFactory connectionFactory,
                                           String username, String password)
          throws JMSException
      {
          TopicConnectionFactory tcf = (TopicConnectionFactory)connectionFactory;
          if(username == null)
              return tcf.createTopicConnection();
  
          return tcf.createTopicConnection(username, password);
      }
  
  
      protected SyncConnection createSyncConnection(ConnectionFactory factory,
                                                    Connection connection,
                                                    int numSessions,
                                                    String threadName,
                                                    String clientID,
                                                    String username,
                                                    String password)
          throws JMSException
      {
          return new TopicSyncConnection((TopicConnectionFactory)factory,
                                         (TopicConnection)connection, numSessions,
                                         threadName, clientID, username, password);
      }
  
      protected AsyncConnection createAsyncConnection(ConnectionFactory factory,
                                                      Connection connection,
                                                      String threadName,
                                                      String clientID,
                                                      String username,
                                                      String password)
          throws JMSException
      {
          return new TopicAsyncConnection((TopicConnectionFactory)factory,
                                          (TopicConnection)connection, threadName,
                                          clientID, username, password);
      }
  
      protected JMSEndpoint internalCreateEndpoint(String destination)
      {
          return new TopicEndpoint(destination);
      }
  
      /**
       * Create an endpoint for a queue destination.
       *
       * @param destination
       * @return
       * @throws JMSException
       */
      public JMSEndpoint createEndpoint(Destination destination)
          throws JMSException
      {
          if(!(destination instanceof Topic))
              throw new IllegalArgumentException("The input be a topic for this connector");
          return new TopicDestinationEndpoint((Topic)destination);
      }
  
      private TopicSession createTopicSession(TopicConnection connection, int ackMode)
          throws JMSException
      {
          return connection.createTopicSession(false,
                                               ackMode);
      }
  
      private Topic createTopic(TopicSession session, String subject)
          throws JMSException
      {
          return session.createTopic(subject);
      }
  
      private TopicSubscriber createSubscriber(TopicSession session,
                                               TopicSubscription subscription)
          throws JMSException
      {
          if(subscription.isDurable())
              return createDurableSubscriber(session,
                          (Topic)subscription.m_endpoint.getDestination(session),
                          subscription.m_subscriptionName,
                          subscription.m_messageSelector,
                          subscription.m_noLocal);
          else
              return createSubscriber(session,
                          (Topic)subscription.m_endpoint.getDestination(session),
                          subscription.m_messageSelector,
                          subscription.m_noLocal);
      }
  
      private TopicSubscriber createDurableSubscriber(TopicSession session,
                                                      Topic topic,
                                                      String subscriptionName,
                                                      String messageSelector,
                                                      boolean noLocal)
          throws JMSException
      {
          return session.createDurableSubscriber(topic, subscriptionName,
                                                 messageSelector, noLocal);
      }
  
      private TopicSubscriber createSubscriber(TopicSession session,
                                               Topic topic,
                                               String messageSelector,
                                               boolean noLocal)
          throws JMSException
      {
          return session.createSubscriber(topic, messageSelector, noLocal);
      }
  
  
  
  
      private final class TopicAsyncConnection extends AsyncConnection
      {
  
          TopicAsyncConnection(TopicConnectionFactory connectionFactory,
                               TopicConnection connection,
                               String threadName,
                               String clientID,
                               String username,
                               String password)
  
              throws JMSException
          {
              super(connectionFactory, connection, threadName,
                    clientID, username, password);
          }
  
          protected ListenerSession createListenerSession(javax.jms.Connection connection,
                                                          Subscription subscription)
              throws JMSException
          {
              TopicSession session = createTopicSession((TopicConnection)connection,
                                                        subscription.m_ackMode);
              TopicSubscriber subscriber = createSubscriber(session,
                                                  (TopicSubscription)subscription);
              return new TopicListenerSession(session, subscriber,
                                                  (TopicSubscription)subscription);
          }
  
          private final class TopicListenerSession extends ListenerSession
          {
  
              TopicListenerSession(TopicSession session,
                                   TopicSubscriber subscriber,
                                   TopicSubscription subscription)
                  throws JMSException
              {
                  super(session, subscriber, subscription);
              }
  
              void cleanup()
              {
                  try{m_consumer.close();}catch(Exception ignore){}
                  try
                  {
                      TopicSubscription sub = (TopicSubscription)m_subscription;
                      if(sub.isDurable() && sub.m_unsubscribe)
                      {
                          ((TopicSession)m_session).unsubscribe(sub.m_subscriptionName);
                      }
                  }
                  catch(Exception ignore){}
                  try{m_session.close();}catch(Exception ignore){}
  
              }
          }
      }
  
      private final class TopicSyncConnection extends SyncConnection
      {
          TopicSyncConnection(TopicConnectionFactory connectionFactory,
                              TopicConnection connection,
                              int numSessions,
                              String threadName,
                              String clientID,
                              String username,
                              String password)
  
              throws JMSException
          {
              super(connectionFactory, connection, numSessions, threadName,
                    clientID, username, password);
          }
  
          protected SendSession createSendSession(javax.jms.Connection connection)
              throws JMSException
          {
              TopicSession session = createTopicSession((TopicConnection)connection,
                                              JMSConstants.DEFAULT_ACKNOWLEDGE_MODE);
              TopicPublisher publisher = session.createPublisher(null);
              return new TopicSendSession(session, publisher);
          }
  
          private final class TopicSendSession extends SendSession
          {
              TopicSendSession(TopicSession session,
                               TopicPublisher publisher)
                  throws JMSException
              {
                  super(session, publisher);
              }
  
  
              protected MessageConsumer createConsumer(Destination destination)
                  throws JMSException
              {
                  return createSubscriber((TopicSession)m_session, (Topic)destination,
                                          null, JMSConstants.DEFAULT_NO_LOCAL);
              }
  
              protected void deleteTemporaryDestination(Destination destination)
                  throws JMSException
              {
                  ((TemporaryTopic)destination).delete();
              }
  
  
              protected Destination createTemporaryDestination()
                  throws JMSException
              {
                  return ((TopicSession)m_session).createTemporaryTopic();
              }
  
              protected void send(Destination destination, Message message,
                                  int deliveryMode, int priority, long timeToLive)
                  throws JMSException
              {
                  ((TopicPublisher)m_producer).publish((Topic)destination, message,
                                                  deliveryMode, priority, timeToLive);
              }
  
          }
      }
  
  
  
      private class TopicEndpoint
          extends JMSEndpoint
      {
          String m_topicName;
  
          TopicEndpoint(String topicName)
          {
              super(TopicConnector.this);
              m_topicName = topicName;
          }
  
          Destination getDestination(Session session)
              throws JMSException
          {
              return createTopic((TopicSession)session, m_topicName);
          }
  
          protected Subscription createSubscription(MessageListener listener,
                                                    HashMap properties)
          {
              return new TopicSubscription(listener, this, properties);
          }
  
          public String toString()
          {
              StringBuffer buffer = new StringBuffer("TopicEndpoint:");
              buffer.append(m_topicName);
              return buffer.toString();
          }
  
          public boolean equals(Object object)
          {
              if(!super.equals(object))
                  return false;
  
              if(!(object instanceof TopicEndpoint))
                  return false;
  
              return m_topicName.equals(((TopicEndpoint)object).m_topicName);
          }
      }
  
      private final class TopicSubscription extends Subscription
      {
          String m_subscriptionName;
          boolean m_unsubscribe;
          boolean m_noLocal;
  
          TopicSubscription(MessageListener listener,
                            JMSEndpoint endpoint,
                            HashMap properties)
          {
              super(listener, endpoint, properties);
              m_subscriptionName = MapUtils.removeStringProperty(properties,
                                                  JMSConstants.SUBSCRIPTION_NAME,
                                                  null);
              m_unsubscribe = MapUtils.removeBooleanProperty(properties,
                                                  JMSConstants.UNSUBSCRIBE,
                                                  JMSConstants.DEFAULT_UNSUBSCRIBE);
              m_noLocal = MapUtils.removeBooleanProperty(properties,
                                                  JMSConstants.NO_LOCAL,
                                                  JMSConstants.DEFAULT_NO_LOCAL);
          }
  
          boolean isDurable()
          {
              return m_subscriptionName != null;
          }
  
          public boolean equals(Object obj)
          {
              if(!super.equals(obj))
                  return false;
              if(!(obj instanceof TopicSubscription))
                  return false;
  
              TopicSubscription other = (TopicSubscription)obj;
              if(other.m_unsubscribe != m_unsubscribe || other.m_noLocal != m_noLocal)
                  return false;
  
              if(isDurable())
              {
                  return other.isDurable() && other.m_subscriptionName.equals(m_subscriptionName);
              }
              else if(other.isDurable())
                  return false;
              else
                  return true;
          }
  
          public String toString()
          {
              StringBuffer buffer = new StringBuffer(super.toString());
              buffer.append(":").append(m_noLocal).append(":").append(m_unsubscribe);
              if(isDurable())
              {
                  buffer.append(":");
                  buffer.append(m_subscriptionName);
              }
              return buffer.toString();
          }
  
      }
  
      private final class TopicDestinationEndpoint
          extends TopicEndpoint
      {
          Topic m_topic;
  
          TopicDestinationEndpoint(Topic topic)
              throws JMSException
          {
              super(topic.getTopicName());
              m_topic = topic;
          }
  
          Destination getDestination(Session session)
          {
              return m_topic;
          }
  
      }
  
  
  }
  
  
  1.1                  xml-axis/java/src/org/apache/axis/transport/jms/JMSEndpoint.java
  
  Index: JMSEndpoint.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001, 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.axis.transport.jms;
  
  import javax.jms.Destination;
  import javax.jms.Session;
  import javax.jms.JMSException;
  import javax.jms.MessageListener;
  
  import java.util.HashMap;
  
  /**
   * JMSEndpoint encapsulates interactions w/ a JMS destination.
   *
   * @author Jaime Meritt  (jmeritt@sonicsoftware.com)
   * @author Richard Chung (rchung@sonicsoftware.com)
   * @author Dave Chappell (chappell@sonicsoftware.com)
   */
  public abstract class JMSEndpoint
  {
      private JMSConnector m_connector;
  
      protected JMSEndpoint(JMSConnector connector)
      {
          m_connector = connector;
      }
  
      abstract Destination getDestination(Session session)
          throws JMSException;
  
      /**
       * Send a message and wait for a response.
       *
       * @param message
       * @param timeout
       * @return
       * @throws JMSException
       */
      public byte[] call(byte[] message, long timeout)throws JMSException
      {
          return m_connector.getSendConnection().call(this, message, timeout, null);
      }
  
      /**
       * Send a message and wait for a response.
       *
       * @param message
       * @param timeout
       * @param properties
       * @return
       * @throws JMSException
       */
      public byte[] call(byte[] message, long timeout, HashMap properties)
          throws JMSException
      {
          if(properties != null)
              properties = (HashMap)properties.clone();
          return m_connector.getSendConnection().call(this, message, timeout, properties);
      }
  
      /**
       * Send a message w/o waiting for a response.
       *
       * @param message
       * @throws JMSException
       */
      public void send(byte[] message)throws JMSException
      {
          m_connector.getSendConnection().send(this, message, null);
      }
  
      /**
       * Send a message w/o waiting for a response.
       *
       * @param message
       * @param properties
       * @throws JMSException
       */
      public void send(byte[] message, HashMap properties)
          throws JMSException
      {
          if(properties != null)
              properties = (HashMap)properties.clone();
          m_connector.getSendConnection().send(this, message, properties);
      }
  
      /**
       * Register a MessageListener.
       *
       * @param listener
       * @throws JMSException
       */
      public void registerListener(MessageListener listener)
          throws JMSException
      {
          m_connector.getReceiveConnection().subscribe(createSubscription(listener, null));
      }
  
      /**
       * Register a MessageListener.
       *
       * @param listener
       * @param properties
       * @throws JMSException
       */
      public void registerListener(MessageListener listener, HashMap properties)
          throws JMSException
      {
          if(properties != null)
              properties = (HashMap)properties.clone();
          m_connector.getReceiveConnection().subscribe(createSubscription(listener, properties));
      }
  
      /**
       * Unregister a message listener.
       *
       * @param listener
       */
      public void unregisterListener(MessageListener listener)
      {
          m_connector.getReceiveConnection().unsubscribe(createSubscription(listener, null));
      }
  
      /**
       * Unregister a message listener.
       *
       * @param listener
       * @param properties
       */
      public void unregisterListener(MessageListener listener, HashMap properties)
      {
          if(properties != null)
              properties = (HashMap)properties.clone();
          m_connector.getReceiveConnection().unsubscribe(createSubscription(listener, properties));
      }
  
      protected Subscription createSubscription(MessageListener listener,
                                                HashMap properties)
      {
          return new Subscription(listener, this, properties);
      }
  
      public int hashCode()
      {
          return toString().hashCode();
      }
  
      public boolean equals(Object object)
      {
          if(object == null || !(object instanceof JMSEndpoint))
              return false;
          return true;
      }
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/transport/jms/MapUtils.java
  
  Index: MapUtils.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001, 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.axis.transport.jms;
  
  import java.util.Map;
  
  /**
   * MapUtils provides convenience methods for accessing a java.util.Map
   *
   * @author Jaime Meritt  (jmeritt@sonicsoftware.com)
   * @author Richard Chung (rchung@sonicsoftware.com)
   * @author Dave Chappell (chappell@sonicsoftware.com)
   */
  public class MapUtils
  {
      /**
       * Returns an int property from a Map and removes it.
       *
       * @param properties
       * @param key
       * @param defaultValue
       * @return
       */
      public static int removeIntProperty(Map properties, String key, int defaultValue)
      {
          int value = defaultValue;
          if(properties != null && properties.containsKey(key))
          {
              try{value = ((Integer)properties.remove(key)).intValue();}catch(Exception ignore){}
          }
          return value;
      }
  
      /**
       * Returns a long property from a Map and removes it.
       *
       * @param properties
       * @param key
       * @param defaultValue
       * @return
       */
      public static long removeLongProperty(Map properties, String key, long defaultValue)
      {
          long value = defaultValue;
          if(properties != null && properties.containsKey(key))
          {
              try{value = ((Long)properties.remove(key)).longValue();}catch(Exception ignore){}
          }
          return value;
      }
  
      /**
       * Returns a String property from a Map and removes it.
       *
       * @param properties
       * @param key
       * @param defaultValue
       * @return
       */
      public static String removeStringProperty(Map properties, String key, String defaultValue)
      {
          String value = defaultValue;
          if(properties != null && properties.containsKey(key))
          {
              try{value = (String)properties.remove(key);}catch(Exception ignore){}
          }
          return value;
      }
  
      /**
       * Returns a boolean property from a Map and removes it.
       *
       * @param properties
       * @param key
       * @param defaultValue
       * @return
       */
      public static boolean removeBooleanProperty(Map properties, String key, boolean defaultValue)
      {
          boolean value = defaultValue;
          if(properties != null && properties.containsKey(key))
          {
              try{value = ((Boolean)properties.remove(key)).booleanValue();}catch(Exception ignore){}
          }
          return value;
      }
  
      /**
       * Returns an Object property from a Map and removes it.
       *
       * @param properties
       * @param key
       * @param defaultValue
       * @return
       */
      public static Object removeObjectProperty(Map properties, String key, Object defaultValue)
      {
          Object value = defaultValue;
          if(properties != null && properties.containsKey(key))
          {
              value = properties.remove(key);
          }
          return value;
      }
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/transport/jms/Subscription.java
  
  Index: Subscription.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001, 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.axis.transport.jms;
  
  import javax.jms.MessageListener;
  
  import java.util.HashMap;
  
  /*
   * Subscription class holds information about a subscription
   *
   * @author Jaime Meritt  (jmeritt@sonicsoftware.com)
   * @author Richard Chung (rchung@sonicsoftware.com)
   * @author Dave Chappell (chappell@sonicsoftware.com)
   */
  public class Subscription
  {
      MessageListener m_listener;
      JMSEndpoint     m_endpoint;
      String          m_messageSelector;
      int             m_ackMode;
  
      Subscription(MessageListener listener,
                   JMSEndpoint endpoint,
                   HashMap properties)
      {
          m_listener = listener;
          m_endpoint = endpoint;
          m_messageSelector = MapUtils.removeStringProperty(
                                              properties,
                                              JMSConstants.MESSAGE_SELECTOR,
                                              null);
          m_ackMode = MapUtils.removeIntProperty(properties,
                                                 JMSConstants.ACKNOWLEDGE_MODE,
                                                 JMSConstants.DEFAULT_ACKNOWLEDGE_MODE);
      }
  
      public int hashCode()
      {
          return toString().hashCode();
      }
  
      public boolean equals(Object obj)
      {
          if(obj == null || !(obj instanceof Subscription))
              return false;
          Subscription other = (Subscription)obj;
          if(m_messageSelector == null)
          {
              if(other.m_messageSelector != null)
                  return false;
          }
          else
          {
              if(other.m_messageSelector == null ||
                 !other.m_messageSelector.equals(m_messageSelector))
                  return false;
          }
          return m_ackMode == other.m_ackMode &&
                 m_endpoint.equals(other.m_endpoint) &&
                 other.m_listener.equals(m_listener);
      }
  
      public String toString()
      {
          return m_listener.toString();
      }
  
  }
  
  
  1.1                  xml-axis/java/src/org/apache/axis/transport/jms/JMSConstants.java
  
  Index: JMSConstants.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001, 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.axis.transport.jms;
  
  import javax.jms.Message;
  import javax.jms.Session;
  import javax.jms.DeliveryMode;
  
  /**
   * JMSConstants contains constants that apply to all JMS providers.
   *
   * <code>JMSConstants</code> contains the constant definitions for
   * interacting with the WSClient.  The most important constants are the
   * <code>HashMap</code> keys for use in the arguments to the
   * <code>send, call, registerListener, unregisterListener</code> methods of
   * <code>JMSEndpoint</code> and the <code>createConnector</code> method of
   * <code>JMSConnectorFactory</code>.
   *
   * @author Jaime Meritt  (jmeritt@sonicsoftware.com)
   * @author Richard Chung (rchung@sonicsoftware.com)
   * @author Dave Chappell (chappell@sonicsoftware.com)
   */
  
  public interface JMSConstants
  {
  
      /**
       * This is used as a key in the Call properties telling the JMS transport
       * to wait for a response from the service.  The default value is true.
       * If false is specified, the message will be delivered without specifying
       * a ReplyTo.  The client will always return null from invoke unless
       * a client-side exception is thrown (similar to invokeOneWay in semantics)
       * The value must be a <code>java.lang.Boolean</code>.
       * See the javax.jms javadoc for information on this property.
       */
      final static String WAIT_FOR_RESPONSE        = "transport.jms.WaitForResponse";
  
      /**
       * <code>SonicConnectionFactory</code> parameter valid for either domain.  This should
       * be used as a key in the environment map passed into calls to
       * <code>createConnector</code> in <code>JMSConnectorFactory</code>
       * This is a required property for durable subscribers.
       * The value must be a <code>java.lang.String</code>.
       * See the javax.jms javadoc for information on this property.
       */
      final static String CLIENT_ID               = "transport.jms.ClientID";
  
      final static String DESTINATION     = "transport.jms.Destination";
  
      final static String CONNECTOR       = "transport.jms.Connector";
  
      final static String CONNECTION_FACTORY_CLASS =
          "transport.jms.ConnectionFactoryClass";
  
      final static String CONNECTION_FACTORY_JNDI_NAME =
          "transport.jms.ConnectionFactoryJNDIName";
  
      /**
       * Key for properties used in the <code>send</code> and <code>call</code>
       * methods.  It is valid for either domain.
       * The value must be a <code>java.lang.String</code>.
       * See the javax.jms javadoc for information on this property.
       */
      final static String JMS_CORRELATION_ID              = "transport.jms.JMSCorrelationID";
      /**
       * Key for properties used in the <code>send</code> and <code>call</code>
       * methods.  It is valid for either domain.
       * The value must be a <code>byte[]</code>.
       * See the javax.jms javadoc for information on this property.
       */
      final static String JMS_CORRELATION_ID_AS_BYTES     = "transport.jms.JMSCorrelationIDAsBytes";
      /**
       * Key for properties used in the <code>send</code> and <code>call</code>
       * methods.  It is valid for either domain.
       * The value must be a <code>java.lang.String</code>.
       * See the javax.jms javadoc for information on this property.
       */
      final static String JMS_TYPE                        = "transport.jms.JMSType";
      /**
       * Key for properties used in the <code>send</code> and <code>call</code>
       * methods.  It is valid for either domain.
       * The value must be a <code>java.lang.Long</code>.
       * See the javax.jms javadoc for information on this property.
       */
      final static String TIME_TO_LIVE                    = "transport.jms.TimeToLive";
      /**
       * Key for properties used in the <code>send</code> and <code>call</code>
       * methods.  It is valid for either domain.
       * The value must be a <code>java.lang.Integer</code>.
       * See the javax.jms javadoc for information on this property.
       */
      final static String PRIORITY                        = "transport.jms.Priority";
      /**
       * Key for properties used in the <code>send</code> and <code>call</code>
       * methods.  It is valid for either domain.
       * The value must be a <code>java.lang.Integer</code> equal to
       * DeliveryMode.NON_PERSISTENT or DeliveryMode.PERSISTENT.
       * See the javax.jms javadoc for information on this property.
       */
      final static String DELIVERY_MODE                   = "transport.jms.DeliveryMode";
  
      final static int DEFAULT_DELIVERY_MODE              = DeliveryMode.NON_PERSISTENT;
      final static int DEFAULT_PRIORITY                   = Message.DEFAULT_PRIORITY;
      final static long DEFAULT_TIME_TO_LIVE              = Message.DEFAULT_TIME_TO_LIVE;
  
      /**
       * Key for properties used in the <code>registerListener</code>
       * method.  It is valid for either domain.
       * The value must be a <code>java.lang.String</code>.
       * See the javax.jms javadoc for information on this property.
       */
      final static String MESSAGE_SELECTOR                = "transport.jms.MessageSelector";
      /**
       * Key for properties used in the <code>registerListener</code>
       * method.  It is valid for either domain.
       * The value must be a <code>java.lang.Integer</code> that is one of
       * Session.AUTO_ACKNOWLEDGE, Session.DUPS_OK_ACKNOWLEDGE,
       * or Session.CLIENT_ACKNOWLEDGE.
       * See the javax.jms javadoc for information on this property.
       */
      final static String ACKNOWLEDGE_MODE                = "transport.jms.AcknowledgeMode";
  
      /**
       * value for ACKNOWLEDGE_MODE if left unset.  It is equal to
       * Session.DUPS_OK_ACKNOWLEDGE.
       */
      final static int DEFAULT_ACKNOWLEDGE_MODE           = Session.DUPS_OK_ACKNOWLEDGE;
  
      /**
       * Specifies the name of a durable subscription
       * Key for properties used in the <code>registerListener</code>
       * method.  It is valid for the PubSub domain.
       * The value must be a <code>java.lang.String</code>.
       */
      final static String SUBSCRIPTION_NAME               = "transport.jms.SubscriptionName";
      /**
       * Key for properties used in the <code>registerListener</code>
       * method.  It is valid for the PubSub domain.
       * Specifies that the durable subscription should be unsubscribed
       * (deleted from the broker) when unregistered.
       * The value must be a <code>java.lang.Boolean</code>.
       */
      final static String UNSUBSCRIBE                     = "transport.jms.Unsubscribe";
      /**
       * Key for properties used in the <code>registerListener</code>
       * method.  It is valid for the PubSub domain.
       * The value must be a <code>java.lang.Boolean</code>.
       */
      final static String NO_LOCAL                        = "transport.jms.NoLocal";
  
      final static boolean DEFAULT_NO_LOCAL               = false;
      final static boolean DEFAULT_UNSUBSCRIBE            = false;
  
  
      /**
       * Key for properties used in the <code>createConnector</code>
       * method.  It changes the behavior of the wsclient.
       * The value must be a <code>java.lang.Integer</code>.
       */
      final static String NUM_RETRIES  = "transport.jms.NumRetries";
      /**
       * Key for properties used in the <code>createConnector</code>
       * method.  It changes the behavior of the wsclient.
       * The value must be a <code>java.lang.Integer</code>.
       */
      final static String NUM_SESSIONS = "transport.jms.NumSessions";
      /**
       * Key for properties used in the <code>createConnector</code>
       * method.  It changes the behavior of the wsclient.
       * The value must be a <code>java.lang.Long</code>.
       */
      final static String CONNECT_RETRY_INTERVAL = "transport.jms.ConnectRetryInterval";
      /**
       * Key for properties used in the <code>createConnector</code>
       * method.  It changes the behavior of the wsclient.
       * The value must be a <code>java.lang.Long</code>.
       */
      final static String INTERACT_RETRY_INTERVAL = "transport.jms.InteractRetryInterval";
      /**
       * Key for properties used in the <code>createConnector</code>
       * method.  It changes the behavior of the wsclient.
       * The value must be a <code>java.lang.Long</code>.
       */
      final static String TIMEOUT_TIME = "transport.jms.TimeoutTime";
      /**
       * Key for properties used in the <code>createConnector</code>
       * method.  It changes the behavior of the wsclient.
       * The value must be a <code>java.lang.Long</code>.
       */
      final static String MIN_TIMEOUT_TIME = "transport.jms.MinTimeoutTime";
  
      final static int DEFAULT_NUM_RETRIES       = 5;
      final static int DEFAULT_NUM_SESSIONS      = 5;
  
      final static long DEFAULT_CONNECT_RETRY_INTERVAL    = 2000;
      final static long DEFAULT_TIMEOUT_TIME     = 5000;
      final static long DEFAULT_MIN_TIMEOUT_TIME = 1000;
      final static long DEFAULT_INTERACT_RETRY_INTERVAL = 250;
  
  }
  
  
  1.1                  xml-axis/java/src/org/apache/axis/transport/jms/InvokeTimeoutException.java
  
  Index: InvokeTimeoutException.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001, 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.axis.transport.jms;
  
  /**
   * The <code>InvokeTimeoutException</code> is thrown when a method cannot
   * complete processing within the time allotted.  This occurs most often
   * when the broker has failed and the client is unable to reconnect.  This
   * may be thrown from any method within the wsclient that interacts with the
   * broker.  The timeout is defined within the environment parameter to
   * <code>createConnector</code> method in <code>JMSConnectorFactory</code>
   * The key in the table is <code>IJMSConstants.INTERACT_TIMEOUT_TIME</code>
   *
   * @author Jaime Meritt  (jmeritt@sonicsoftware.com)
   * @author Richard Chung (rchung@sonicsoftware.com)
   * @author Dave Chappell (chappell@sonicsoftware.com)
   *
   */
  public class InvokeTimeoutException extends InvokeException
  {
      public InvokeTimeoutException(String message)
      {
          super(message);
      }
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/transport/jms/JMSTransport.java
  
  Index: JMSTransport.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001, 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.axis.transport.jms;
  
  import org.apache.axis.AxisFault;
  import org.apache.axis.MessageContext;
  import org.apache.axis.AxisEngine;
  
  import org.apache.axis.client.Transport;
  import org.apache.axis.client.Call;
  
  import org.apache.axis.utils.Messages;
  import org.apache.commons.logging.Log;
  import org.apache.axis.components.logger.LogFactory;
  
  import javax.jms.Destination;
  
  import java.util.HashMap;
  import java.util.Iterator;
  
  /**
   * JMSTransport is the JMS-specific implemenation of org.apache.axis.client.Transport.
   *   It implements the setupMessageContextImpl() function to set JMS-specific message
   *   context fields and transport chains. Connector and connection factory
   *   properties are passed in during instantiation and are in turn passed through
   *   when creating a connector.
   *
   * @author Jaime Meritt  (jmeritt@sonicsoftware.com)
   * @author Richard Chung (rchung@sonicsoftware.com)
   * @author Dave Chappell (chappell@sonicsoftware.com)
   */
  public class JMSTransport extends Transport
  {
      protected static Log log =
              LogFactory.getLog(JMSTransport.class.getName());
  
      private HashMap connectors;
      private HashMap connectorProps;
      private HashMap connectionFactoryProps;
      private JMSConnector defaultConnector;
      private HashMap passwords;
      private Object connectorLock;
  
      public JMSTransport(HashMap connectorProps,
                          HashMap connectionFactoryProps)
      {
          transportName = "JMSTransport";
          connectors = new HashMap();
          passwords = new HashMap();
          this.connectorProps = connectorProps;
          this.connectionFactoryProps = connectionFactoryProps;
          connectorLock = new Object();
      }
  
      /**
       * Set up any transport-specific derived properties in the message context.
       * @param context the context to set up
       * @param message the client service instance
       * @param engine the engine containing the registries
       * @throws AxisFault if service cannot be found
       */
      public void setupMessageContextImpl(MessageContext context,
                                          Call message,
                                          AxisEngine engine)
          throws AxisFault
      {
          String username = message.getUsername();
          JMSConnector connector = null;
          try
          {
              if(username == null)
              {
                  initConnectorIfNecessary();
                  connector = defaultConnector;
              }
              else
              {
                  String password = message.getPassword();
                  synchronized(connectorLock)
                  {
                      if(connectors.containsKey(username))
                      {
                          String oldPassword = (String)passwords.get(username);
                          if(password.equals(oldPassword))
                              connector = (JMSConnector)connectors.get(username);
                          else
                              throw new AxisFault("badUserPass");
                      }
                      else
                      {
                          connector = createConnector(username, password);
                          connectors.put(username, connector);
                          // I should really md5 hash these
                          passwords.put(username, password);
                      }
                  }
              }
          }
          catch(Exception e)
          {
              log.error(Messages.getMessage("cannotConnectError"), e);
  
              if(e instanceof AxisFault)
                  throw (AxisFault)e;
              throw new AxisFault("cannotConnect", e);
          }
  
          context.setProperty(JMSConstants.CONNECTOR, connector);
  
          //I would like to use the following, but that requires JMS-URL syntax
          //which I don't have so I will rely on message properties for now
          //String destination = message.getTargetEndpointAddress();
  
          Object tmp = message.getProperty(JMSConstants.DESTINATION);
          if(tmp != null && (tmp instanceof String || tmp instanceof Destination))
              context.setProperty(JMSConstants.DESTINATION, tmp);
          else
              context.removeProperty(JMSConstants.DESTINATION);
  
          tmp = message.getProperty(JMSConstants.WAIT_FOR_RESPONSE);
          if(tmp != null && tmp instanceof Boolean)
              context.setProperty(JMSConstants.WAIT_FOR_RESPONSE, tmp);
          else
              context.removeProperty(JMSConstants.WAIT_FOR_RESPONSE);
  
          tmp = message.getProperty(JMSConstants.DELIVERY_MODE);
          if(tmp != null && tmp instanceof Integer)
              context.setProperty(JMSConstants.DELIVERY_MODE, tmp);
          else
              context.removeProperty(JMSConstants.DELIVERY_MODE);
  
          tmp = message.getProperty(JMSConstants.PRIORITY);
          if(tmp != null && tmp instanceof Integer)
              context.setProperty(JMSConstants.PRIORITY, tmp);
          else
              context.removeProperty(JMSConstants.PRIORITY);
  
          tmp = message.getProperty(JMSConstants.TIME_TO_LIVE);
          if(tmp != null && tmp instanceof Long)
              context.setProperty(JMSConstants.TIME_TO_LIVE, tmp);
          else
              context.removeProperty(JMSConstants.TIME_TO_LIVE);
  
      }
  
      private void initConnectorIfNecessary()
          throws Exception
      {
          if(defaultConnector != null)
              return;
          synchronized(connectorLock)
          {
              //this is to catch a race issue when n threads do the null check
              //before one of them actually creates the default connector
              if(defaultConnector != null)
                  return;
              defaultConnector = createConnector(null, null);
          }
      }
  
      private JMSConnector createConnector(String username, String password)
          throws Exception
      {
          JMSConnector connector = JMSConnectorFactory.
                  createClientConnector(connectorProps, connectionFactoryProps,
                                        username, password);
          connector.start();
          return connector;
      }
  
      /**
       * Shuts down the connectors managed by this JMSTransport.
       */
      public void shutdown()
      {
          synchronized(connectorLock)
          {
              if(defaultConnector != null)
                  defaultConnector.shutdown();
  
              Iterator connectorIter = connectors.values().iterator();
              while(connectorIter.hasNext())
              {
                  ((JMSConnector)connectorIter.next()).shutdown();
              }
          }
      }
  
  }
  
  
  1.1                  xml-axis/java/src/org/apache/axis/transport/jms/InvokeException.java
  
  Index: InvokeException.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001, 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.axis.transport.jms;
  
  /**
   * The <code>InvokeException</code> is thrown when a method encounters a
   * general exception in the course of processing.
   * @author Jaime Meritt  (jmeritt@sonicsoftware.com)
   * @author Richard Chung (rchung@sonicsoftware.com)
   * @author Dave Chappell (chappell@sonicsoftware.com)
   */
  public class InvokeException extends RuntimeException
  {
      public InvokeException(String message)
      {
          super(message);
      }
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/transport/jms/QueueConnector.java
  
  Index: QueueConnector.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001, 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.axis.transport.jms;
  
  import javax.jms.QueueConnectionFactory;
  import javax.jms.QueueConnection;
  import javax.jms.Queue;
  import javax.jms.TemporaryQueue;
  import javax.jms.Session;
  import javax.jms.QueueSession;
  import javax.jms.QueueReceiver;
  import javax.jms.QueueSender;
  import javax.jms.Connection;
  import javax.jms.ConnectionFactory;
  import javax.jms.Message;
  import javax.jms.MessageListener;
  import javax.jms.MessageConsumer;
  import javax.jms.MessageProducer;
  import javax.jms.JMSException;
  import javax.jms.Destination;
  
  import javax.naming.Context;
  
  import java.util.HashMap;
  
  /**
   * QueueConnector is a concrete JMSConnector subclass that specifically handles
   *   connections to queues (ptp domain).
   *
   * @author Jaime Meritt  (jmeritt@sonicsoftware.com)
   * @author Richard Chung (rchung@sonicsoftware.com)
   * @author Dave Chappell (chappell@sonicsoftware.com)
   */
  public class QueueConnector extends JMSConnector
  {
  
      public QueueConnector(ConnectionFactory factory,
                            int numRetries,
                            int numSessions,
                            long connectRetryInterval,
                            long interactRetryInterval,
                            long timeoutTime,
                            boolean allowReceive,
                            String clientID,
                            String username,
                            String password,
                            Context context)
          throws JMSException
      {
          super(factory, numRetries, numSessions, connectRetryInterval,
                interactRetryInterval, timeoutTime, allowReceive, clientID,
                username, password, context);
      }
  
      protected JMSEndpoint internalCreateEndpoint(String destination)
      {
          return new QueueEndpoint(destination);
      }
  
      /**
       * Create an endpoint for a queue destination.
       *
       * @param destination
       * @return
       * @throws JMSException
       */
      public JMSEndpoint createEndpoint(Destination destination)
          throws JMSException
      {
          if(!(destination instanceof Queue))
              throw new IllegalArgumentException("The input must be a queue for this connector");
          return new QueueDestinationEndpoint((Queue)destination);
      }
  
      protected Connection internalConnect(ConnectionFactory connectionFactory,
                                           String username,
                                           String password)
          throws JMSException
      {
          QueueConnectionFactory qcf = (QueueConnectionFactory)connectionFactory;
          if(username == null)
              return qcf.createQueueConnection();
  
          return qcf.createQueueConnection(username, password);
      }
  
  
      protected SyncConnection createSyncConnection(ConnectionFactory factory,
                                                    Connection connection,
                                                    int numSessions,
                                                    String threadName,
                                                    String clientID,
                                                    String username,
                                                    String password)
  
          throws JMSException
      {
          return new QueueSyncConnection((QueueConnectionFactory)factory,
                                         (QueueConnection)connection, numSessions,
                                         threadName, clientID, username, password);
      }
  
      private QueueSession createQueueSession(QueueConnection connection, int ackMode)
          throws JMSException
      {
          return connection.createQueueSession(false, ackMode);
      }
  
      private Queue createQueue(QueueSession session, String subject)
          throws JMSException
      {
          return session.createQueue(subject);
      }
  
      private QueueReceiver createReceiver(QueueSession session,
                                           Queue queue,
                                           String messageSelector)
          throws JMSException
      {
          return session.createReceiver(queue, messageSelector);
      }
  
      private final class QueueSyncConnection extends SyncConnection
      {
          QueueSyncConnection(QueueConnectionFactory connectionFactory,
                              QueueConnection connection,
                              int numSessions,
                              String threadName,
                              String clientID,
                              String username,
                              String password)
              throws JMSException
          {
              super(connectionFactory, connection, numSessions, threadName,
                    clientID, username, password);
          }
  
          protected SendSession createSendSession(javax.jms.Connection connection)
              throws JMSException
          {
              QueueSession session = createQueueSession((QueueConnection)connection,
                                          JMSConstants.DEFAULT_ACKNOWLEDGE_MODE);
              QueueSender sender = session.createSender(null);
              return new QueueSendSession(session, sender);
          }
  
          private final class QueueSendSession extends SendSession
          {
              QueueSendSession(QueueSession session,
                               QueueSender  sender)
                  throws JMSException
              {
                  super(session, sender);
              }
  
              protected MessageConsumer createConsumer(Destination destination)
                  throws JMSException
              {
                  return createReceiver((QueueSession)m_session, (Queue)destination, null);
              }
  
  
              protected Destination createTemporaryDestination()
                  throws JMSException
              {
                  return ((QueueSession)m_session).createTemporaryQueue();
              }
  
              protected void deleteTemporaryDestination(Destination destination)
                  throws JMSException
              {
                  ((TemporaryQueue)destination).delete();
              }
  
              protected void send(Destination destination, Message message,
                                  int deliveryMode, int priority, long timeToLive)
                  throws JMSException
              {
                  ((QueueSender)m_producer).send((Queue)destination, message,
                                                  deliveryMode, priority, timeToLive);
              }
  
          }
      }
  
      private class QueueEndpoint
          extends JMSEndpoint
      {
          String m_queueName;
  
          QueueEndpoint(String queueName)
          {
              super(QueueConnector.this);
              m_queueName = queueName;
          }
  
          Destination getDestination(Session session)
              throws JMSException
          {
              return createQueue((QueueSession)session, m_queueName);
          }
  
          public String toString()
          {
              StringBuffer buffer = new StringBuffer("QueueEndpoint:");
              buffer.append(m_queueName);
              return buffer.toString();
          }
  
          public boolean equals(Object object)
          {
              if(!super.equals(object))
                  return false;
  
              if(!(object instanceof QueueEndpoint))
                  return false;
  
              return m_queueName.equals(((QueueEndpoint)object).m_queueName);
          }
      }
  
  
      private final class QueueDestinationEndpoint
          extends QueueEndpoint
      {
          Queue m_queue;
  
          QueueDestinationEndpoint(Queue queue)
              throws JMSException
          {
              super(queue.getQueueName());
              m_queue = queue;
          }
  
          Destination getDestination(Session session)
          {
              return m_queue;
          }
  
      }
  
      protected AsyncConnection createAsyncConnection(ConnectionFactory factory,
                                                      Connection connection,
                                                      String threadName,
                                                      String clientID,
                                                      String username,
                                                      String password)
          throws JMSException
      {
          return new QueueAsyncConnection((QueueConnectionFactory)factory,
                                          (QueueConnection)connection, threadName,
                                          clientID, username, password);
      }
  
      private final class QueueAsyncConnection extends AsyncConnection
      {
  
          QueueAsyncConnection(QueueConnectionFactory connectionFactory,
                               QueueConnection connection,
                               String threadName,
                               String clientID,
                               String username,
                               String password)
              throws JMSException
          {
              super(connectionFactory, connection, threadName, clientID, username, password);
          }
  
          protected ListenerSession createListenerSession(javax.jms.Connection connection,
                                                          Subscription subscription)
              throws JMSException
          {
              QueueSession session = createQueueSession((QueueConnection)connection,
                                                        subscription.m_ackMode);
              QueueReceiver receiver = createReceiver(session,
                          (Queue)subscription.m_endpoint.getDestination(session),
                          subscription.m_messageSelector);
              return new ListenerSession(session, receiver, subscription);
          }
  
      }
  
  }
  
  
  1.1                  xml-axis/java/src/org/apache/axis/transport/jms/JMSConnectorFactory.java
  
  Index: JMSConnectorFactory.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001, 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.axis.transport.jms;
  
  import java.util.HashMap;
  import java.util.Iterator;
  import java.util.Hashtable;
  
  import java.lang.reflect.Method;
  
  import javax.jms.ConnectionFactory;
  import javax.jms.QueueConnectionFactory;
  import javax.jms.TopicConnectionFactory;
  import javax.jms.JMSException;
  
  import javax.naming.Context;
  import javax.naming.InitialContext;
  
  import org.apache.axis.utils.ClassUtils;
  import org.apache.axis.utils.BeanUtils;
  import org.apache.axis.utils.BeanPropertyDescriptor;
  
  /**
   * JMSConnectorFactory is a factory class for creating JMSConnectors. It can
   *   create both client connectors and server connectors. A server connector
   *   is configured to allow asynchronous message receipt, while a client
   *   connector is not.
   *
   * @author Jaime Meritt  (jmeritt@sonicsoftware.com)
   * @author Richard Chung (rchung@sonicsoftware.com)
   * @author Dave Chappell (chappell@sonicsoftware.com)
   */
  public class JMSConnectorFactory
  {
      /**
       * Static method to create a server connector. Server connectors can
       *   accept incoming requests.
       *
       * @param connectorConfig
       * @param cfConfig
       * @param username
       * @param password
       * @return
       * @throws Exception
       */
      public static JMSConnector createServerConnector(HashMap connectorConfig,
                                                       HashMap cfConfig,
                                                       String username,
                                                       String password)
          throws Exception
      {
          return createConnector(connectorConfig, cfConfig, true,
                                 username, password);
      }
  
      /**
       * Static method to create a client connector. Client connectors cannot
       *   accept incoming requests.
       *
       * @param connectorConfig
       * @param cfConfig
       * @param username
       * @param password
       * @return
       * @throws Exception
       */
      public static JMSConnector createClientConnector(HashMap connectorConfig,
                                                       HashMap cfConfig,
                                                       String username,
                                                       String password)
          throws Exception
      {
          return createConnector(connectorConfig, cfConfig, false,
                                 username, password);
      }
  
      private static JMSConnector createConnector(HashMap connectorConfig,
                                                  HashMap cfConfig,
                                                  boolean allowReceive,
                                                  String username,
                                                  String password)
          throws Exception
      {
          if(connectorConfig != null)
              connectorConfig = (HashMap)connectorConfig.clone();
          int numRetries = MapUtils.removeIntProperty(connectorConfig,
                                      JMSConstants.NUM_RETRIES,
                                      JMSConstants.DEFAULT_NUM_RETRIES);
  
          int numSessions = MapUtils.removeIntProperty(connectorConfig,
                                      JMSConstants.NUM_SESSIONS,
                                      JMSConstants.DEFAULT_NUM_SESSIONS);
  
          long connectRetryInterval = MapUtils.removeLongProperty(connectorConfig,
                                      JMSConstants.CONNECT_RETRY_INTERVAL,
                                      JMSConstants.DEFAULT_CONNECT_RETRY_INTERVAL);
  
          long interactRetryInterval = MapUtils.removeLongProperty(connectorConfig,
                                      JMSConstants.INTERACT_RETRY_INTERVAL,
                                      JMSConstants.DEFAULT_INTERACT_RETRY_INTERVAL);
  
          long timeoutTime = MapUtils.removeLongProperty(connectorConfig,
                                      JMSConstants.TIMEOUT_TIME,
                                      JMSConstants.DEFAULT_TIMEOUT_TIME);
  
          String clientID = MapUtils.removeStringProperty(connectorConfig,
                                      JMSConstants.CLIENT_ID,
                                      null);
  
          if(cfConfig == null)
              throw new IllegalArgumentException("noCfConfig");
  
          ConnectionFactory factory = null;
          Context context = null;
          if(cfConfig.containsKey(JMSConstants.CONNECTION_FACTORY_JNDI_NAME))
          {
              context = getContext(cfConfig);
              factory = getConnectionFactoryFromJNDI(cfConfig, context);
          }
          else if(cfConfig.containsKey(JMSConstants.CONNECTION_FACTORY_CLASS))
          {
              factory = getConnectionFactoryFromBean(cfConfig);
          }
          else
              throw new IllegalArgumentException("invalidCfConfig");
  
          if(factory instanceof QueueConnectionFactory)
          {
              return new QueueConnector((QueueConnectionFactory)factory,
                                        numRetries, numSessions, connectRetryInterval,
                                        interactRetryInterval, timeoutTime,
                                        allowReceive, clientID, username, password, context);
          }
          else // (factory instanceof TopicConnectionFactory)
          {
              return new TopicConnector((TopicConnectionFactory)factory,
                                        numRetries, numSessions, connectRetryInterval,
                                        interactRetryInterval, timeoutTime,
                                        allowReceive, clientID, username, password, context);
          }
      }
  
      private static ConnectionFactory getConnectionFactoryFromBean(HashMap cfConfig)
          throws Exception
      {
          String classname = (String)cfConfig.get(JMSConstants.CONNECTION_FACTORY_CLASS);
          Class factoryClass = ClassUtils.forName(classname);
          ConnectionFactory factory = (ConnectionFactory)factoryClass.newInstance();
          callSetters(cfConfig, factoryClass, factory);
          return factory;
  
      }
  
      private static Context getContext(HashMap cfConfig)
          throws Exception
      {
          Hashtable environment = new Hashtable(cfConfig);
          return new InitialContext(environment);
      }
  
      private static ConnectionFactory getConnectionFactoryFromJNDI(HashMap cfConfig, Context context)
          throws Exception
      {
          String jndiName = (String)cfConfig.get(JMSConstants.CONNECTION_FACTORY_JNDI_NAME);
          return (ConnectionFactory)context.lookup(jndiName);
      }
  
      private static void callSetters(HashMap cfConfig,
                                      Class factoryClass,
                                      ConnectionFactory factory)
        throws Exception
      {
          BeanPropertyDescriptor[] bpd = BeanUtils.getPd(factoryClass);
          for(int i = 0; i < bpd.length; i++)
          {
              BeanPropertyDescriptor thisBPD = bpd[i];
              String propName = thisBPD.getName();
              if(cfConfig.containsKey(propName))
              {
                  Object value = cfConfig.get(propName);
                  String validType = thisBPD.getType().getName();
                  if(!value.getClass().getName().equals(validType))
                      throw new IllegalArgumentException("badType");
                  if(!thisBPD.isWriteable())
                      throw new IllegalArgumentException("notWriteable");
                  if(thisBPD.isIndexed())
                      throw new IllegalArgumentException("noIndexedSupport");
                  thisBPD.set(factory, value);
              }
          }
      }
  
  
  
  }
  
  
  1.1                  xml-axis/java/src/org/apache/axis/transport/jms/SimpleJMSWorker.java
  
  Index: SimpleJMSWorker.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001, 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.axis.transport.jms;
  
  import java.io.ByteArrayInputStream;
  import java.io.ByteArrayOutputStream;
  import java.io.InputStream;
  
  import javax.jms.BytesMessage;
  import javax.jms.Destination;
  
  import org.apache.axis.Message;
  import org.apache.axis.MessageContext;
  import org.apache.axis.AxisFault;
  
  import org.apache.axis.server.AxisServer;
  
  import org.apache.axis.utils.Messages;
  import org.apache.commons.logging.Log;
  import org.apache.axis.components.logger.LogFactory;
  
  /**
   * SimpleJMSWorker is a worker thread that processes messages that are
   *   received by SimpleJMSListener. It creates a new message context, invokes
   *   the server, and sends back response msg to the replyTo destination.
   *
   * @author Jaime Meritt  (jmeritt@sonicsoftware.com)
   * @author Richard Chung (rchung@sonicsoftware.com)
   * @author Dave Chappell (chappell@sonicsoftware.com)
   */
  public class SimpleJMSWorker implements Runnable
  {
      protected static Log log =
              LogFactory.getLog(SimpleJMSWorker.class.getName());
  
      SimpleJMSListener listener;
      BytesMessage message;
  
      public SimpleJMSWorker(SimpleJMSListener listener, BytesMessage message)
      {
          this.listener = listener;
          this.message = message;
      }
  
      /**
       * This is where the incoming message is processed.
       */
      public void run()
      {
          InputStream in = null;
          try
          {
              // get the incoming msg content into a byte array
              byte[] buffer = new byte[8 * 1024];
              ByteArrayOutputStream out = new ByteArrayOutputStream();
              for(int bytesRead = message.readBytes(buffer);
                  bytesRead != -1; bytesRead = message.readBytes(buffer))
              {
                  out.write(buffer, 0, bytesRead);
              }
              in = new ByteArrayInputStream(out.toByteArray());
          }
          catch(Exception e)
          {
              log.error(Messages.getMessage("exception00"), e);
              e.printStackTrace();
              return;
          }
  
          // create the msg and context and invoke the server
          AxisServer server = listener.getAxisServer();
          Message msg = new Message(in);
          MessageContext  msgContext = new MessageContext(server);
          msgContext.setRequestMessage( msg );
          try
          {
              server.invoke( msgContext );
              msg = msgContext.getResponseMessage();
          }
          catch (AxisFault af)
          {
              msg = new Message(af);
              msg.setMessageContext(msgContext);
          }
          catch (Exception e)
          {
              msg = new Message(new AxisFault(e.toString()));
              msg.setMessageContext(msgContext);
          }
  
          try
          {
              // now we need to send the response
              Destination destination = message.getJMSReplyTo();
              if(destination == null)
                  return;
              JMSEndpoint replyTo = listener.getConnector().createEndpoint(destination);
              ByteArrayOutputStream out = new ByteArrayOutputStream();
              msg.writeTo(out);
              replyTo.send(out.toByteArray());
          }
          catch(Exception e)
          {
              e.printStackTrace();
          }
  
          if (msgContext.getProperty(msgContext.QUIT_REQUESTED) != null)
              // why then, quit!
              try {listener.shutdown();} catch (Exception e) {}
      }
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/transport/jms/JMSSender.java
  
  Index: JMSSender.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001, 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.axis.transport.jms;
  
  import java.io.ByteArrayOutputStream;
  
  import java.util.HashMap;
  
  import org.apache.axis.MessageContext;
  import org.apache.axis.Message;
  import org.apache.axis.AxisFault;
  
  import org.apache.axis.handlers.BasicHandler;
  
  import javax.jms.ConnectionFactory;
  import javax.jms.Destination;
  
  /**
   * This is meant to be used on a SOAP Client to call a SOAP server.
   *
   * @author Jaime Meritt  (jmeritt@sonicsoftware.com)
   * @author Richard Chung (rchung@sonicsoftware.com)
   * @author Dave Chappell (chappell@sonicsoftware.com)
   */
  public class JMSSender extends BasicHandler
  {
      public JMSSender()
      {
      }
  
      /**
       * invoke() creates an endpoint, sends the request SOAP message, and then
       *   either reads the response SOAP message or simply returns.
       *
       * @todo hash on something much better than the connection factory
       *  something like domain:url:username:password would be adequate
       * @param msgContext
       * @throws AxisFault
       */
      public void invoke(MessageContext msgContext) throws AxisFault
      {
          try
          {
              Object destination = msgContext.getProperty(JMSConstants.DESTINATION);
              if(destination == null)
                  throw new AxisFault("noDestination");
  
              JMSConnector connector = (JMSConnector)msgContext.getProperty(
                                                      JMSConstants.CONNECTOR);
              JMSEndpoint endpoint = null;
              if(destination instanceof String)
                  endpoint = connector.createEndpoint((String)destination);
              else
                  endpoint = connector.createEndpoint((Destination)destination);
  
              ByteArrayOutputStream out = new ByteArrayOutputStream();
              msgContext.getRequestMessage().writeTo(out);
  
              HashMap props = createSendProperties(msgContext);
              boolean waitForResponse = true;
              if(msgContext.containsProperty(JMSConstants.WAIT_FOR_RESPONSE))
                  waitForResponse =
                      ((Boolean)msgContext.getProperty(
                          JMSConstants.WAIT_FOR_RESPONSE)).booleanValue();
              if(waitForResponse)
              {
                  long timeout = (long) msgContext.getTimeout();
                  byte[] response = endpoint.call(out.toByteArray(), timeout, props);
                  Message msg = new Message(response);
                  msgContext.setResponseMessage(msg);
              }
              else
              {
                  endpoint.send(out.toByteArray(), props);
              }
          }
          catch(Exception e)
          {
              throw new AxisFault("failedSend", e);
          }
      }
  
      private HashMap createSendProperties(MessageContext context)
      {
  
          if(!context.containsProperty(JMSConstants.PRIORITY) &&
             !context.containsProperty(JMSConstants.DELIVERY_MODE) &&
             !context.containsProperty(JMSConstants.TIME_TO_LIVE))
          {
              return null;
          }
  
          HashMap props = new HashMap();
          if(context.containsProperty(JMSConstants.PRIORITY))
              props.put(JMSConstants.PRIORITY,
              context.getProperty(JMSConstants.PRIORITY));
          if(context.containsProperty(JMSConstants.DELIVERY_MODE))
              props.put(JMSConstants.DELIVERY_MODE,
              context.getProperty(JMSConstants.DELIVERY_MODE));
          if(context.containsProperty(JMSConstants.TIME_TO_LIVE))
              props.put(JMSConstants.TIME_TO_LIVE,
              context.getProperty(JMSConstants.TIME_TO_LIVE));
          return props;
      }
  
  
  }
  
  
  1.29      +5 -0      xml-axis/java/xmls/targets.xml
  
  Index: targets.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/xmls/targets.xml,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- targets.xml	13 Sep 2002 16:51:21 -0000	1.28
  +++ targets.xml	17 Sep 2002 16:50:36 -0000	1.29
  @@ -148,6 +148,10 @@
         </and>
       </condition>
   
  +    <condition property="jms.present" >
  +      <available classname="javax.jms.Message" classpathref="classpath" />
  +    </condition>
  +
       <available property="post-compile.present" file="post-compile.xml" />
   
       <property environment="env"/>
  @@ -202,6 +206,7 @@
       <echo message="commons-httpclient.present=${commons-httpclient.present}" />
       <echo message="axis-ant.present=${axis-ant.present}" />
       <echo message="httpunit.present=${httpunit.present}" />
  +    <echo message="jms.present=${jms.present}" />
       <echo message=""/>
       <echo message="--- Property values ---" />
       <echo message="debug=${debug}" />
  
  
  
  1.1                  xml-axis/java/samples/jms/server-config.wsdd
  
  Index: server-config.wsdd
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
   <service name="urn:cominfo" provider="java:RPC">
    <parameter name="allowedMethods" value="getInfo"/>
    <parameter name="className" value="samples.stock.ComInfoService"/>
   </service>
   <service name="urn:xmltoday-delayed-quotes" provider="java:RPC">
    <parameter name="allowedMethods" value="getQuote"/>
    <parameter name="className" value="samples.stock.StockQuoteService"/>
   </service>
  </deployment>
  
  
  1.1                  xml-axis/java/samples/jms/JMSTest.java
  
  Index: JMSTest.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001, 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package samples.jms;
  
  import org.apache.axis.AxisEngine;
  import org.apache.axis.SimpleTargetedChain;
  import org.apache.axis.configuration.XMLStringProvider;
  import org.apache.axis.deployment.wsdd.WSDDConstants;
  import org.apache.axis.client.Call;
  import org.apache.axis.client.Service;
  import org.apache.axis.encoding.XMLType;
  import org.apache.axis.utils.Options;
  
  import org.apache.axis.transport.jms.JMSTransport;
  import org.apache.axis.transport.jms.JMSConstants;
  import org.apache.axis.transport.jms.SimpleJMSListener;
  import org.apache.axis.transport.jms.SonicConstants;
  
  import java.util.HashMap;
  
  import javax.xml.rpc.ParameterMode;
  import javax.xml.namespace.QName;
  
  /** Tests the JMS transport.  To run:
   *      java org.apache.axis.utils.Admin client client_deploy.xml
   *      java org.apache.axis.utils.Admin server deploy.xml
   *      java samples.transport.FileTest IBM
   *      java samples.transport.FileTest XXX
   *
   * JMSTest is a simple test driver for the JMS transport. It sets up a
   *   JMS listener, then calls a delayed quote service for each of the symbols
   *   specified on the command line.
   *
   * @author Jaime Meritt  (jmeritt@sonicsoftware.com)
   * @author Richard Chung (rchung@sonicsoftware.com)
   * @author Dave Chappell (chappell@sonicsoftware.com)
   */
  
  public class JMSTest {
      static final String wsdd =
              "<deployment xmlns=\"http://xml.apache.org/axis/wsdd/\" " +
                    "xmlns:java=\"" + WSDDConstants.URI_WSDD_JAVA + "\">\n" +
              " <transport name=\"JMSTransport\" pivot=\"java:org.apache.axis.transport.jms.JMSSender\"/>\n" +
              " <service name=\"" + WSDDConstants.URI_WSDD + "\" provider=\"java:MSG\">\n" +
              "  <parameter name=\"allowedMethods\" value=\"AdminService\"/>\n" +
              "  <parameter name=\"className\" value=\"org.apache.axis.utils.Admin\"/>\n" +
              " </service>\n" +
              "</deployment>";
  
      public static void main(String args[]) throws Exception {
          Options opts = new Options( args );
  
          // first check if we should print usage
          if ((opts.isFlagSet('?') > 0) || (opts.isFlagSet('h') > 0)) {
              printUsage();
          }
  
          // create the jms listener
          SimpleJMSListener listener = new SimpleJMSListener(opts);
          listener.start();
  
          args = opts.getRemainingArgs();
          if ( args == null ) {
              printUsage();
          }
  
          int numArgs = args.length;
          String[] symbols = new String[numArgs];
          for (int i = 0; i < numArgs; i++) {
              symbols[i] = args[i];
          }
  
          Service  service = new Service(new XMLStringProvider(wsdd));
  
          HashMap cfProps = new HashMap();
          cfProps.put(SonicConstants.BROKER_URL, opts.isValueSet('b'));
          cfProps.put(SonicConstants.DEFAULT_USERNAME, opts.getUser());
          cfProps.put(SonicConstants.DEFAULT_PASSWORD, opts.getPassword());
  
          // do we have a jndi name?
          String jndiName = opts.isValueSet('n');
          if (jndiName != null) {
              // w/ a jndi name, we can get the appropriate connection factory
              cfProps.put(JMSConstants.CONNECTION_FACTORY_JNDI_NAME, jndiName);
          } else {
              // w/o a jndi name, we default to using the Sonic-specific method
              // for creating a connection factory, which is by specifying the
              // appropriate connection factory class from SonicConstants.java
  
              // topics or queues?
              String cf = null;
              if (opts.isFlagSet('t') > 0) {
                  cf = SonicConstants.TCF_CLASS;
              } else {
                  cf = SonicConstants.QCF_CLASS;
              }
              cfProps.put(JMSConstants.CONNECTION_FACTORY_CLASS, cf);
          }
  
          // create the transport
          JMSTransport transport = new JMSTransport(null, cfProps);
  
          // create a new Call object
          Call     call    = (Call) service.createCall();
  
          call.setOperationName( new QName("urn:xmltoday-delayed-quotes", "getQuote") );
          call.addParameter( "symbol", XMLType.XSD_STRING, ParameterMode.IN );
          call.setReturnType( XMLType.XSD_FLOAT );
          call.setTransport(transport);
  
          // set additional params on the call if desired
  
          //call.setUsername(opts.getUser() );
          //call.setPassword(opts.getPassword() );
  
          //call.setProperty(JMSConstants.WAIT_FOR_RESPONSE, Boolean.FALSE);
          //call.setProperty(JMSConstants.PRIORITY, new Integer(5));
          //call.setProperty(JMSConstants.DELIVERY_MODE,
          //    new Integer(javax.jms.DeliveryMode.PERSISTENT));
          //call.setProperty(JMSConstants.TIME_TO_LIVE, new Long(20000));
  
          call.setProperty(JMSConstants.DESTINATION, "SampleQ1");
          call.setTimeout(new Integer(10000));
  
          Float res = new Float(0.0F);
  
          // invoke a call for each of the symbols and print out
          for (int i = 0; i < symbols.length; i++) {
              res = (Float) call.invoke(new Object[] {symbols[i]});
              System.out.println(symbols[i] + ": " + res);
          }
  
          // shutdown
          listener.shutdown();
          transport.shutdown();
      }
  
      public static void printUsage()
      {
          System.out.println("JMSTest: Tests JMS transport by obtaining stock quote");
          System.out.println("  Usage: JMSTest <symbol 1> <symbol 2> <symbol 3> ...");
          System.out.println("   Opts: -? this message");
          System.out.println();
          System.out.println("         -b brokerurl");
          System.out.println("         -u username");
          System.out.println("         -w password");
          System.out.println();
          System.out.println("         -d destination");
          System.out.println("         -t topic [absence of -t indicates queue]");
          System.out.println();
          System.out.println("         -n jndi name for connection factory");
          System.out.println("            [jndi name obviates need for -t option]");
          System.out.println();
          System.out.println("         -s single-threaded listener");
          System.out.println("            [absence of option => multithreaded]");
  
          System.exit(1);
      }
  }
  
  
  
  1.1                  xml-axis/java/samples/jms/client_deploy.wsdd
  
  Index: client_deploy.wsdd
  ===================================================================
  <!-- Use this file to deploy some handlers/chains and services  -->
  <!-- on the client.  To do this simply run:                     -->
  <!--   java org.apache.axis.utils.Admin client_deploy.xml       -->
  <!--      from the same dir that the Axis client will run in    -->
  <!-- This file will be replaced by WSDD once it's ready         -->
  
  <deployment name="test" xmlns="http://xml.apache.org/axis/wsdd/"
      xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
    <handler name="JMSSender" type="java:org.apache.axis.transport.jms.JMSSender" />
    <transport name="JMSTransport" pivot="JMSSender"/>
  </deployment>
  
  
  
  1.1                  xml-axis/java/samples/jms/build.xml
  
  Index: build.xml
  ===================================================================
  <?xml version="1.0"?>
  <!DOCTYPE project [
    <!ENTITY properties SYSTEM "file:../../xmls/properties.xml">
    <!ENTITY paths SYSTEM "file:../../xmls/path_refs.xml">
    <!ENTITY taskdefs SYSTEM "file:../../xmls/taskdefs.xml">
    <!ENTITY taskdefs_post_compile SYSTEM "file:../../xmls/taskdefs_post_compile.xml">
    <!ENTITY targets SYSTEM "file:../../xmls/targets.xml">
  ]>
  <!-- ===================================================================
  <description>
     Test/Sample Component file for Axis
  
  Notes:
     This is a build file for use with the Jakarta Ant build tool.
  
  Prerequisites:
  
     jakarta-ant from http://jakarta.apache.org
  
  Build Instructions:
     To compile
          ant compile
     To execute
          ant run
  
  Authors:
    Jaime Meritt jmeritt@sonicsoftware.com
    Richard Chung rchung@sonicsoftware.com
    David Chappell chappell@sonicsoftware.com
  
  Copyright:
    Copyright (c) 2002-2003 Apache Software Foundation.
  </description>
  ==================================================================== -->
  <project default="compile">
    <property name="axis.home" location="../.." />
    <property name="componentName" value="samples/jms" />
  
      &properties;
      &paths;
      &taskdefs;
      &taskdefs_post_compile;
      &targets;
  
    <target name="clean"/>
    <target name="copy"/>
    <target name="compile">
      <javac srcdir="${axis.home}" destdir="${build.dest}" debug="${debug}" fork="${javac.fork}">
        <classpath>
          <path refid="classpath"/>
        </classpath>
        <include name="samples/jms/**/*.java"/>
        <exclude name="samples/jms/**/*.java" unless="jms.present"/>
        <exclude name="samples/**/*SMTP*.java" unless="smtp.present"/>
        <exclude name="**/old/**/*.java"/>
      </javac>
    </target>
    <target name="deploy"/>
    <target name="run"/>
    <target name="undeploy"/>
  </project>
  
  
  
  

Mime
View raw message