jdk/src/share/classes/javax/management/MBean.java
author sjiang
Thu, 31 Jul 2008 15:31:13 +0200
changeset 1004 5ba8217eb504
parent 833 bfa2bef7517c
child 1247 b4c26443dee5
permissions -rw-r--r--
5108776: Add reliable event handling to the JMX API 6218920: API bug - impossible to delete last MBeanServerForwarder on a connector Reviewed-by: emcmanus
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
833
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
     1
/*
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
     2
 * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
     4
 *
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    10
 *
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    15
 * accompanied this code).
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    16
 *
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    20
 *
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    23
 * have any questions.
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    24
 */
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    25
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    26
package javax.management;
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    27
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    28
import java.lang.annotation.ElementType;
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    29
import java.lang.annotation.Inherited;
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    30
import java.lang.annotation.Retention;
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    31
import java.lang.annotation.RetentionPolicy;
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    32
import java.lang.annotation.Target;
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    33
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    34
/**
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    35
 * <p>Indicates that the annotated class is a Standard MBean.  A Standard
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    36
 * MBean class can be defined as in this example:</p>
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    37
 *
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    38
 * <pre>
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    39
 * {@code @MBean}
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    40
 * public class Configuration {
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    41
 *     {@link ManagedAttribute @ManagedAttribute}
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    42
 *     public int getCacheSize() {...}
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    43
 *     {@code @ManagedAttribute}
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    44
 *     public void setCacheSize(int size);
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    45
 *
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    46
 *     {@code @ManagedAttribute}
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    47
 *     public long getLastChangedTime();
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    48
 *
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    49
 *     {@link ManagedOperation @ManagedOperation}
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    50
 *     public void save();
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    51
 * }
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    52
 * </pre>
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    53
 *
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    54
 * <p>The class must be public.  Public methods within the class can be
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    55
 * annotated with {@code @ManagedOperation} to indicate that they are
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    56
 * MBean operations.  Public getter and setter methods within the class
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    57
 * can be annotated with {@code @ManagedAttribute} to indicate that they define
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    58
 * MBean attributes.</p>
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    59
 *
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    60
 * <p>If the MBean is to be an MXBean rather than a Standard MBean, then
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    61
 * the {@link MXBean @MXBean} annotation must be used instead of
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    62
 * {@code @MBean}.</p>
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    63
 */
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    64
@Retention(RetentionPolicy.RUNTIME)
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    65
@Target(ElementType.TYPE)
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    66
@Inherited
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    67
public @interface MBean {
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    68
}