KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > remoting > handler > mbean > MBeanHandler


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.test.remoting.handler.mbean;
8
9 import javax.management.MBeanServer JavaDoc;
10 import org.jboss.remoting.InvocationRequest;
11 import org.jboss.remoting.ServerInvoker;
12 import org.jboss.remoting.callback.InvokerCallbackHandler;
13
14 /**
15  * @author <a HREF="mailto:tom.elrod@jboss.com">Tom Elrod</a>
16  */

17 public class MBeanHandler implements MBeanHandlerMBean
18 {
19    private MBeanServer JavaDoc server = null;
20    private ServerInvoker invoker = null;
21
22    /**
23     * set the mbean server that the handler can reference
24     *
25     * @param server
26     */

27    public void setMBeanServer(MBeanServer JavaDoc server)
28    {
29       this.server = server;
30    }
31
32    /**
33     * set the invoker that owns this handler
34     *
35     * @param invoker
36     */

37    public void setInvoker(ServerInvoker invoker)
38    {
39       this.invoker = invoker;
40    }
41
42    /**
43     * called to handle a specific invocation
44     *
45     * @param invocation
46     * @return
47     * @throws Throwable
48     */

49    public Object JavaDoc invoke(InvocationRequest invocation) throws Throwable JavaDoc
50    {
51       System.out.println(invocation.getParameter());
52       return ServerTest.RESPONSE_VALUE;
53    }
54
55    /**
56     * Adds a callback handler that will listen for callbacks from
57     * the server invoker handler.
58     *
59     * @param callbackHandler
60     */

61    public void addListener(InvokerCallbackHandler callbackHandler)
62    {
63       // NO OP for test
64
}
65
66    /**
67     * Removes the callback handler that was listening for callbacks
68     * from the server invoker handler.
69     *
70     * @param callbackHandler
71     */

72    public void removeListener(InvokerCallbackHandler callbackHandler)
73    {
74       // NO OP for test
75
}
76
77    /***************************************************************
78     * Following satisfies being a mbean service within JBossAS *
79     ***************************************************************/

80
81    /**
82     * create the service, do expensive operations etc
83     */

84    void create() throws Exception JavaDoc
85    {
86    }
87
88    /**
89     * start the service, create is already called
90     */

91    void start() throws Exception JavaDoc
92    {
93    }
94
95    /**
96     * stop the service
97     */

98    void stop()
99    {
100    }
101
102    /**
103     * destroy the service, tear down
104     */

105    void destroy()
106    {
107    }
108
109 }
Popular Tags