1 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 21 public class ServerBrowserInterceptor 22 implements Interceptor 23 { 24 26 28 30 public static ServerBrowserInterceptor singleton = new ServerBrowserInterceptor(); 31 32 34 36 38 public String getName() 39 { 40 return "ServerBrowserInterceptor"; 41 } 42 43 public Object invoke(Invocation invocation) throws Throwable 44 { 45 MethodInvocation mi = (MethodInvocation) invocation; 46 String 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 (mi.getMethod().toString()); 56 } 57 58 60 62 64 66 } 67 | Popular Tags |