1 package org.objectweb.celtix.systest.ws.rm; 2 3 import java.util.ArrayList ; 4 import java.util.List ; 5 import java.util.Map ; 6 import java.util.Set ; 7 8 import javax.xml.namespace.QName ; 9 import javax.xml.ws.handler.LogicalHandler; 10 import javax.xml.ws.handler.LogicalMessageContext; 11 import javax.xml.ws.handler.MessageContext; 12 13 import org.objectweb.celtix.bus.context.LogicalMessageContextImpl; 14 import org.objectweb.celtix.bus.ws.addressing.ContextUtils; 15 import org.objectweb.celtix.context.GenericMessageContext; 16 17 public class LogicalMessageContextRecorder implements LogicalHandler<LogicalMessageContext> { 18 19 private static List <LogicalMessageContext> inbound; 20 21 public LogicalMessageContextRecorder() { 22 if (null == inbound) { 23 inbound = new ArrayList <LogicalMessageContext>(); 24 } 25 } 26 27 public void init(Map <String , Object > map) { 28 } 29 30 public Set <QName > getHeaders() { 31 return null; 32 } 33 34 public boolean handleMessage(LogicalMessageContext context) { 35 record(context); 36 return true; 37 } 38 39 public boolean handleFault(LogicalMessageContext context) { 40 record(context); 41 return true; 42 } 43 44 public void close(MessageContext arg0) { 45 } 46 47 protected List <LogicalMessageContext> getInboundContexts() { 48 return inbound; 49 } 50 51 private void record(LogicalMessageContext context) { 52 if (!ContextUtils.isOutbound(context)) { 53 GenericMessageContext clone = new GenericMessageContext(); 54 clone.putAll(context); 55 inbound.add(new LogicalMessageContextImpl(clone)); 56 } 57 } 58 59 } 60 | Popular Tags |