Implementing a Provider to enable Security on JMS Connection Factories

The interface org.eclipse.stardust.engine.core.spi.jms.IQueueConnectionProvider provides the option to enable security on JMS connection factories. If you can implement this interface with a mechanism of your choice to provide credentials. The default implementation creates the current queue connection without credentials.

Find the code of the interface to be implemented in the public Javadoc of the according provider class mentioned above or here:

package org.eclipse.stardust.engine.core.spi.jms;

import javax.jms.JMSException;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;

import org.eclipse.stardust.common.annotations.SPI;
import org.eclipse.stardust.common.annotations.Status;
import org.eclipse.stardust.common.annotations.UseRestriction;

@SPI(useRestriction = UseRestriction.Public, status = Status.Experimental)
public interface IQueueConnectionProvider
   /**
    * 
    * @param factory {@link QueueConnectionFactory}
    * @return {@link QueueConnection}
    * @throws JMSException
    */
{
   QueueConnection createQueueConnection(QueueConnectionFactory factory)
         throws JMSException;
}

Example Implementation

The following code shows an example implementation of the IQueueConnectionProvider:

public class SecureQueueConnectionProvider implements IQueueConnectionProvider
{

   @Override
   public QueueConnection createQueueConnection(QueueConnectionFactory factory)
         throws JMSException
   {
      String jmsUser = System.getProperty("jmsur", "echjms");
      String jmsPwd = System.getProperty("jmsps");

      if (null != jmsPwd)
      {
         return factory.createQueueConnection(jmsUser, jmsPwd);
      }
      
      return null;
   }
}