jdk/src/share/classes/com/sun/jmx/interceptor/MBeanServerInterceptor.java
author dfuchs
Thu, 04 Sep 2008 14:46:36 +0200
changeset 1156 bbc2d15aaf7a
parent 2 90ce3da70b43
child 5506 202f599c92aa
permissions -rw-r--r--
5072476: RFE: support cascaded (federated) MBean Servers 6299231: Add support for named MBean Servers Summary: New javax.management.namespace package. Reviewed-by: emcmanus
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
1156
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
     2
 * Copyright 2002-2008 Sun Microsystems, Inc.  All Rights Reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package com.sun.jmx.interceptor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
1156
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
    29
import java.io.ObjectInputStream;
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
    30
import javax.management.InstanceNotFoundException;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import javax.management.MBeanException;
1156
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
    32
import javax.management.MBeanServer;
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
    33
import javax.management.ObjectName;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import javax.management.OperationsException;
1156
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
    35
import javax.management.ReflectionException;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import javax.management.loading.ClassLoaderRepository;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * <p>This interface specifies the behavior to be implemented by an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * MBean Server Interceptor.  An MBean Server Interceptor has
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * essentially the same interface as an MBean Server.  An MBean Server
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * forwards received requests to its default interceptor, which may
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * handle them itself or forward them to other interceptors.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * default interceptor may be changed via the {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * com.sun.jmx.mbeanserver.SunJmxMBeanServer#setMBeanServerInterceptor}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * method.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * <p>The initial default interceptor provides the standard MBean
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * Server behavior.  It handles a collection of named MBeans, each
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * represented by a Java object.  A replacement default interceptor
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * may build on this behavior, for instance by adding logging or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * security checks, before forwarding requests to the initial default
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * interceptor.  Or, it may route each request to one of a number of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * sub-interceptors, for instance based on the {@link ObjectName} in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * the request.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * <p>An interceptor, default or not, need not implement MBeans as
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * Java objects, in the way that the initial default interceptor does.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * It may instead implement <em>virtual MBeans</em>, which do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * exist as Java objects when they are not in use.  For example, these
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * MBeans could be implemented by forwarding requests to a database,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * or to a remote MBean server, or by performing system calls to query
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * or modify system resources.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 */
1156
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
    67
public interface MBeanServerInterceptor extends MBeanServer {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    /**
1156
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
    69
     * This method should never be called.
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
    70
     * Usually hrows UnsupportedOperationException.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     */
1156
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
    72
    public Object instantiate(String className)
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
    73
            throws ReflectionException, MBeanException;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    /**
1156
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
    75
     * This method should never be called.
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
    76
     * Usually throws UnsupportedOperationException.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     */
1156
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
    78
    public Object instantiate(String className, ObjectName loaderName)
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
    79
            throws ReflectionException, MBeanException,
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
    80
            InstanceNotFoundException;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    /**
1156
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
    82
     * This method should never be called.
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
    83
     * Usually throws UnsupportedOperationException.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     */
1156
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
    85
    public Object instantiate(String className, Object[] params,
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
    86
            String[] signature) throws ReflectionException, MBeanException;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    /**
1156
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
    89
     * This method should never be called.
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
    90
     * Usually throws UnsupportedOperationException.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     */
1156
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
    92
    public Object instantiate(String className, ObjectName loaderName,
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
    93
            Object[] params, String[] signature)
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
    94
            throws ReflectionException, MBeanException,
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
    95
            InstanceNotFoundException;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    /**
1156
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
    98
     * This method should never be called.
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
    99
     * Usually throws UnsupportedOperationException.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     */
1156
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
   101
    @Deprecated
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
   102
    public ObjectInputStream deserialize(ObjectName name, byte[] data)
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
   103
            throws InstanceNotFoundException, OperationsException;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    /**
1156
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
   106
     * This method should never be called.
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
   107
     * Usually throws UnsupportedOperationException.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     */
1156
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
   109
    @Deprecated
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
   110
    public ObjectInputStream deserialize(String className, byte[] data)
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
   111
            throws OperationsException, ReflectionException;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    /**
1156
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
   114
     * This method should never be called.
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
   115
     * Usually hrows UnsupportedOperationException.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     */
1156
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
   117
    @Deprecated
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
   118
    public ObjectInputStream deserialize(String className,
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
   119
            ObjectName loaderName, byte[] data)
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
   120
            throws InstanceNotFoundException, OperationsException,
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
   121
            ReflectionException;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    /**
1156
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
   124
     * This method should never be called.
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
   125
     * Usually throws UnsupportedOperationException.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     */
1156
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
   127
    public ClassLoaderRepository getClassLoaderRepository();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
}
1156
bbc2d15aaf7a 5072476: RFE: support cascaded (federated) MBean Servers
dfuchs
parents: 2
diff changeset
   130