1 /*
   2  * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 
  27 package javax.management;
  28 
  29 
  30 /**
  31  * Defines the methods that should be implemented by
  32  * a Dynamic MBean (MBean that exposes a dynamic management interface).
  33  *
  34  * @since 1.5
  35  */
  36 public interface DynamicMBean {
  37 
  38 
  39     /**
  40      * Obtain the value of a specific attribute of the Dynamic MBean.
  41      *
  42      * @param attribute The name of the attribute to be retrieved
  43      *
  44      * @return  The value of the attribute retrieved.
  45      *
  46      * @exception AttributeNotFoundException if the specified attribute does not exist or cannot be retrieved.
  47      * @exception MBeanException  Wraps a <CODE>java.lang.Exception</CODE> thrown by the MBean's getter.
  48      * @exception ReflectionException  Wraps a <CODE>java.lang.Exception</CODE> thrown while trying to invoke the getter.
  49      *
  50      * @see #setAttribute
  51      */
  52     public Object getAttribute(String attribute) throws AttributeNotFoundException,
  53         MBeanException, ReflectionException;
  54 
  55     /**
  56      * Set the value of a specific attribute of the Dynamic MBean.
  57      *
  58      * @param attribute The identification of the attribute to
  59      * be set and  the value it is to be set to.
  60      *
  61      * @exception AttributeNotFoundException if the specified attribute does not exist or cannot be retrieved.
  62      * @exception InvalidAttributeValueException if there is a conflict between the value and the attribute's schema
  63      * @exception MBeanException Wraps a <CODE>java.lang.Exception</CODE> thrown by the MBean's setter.
  64      * @exception ReflectionException Wraps a <CODE>java.lang.Exception</CODE> thrown while trying to invoke the MBean's setter.
  65      *
  66      * @see #getAttribute
  67      */
  68     public void setAttribute(Attribute attribute) throws AttributeNotFoundException,
  69         InvalidAttributeValueException, MBeanException, ReflectionException ;
  70 
  71     /**
  72      * Get the values of several attributes of the Dynamic MBean.
  73      *
  74      * @param attributes A list of the attributes to be retrieved.
  75      *
  76      * @return  The list of attributes retrieved.
  77      *
  78      * @see #setAttributes
  79      */
  80     public AttributeList getAttributes(String[] attributes);
  81 
  82     /**
  83      * Sets the values of several attributes of the Dynamic MBean.
  84      *
  85      * @param attributes A list of attributes: The identification of the
  86      * attributes to be set and  the values they are to be set to.
  87      *
  88      * @return  The list of attributes that were set, with their new values.
  89      *
  90      * @see #getAttributes
  91      */
  92     public AttributeList setAttributes(AttributeList attributes);
  93 
  94     /**
  95      * Allows an action to be invoked on the Dynamic MBean.
  96      *
  97      * @param actionName The name of the action to be invoked.
  98      * @param params An array containing the parameters to be set when the action is
  99      * invoked.
 100      * @param signature An array containing the signature of the action. The class objects will
 101      * be loaded through the same class loader as the one used for loading the
 102      * MBean on which the action is invoked.
 103      *
 104      * @return  The object returned by the action, which represents the result of
 105      * invoking the action on the MBean specified.
 106      *
 107      * @exception MBeanException  Wraps a <CODE>java.lang.Exception</CODE> thrown by the MBean's invoked method.
 108      * @exception ReflectionException  Wraps a <CODE>java.lang.Exception</CODE> thrown while trying to invoke the method
 109      */
 110     public Object invoke(String actionName, Object params[], String signature[])
 111         throws MBeanException, ReflectionException ;
 112 
 113     /**
 114      * Provides the exposed attributes and actions of the Dynamic MBean using an MBeanInfo object.
 115      *
 116      * @return  An instance of <CODE>MBeanInfo</CODE> allowing all attributes and actions
 117      * exposed by this Dynamic MBean to be retrieved.
 118      *
 119      */
 120     public MBeanInfo getMBeanInfo();
 121 
 122  }