KickJava   Java API By Example, From Geeks To Geeks.

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


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 import org.jboss.jms.server.BrowserEndpoint;
13 import org.jboss.jms.server.BrowserEndpointFactory;
14
15 /**
16  * The server implementation of the browser
17  *
18  * @author <a HREF="mailto:adrian@jboss.org>Adrian Brock</a>
19  * @version $Revision: 1.4 $
20  */

21 public class ServerBrowserInterceptor
22    implements Interceptor
23 {
24    // Constants -----------------------------------------------------
25

26    // Attributes ----------------------------------------------------
27

28    // Static --------------------------------------------------------
29

30    public static ServerBrowserInterceptor singleton = new ServerBrowserInterceptor();
31
32    // Constructors --------------------------------------------------
33

34    // Public --------------------------------------------------------
35

36    // Interceptor implementation ------------------------------------
37

38    public String JavaDoc getName()
39    {
40       return "ServerBrowserInterceptor";
41    }
42
43    public Object JavaDoc invoke(Invocation invocation) throws Throwable JavaDoc
44    {
45       MethodInvocation mi = (MethodInvocation) invocation;
46       String JavaDoc methodName = mi.getMethod().getName();
47       if (methodName.equals("browse"))
48       {
49          BrowserEndpointFactory factory = (BrowserEndpointFactory) mi.getMetaData("JMS", "BrowserEndpointFactory");
50          BrowserEndpoint endpoint = factory.getBrowserEndpoint();
51          return endpoint.browse();
52       }
53       else if (methodName.equals("closing") || methodName.equals("close"))
54          return null;
55       throw new UnsupportedOperationException JavaDoc(mi.getMethod().toString());
56    }
57
58    // Protected ------------------------------------------------------
59

60    // Package Private ------------------------------------------------
61

62    // Private --------------------------------------------------------
63

64    // Inner Classes --------------------------------------------------
65

66 }
67
Popular Tags