1 16 17 package org.apache.axis ; 18 19 import org.apache.axis.components.logger.LogFactory; 20 import org.apache.axis.handlers.BasicHandler; 21 import org.apache.commons.logging.Log; 22 23 30 public class SimpleTargetedChain extends SimpleChain implements TargetedChain 31 { 32 protected static Log log = 33 LogFactory.getLog(SimpleTargetedChain.class.getName()); 34 35 protected Handler requestHandler ; 36 protected Handler pivotHandler ; 37 protected Handler responseHandler ; 38 39 44 private class PivotIndicator extends BasicHandler { 45 public PivotIndicator() {} 46 47 public void invoke(MessageContext msgContext) throws AxisFault { 48 msgContext.setPastPivot(true); 49 } 50 } 51 52 55 public SimpleTargetedChain() {} 56 57 62 public SimpleTargetedChain(Handler handler) { 63 pivotHandler = handler; 64 if (pivotHandler != null) { 65 addHandler(pivotHandler); 66 addHandler(new PivotIndicator()); 67 } 68 } 69 70 74 public SimpleTargetedChain(Handler reqHandler, Handler pivHandler, 75 Handler respHandler) { 76 init(reqHandler, null, pivHandler, null, respHandler); 77 } 78 79 90 protected void init(Handler reqHandler, Handler specialReqHandler, 91 Handler pivHandler, Handler specialRespHandler, 92 Handler respHandler) { 93 94 requestHandler = reqHandler; 95 if (requestHandler != null) 96 addHandler(requestHandler); 97 98 if (specialReqHandler != null) 99 addHandler(specialReqHandler); 100 101 pivotHandler = pivHandler; 102 if (pivotHandler != null) { 103 addHandler(pivotHandler); 104 addHandler(new PivotIndicator()); 105 } 106 107 if (specialRespHandler != null) 108 addHandler(specialRespHandler); 109 110 responseHandler = respHandler; 111 if (responseHandler != null) 112 addHandler(responseHandler); 113 } 114 115 public Handler getRequestHandler() { return( requestHandler ); } 116 117 public Handler getPivotHandler() { return( pivotHandler ); } 118 119 public Handler getResponseHandler() { return( responseHandler ); } 120 }; 121 | Popular Tags |