FileDocCategorySizeDatePackage
ServiceEngineUtil.javaAPI DocGlassfish v2 API6506Fri May 04 22:36:10 BST 2007com.sun.enterprise.webservice

ServiceEngineUtil

public class ServiceEngineUtil extends Object
If web service client is JBI enabled, transport factory is set to NMR, otherwise ususal JAXWS stack is used.

Not thread-safe

author
Manisha Umbarje

Fields Summary
public static final String
JBI_ENABLED
private static final String
seDisablePropertyValue
private static final boolean
seEnabledFlag
private static final ApplicationLoaderEventListenerImpl
listener
private static final Logger
logger
Constructors Summary
Methods Summary
public static ApplicationLoaderEventListenerImplgetListener()


        
        return listener;
    
public static com.sun.enterprise.deployment.ServiceRefPortInfogetPortInfo(WSClientContainer container, javax.xml.namespace.QName portName)

        return container.svcRef.getPortInfoByPort(portName);
    
public static booleanisJBIRequest(java.lang.String delegateClassName)

        return delegateClassName.equals("com.sun.enterprise.jbi.serviceengine." +
                                        "bridge.transport.NMRServerConnection");
    
private static booleanisPortJbiEnabled(com.sun.enterprise.deployment.ServiceRefPortInfo portInfo)

        if(portInfo != null) {
            String value = portInfo.getStubPropertyValue(JBI_ENABLED);
            logger.log(Level.FINEST, "JBI_ENABLED flag value is : " + value);
            return "true".equals(value);
        } else {
            // This means the deployer did not resolve the port to
            // which this SEI is mapped, return false;
        }
        return false;
    
public static booleanisServiceEngineEnabled()

        return seEnabledFlag;
    
public static booleanisServiceJBIEnabled(com.sun.enterprise.deployment.ServiceReferenceDescriptor desc)

        if(isServiceEngineEnabled()) {
            java.util.Set portsInfo = desc.getPortsInfo();
            java.util.Iterator ports = portsInfo.iterator();
            while(ports.hasNext()) {
                ServiceRefPortInfo portDesc = (ServiceRefPortInfo)ports.next();
                if(isPortJbiEnabled(portDesc))
                    return true;
            }
        }
        return false;
    
public static voidsetJBITransportFactory(com.sun.enterprise.deployment.ServiceRefPortInfo portInfo, java.lang.Object stubObj, boolean jbiEnabled)

        if(isServiceEngineEnabled()) {
            ServiceReferenceDescriptor serviceRef = portInfo.getServiceReference();
            if(serviceRef != null && stubObj != null) {
                if (isServiceEngineEnabled() && 
                        jbiEnabled && 
                        serviceRef.getMappingFileUri() != null) {
                    setTransportFactory((com.sun.xml.rpc.spi.runtime.StubBase)stubObj, portInfo);
                    
                }
                
            }
        } else {
            logger.log(Level.INFO, "Java EE Service Engine's functionality is disabled");
        }
        
    
private static voidsetTransportFactory(com.sun.xml.rpc.spi.runtime.StubBase stubObj, com.sun.enterprise.deployment.ServiceRefPortInfo portInfo)

        try {
            // This is done to avoide classloader issues.
            // Check out ServiceEngineRtObjectFactory for more details.
            com.sun.xml.rpc.spi.runtime.ClientTransportFactory factory =
                    (com.sun.xml.rpc.spi.runtime.ClientTransportFactory)
                    ServiceEngineRtObjectFactory.getInstance().
                    getFacade().getTransportFactory(portInfo, true);
            if (factory == null)
                return ;
            
            logger.log(Level.INFO, "Before setting setTransportFactory to NMR");
            // Set JBI transport factory
            stubObj._setTransportFactory(factory);
            
        } catch(Exception e) {
            // Do nothing.
            if (logger.isLoggable(Level.WARNING)) {
                logger.log(Level.WARNING,
                        "Error during setting of transport factory"+e.getMessage());
            }
        }