blob: 1a2c01c6cc0eb4d7fe9d43f56fd41f6517d31b2a [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 1999-2006 Sun Microsystems, Inc. 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. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26package javax.management.loading;
27
28import java.net.URL;
29import java.io.InputStream;
30import java.io.IOException;
31import java.util.Set;
32import java.util.Enumeration;
33
34import javax.management.*;
35
36
37
38/**
39 * Exposes the remote management interface of the MLet
40 * MBean.
41 *
42 * @since 1.5
43 */
44public interface MLetMBean {
45
46
47 /**
48 * Loads a text file containing MLET tags that define the MBeans
49 * to be added to the MBean server. The location of the text file is
50 * specified by a URL. The text file is read using the UTF-8
51 * encoding. The MBeans specified in the MLET file will be
52 * instantiated and registered in the MBean server.
53 *
54 * @param url The URL of the text file to be loaded as String object.
55 *
56 * @return A set containing one entry per MLET tag in the m-let
57 * text file loaded. Each entry specifies either the
58 * ObjectInstance for the created MBean, or a throwable object
59 * (that is, an error or an exception) if the MBean could not be
60 * created.
61 *
62 * @exception ServiceNotFoundException One of the following errors
63 * has occurred: The m-let text file does not contain an MLET tag,
64 * the m-let text file is not found, a mandatory attribute of the
65 * MLET tag is not specified, the value of url is malformed.
66 */
67 public Set<Object> getMBeansFromURL(String url)
68 throws ServiceNotFoundException;
69
70 /**
71 * Loads a text file containing MLET tags that define the MBeans
72 * to be added to the MBean server. The location of the text file is
73 * specified by a URL. The text file is read using the UTF-8
74 * encoding. The MBeans specified in the MLET file will be
75 * instantiated and registered in the MBean server.
76 *
77 * @param url The URL of the text file to be loaded as URL object.
78 *
79 * @return A set containing one entry per MLET tag in the m-let
80 * text file loaded. Each entry specifies either the
81 * ObjectInstance for the created MBean, or a throwable object
82 * (that is, an error or an exception) if the MBean could not be
83 * created.
84 *
85 * @exception ServiceNotFoundException One of the following errors
86 * has occurred: The m-let text file does not contain an MLET tag,
87 * the m-let text file is not found, a mandatory attribute of the
88 * MLET tag is not specified, the value of url is null.
89 */
90 public Set<Object> getMBeansFromURL(URL url)
91 throws ServiceNotFoundException;
92
93 /**
94 * Appends the specified URL to the list of URLs to search for classes and
95 * resources.
96 *
97 * @param url the URL to add.
98 */
99 public void addURL(URL url) ;
100
101 /**
102 * Appends the specified URL to the list of URLs to search for classes and
103 * resources.
104 *
105 * @param url the URL to add.
106 *
107 * @exception ServiceNotFoundException The specified URL is malformed.
108 */
109 public void addURL(String url) throws ServiceNotFoundException;
110
111 /**
112 * Returns the search path of URLs for loading classes and resources.
113 * This includes the original list of URLs specified to the constructor,
114 * along with any URLs subsequently appended by the addURL() method.
115 *
116 * @return the list of URLs.
117 */
118 public URL[] getURLs();
119
120 /** Finds the resource with the given name.
121 * A resource is some data (images, audio, text, etc) that can be accessed by class code in a way that is
122 * independent of the location of the code.
123 * The name of a resource is a "/"-separated path name that identifies the resource.
124 *
125 * @param name The resource name
126 *
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
128 * resource.
129 */
130 public URL getResource(String name);
131
132 /** Returns an input stream for reading the specified resource. The search order is described in the documentation for
133 * getResource(String).
134 *
135 * @param name The resource name
136 *
137 * @return An input stream for reading the resource, or null if the resource could not be found
138 *
139 */
140 public InputStream getResourceAsStream(String name);
141
142 /**
143 * Finds all the resources with the given name. A resource is some
144 * data (images, audio, text, etc) that can be accessed by class
145 * code in a way that is independent of the location of the code.
146 * The name of a resource is a "/"-separated path name that
147 * identifies the resource.
148 *
149 * @param name The resource name.
150 *
151 * @return An enumeration of URL to the resource. If no resources
152 * could be found, the enumeration will be empty. Resources that
153 * cannot be accessed will not be in the enumeration.
154 *
155 * @exception IOException if an I/O exception occurs when
156 * searching for resources.
157 */
158 public Enumeration<URL> getResources(String name) throws IOException;
159
160 /**
161 * Gets the current directory used by the library loader for
162 * storing native libraries before they are loaded into memory.
163 *
164 * @return The current directory used by the library loader.
165 *
166 * @see #setLibraryDirectory
167 *
168 * @throws UnsupportedOperationException if this implementation
169 * does not support storing native libraries in this way.
170 */
171 public String getLibraryDirectory();
172
173 /**
174 * Sets the directory used by the library loader for storing
175 * native libraries before they are loaded into memory.
176 *
177 * @param libdir The directory used by the library loader.
178 *
179 * @see #getLibraryDirectory
180 *
181 * @throws UnsupportedOperationException if this implementation
182 * does not support storing native libraries in this way.
183 */
184 public void setLibraryDirectory(String libdir);
185
186 }