src/java.management/share/classes/javax/management/loading/MLetMBean.java
author darcy
Wed, 23 Oct 2019 13:01:40 -0700
changeset 58766 54ffb15c4839
parent 47216 71c04702a3d5
permissions -rw-r--r--
8232442: Suppress warnings on non-serializable non-transient instance fields in java.management.* Reviewed-by: rriggs, mchung
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 1999, 2006, Oracle and/or its affiliates. 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
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
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
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
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 javax.management.loading;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.net.URL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.io.InputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.io.IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.util.Set;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.util.Enumeration;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import javax.management.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * Exposes the remote management interface of the MLet
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * MBean.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
public interface MLetMBean   {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
     * Loads a text file containing MLET tags that define the MBeans
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
     * to be added to the MBean server. The location of the text file is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
     * specified by a URL. The text file is read using the UTF-8
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
     * encoding. The MBeans specified in the MLET file will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
     * instantiated and registered in the MBean server.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
     * @param url The URL of the text file to be loaded as String object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     * @return A set containing one entry per MLET tag in the m-let
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     * text file loaded.  Each entry specifies either the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * ObjectInstance for the created MBean, or a throwable object
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     * (that is, an error or an exception) if the MBean could not be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     * created.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     * @exception ServiceNotFoundException One of the following errors
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     * has occurred: The m-let text file does not contain an MLET tag,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     * the m-let text file is not found, a mandatory attribute of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * MLET tag is not specified, the value of url is malformed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    public Set<Object> getMBeansFromURL(String url)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
            throws ServiceNotFoundException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * Loads a text file containing MLET tags that define the MBeans
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * to be added to the MBean server. The location of the text file is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * specified by a URL. The text file is read using the UTF-8
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * encoding. The MBeans specified in the MLET file will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * instantiated and registered in the MBean server.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * @param url The URL of the text file to be loaded as URL object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * @return A set containing one entry per MLET tag in the m-let
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * text file loaded.  Each entry specifies either the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * ObjectInstance for the created MBean, or a throwable object
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * (that is, an error or an exception) if the MBean could not be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * created.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * @exception ServiceNotFoundException One of the following errors
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * has occurred: The m-let text file does not contain an MLET tag,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * the m-let text file is not found, a mandatory attribute of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * MLET tag is not specified, the value of url is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    public Set<Object> getMBeansFromURL(URL url)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
            throws ServiceNotFoundException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * Appends the specified URL to the list of URLs to search for classes and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * resources.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * @param url the URL to add.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    public void addURL(URL url) ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * Appends the specified URL to the list of URLs to search for classes and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * resources.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * @param url the URL to add.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * @exception ServiceNotFoundException The specified URL is malformed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    public void addURL(String url) throws ServiceNotFoundException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * Returns the search path of URLs for loading classes and resources.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * This includes the original list of URLs specified to the constructor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * along with any URLs subsequently appended by the addURL() method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * @return the list of URLs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    public URL[] getURLs();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    /** Finds the resource with the given name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * A resource is some data (images, audio, text, etc) that can be accessed by class code in a way that is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     *   independent of the location of the code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     *   The name of a resource is a "/"-separated path name that identifies the resource.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * @param name The resource name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * @return  An URL for reading the resource, or null if the resource could not be found or the caller doesn't have adequate privileges to get the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * resource.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    public URL getResource(String name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    /** Returns an input stream for reading the specified resource. The search order is described in the documentation for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     *  getResource(String).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * @param name  The resource name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * @return An input stream for reading the resource, or null if the resource could not be found
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    public InputStream getResourceAsStream(String name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * Finds all the resources with the given name. A resource is some
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     * data (images, audio, text, etc) that can be accessed by class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     * code in a way that is independent of the location of the code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * The name of a resource is a "/"-separated path name that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     * identifies the resource.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * @param name The  resource name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     * @return An enumeration of URL to the resource. If no resources
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     * could be found, the enumeration will be empty. Resources that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     * cannot be accessed will not be in the enumeration.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * @exception IOException if an I/O exception occurs when
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * searching for resources.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    public Enumeration<URL> getResources(String name) throws IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     * Gets the current directory used by the library loader for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     * storing native libraries before they are loaded into memory.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * @return The current directory used by the library loader.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * @see #setLibraryDirectory
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * @throws UnsupportedOperationException if this implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     * does not support storing native libraries in this way.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    public String getLibraryDirectory();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     * Sets the directory used by the library loader for storing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * native libraries before they are loaded into memory.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * @param libdir The directory used by the library loader.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * @see #getLibraryDirectory
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     * @throws UnsupportedOperationException if this implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     * does not support storing native libraries in this way.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    public void setLibraryDirectory(String libdir);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
 }