Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
EnvelopeInterceptor |
|
| 1.0;1 |
1 | /* | |
2 | * $Id: EnvelopeInterceptor.java 7963 2007-08-21 08:53:15Z dirk.olmes $ | |
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.interceptors; | |
12 | ||
13 | import org.mule.umo.Invocation; | |
14 | import org.mule.umo.UMOException; | |
15 | import org.mule.umo.UMOInterceptor; | |
16 | import org.mule.umo.UMOMessage; | |
17 | ||
18 | /** | |
19 | * <code>EnvelopeInterceptor</code> is an intercepter that will fire before and after an | |
20 | * event is received. | |
21 | */ | |
22 | 2 | public abstract class EnvelopeInterceptor implements UMOInterceptor |
23 | { | |
24 | /** | |
25 | * This method is invoked before the event is processed | |
26 | * | |
27 | * @param invocation the message invocation being processed | |
28 | */ | |
29 | public abstract void before(Invocation invocation) throws UMOException; | |
30 | ||
31 | /** | |
32 | * This method is invoked after the event has been processed | |
33 | * | |
34 | * @param invocation the message invocation being processed | |
35 | */ | |
36 | public abstract void after(Invocation invocation) throws UMOException; | |
37 | ||
38 | public final UMOMessage intercept(Invocation invocation) throws UMOException | |
39 | { | |
40 | 2 | before(invocation); |
41 | 2 | UMOMessage message = invocation.execute(); |
42 | 2 | invocation.setMessage(message); |
43 | 2 | after(invocation); |
44 | 2 | return message; |
45 | } | |
46 | } |