KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > aspects > remoting > interceptors > invoker > InvokerInterceptor


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.aspects.remoting.interceptors.invoker;
8
9 import org.jboss.aop.advice.Interceptor;
10 import org.jboss.aop.joinpoint.Invocation;
11
12 /**
13  * @author <a HREF="mailto:tom@jboss.org">Tom Elrod</a>
14  */

15 public class InvokerInterceptor implements Interceptor
16 {
17
18    public String JavaDoc getName()
19    {
20       return "InvokerInterceptor";
21    }
22
23    public Object JavaDoc invoke(Invocation invocation) throws Throwable JavaDoc
24    {
25       Object JavaDoc ret = null;
26
27       // Will use the locator to determine which remoting interceptors to insert into chain
28
// Returns a new invocation with the marshalling and transport interceptors added.
29
Invocation newInvocation = RemotingInterceptorFactory.injectRemotingInterceptors(invocation);
30
31       if (newInvocation != null)
32       {
33          ret = newInvocation.invokeNext();
34       }
35       else
36       {
37          throw new RuntimeException JavaDoc("Could not make invocation due to new invocation object being null.");
38       }
39
40       return ret;
41    }
42 }
Popular Tags