001: /**
002: * The XMOJO Project 5
003: * Copyright © 2003 XMOJO.org. All rights reserved.
004:
005: * NO WARRANTY
006:
007: * BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
008: * THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
009: * OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
010: * PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
011: * OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
012: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
013: * TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE
014: * LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
015: * REPAIR OR CORRECTION.
016:
017: * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
018: * ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
019: * THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
020: * GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
021: * USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF
022: * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
023: * PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE),
024: * EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
025: * SUCH DAMAGES.
026: **/package javax.management.loading;
027:
028: import java.io.InputStream;
029: import java.io.IOException;
030: import java.net.URL;
031: import java.util.Enumeration;
032: import java.util.Set;
033:
034: import javax.management.ServiceNotFoundException;
035:
036: /**
037: * This interface exposes the remote management interface of the MLet MBean.
038: */
039: public abstract interface MLetMBean {
040: /**
041: * Appends the specified URL to the list of URLs to search for classes and
042: * resources.
043: *
044: * @param url This url will be appended with the list of URLs to search
045: * for classes and resources
046: *
047: * @exception javax.management.ServiceNotFoundException The specified
048: * URL is malformed.
049: */
050: public void addURL(String url) throws ServiceNotFoundException;
051:
052: /**
053: * Appends the specified URL to the list of URLs to search for classes and
054: * resources.
055: *
056: * @param url the url to be added to this MLetMBean
057: */
058: public void addURL(URL url);
059:
060: /**
061: * Gets the current directory used by the library loader for storing
062: * native libraries before they are loaded into memory.
063: *
064: * @return The current directory used by the library loader.
065: */
066: public String getLibraryDirectory();
067:
068: /**
069: * Loads a text file containing MLET tags that define the MBeans to be
070: * added to the agent. The location of the text file is specified by a URL.
071: * The MBeans specified in the MLET file will be instantiated and
072: * registered by the MBeanServer.
073: *
074: * @param url The URL of the text file to be loaded as String object.
075: *
076: * @return A set containing one entry per MLET tag in the m-let text
077: * file loaded. Each entry specifies either the ObjectInstance
078: * for the created MBean, or a throwable object (that is, an
079: * error or an exception) if the MBean could not be created.
080: *
081: * @exception javax.management.ServiceNotFoundException One of the
082: * following errors has occurred:
083: * The m-let text file does not contain an MLET tag,
084: * the m-let text file is not found,
085: * a mandatory attribute of the MLET tag is not specified,
086: * the value of url is malformed.
087: */
088: public Set getMBeansFromURL(String url)
089: throws ServiceNotFoundException;
090:
091: /**
092: * Loads a text file containing MLET tags that define the MBeans to be
093: * added to the agent. The location of the text file is specified by a URL.
094: * The MBeans specified in the MLET file will be instantiated and
095: * registered by the MBeanServer.
096: *
097: * @param url The URL of the text file to be loaded as URL object.
098: *
099: * @return A set containing one entry per MLET tag in the m-let text
100: * file loaded. Each entry specifies either the ObjectInstance
101: * for the created MBean, or a throwable object (that is, an
102: * error or an exception) if the MBean could not be created.
103: *
104: * @exception javax.management.ServiceNotFoundException - One of the
105: * following errors has occurred:
106: * The m-let text file does not contain an MLET tag,
107: * the m-let text file is not found,
108: * a mandatory attribute of the MLET tag is not specified,
109: * the value of url is null.
110: */
111: public Set getMBeansFromURL(java.net.URL url)
112: throws ServiceNotFoundException;
113:
114: /**
115: * Finds the resource with the given name. A resource is some data
116: * (images, audio, text, etc) that can be accessed by class code in a
117: * way that is independent of the location of the code.The name of a
118: * resource is a "/"-separated path name that identifies the resource.
119: *
120: * @param name The resource name
121: *
122: * @return An URL for reading the resource, or null if the resource
123: * could not be found or the caller doesn't have adequate
124: * privileges to get the resource.
125: */
126: public URL getResource(String name);
127:
128: /**
129: * Returns an input stream for reading the specified resource. The
130: * search order is described in the documentation for getResource(String).
131: *
132: * @param name The resource name
133: *
134: * @return An input stream for reading the resource, or null if the
135: * resource could not be found
136: */
137: public InputStream getResourceAsStream(String name);
138:
139: /**
140: * Finds all the resources with the given name. A resource is some data
141: * (images, audio, text, etc) that can be accessed by class code in a way
142: * that is independent of the location of the code. The name of a
143: * resource is a "/"-separated path name that identifies the resource.
144: *
145: * @param name The resource name
146: *
147: * @return An enumeration of URL to the resource. If no resources could
148: * be found, the enumeration will be empty. Resources that
149: * the doesn't have access to will not be in the enumeration.
150: *
151: * @exception IOException - Signals that an I/O exception of some sort
152: * has occurred. This class is the general class of exceptions
153: * produced by failed or interrupted I/O operations.
154: */
155: public Enumeration getResources(String name) throws IOException;
156:
157: /**
158: * Returns the search path of URLs for loading classes and resources.
159: * This includes the original list of URLs specified to the constructor,
160: * along with any URLs subsequently appended by the addURL() method.
161: *
162: * @return This returns the search path of URLs for loading classes and resources
163: */
164: public URL[] getURLs();
165:
166: /**
167: * Sets the directory used by the library loader for storing native
168: * libraries before they are loaded into memory.
169: *
170: * @param libdir The directory used by the library loader.
171: */
172: public void setLibraryDirectory(java.lang.String libdir);
173:
174: }//End of interface MLetMBean
|