package de.tu_dresden.diplom.richter_mirko_mat2628335.common.handler;

import org.apache.log4j.Logger;
import org.apache.log4j.MDC;
import org.apache.axis.MessageContext;
import org.apache.axis.AxisFault;

/**
 * 
 */
public class HandlingInfoRemover extends BaseHandler{

   private static final Logger logger = Logger.getLogger(HandlingInfoRemover.class);

   /**
    * @see org.apache.axis.Handler#invoke(org.apache.axis.MessageContext)
    */
   public void invoke(MessageContext messageContext) throws AxisFault {
      String fn = "[invoke] ";
      String logInfo = (String) getOption(OPTION_LOG_INFO);
      if(logInfo != null){
         //fn = fn + " -> " + logInfo + "::";
         MDC.put(OPTION_LOG_INFO, logInfo);
      }
      if (logger.isDebugEnabled()) logger.debug(fn + "--> HANDLING_INFO_REMOVER");
      if (logger.isDebugEnabled()) logger.debug(fn + "removing HandlingInfo from this Thread...");
      removeHandlingInfo();
      if (logger.isDebugEnabled()) logger.debug(fn + "...done");
      if (logger.isDebugEnabled()) logger.debug(fn + "<-- HANDLING_INFO_REMOVER");
      MDC.remove(OPTION_LOG_INFO);
   }
}
