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

JMSVendorAdapterFactory

public class JMSVendorAdapterFactory extends Object
Discovery class used to locate vendor adapters. Switch the default JNDI-based implementation by using the org.apache.axis.components.jms.JMSVendorAdapter system property
author
Jaime Meritt (jmeritt@sonicsoftware.com)
author
Ray Chun (rchun@sonicsoftware.com)

Fields Summary
private static HashMap
s_adapters
private static final String
VENDOR_PKG
Constructors Summary
Methods Summary
public static final JMSVendorAdaptergetJMSVendorAdapter()


     
        AxisProperties.setClassDefault(JMSVendorAdapter.class,
                                       VENDOR_PKG + ".JNDIVendorAdapter");
    
        return (JMSVendorAdapter)AxisProperties.newInstance(JMSVendorAdapter.class);
    
public static final JMSVendorAdaptergetJMSVendorAdapter(java.lang.String vendorId)

        // check to see if the adapter has already been instantiated
        if (s_adapters.containsKey(vendorId))
            return (JMSVendorAdapter)s_adapters.get(vendorId);

        // create a new instance
        JMSVendorAdapter adapter = null;
        try
        {
            Class vendorClass = Class.forName(getVendorAdapterClassname(vendorId));
            adapter = (JMSVendorAdapter)vendorClass.newInstance();
        }
        catch (Exception e)
        {
            return null;
        }

        synchronized (s_adapters)
        {
            if (s_adapters.containsKey(vendorId))
                return (JMSVendorAdapter)s_adapters.get(vendorId);

            if (adapter != null)
                s_adapters.put(vendorId, adapter);
        }

        return adapter;
    
private static java.lang.StringgetVendorAdapterClassname(java.lang.String vendorId)

        StringBuffer sb = new StringBuffer(VENDOR_PKG).append(".");
        sb.append(vendorId);
        sb.append("VendorAdapter");

        return sb.toString();