FileDocCategorySizeDatePackage
SonicMQVendorAdapter.javaAPI DocApache Axis 1.416814Sat Apr 22 18:57:28 BST 2006org.apache.axis.components.jms

SonicMQVendorAdapter

public class SonicMQVendorAdapter extends BeanVendorAdapter
Defines SonicMQ specific constants for connnection factory creation. Overrides methods in BeanVendorAdapter to fill in MQ classnames
author
Jaime Meritt (jmeritt@sonicsoftware.com)
author
Ray Chun (rchun@sonicsoftware.com)

Fields Summary
private static final String
QCF_CLASS
private static final String
TCF_CLASS
public static final String
BROKER_URL
SonicConnectionFactory parameter valid for either domain. This should be used as a key in the environment map passed into calls to createConnector in JMSConnectorFactory. This is a required property. The value must be a java.lang.String See the SonicMQ documentation for information on this property
public static final String
DEFAULT_USERNAME
SonicConnectionFactory parameter valid for either domains. This should be used as a key in the environment map passed into calls to createConnector in JMSConnectorFactory This is a required property for secure brokers. The value must be a java.lang.String See the SonicMQ documentation for information on this property
public static final String
DEFAULT_PASSWORD
SonicConnectionFactory parameter valid for either domain. This should be used as a key in the environment map passed into calls to createConnector in JMSConnectorFactory This is a required property for secure brokers. The value must be a java.lang.String See the SonicMQ documentation for information on this property
public static final String
PING_INTERVAL
SonicConnectionFactory parameter valid for either domain. This should be used as a key in the environment map passed into calls to createConnector in JMSConnectorFactory The value must be a java.lang.Long See the SonicMQ documentation for information on this property
public static final String
RECONNECT_INTERVAL
SonicConnectionFactory parameter valid for either domain. This should be used as a key in the environment map passed into calls to createConnector in JMSConnectorFactory The value must be a java.lang.Integer See the SonicMQ documentation for information on this property
public static final String
RECONNECT_TIMEOUT
SonicConnectionFactory parameter valid for either domain. This should be used as a key in the environment map passed into calls to createConnector in JMSConnectorFactory The value must be a java.lang.Integer See the SonicMQ documentation for information on this property
public static final String
CONNECT_ID
SonicConnectionFactory parameter valid for either domain. This should be used as a key in the environment map passed into calls to createConnector in JMSConnectorFactory The value must be a java.lang.String See the SonicMQ documentation for information on this property
public static final String
CONNECTION_URLS
SonicConnectionFactory parameter valid for either domain. This should be used as a key in the environment map passed into calls to createConnector in JMSConnectorFactory The value must be a java.lang.String See the SonicMQ documentation for information on this property
public static final String
LOAD_BALANCING
SonicConnectionFactory parameter valid for either domain. This should be used as a key in the environment map passed into calls to createConnector in JMSConnectorFactory The value must be a java.lang.Boolean See the SonicMQ documentation for information on this property
public static final String
MONITOR_INTERVAL
SonicConnectionFactory parameter valid for either domain. This should be used as a key in the environment map passed into calls to createConnector in JMSConnectorFactory The value must be a java.lang.Long See the SonicMQ documentation for information on this property
public static final String
PERSISTENT_DELIVERY
SonicConnectionFactory parameter valid for either domain. This should be used as a key in the environment map passed into calls to createConnector in JMSConnectorFactory The value must be a java.lang.Boolean See the SonicMQ documentation for information on this property
public static final String
SEQUENTIAL
SonicConnectionFactory parameter valid for either domain. This should be used as a key in the environment map passed into calls to createConnector in JMSConnectorFactory The value must be a java.lang.Boolean See the SonicMQ documentation for information on this property
public static final String
PREFETCH_COUNT
SonicConnectionFactory parameter valid for the PTP domain. This should be used as a key in the environment map passed into calls to createConnector in JMSConnectorFactory The value must be a java.lang.Integer See the SonicMQ documentation for information on this property
public static final String
PREFETCH_THRESHOLD
SonicConnectionFactory parameter valid for the PTP domain. This should be used as a key in the environment map passed into calls to createConnector in JMSConnectorFactory The value must be a java.lang.Integer See the SonicMQ documentation for information on this property
public static final String
SELECTOR_AT_BROKER
SonicConnectionFactory parameter valid for the PubSub domain. This should be used as a key in the environment map passed into calls to createConnector in JMSConnectorFactory The value must be a java.lang.Boolean See the SonicMQ documentation for information on this property
Constructors Summary
Methods Summary
public voidaddVendorConnectionFactoryProperties(org.apache.axis.transport.jms.JMSURLHelper jmsurl, java.util.HashMap cfProps)
Extract Sonic-specific properties from the JMS URL

