FileDocCategorySizeDatePackage
NMRClientConnection.javaAPI DocGlassfish v2 API6424Fri May 25 01:19:40 BST 2007com.sun.enterprise.jbi.serviceengine.bridge.transport

NMRClientConnection

public class NMRClientConnection extends Object
author
Manisha Umbarje

Fields Summary
private boolean
oneWay
private URL
wsdlLocation
private QName
service
private String
endpointName
private QName
operation
private javax.jbi.messaging.MessageExchange
me
private com.sun.enterprise.jbi.serviceengine.comm.MessageExchangeTransport
meTransport
private static ConcurrentHashMap
emdCache
Constructors Summary
public NMRClientConnection(URL wsdlLocation, QName service, String endpointName, QName operation, boolean oneWay)

    
      
             
             
             
              
        this.wsdlLocation = wsdlLocation;
        this.service = service;
        this.endpointName = endpointName;
        this.operation = operation;
        setOneWay(oneWay);
    
Methods Summary
private com.sun.enterprise.jbi.serviceengine.util.soap.EndpointMetaDatacreateEndpointMetaData()

        EndpointMetaData emd = new EndpointMetaData(wsdlLocation, service, endpointName);
        emd.resolve();
        return emd;
    
private com.sun.enterprise.jbi.serviceengine.util.soap.EndpointMetaDatagetEndpointMetaData()
Get the EndpointMetaData from the cache if running in production clientCache. Otherwise, return a new EndpointMetaData.

        String clientCache = System.getProperty(JBIConstants.CLIENT_CACHE);
        if("false".equalsIgnoreCase(clientCache)) {
            return createEndpointMetaData();
        } else {
            String key = wsdlLocation.toString();
            EndpointMetaData emd = emdCache.get(key);
            if(emd == null) {
                emd = createEndpointMetaData();
                emdCache.put(key, emd);
            }
            return emd;
        }
    
public voidinitialize()

        try {
            DeliveryChannel channel =
                    JavaEEServiceEngineContext.getInstance(). getDeliveryChannel();
            String key = DescriptorEndpointInfo.getDEIKey(service, endpointName);
            DescriptorEndpointInfo dei = EndpointRegistry.getInstance().getJBIEndpts().get(key);
            QName service = (dei == null)? this.service:dei.getServiceName();
            String endpointName = (dei == null)? this.endpointName:dei.getEndpointName();

            // Create MessageExchange
            MessageExchangeFactory factory =
                    channel.createExchangeFactoryForService(service);
            me =  oneWay ? factory.createInOnlyExchange() : factory.createInOutExchange();
            me.setService(service);
            ComponentContext context = JavaEEServiceEngineContext.getInstance().getJBIContext();
            me.setEndpoint(context.getEndpoint(service, endpointName));
            me.setOperation(operation);
            meTransport = MessageExchangeTransportFactory.getHandler(me);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
    
public com.sun.enterprise.jbi.serviceengine.comm.UnWrappedMessagereceiveResponse()

        return meTransport.receive(getEndpointMetaData());
    
public voidsendRequest(com.sun.xml.ws.api.message.Message abstractMessage)

        meTransport.send(abstractMessage, getEndpointMetaData());
    
public voidsendStatus()

        if(me.getStatus().equals(ExchangeStatus.ACTIVE)) {
            meTransport.sendStatus(ExchangeStatus.DONE);
        }
    
public voidsetOneWay(boolean oneWay)

        this.oneWay = oneWay;