1 23 package com.sun.enterprise.admin.wsmgmt.msg; 24 25 import com.sun.enterprise.admin.wsmgmt.config.spi.Constants; 26 import com.sun.enterprise.admin.wsmgmt.filter.spi.Filter; 27 import com.sun.enterprise.admin.wsmgmt.filter.spi.FilterContext; 28 import com.sun.enterprise.admin.wsmgmt.msg.MessageTraceFactory; 29 import com.sun.appserv.management.ext.wsmgmt.MessageTrace; 30 31 34 public class MessageFilter implements Filter { 35 36 43 public MessageFilter(String appId, String endpoint, EndpointHandler h) { 44 _applicationId = appId; 45 _endpointId = endpoint; 46 _handler = h; 47 } 48 49 52 public String getName() { 53 return (NAME_PREFIX + _applicationId + DELIM + _endpointId); 54 } 55 56 63 public void process(String stage, String endpoint, FilterContext context) { 64 65 MessageTraceFactory mtf = MessageTraceFactory.getInstance(); 66 67 if ( stage.equals(Filter.PROCESS_REQUEST) ) { 69 70 mtf.processRequest(context, _applicationId); 72 73 } else if ( stage.equals(Filter.PROCESS_RESPONSE) ) { 75 mtf.processResponse(context); 76 77 } else if (stage.equals(Filter.POST_PROCESS_RESPONSE) ) { 78 MessageTrace mt = mtf.postProcessResponse(context); 79 80 _handler.addMessage(mt); 82 } 83 } 84 85 private String _applicationId = null; 87 private String _endpointId = null; 88 private EndpointHandler _handler = null; 89 private static final String DELIM = "#"; 90 private static final String NAME_PREFIX = "MSGFILTER_"; 91 } 92 | Popular Tags |