Coverage Report - org.mule.api.interceptor.Interceptor
 
Classes in this File Line Coverage Branch Coverage Complexity
Interceptor
N/A
N/A
1
 
 1  
 /*
 2  
  * $Id: Interceptor.java 12269 2008-07-10 04:19:03Z dfeist $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.api.interceptor;
 12  
 
 13  
 import org.mule.api.MuleException;
 14  
 import org.mule.api.MuleMessage;
 15  
 
 16  
 
 17  
 /**
 18  
  * <code>Interceptor</code> is based on a similar concept of servlet filters and
 19  
  * works much the same way. This method is more commonally known as the interceptor
 20  
  * pattern and it allows for pre and processing of invocations on the object being
 21  
  * intercepted.
 22  
  *
 23  
  * <p>In 2.x this is deprecated, but we provide an adapter, in the Spring Extras package, to
 24  
  * help use old implementations.  There is one significant change, however - because the
 25  
  * interception is now "lower" in the call chain, {@link org.mule.api.interceptor.Invocation#execute()}
 26  
  * returns an Object rather than a {@link org.mule.api.MuleMessage}.  To simplify handling this,
 27  
  * the adapter we provide will construct a suitable MuleMessage for you if you return null. 
 28  
  *
 29  
  * @deprecated - This is only used for backwards compatability with old style (Mule 1.x) interceptors
 30  
  */
 31  
 public interface Interceptor
 32  
 {
 33  
 
 34  
     /**
 35  
      * Invoked when the component should be called.  The implementation can call
 36  
      * {@link Invocation#execute()} to call the component.
 37  
      * 
 38  
      * @param invocation the invocation containing info about the current message and
 39  
      *            service
 40  
      * @return A result message that may have been altered by this invocation
 41  
      * @throws org.mule.api.MuleException if the invocation fails
 42  
      */
 43  
     MuleMessage intercept(Invocation invocation) throws MuleException;
 44  
 
 45  
 }