001/* RuntimeMXBean.java - Interface for a runtime bean
002   Copyright (C) 2006 Free Software Foundation
003
004This file is part of GNU Classpath.
005
006GNU Classpath is free software; you can redistribute it and/or modify
007it under the terms of the GNU General Public License as published by
008the Free Software Foundation; either version 2, or (at your option)
009any later version.
010
011GNU Classpath is distributed in the hope that it will be useful, but
012WITHOUT ANY WARRANTY; without even the implied warranty of
013MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014General Public License for more details.
015
016You should have received a copy of the GNU General Public License
017along with GNU Classpath; see the file COPYING.  If not, write to the
018Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
01902110-1301 USA.
020
021Linking this library statically or dynamically with other modules is
022making a combined work based on this library.  Thus, the terms and
023conditions of the GNU General Public License cover the whole
024combination.
025
026As a special exception, the copyright holders of this library give you
027permission to link this library with independent modules to produce an
028executable, regardless of the license terms of these independent
029modules, and to copy and distribute the resulting executable under
030terms of your choice, provided that you also meet, for each linked
031independent module, the terms and conditions of the license of that
032module.  An independent module is a module which is not derived from
033or based on this library.  If you modify this library, you may extend
034this exception to your version of the library, but you are not
035obligated to do so.  If you do not wish to do so, delete this
036exception statement from your version. */
037
038package java.lang.management;
039
040import java.util.List;
041import java.util.Map;
042
043/**
044 * Provides access to information about the underlying virtual
045 * machine.  An instance of this bean is obtained by calling
046 * {@link ManagementFactory#getRuntimeMXBean()}.
047 *
048 * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
049 * @since 1.5
050 */
051public interface RuntimeMXBean
052{
053
054  /**
055   * <p>
056   * Returns the boot classpath used by the virtual machine.  This
057   * value follows the standard path syntax used by the underlying
058   * operating system (e.g. directories separated by ':' on UNIX
059   * or ';' on Windows).
060   * </p>
061   * <p>
062   * Supplying this value is optional.  Users should check the
063   * return value of {@link isBootClassPathSupported()} prior to
064   * calling this method.
065   * </p>
066   *
067   * @return the boot classpath of the virtual machine, if supported.
068   * @throws UnsupportedOperationException in cases where this
069   *                                       functionality is not
070   *                                       supported by the VM.
071   * @throws SecurityException if a security manager exists and
072   *                           denies ManagementPermission("monitor").
073   * @see #isBootClassPathSupported()
074   * @see java.lang.management.ManagementPermission
075   */
076  String getBootClassPath();
077
078  /**
079   * Returns the classpath used by the system classloader.  This
080   * is equivalent to obtaining the <code>java.class.path</code>
081   * property via {@link System#getProperty(String)}.  This value
082   * follows the standard path syntax used by the underlying operating
083   * system (e.g. directories separated by ':' on UNIX or ';' on
084   * Windows).
085   *
086   * @return the classpath used by the system class loader.
087   * @throws SecurityException if a security manager exists which
088   *                           prevents access to the classpath
089   *                           property.
090   * @see java.lang.System#getProperty(String)
091   * @see java.lang.SecurityManager#checkPropertyAccess(String)
092   */
093  String getClassPath();
094
095  /**
096   * Returns a list of the arguments given to the virtual machine,
097   * excluding those that apply to the <code>main()</code> method
098   * of the class file being executed.  These may not just be those
099   * specified at the command line, but may also include arguments
100   * from environment variables, configuration files, etc.  All
101   * command line arguments may not reach the virtual machine, so
102   * these are not included in this list.
103   *
104   * @return a list of arguments passed to the virtual machine.
105   * @throws SecurityException if a security manager exists and
106   *                           denies ManagementPermission("monitor").
107   * @see java.lang.management.ManagementPermission
108   */
109  List<String> getInputArguments();
110
111  /**
112   * Returns the library path.  This is equivalent to obtaining the
113   * <code>java.library.path</code> property via
114   * {@link System#getProperty(String)}.  This value follows the
115   * standard path syntax used by the underlying operating
116   * system (e.g. directories separated by ':' on UNIX or ';' on
117   * Windows).
118   *
119   * @return the library path.
120   * @throws SecurityException if a security manager exists which
121   *                           prevents access to the library path
122   *                           property.
123   * @see java.lang.System#getProperty(String)
124   * @see java.lang.SecurityManager#checkPropertyAccess(String)
125   */
126  String getLibraryPath();
127
128  /**
129   * Returns the version of the management specification
130   * implemented by the virtual machine.
131   *
132   * @return the version of the management specification
133   *         implemented.
134   */
135  String getManagementSpecVersion();
136
137  /**
138   * Returns the name of this virtual machine.  The content
139   * of this property is left up to the developer of the
140   * virtual machine.  It may include a number of system
141   * attributes and may differ between instances of the
142   * same virtual machine (for example, it might include
143   * the process identifier or the host name of the machine
144   * on which it is running).  The intention is that this
145   * name refers to the precise entity that the other data
146   * supplied by this bean refers to, rather than the VM
147   * in general.
148   *
149   * @return the name of this virtual machine.
150   */
151  String getName();
152
153  /**
154   * Returns the specification name of the virtual machine.
155   * This is equivalent to obtaining the
156   * <code>java.vm.specification.name</code> property via
157   * {@link System#getProperty(String)}.
158   *
159   * @return the specification name of the VM.
160   * @throws SecurityException if a security manager exists which
161   *                           prevents access to the VM
162   *                           specification name property.
163   * @see java.lang.System#getProperty(String)
164   * @see java.lang.SecurityManager#checkPropertyAccess(String)
165   */
166  String getSpecName();
167
168  /**
169   * Returns the specification vendor of the virtual machine.
170   * This is equivalent to obtaining the
171   * <code>java.vm.specification.vendor</code> property via
172   * {@link System#getProperty(String)}.
173   *
174   * @return the specification vendor of the VM.
175   * @throws SecurityException if a security manager exists which
176   *                           prevents access to the VM
177   *                           specification vendor property.
178   * @see java.lang.System#getProperty(String)
179   * @see java.lang.SecurityManager#checkPropertyAccess(String)
180   */
181  String getSpecVendor();
182
183  /**
184   * Returns the specification version of the virtual machine.
185   * This is equivalent to obtaining the
186   * <code>java.vm.specification.version</code> property via
187   * {@link System#getProperty(String)}.
188   *
189   * @return the specification version of the VM.
190   * @throws SecurityException if a security manager exists which
191   *                           prevents access to the VM
192   *                           specification version property.
193   * @see java.lang.System#getProperty(String)
194   * @see java.lang.SecurityManager#checkPropertyAccess(String)
195   */
196  String getSpecVersion();
197
198  /**
199   * Returns the approximate start time of the virtual machine
200   * in milliseconds.
201   *
202   * @return the start time of the virtual machine.
203   */
204  long getStartTime();
205
206  /**
207   * Returns a map containing the keys and values of the system
208   * properties.  This gives largely the same result as calling
209   * {@link System#getProperties()}, but the resulting map
210   * is filtered so as to only provide keys and values that
211   * are <code>String</code>s.
212   *
213   * @return the map of system properties.
214   */
215  Map<String,String> getSystemProperties();
216
217  /**
218   * Returns the uptime of the virtual machine in milliseconds.
219   *
220   * @return the uptime of the virtual machine.
221   */
222  long getUptime();
223
224  /**
225   * Returns the implementation name of the virtual machine.
226   * This is equivalent to obtaining the
227   * <code>java.vm.name</code> property via
228   * {@link System#getProperty(String)}.
229   *
230   * @return the implementation name of the VM.
231   * @throws SecurityException if a security manager exists which
232   *                           prevents access to the VM name
233   *                           property.
234   * @see java.lang.System#getProperty(String)
235   * @see java.lang.SecurityManager#checkPropertyAccess(String)
236   */
237  String getVmName();
238
239  /**
240   * Returns the implementation vendor of the virtual machine.
241   * This is equivalent to obtaining the
242   * <code>java.vm.vendor</code> property via
243   * {@link System#getProperty(String)}.
244   *
245   * @return the implementation vendor of the VM.
246   * @throws SecurityException if a security manager exists which
247   *                           prevents access to the VM vendor
248   *                           property.
249   * @see java.lang.System#getProperty(String)
250   * @see java.lang.SecurityManager#checkPropertyAccess(String)
251   */
252  String getVmVendor();
253
254  /**
255   * Returns the implementation version of the virtual machine.
256   * This is equivalent to obtaining the
257   * <code>java.vm.version</code> property via
258   * {@link System#getProperty(String)}.
259   *
260   * @return the implementation version of the VM.
261   * @throws SecurityException if a security manager exists which
262   *                           prevents access to the VM version
263   *                           property.
264   * @see java.lang.System#getProperty(String)
265   * @see java.lang.SecurityManager#checkPropertyAccess(String)
266   */
267  String getVmVersion();
268
269  /**
270   * Returns true if the virtual machine supports the boot classpath
271   * mechanism.
272   *
273   * @return true if the boot classpath property is supported by the
274   *         virtual machine.
275   */
276  boolean isBootClassPathSupported();
277
278}