param
jmsurl The JMS URL representing the target endpoint address
param
cfProps The set of connection factory configuration properties

        if (jmsurl.getPropertyValue(BROKER_URL) != null)
            cfProps.put(BROKER_URL, jmsurl.getPropertyValue(BROKER_URL));

        if (jmsurl.getPropertyValue(DEFAULT_USERNAME) != null)
            cfProps.put(DEFAULT_USERNAME, jmsurl.getPropertyValue(DEFAULT_USERNAME));

        if (jmsurl.getPropertyValue(DEFAULT_PASSWORD) != null)
            cfProps.put(DEFAULT_PASSWORD, jmsurl.getPropertyValue(DEFAULT_PASSWORD));

        if (jmsurl.getPropertyValue(PING_INTERVAL) != null)
            cfProps.put(PING_INTERVAL, jmsurl.getPropertyValue(PING_INTERVAL));

        if (jmsurl.getPropertyValue(RECONNECT_INTERVAL) != null)
            cfProps.put(RECONNECT_INTERVAL, jmsurl.getPropertyValue(RECONNECT_INTERVAL));

        if (jmsurl.getPropertyValue(RECONNECT_TIMEOUT) != null)
            cfProps.put(RECONNECT_TIMEOUT, jmsurl.getPropertyValue(RECONNECT_TIMEOUT));

        if (jmsurl.getPropertyValue(CONNECT_ID) != null)
            cfProps.put(CONNECT_ID, jmsurl.getPropertyValue(CONNECT_ID));

        if (jmsurl.getPropertyValue(CONNECTION_URLS) != null)
            cfProps.put(CONNECTION_URLS, jmsurl.getPropertyValue(CONNECTION_URLS));

        if (jmsurl.getPropertyValue(LOAD_BALANCING) != null)
            cfProps.put(LOAD_BALANCING, jmsurl.getPropertyValue(LOAD_BALANCING));

        if (jmsurl.getPropertyValue(MONITOR_INTERVAL) != null)
            cfProps.put(MONITOR_INTERVAL, jmsurl.getPropertyValue(MONITOR_INTERVAL));

        if (jmsurl.getPropertyValue(PERSISTENT_DELIVERY) != null)
            cfProps.put(PERSISTENT_DELIVERY, jmsurl.getPropertyValue(PERSISTENT_DELIVERY));

        if (jmsurl.getPropertyValue(SEQUENTIAL) != null)
            cfProps.put(SEQUENTIAL, jmsurl.getPropertyValue(SEQUENTIAL));

        if (jmsurl.getPropertyValue(PREFETCH_COUNT) != null)
            cfProps.put(PREFETCH_COUNT, jmsurl.getPropertyValue(PREFETCH_COUNT));

        if (jmsurl.getPropertyValue(PREFETCH_THRESHOLD) != null)
            cfProps.put(PREFETCH_THRESHOLD, jmsurl.getPropertyValue(PREFETCH_THRESHOLD));

        if (jmsurl.getPropertyValue(SELECTOR_AT_BROKER) != null)
            cfProps.put(SELECTOR_AT_BROKER, jmsurl.getPropertyValue(SELECTOR_AT_BROKER));
    
public javax.jms.QueueConnectionFactorygetQueueConnectionFactory(java.util.HashMap cfConfig)


       
         
    
        cfConfig = (HashMap)cfConfig.clone();
        cfConfig.put(CONNECTION_FACTORY_CLASS, QCF_CLASS);
        return super.getQueueConnectionFactory(cfConfig);
    
public javax.jms.TopicConnectionFactorygetTopicConnectionFactory(java.util.HashMap cfConfig)

        cfConfig = (HashMap)cfConfig.clone();
        cfConfig.put(CONNECTION_FACTORY_CLASS, TCF_CLASS);
        return super.getTopicConnectionFactory(cfConfig);
    
