001/*
002 * (C) Copyright 2006-2008 Nuxeo SAS (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *    Stephane Lacoin (Nuxeo EP Software Engineer)ne Lacoin (Nuxeo EP Software Engineer)
016 */
017package org.nuxeo.runtime.management;
018
019import javax.management.ObjectName;
020import javax.management.modelmbean.RequiredModelMBean;
021
022/**
023 * @author Stephane Lacoin (Nuxeo EP Software Engineer)
024 */
025public class Resource {
026
027    protected final Object instance;
028
029    protected final ObjectName managementName;
030
031    protected final Class<?> clazz;
032
033    protected RequiredModelMBean mbean;
034
035    public Resource(ObjectName managementName, Class<?> managementClass, Object serviceInstance) {
036        this.managementName = managementName;
037        clazz = managementClass;
038        instance = serviceInstance;
039    }
040
041    public Object getInstance() {
042        return instance;
043    }
044
045    public ObjectName getManagementName() {
046        return managementName;
047    }
048
049    public Class<?> getClazz() {
050        return clazz;
051    }
052
053    public boolean isRegistered() {
054        return mbean != null;
055    }
056
057}