001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.console.manager.interfaces.impl;
023:
024: import org.jboss.console.manager.interfaces.ManageableResource;
025:
026: import javax.management.ObjectName;
027:
028: /**
029: * <description>
030: *
031: * @see <related>
032: *
033: * @author <a href="mailto:sacha.labourey@cogito-info.ch">Sacha Labourey</a>.
034: * @version $Revision: 57191 $
035: *
036: * <p><b>Revisions:</b>
037: *
038: * <p><b>December 16, 2002 Sacha Labourey:</b>
039: * <ul>
040: * <li> First implementation </li>
041: * </ul>
042: */
043:
044: public class MBeanResource implements ManageableResource {
045:
046: // Constants -----------------------------------------------------
047:
048: // Attributes ----------------------------------------------------
049:
050: String className = null;
051: ObjectName oj = null;
052: transient Object mbean = null; // SUPPORT FOR REMOTE MBEANS!!!!
053:
054: // Static --------------------------------------------------------
055:
056: // Constructors --------------------------------------------------
057:
058: public MBeanResource() {
059: }
060:
061: public MBeanResource(ObjectName oj, String clazz) {
062: this .oj = oj;
063: this .className = clazz;
064: }
065:
066: public MBeanResource(ObjectName oj, String clazz, Object proxy) {
067: this .oj = oj;
068: this .className = clazz;
069: this .mbean = proxy;
070: }
071:
072: // Public --------------------------------------------------------
073:
074: public String getClassName() {
075: return this .className;
076: }
077:
078: public ObjectName getObjectName() {
079: return this .oj;
080: }
081:
082: public Object getMBeanProxy() {
083: return this .mbean;
084: }
085:
086: // ManageableResource implementation ----------------------------------------------
087:
088: public String getId() {
089: return this .oj.toString();
090: }
091:
092: // Object overrides ---------------------------------------------------
093:
094: public boolean equals(Object other) {
095: if (other instanceof MBeanResource)
096: return this .oj.equals(((MBeanResource) other).oj);
097: else
098: return false;
099: }
100:
101: // Package protected ---------------------------------------------
102:
103: // Protected -----------------------------------------------------
104:
105: // Private -------------------------------------------------------
106:
107: // Inner classes -------------------------------------------------
108:
109: }
|