001/* 002 * (C) Copyright 2006-2008 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * Stephane Lacoin (Nuxeo EP Software Engineer)ne Lacoin (Nuxeo EP Software Engineer) 018 */ 019package org.nuxeo.runtime.management; 020 021import javax.management.ObjectName; 022import javax.management.modelmbean.RequiredModelMBean; 023 024/** 025 * @author Stephane Lacoin (Nuxeo EP Software Engineer) 026 */ 027public class Resource { 028 029 protected final Object instance; 030 031 protected final ObjectName managementName; 032 033 protected final Class<?> clazz; 034 035 protected RequiredModelMBean mbean; 036 037 public Resource(ObjectName managementName, Class<?> managementClass, Object serviceInstance) { 038 this.managementName = managementName; 039 clazz = managementClass; 040 instance = serviceInstance; 041 } 042 043 public Object getInstance() { 044 return instance; 045 } 046 047 public ObjectName getManagementName() { 048 return managementName; 049 } 050 051 public Class<?> getClazz() { 052 return clazz; 053 } 054 055 public boolean isRegistered() { 056 return mbean != null; 057 } 058 059}