private booleanisAnotherSubscriberConnected(javax.jms.JMSException jmse)

        Exception linkedException = jmse.getLinkedException();
        if(linkedException != null &&
           linkedException instanceof EUserAlreadyConnected)
        {
            return true;
        }
        return false;
    
public booleanisConnectionDropped(javax.jms.JMSException jmse)

        return ErrorCodes.testException(jmse, ErrorCodes.ERR_CONNECTION_DROPPED);
    
public booleanisMatchingConnectionFactory(javax.jms.ConnectionFactory cf, org.apache.axis.transport.jms.JMSURLHelper jmsurl, java.util.HashMap cfProps)
Check that the attributes of the candidate connection factory match the requested connection factory properties.

param
cf the candidate connection factory
param
jmsurl the JMS URL associated with the candidate connection factory
param
cfProps the properties associated with the current request
return
true or false

        String brokerURL = null;
        String connectionURLs = null;
        boolean loadBalancing = false;
        boolean sequential = false;

        if (cf instanceof progress.message.jclient.QueueConnectionFactory)
        {
            progress.message.jclient.QueueConnectionFactory qcf =
                (progress.message.jclient.QueueConnectionFactory)cf;

            // get existing queue connection factory properties
            brokerURL = qcf.getBrokerURL();
            connectionURLs = qcf.getConnectionURLs();
            loadBalancing = qcf.getLoadBalancing();
            sequential = qcf.getSequential();
        }
        else if (cf instanceof progress.message.jclient.TopicConnectionFactory)
        {
            progress.message.jclient.TopicConnectionFactory tcf =
                (progress.message.jclient.TopicConnectionFactory)cf;

            // get existing topic connection factory properties
            brokerURL = tcf.getBrokerURL();
            connectionURLs = tcf.getConnectionURLs();
            loadBalancing = tcf.getLoadBalancing();
            sequential = tcf.getSequential();
        }

        // compare broker url
        String propertyBrokerURL = (String)cfProps.get(BROKER_URL);
        if (!brokerURL.equals(propertyBrokerURL))
            return false;

        // compare connection url list
        String propertyConnectionURLs = (String)cfProps.get(CONNECTION_URLS);
        if ((connectionURLs != null) && (propertyConnectionURLs != null))
        {
            if (!connectionURLs.equalsIgnoreCase(propertyConnectionURLs))
                return false;

            // check sequential if connection urls have been set
            String tmpSequential = (String)cfProps.get(SEQUENTIAL);
            boolean propertySequential = true;
            if (tmpSequential != null)
                propertySequential = Boolean.getBoolean(tmpSequential);
            if (sequential != propertySequential)
                return false;
        }
        else if ((connectionURLs != null) || (propertyConnectionURLs != null))
            return false;

        // compare load balancing flag
        String tmpLoadBalancing = (String)cfProps.get(LOAD_BALANCING);
        boolean propertyLoadBalancing = false;
        if (tmpLoadBalancing != null)
            propertyLoadBalancing = Boolean.getBoolean(tmpLoadBalancing);
        if (loadBalancing != propertyLoadBalancing)
            return false;

        return true;
    
private booleanisNetworkFailure(javax.jms.JMSException jmse)

        Exception linkedException = jmse.getLinkedException();
        if(linkedException != null &&
           linkedException instanceof ENetworkFailure)
        {
            return true;
        }
        return false;
    
private booleanisQueueMissing(javax.jms.JMSException jmse)

        String message = jmse.getMessage();
        if(message != null && message.startsWith("Queue not found"))
        {
            return true;
        }
        return false;
    
public booleanisRecoverable(java.lang.Throwable thrown, int action)

        //the super class cannot be trusted for on exception because it always
        //returns false
        if(action != ON_EXCEPTION_ACTION && !super.isRecoverable(thrown, action))
            return false;

        if(!(thrown instanceof JMSException))
            return true;

        JMSException jmse = (JMSException)thrown;
        switch(action)
        {
            case CONNECT_ACTION:
                if(isNetworkFailure(jmse))
                    return false;
                break;
            case SUBSCRIBE_ACTION:

                if(isQueueMissing(jmse) || isAnotherSubscriberConnected(jmse))
                    return false;
                break;

            case ON_EXCEPTION_ACTION:
                if(isConnectionDropped(jmse))
                    return false;
                break;

        }

        return true;