001: /*
002: * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003: *
004: * This file is part of Resin(R) Open Source
005: *
006: * Each copy or derived work must preserve the copyright notice and this
007: * notice unmodified.
008: *
009: * Resin Open Source is free software; you can redistribute it and/or modify
010: * it under the terms of the GNU General Public License as published by
011: * the Free Software Foundation; either version 2 of the License, or
012: * (at your option) any later version.
013: *
014: * Resin Open Source is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017: * of NON-INFRINGEMENT. See the GNU General Public License for more
018: * details.
019: *
020: * You should have received a copy of the GNU General Public License
021: * along with Resin Open Source; if not, write to the
022: * Free SoftwareFoundation, Inc.
023: * 59 Temple Place, Suite 330
024: * Boston, MA 02111-1307 USA
025: *
026: * @author Sam
027: */
028:
029: package com.caucho.management.j2ee;
030:
031: import com.caucho.jmx.AbstractMBeanServer;
032: import com.caucho.jmx.Jmx;
033:
034: import javax.ejb.CreateException;
035: import javax.management.*;
036: import javax.management.j2ee.statistics.ListenerRegistration;
037: import java.rmi.RemoteException;
038: import java.util.Set;
039:
040: public class ManagementImpl
041: // extends AbstractSessionBean
042: {
043: private final ListenerRegistration _listenerRegistrationImpl = new ListenerRegistrationImpl();
044:
045: public void ejbCreate() throws CreateException {
046: }
047:
048: private AbstractMBeanServer getMBeanServer() {
049: return Jmx.getMBeanServer();
050: }
051:
052: public Object getAttribute(ObjectName name, String attribute)
053: throws MBeanException, AttributeNotFoundException,
054: InstanceNotFoundException, ReflectionException,
055: RemoteException {
056: return getMBeanServer().getAttribute(name, attribute);
057: }
058:
059: public AttributeList getAttributes(ObjectName name,
060: String[] attributes) throws InstanceNotFoundException,
061: ReflectionException, RemoteException {
062: return getMBeanServer().getAttributes(name, attributes);
063: }
064:
065: public String getDefaultDomain() throws RemoteException {
066: return getMBeanServer().getDefaultDomain();
067: }
068:
069: public Integer getMBeanCount() throws RemoteException {
070: return getMBeanServer().getMBeanCount();
071: }
072:
073: public MBeanInfo getMBeanInfo(ObjectName objectName)
074: throws IntrospectionException, InstanceNotFoundException,
075: ReflectionException, RemoteException {
076: return getMBeanServer().getMBeanInfo(objectName);
077: }
078:
079: public Object invoke(ObjectName objectName, String operationName,
080: Object[] parameters, String[] signature)
081: throws MBeanException, InstanceNotFoundException,
082: ReflectionException, RemoteException {
083: return getMBeanServer().invoke(objectName, operationName,
084: parameters, signature);
085: }
086:
087: public boolean isRegistered(ObjectName objectName)
088: throws RemoteException {
089: return getMBeanServer().isRegistered(objectName);
090: }
091:
092: public Set queryNames(ObjectName objectName, QueryExp queryExp)
093: throws RemoteException {
094: return getMBeanServer().queryNames(objectName, queryExp);
095: }
096:
097: public void setAttribute(ObjectName objectName, Attribute attribute)
098: throws InstanceNotFoundException,
099: AttributeNotFoundException, InvalidAttributeValueException,
100: MBeanException, ReflectionException, RemoteException {
101: getMBeanServer().setAttribute(objectName, attribute);
102: }
103:
104: public AttributeList setAttributes(ObjectName objectName,
105: AttributeList attributes) throws InstanceNotFoundException,
106: ReflectionException, RemoteException {
107: return getMBeanServer().setAttributes(objectName, attributes);
108: }
109:
110: public ListenerRegistration getListenerRegistry()
111: throws RemoteException {
112: return _listenerRegistrationImpl;
113: }
114:
115: public class ListenerRegistrationImpl implements
116: ListenerRegistration {
117: public void addNotificationListener(ObjectName objectName,
118: NotificationListener listener,
119: NotificationFilter filter, Object handback)
120: throws InstanceNotFoundException, RemoteException {
121: }
122:
123: public void removeNotificationListener(ObjectName objectName,
124: NotificationListener listener)
125: throws InstanceNotFoundException,
126: ListenerNotFoundException, RemoteException {
127: }
128: }
129: }
|