KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > jms > server > container > ServerConnectionInterceptor


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.server.container;
8
9 import org.jboss.aop.advice.Interceptor;
10 import org.jboss.aop.joinpoint.Invocation;
11 import org.jboss.aop.joinpoint.MethodInvocation;
12
13 /**
14  * The server implementation of the connection
15  *
16  * @author <a HREF="mailto:adrian@jboss.org>Adrian Brock</a>
17  * @version $Revision: 1.4 $
18  */

19 public class ServerConnectionInterceptor
20    implements Interceptor
21 {
22    // Constants -----------------------------------------------------
23

24    // Attributes ----------------------------------------------------
25

26    // Static --------------------------------------------------------
27

28    public static ServerConnectionInterceptor singleton = new ServerConnectionInterceptor();
29
30    // Constructors --------------------------------------------------
31

32    // Public --------------------------------------------------------
33

34    // Interceptor implementation ------------------------------------
35

36    public String JavaDoc getName()
37    {
38       return "ServerConnectionInterceptor";
39    }
40
41    public Object JavaDoc invoke(Invocation invocation) throws Throwable JavaDoc
42    {
43       MethodInvocation mi = (MethodInvocation) invocation;
44       String JavaDoc methodName = ((MethodInvocation) invocation).getMethod().getName();
45       if (methodName.equals("createSession"))
46          return null;
47       else if (methodName.equals("closing") || methodName.equals("close"))
48          return null;
49       throw new UnsupportedOperationException JavaDoc(mi.getMethod().toString());
50    }
51
52    // Protected ------------------------------------------------------
53

54    // Package Private ------------------------------------------------
55

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

58    // Inner Classes --------------------------------------------------
59

60 }
61
Popular Tags