package org.jboss.jms.server.container;
import org.jboss.aop.advice.Interceptor;
import org.jboss.aop.joinpoint.Invocation;
import org.jboss.aop.joinpoint.MethodInvocation;
import org.jboss.jms.server.BrowserEndpoint;
import org.jboss.jms.server.BrowserEndpointFactory;
public class ServerBrowserInterceptor
implements Interceptor
{
public static ServerBrowserInterceptor singleton = new ServerBrowserInterceptor();
public String getName()
{
return "ServerBrowserInterceptor";
}
public Object invoke(Invocation invocation) throws Throwable
{
MethodInvocation mi = (MethodInvocation) invocation;
String methodName = mi.getMethod().getName();
if (methodName.equals("browse"))
{
BrowserEndpointFactory factory = (BrowserEndpointFactory) mi.getMetaData("JMS", "BrowserEndpointFactory");
BrowserEndpoint endpoint = factory.getBrowserEndpoint();
return endpoint.browse();
}
else if (methodName.equals("closing") || methodName.equals("close"))
return null;
throw new UnsupportedOperationException(mi.getMethod().toString());
}
}