FileDocCategorySizeDatePackage
EndpointHandler.javaAPI DocGlassfish v2 API6811Fri May 04 22:24:42 BST 2007com.sun.enterprise.admin.wsmgmt.msg

EndpointHandler

public class EndpointHandler extends Object
Keeps track of SOAP messages per endpoint.

Fields Summary
private MessageFilter
_filter
private com.sun.enterprise.admin.wsmgmt.pool.spi.Pool
_pool
private String
_endpointId
private String
_applicationId
private static final String
DELIM
private static final Logger
_logger
private static final com.sun.enterprise.util.i18n.StringManager
_stringMgr
Constructors Summary
EndpointHandler(com.sun.enterprise.admin.wsmgmt.config.spi.WebServiceConfig wsc, String appId)
Constructor.

param
endpoint name of the endpoint


        _applicationId  = appId;
        _endpointId     = wsc.getName();
        String mLevel   = wsc.getMonitoringLevel();

        // SOAP message visualization is only enabled for level HIGH
        if (Constants.HIGH.equals(mLevel)) {
            _pool = new BoundedPool(wsc.getName(), wsc.getMaxHistorySize());
            registerFilter();
        }
    
EndpointHandler(String endpoint, int size, String appId)
Constructor.

param
endpoint name of the endpoint
param
size max size of the pool

        _applicationId  = appId;
        _endpointId     = endpoint;
        _pool           = new BoundedPool(endpoint, size);

        registerFilter();
    
Methods Summary
public voidaddMessage(com.sun.appserv.management.ext.wsmgmt.MessageTrace msgTrace)
Adds a message trace to the pool.

param
msgTrace a message trace object after the invocation

        _pool.put(msgTrace.getMessageID(), msgTrace);
    
voiddestroy()
Disables monitoring for the endpoint and deregisters the filters.

        if (_pool != null) {
            _pool.clear();
            _pool = null;
        }

        if (_filter != null) {
            FilterRegistry fr = FilterRegistry.getInstance();
            String endpoint = getFQEndpointName();

            // unregister filters
            fr.unregisterFilter(Filter.PROCESS_REQUEST, endpoint, _filter);
            fr.unregisterFilter(Filter.PROCESS_RESPONSE, endpoint, _filter);
            fr.unregisterFilter(Filter.POST_PROCESS_RESPONSE, endpoint, _filter);
            _filter = null;
        }
        _logger.finer("Message trace handler destroyed for " 
            + getEndpointName());
    
java.lang.StringgetEndpointName()
Returns the name of the endpoint.

return
name of the endpoint

        return _endpointId;
    
java.lang.StringgetFQEndpointName()
Returns the fully qualified name of this endpoint.

return
fully qualified name of this endpoint

        return _applicationId + DELIM + _endpointId;
    
java.util.CollectiongetMessages()
Returns all messages for this endpoint.

return
messages associated for this endpoint

        return _pool.values();
    
private voidregisterFilter()
Registers a filter with the filter manager for this endpoint.


        // msg filter
        _filter = new MessageFilter(_applicationId, _endpointId, this);
        FilterRegistry fr = FilterRegistry.getInstance();
        String endpoint = getFQEndpointName();

        // registers the filter
        fr.registerFilter(Filter.PROCESS_REQUEST, endpoint, _filter);
        fr.registerFilter(Filter.PROCESS_RESPONSE, endpoint, _filter);
        fr.registerFilter(Filter.POST_PROCESS_RESPONSE, endpoint, _filter);
    
voidsetMessageHistorySize(int size)
Sets the number of messages stored in memory for this endpoint. This method is called to dynamically reconfigure the size.

param
size number of message stored in memory

        if (_pool != null) {
            _pool.resize(size);
            _logger.fine("Set message history size to " + size 
                + " for " + getEndpointName());
        }