KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > caucho > management > j2ee > ManagementImpl


1 /*
2  * Copyright (c) 1998-2006 Caucho Technology -- all rights reserved
3  *
4  * This file is part of Resin(R) Open Source
5  *
6  * Each copy or derived work must preserve the copyright notice and this
7  * notice unmodified.
8  *
9  * Resin Open Source is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Resin Open Source is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
17  * of NON-INFRINGEMENT. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with Resin Open Source; if not, write to the
22  * Free SoftwareFoundation, Inc.
23  * 59 Temple Place, Suite 330
24  * Boston, MA 02111-1307 USA
25  *
26  * @author Sam
27  */

28
29
30 package com.caucho.management.j2ee;
31
32 import com.caucho.ejb.AbstractSessionBean;
33 import com.caucho.jmx.AbstractMBeanServer;
34 import com.caucho.jmx.Jmx;
35
36 import javax.ejb.CreateException JavaDoc;
37 import javax.management.*;
38 import javax.management.j2ee.statistics.ListenerRegistration JavaDoc;
39 import java.rmi.RemoteException JavaDoc;
40 import java.util.Set JavaDoc;
41
42 public class ManagementImpl
43   extends AbstractSessionBean
44 {
45   private final ListenerRegistration JavaDoc _listenerRegistrationImpl
46     = new ListenerRegistrationImpl();
47
48   public void ejbCreate()
49      throws CreateException JavaDoc
50    {
51    }
52
53   private AbstractMBeanServer getMBeanServer()
54   {
55     return Jmx.getMBeanServer();
56   }
57
58   public Object JavaDoc getAttribute(ObjectName name, String JavaDoc attribute)
59     throws
60     MBeanException,
61     AttributeNotFoundException,
62     InstanceNotFoundException,
63     ReflectionException,
64     RemoteException JavaDoc
65   {
66     return getMBeanServer().getAttribute(name, attribute);
67   }
68
69   public AttributeList getAttributes(ObjectName name, String JavaDoc []attributes)
70     throws InstanceNotFoundException, ReflectionException, RemoteException JavaDoc
71   {
72     return getMBeanServer().getAttributes(name, attributes);
73   }
74
75   public String JavaDoc getDefaultDomain()
76     throws RemoteException JavaDoc
77   {
78     return getMBeanServer().getDefaultDomain();
79   }
80
81   public Integer JavaDoc getMBeanCount()
82     throws RemoteException JavaDoc
83   {
84     return getMBeanServer().getMBeanCount();
85   }
86
87   public MBeanInfo getMBeanInfo(ObjectName objectName)
88     throws
89     IntrospectionException,
90     InstanceNotFoundException,
91     ReflectionException,
92     RemoteException JavaDoc
93   {
94     return getMBeanServer().getMBeanInfo(objectName);
95   }
96
97   public Object JavaDoc invoke(ObjectName objectName,
98                        String JavaDoc operationName,
99                        Object JavaDoc []parameters,
100                        String JavaDoc []signature)
101     throws
102     MBeanException,
103     InstanceNotFoundException,
104     ReflectionException,
105     RemoteException JavaDoc
106   {
107     return getMBeanServer().invoke(objectName, operationName, parameters, signature);
108   }
109
110   public boolean isRegistered(ObjectName objectName)
111     throws RemoteException JavaDoc
112   {
113     return getMBeanServer().isRegistered(objectName);
114   }
115
116   public Set JavaDoc queryNames(ObjectName objectName, QueryExp queryExp)
117     throws RemoteException JavaDoc
118   {
119     return getMBeanServer().queryNames(objectName, queryExp);
120   }
121
122   public void setAttribute(ObjectName objectName, Attribute attribute)
123     throws InstanceNotFoundException,
124            AttributeNotFoundException,
125            InvalidAttributeValueException,
126            MBeanException,
127            ReflectionException,
128            RemoteException JavaDoc
129   {
130     getMBeanServer().setAttribute(objectName, attribute);
131   }
132
133   public AttributeList setAttributes(ObjectName objectName,
134                                      AttributeList attributes)
135     throws InstanceNotFoundException, ReflectionException, RemoteException JavaDoc
136   {
137     return getMBeanServer().setAttributes(objectName, attributes);
138   }
139
140   public ListenerRegistration JavaDoc getListenerRegistry()
141     throws RemoteException JavaDoc
142   {
143     return _listenerRegistrationImpl;
144   }
145
146   public class ListenerRegistrationImpl
147     implements ListenerRegistration JavaDoc
148   {
149     public void addNotificationListener(ObjectName objectName,
150                                         NotificationListener listener,
151                                         NotificationFilter filter,
152                                         Object JavaDoc handback)
153       throws InstanceNotFoundException, RemoteException JavaDoc
154     {
155     }
156
157     public void removeNotificationListener(ObjectName objectName,
158                                            NotificationListener listener)
159       throws InstanceNotFoundException, ListenerNotFoundException, RemoteException JavaDoc
160     {
161     }
162   }
163 }
164
Popular Tags