1. /*
  2. * @(#)MLetMBean.java 4.19 04/04/20
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.management.loading;
  8. import java.net.URL;
  9. import java.io.InputStream;
  10. import java.io.IOException;
  11. import java.util.Set;
  12. import java.util.Enumeration;
  13. import javax.management.*;
  14. /**
  15. * Exposes the remote management interface of the MLet
  16. * MBean.
  17. *
  18. * @since 1.5
  19. */
  20. public interface MLetMBean {
  21. /**
  22. * Loads a text file containing MLET tags that define the MBeans
  23. * to be added to the agent. The location of the text file is
  24. * specified by a URL. The text file is read using the UTF-8
  25. * encoding. The MBeans specified in the MLET file will be
  26. * instantiated and registered by the MBeanServer.
  27. *
  28. * @param url The URL of the text file to be loaded as String object.
  29. *
  30. * @return A set containing one entry per MLET tag in the m-let
  31. * text file loaded. Each entry specifies either the
  32. * ObjectInstance for the created MBean, or a throwable object
  33. * (that is, an error or an exception) if the MBean could not be
  34. * created.
  35. *
  36. * @exception ServiceNotFoundException One of the following errors
  37. * has occurred: The m-let text file does not contain an MLET tag,
  38. * the m-let text file is not found, a mandatory attribute of the
  39. * MLET tag is not specified, the value of url is malformed.
  40. */
  41. public Set getMBeansFromURL(String url) throws ServiceNotFoundException ;
  42. /**
  43. * Loads a text file containing MLET tags that define the MBeans
  44. * to be added to the agent. The location of the text file is
  45. * specified by a URL. The text file is read using the UTF-8
  46. * encoding. The MBeans specified in the MLET file will be
  47. * instantiated and registered by the MBeanServer.
  48. *
  49. * @param url The URL of the text file to be loaded as URL object.
  50. *
  51. * @return A set containing one entry per MLET tag in the m-let
  52. * text file loaded. Each entry specifies either the
  53. * ObjectInstance for the created MBean, or a throwable object
  54. * (that is, an error or an exception) if the MBean could not be
  55. * created.
  56. *
  57. * @exception ServiceNotFoundException One of the following errors
  58. * has occurred: The m-let text file does not contain an MLET tag,
  59. * the m-let text file is not found, a mandatory attribute of the
  60. * MLET tag is not specified, the value of url is null.
  61. */
  62. public Set getMBeansFromURL(URL url) throws ServiceNotFoundException ;
  63. /**
  64. * Appends the specified URL to the list of URLs to search for classes and
  65. * resources.
  66. *
  67. * @param url the URL to add.
  68. */
  69. public void addURL(URL url) ;
  70. /**
  71. * Appends the specified URL to the list of URLs to search for classes and
  72. * resources.
  73. *
  74. * @param url the URL to add.
  75. *
  76. * @exception ServiceNotFoundException The specified URL is malformed.
  77. */
  78. public void addURL(String url) throws ServiceNotFoundException;
  79. /**
  80. * Returns the search path of URLs for loading classes and resources.
  81. * This includes the original list of URLs specified to the constructor,
  82. * along with any URLs subsequently appended by the addURL() method.
  83. *
  84. * @return the list of URLs.
  85. */
  86. public URL[] getURLs();
  87. /** Finds the resource with the given name.
  88. * A resource is some data (images, audio, text, etc) that can be accessed by class code in a way that is
  89. * independent of the location of the code.
  90. * The name of a resource is a "/"-separated path name that identifies the resource.
  91. *
  92. * @param name The resource name
  93. *
  94. * @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
  95. * resource.
  96. */
  97. public URL getResource(String name);
  98. /** Returns an input stream for reading the specified resource. The search order is described in the documentation for
  99. * getResource(String).
  100. *
  101. * @param name The resource name
  102. *
  103. * @return An input stream for reading the resource, or null if the resource could not be found
  104. *
  105. */
  106. public InputStream getResourceAsStream(String name);
  107. /**
  108. * Finds all the resources with the given name. A resource is some
  109. * data (images, audio, text, etc) that can be accessed by class
  110. * code in a way that is independent of the location of the code.
  111. * The name of a resource is a "/"-separated path name that
  112. * identifies the resource.
  113. *
  114. * @param name The resource name.
  115. *
  116. * @return An enumeration of URL to the resource. If no resources
  117. * could be found, the enumeration will be empty. Resources that
  118. * cannot be accessed will not be in the enumeration.
  119. *
  120. * @exception IOException if an I/O exception occurs when
  121. * searching for resources.
  122. */
  123. public Enumeration getResources(String name) throws IOException;
  124. /**
  125. * Gets the current directory used by the library loader for
  126. * storing native libraries before they are loaded into memory.
  127. *
  128. * @return The current directory used by the library loader.
  129. *
  130. * @see #setLibraryDirectory
  131. */
  132. public String getLibraryDirectory();
  133. /**
  134. * Sets the directory used by the library loader for storing
  135. * native libraries before they are loaded into memory.
  136. *
  137. * @param libdir The directory used by the library loader.
  138. *
  139. * @see #getLibraryDirectory
  140. */
  141. public void setLibraryDirectory(String libdir);
  142. }