KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > jms > client > container > JMSExceptionInterceptor


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.jms.client.container;
8
9 import org.jboss.aop.advice.Interceptor;
10 import org.jboss.aop.joinpoint.Invocation;
11 import org.jboss.jms.JBossJMSException;
12
13 /**
14  * An interceptor for testing the thrown exceptions are
15  * JMSExceptions.
16  *
17  * @author <a HREF="mailto:adrian@jboss.org>Adrian Brock</a>
18  * @version $Revision: 1.2 $
19  */

20 public class JMSExceptionInterceptor
21    implements Interceptor
22 {
23    // Constants -----------------------------------------------------
24

25    // Attributes ----------------------------------------------------
26

27    // Static --------------------------------------------------------
28

29    public static JMSExceptionInterceptor singleton = new JMSExceptionInterceptor();
30
31    // Constructors --------------------------------------------------
32

33    // Public --------------------------------------------------------
34

35    // Interceptor implementation -----------------------------------
36

37    public String JavaDoc getName()
38    {
39       return "JMSExceptionInterceptor";
40    }
41
42    public Object JavaDoc invoke(Invocation invocation) throws Throwable JavaDoc
43    {
44       try
45       {
46          return invocation.invokeNext();
47       }
48       catch (Throwable JavaDoc t)
49       {
50          throw JBossJMSException.handle(t);
51       }
52    }
53
54    // Protected ------------------------------------------------------
55

56    // Package Private ------------------------------------------------
57

58    // Private --------------------------------------------------------
59

60    // Inner Classes --------------------------------------------------
61
}
62
Popular Tags