FileDocCategorySizeDatePackage
TransformHandler.javaAPI DocGlassfish v2 API7598Fri May 04 22:24:46 BST 2007com.sun.enterprise.admin.wsmgmt.transform

TransformHandler

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

Fields Summary
private TransformFilter
_filter
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
public TransformHandler(com.sun.enterprise.admin.wsmgmt.config.spi.WebServiceConfig wsc, String appId)
Constructor.

param
endpoint name of the endpoint


        _applicationId  = appId;
        _endpointId     = wsc.getName();

    
public TransformHandler(String endpoint, String appId)
Constructor.

param
endpoint name of the endpoint

        _applicationId  = appId;
        _endpointId     = endpoint;

    
Methods Summary
voiddestroy()
Disables transformation for the endpoint and deregisters the filters.

        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);
            _filter = null;
        }
        _logger.finer("Transform handler destroyed for " 
            + getEndpointName());
    
java.lang.StringgetEndpointName()
Returns the name of the endpoint.

return
name of the endpoint

        return _endpointId;
    
java.lang.StringgetFQEndpointName(java.lang.String appId, com.sun.enterprise.admin.wsmgmt.config.spi.WebServiceConfig wsc)
Returns the fully qualified name of this endpoint.

return
fully qualified name of this endpoint

        return appId + DELIM + wsc.getName();
    
java.lang.StringgetFQEndpointName()
Returns the fully qualified name of this endpoint.

return
fully qualified name of this endpoint

        return _applicationId + DELIM + _endpointId;
    
public com.sun.enterprise.admin.wsmgmt.filter.spi.FiltergetFilter(java.lang.String appId, com.sun.enterprise.admin.wsmgmt.config.spi.WebServiceConfig wsc)
Gets the registered filter for transformation.

            FilterRegistry fr = FilterRegistry.getInstance();
            String endpoint = getFQEndpointName(appId, wsc);

        _logger.finer("getFilter called for " 
            + getEndpointName());
           List filterList= fr.getFilters(Filter.PROCESS_REQUEST, endpoint);
           if ( filterList == null) {
                return null;
           }
           Iterator filterItr = filterList.iterator();
           if ( filterItr == null) {
                return null;
           }
          while ( filterItr.hasNext()) {
                Filter f = (Filter) filterItr.next();
                if ( f instanceof TransformFilter) {
                return f;
          }
        }
        return null;
    
public com.sun.enterprise.admin.wsmgmt.filter.spi.FilterregisterFilter(com.sun.enterprise.admin.wsmgmt.config.spi.WebServiceConfig wsc)
Registers a filter with the filter manager for this endpoint.


        _filter = new TransformFilter(_applicationId, wsc);
        FilterRegistry fr = FilterRegistry.getInstance();
        String endpoint = getFQEndpointName();

        // registers the filter
        fr.registerFilter(Filter.PROCESS_REQUEST, endpoint, _filter);
        fr.registerFilter(Filter.PROCESS_RESPONSE, endpoint, _filter);
        return _filter;
    
private voidregisterFilter()
Registers a filter with the filter manager for this endpoint.


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

        // registers the filter
        fr.registerFilter(Filter.PROCESS_REQUEST, endpoint, _filter);
        fr.registerFilter(Filter.PROCESS_RESPONSE, endpoint, _filter);
    
voidunregisterFilter(java.lang.String appId, com.sun.enterprise.admin.wsmgmt.config.spi.WebServiceConfig wsc)
Disables transformation for the endpoint and deregisters the filters.

            String fn =  TransformFilter.getName(appId, wsc);
            FilterRegistry fr = FilterRegistry.getInstance();
            String endpoint = getFQEndpointName(appId, wsc);

            // unregister filters
            fr.unregisterFilterByName(Filter.PROCESS_REQUEST, endpoint, fn);
            fr.unregisterFilterByName(Filter.PROCESS_RESPONSE, endpoint, fn);
        _logger.finer("Transform handler destroyed for " 
            + getEndpointName());