1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */
22 package org.jboss.aspects.remoting;
23
24 import org.jboss.aop.Dispatcher;
25 import org.jboss.remoting.InvocationRequest;
26 import org.jboss.remoting.callback.InvokerCallbackHandler;
27 import org.jboss.remoting.ServerInvocationHandler;
28 import org.jboss.remoting.ServerInvoker;
29
30 import javax.management.MBeanServer;
31
32 /**
33 * AOPRemotingInvocationHandler is a ServerInvocationHandler that will forward requests to the
34 * aop Dispatcher
35 *
36 * @author <a href="mailto:bill@jboss.org">Bill Burke</a>
37 * @version $Revision: 37406 $
38 */
39 public class AOPRemotingInvocationHandler implements ServerInvocationHandler
40 {
41 public AOPRemotingInvocationHandler()
42 {
43 super();
44 }
45
46 /**
47 * set the invoker that owns this handler
48 *
49 * @param invoker
50 */
51 public void setInvoker(ServerInvoker invoker)
52 {
53 }
54
55 /**
56 * set the mbean server that the handler can reference
57 *
58 * @param server
59 */
60 public void setMBeanServer( MBeanServer server )
61 {
62 }
63
64 /**
65 * method is called to destroy the handler and remove all pending notifications and listeners
66 * from the notification cache
67 */
68 public synchronized void destroy()
69 {
70 }
71
72 protected void finalize() throws Throwable
73 {
74 destroy();
75 super.finalize();
76 }
77
78 public Object invoke(InvocationRequest invocation)
79 throws Throwable
80 {
81 org.jboss.aop.joinpoint.Invocation inv =(org.jboss.aop.joinpoint.Invocation)invocation.getParameter();
82 return Dispatcher.singleton.invoke(inv);
83 }
84
85 /**
86 * Adds a callback handler that will listen for callbacks from
87 * the server invoker handler.
88 * @param callbackHandler
89 */
90 public void addListener(InvokerCallbackHandler callbackHandler)
91 {
92 //TODO: implement for callback api -TME
93 }
94
95 /**
96 * Removes the callback handler that was listening for callbacks
97 * from the server invoker handler.
98 * @param callbackHandler
99 */
100 public void removeListener(InvokerCallbackHandler callbackHandler)
101 {
102 //TODO: implement for callback api -TME
103 }
104 }