FileDocCategorySizeDatePackage
GlobalMessageListenerImpl.javaAPI DocGlassfish v2 API9195Fri May 04 22:24:40 BST 2007com.sun.enterprise.admin.wsmgmt.agent

GlobalMessageListenerImpl

public class GlobalMessageListenerImpl extends Object implements com.sun.enterprise.webservice.monitoring.GlobalMessageListener
This singleton class receives all the callbacks for web service endpoints

Fields Summary
public static int
sequenceNumber
static HashMap
msgId2fc
Constructors Summary
Methods Summary
public static synchronized intgetSequenceNumber()

        return sequenceNumber;
    
public static synchronized intnewSequenceNumber()

        sequenceNumber++;
        return sequenceNumber;
    
public voidpostProcessResponse(java.lang.String messageID, com.sun.enterprise.webservice.monitoring.TransportInfo info)
Callback when a web service response has finished being processed by the container and was sent back to the client

param
messageID returned by the preProcessRequest call

        FilterContext  fc = (FilterContext) msgId2fc.get(messageID);
        long startTime = fc.getExecutionTime();
        fc.setExecutionTime(System.currentTimeMillis() - startTime);
        FilterRouter.getInstance().applyFilters(Filter.POST_PROCESS_RESPONSE, 
                fc);
        // Web service execution is ended, remove this message id information
        msgId2fc.remove(messageID);
    
public java.lang.StringpreProcessRequest(com.sun.enterprise.webservice.monitoring.Endpoint endpoint)
Callback when a web service request entered the web service container and before any system processing is done.

param
endpoint is the endpoint the web service request is targeted to


        String ep = null;
        WebServiceEndpoint wse = endpoint.getDescriptor();
        
        if ( wse != null) {
            ep = wse.getEndpointName();
        }
        //wse.resolveComponentLink();

        BundleDescriptor bundle = wse.getBundleDescriptor();
        Application app = bundle.getApplication();

        String fqn =  
        WebServiceMgrBackEnd.getManager().getFullyQualifiedName(
           app.getRegistrationName() ,
           bundle.getModuleDescriptor().getArchiveUri(),
           bundle.getModuleDescriptor().isStandalone(), ep); 

        if (FilterRegistry.getInstance().isManaged(fqn) == false) {
            return null;
        }
        String mId = null;
        String cfId = null;
        boolean isCallFlowEnabled = false;

        // call flow request id
        Agent agent = Switch.getSwitch().getCallFlowAgent();
        if (agent != null) {
            if (agent.isEnabled()) {
                ThreadLocalData data = agent.getThreadLocalData();
                if (data != null) {
                    cfId = data.getRequestId();
                }
            }
        }

        if ( (cfId == null) || ("".equals(cfId)) ) {

            // call flow id is not available; use own id
            int newNumber = newSequenceNumber();
            mId = Integer.valueOf(newNumber).toString();

        } else {
            // use id from call flow if it is not null
            mId = cfId;
            isCallFlowEnabled = true;
        }
        FilterContext fc = new FilterContext(endpoint, isCallFlowEnabled, 
            (TransportInfo)null, 
            (com.sun.enterprise.admin.wsmgmt.SOAPMessageContext)null, mId, fqn);

        FilterRouter.getInstance().applyFilters(Filter.PRE_PROCESS_REQUEST,fc);

        // update the endpoint 2 filter context mapping
        msgId2fc.put(mId, fc);
        
        return mId;
    
public voidprocessRequest(java.lang.String messageID, com.sun.xml.rpc.spi.runtime.SOAPMessageContext context, com.sun.enterprise.webservice.monitoring.TransportInfo info)
Callback when a 1.X web service request is about the be delivered to the Web Service Implementation Bean.

param
messageID - returned by preProcessRequest call
param
context - the jaxrpc message trace, transport dependent.

        com.sun.enterprise.admin.wsmgmt.SOAPMessageContext smc = 
            new com.sun.enterprise.admin.wsmgmt.SOAPMessageContext_1_0(context);

         FilterContext fc = (FilterContext) msgId2fc.get(messageID);
        fc.setTransportInfo(info); 
        fc.setMessageContext(smc); 
        FilterRouter.getInstance().applyFilters(Filter.PROCESS_REQUEST,fc);
    
public voidprocessRequest(java.lang.String messageID, com.sun.enterprise.webservice.SOAPMessageContext context, com.sun.enterprise.webservice.monitoring.TransportInfo info)
Callback when a 2.X web service request is about the be delivered to the Web Service Implementation Bean.

param
messageID - returned by preProcessRequest call
param
context - the jaxrpc message trace, transport dependent.

        com.sun.enterprise.admin.wsmgmt.SOAPMessageContext smc = 
            new com.sun.enterprise.admin.wsmgmt.SOAPMessageContext_2_0(context);

         FilterContext fc = (FilterContext) msgId2fc.get(messageID);
        fc.setTransportInfo(info); 
        fc.setMessageContext(smc); 
        FilterRouter.getInstance().applyFilters(Filter.PROCESS_REQUEST,fc);
    
public voidprocessResponse(java.lang.String messageID, com.sun.xml.rpc.spi.runtime.SOAPMessageContext context)
Callback when a 1.X web service response was returned by the Web Service Implementation Bean

param
messageID - returned by preProcessRequest call
param
context - the jaxrpc message trace, transport dependent.

        String ep = null;
        FilterContext fc = (FilterContext) msgId2fc.get(messageID);
        FilterRouter.getInstance().applyFilters(Filter.PROCESS_RESPONSE,fc);
    
public voidprocessResponse(java.lang.String messageID, com.sun.enterprise.webservice.SOAPMessageContext context)
Callback when a 2.X web service response was returned by the Web Service Implementation Bean

param
messageID - returned by preProcessRequest call
param
context - the jaxrpc message trace, transport dependent.

        String ep = null;
        FilterContext fc = (FilterContext) msgId2fc.get(messageID);
        FilterRouter.getInstance().applyFilters(Filter.PROCESS_RESPONSE,fc);