summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew John Hughes <gnu_andrew@member.fsf.org>2006-05-28 15:04:14 +0000
committerAndrew John Hughes <gnu_andrew@member.fsf.org>2006-05-28 15:04:14 +0000
commitc1b2e23fc4c5b5c87c659e584e1326af63081293 (patch)
tree4d5f2fbf402e91bb3cc5716f10aaf157283f197e
parent2de52521866b8be39ce4ed1e93879b4dfff1a301 (diff)
downloadclasspath-c1b2e23fc4c5b5c87c659e584e1326af63081293.tar.gz
2006-05-28 Andrew John Hughes <gnu_andrew@member.fsf.org>
* gnu/java/lang/management/OperatingSystemMXBeanImpl.java: New class implementing the OS bean. * gnu/java/lang/management/package.html: New file to document the gnu.java.lang.management package. * java/lang/management/ManagementFactory.java: New class to provide access to the OS bean. * java/lang/management/OperatingSystemMXBean.java: New interface. * java/lang/management/package.html: New file to document the java.lang.management package.
-rw-r--r--ChangeLog13
-rw-r--r--gnu/java/lang/management/OperatingSystemMXBeanImpl.java73
-rw-r--r--gnu/java/lang/management/package.html46
-rw-r--r--java/lang/management/ManagementFactory.java81
-rw-r--r--java/lang/management/OperatingSystemMXBean.java103
-rw-r--r--java/lang/management/package.html64
6 files changed, 380 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 949581ce6..108ed6b63 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2006-05-28 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ * gnu/java/lang/management/OperatingSystemMXBeanImpl.java:
+ New class implementing the OS bean.
+ * gnu/java/lang/management/package.html:
+ New file to document the gnu.java.lang.management package.
+ * java/lang/management/ManagementFactory.java:
+ New class to provide access to the OS bean.
+ * java/lang/management/OperatingSystemMXBean.java:
+ New interface.
+ * java/lang/management/package.html:
+ New file to document the java.lang.management package.
+
2006-05-28 Raif S. Naffah <raif@swiftdsl.com.au>
* tools/gnu/classpath/tools/keytool/ImportCmd.java (GKR): New constant.
diff --git a/gnu/java/lang/management/OperatingSystemMXBeanImpl.java b/gnu/java/lang/management/OperatingSystemMXBeanImpl.java
new file mode 100644
index 000000000..3ba059b36
--- /dev/null
+++ b/gnu/java/lang/management/OperatingSystemMXBeanImpl.java
@@ -0,0 +1,73 @@
+/* OperatingSystemMXBeanImpl.java - Implementation of an operating system bean
+ Copyright (C) 2006 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.java.lang.management;
+
+import java.lang.management.OperatingSystemMXBean;
+
+/**
+ * Provides access to information about the underlying operating
+ * system.
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.5
+ */
+public final class OperatingSystemMXBeanImpl
+ implements OperatingSystemMXBean
+{
+
+ public String getArch()
+ {
+ return System.getProperty("os.arch");
+ }
+
+ public int getAvailableProcessors()
+ {
+ return Runtime.getRuntime().availableProcessors();
+ }
+
+ public String getName()
+ {
+ return System.getProperty("os.name");
+ }
+
+ public String getVersion()
+ {
+ return System.getProperty("os.version");
+ }
+
+}
diff --git a/gnu/java/lang/management/package.html b/gnu/java/lang/management/package.html
new file mode 100644
index 000000000..fc1bafc0c
--- /dev/null
+++ b/gnu/java/lang/management/package.html
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in gnu.java.lang.management package.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. -->
+
+<html>
+<head><title>GNU Classpath - gnu.java.lang.management</title></head>
+
+<body>
+<p>GNU implementations of the Java system management beans.</p>
+
+</body>
+</html>
diff --git a/java/lang/management/ManagementFactory.java b/java/lang/management/ManagementFactory.java
new file mode 100644
index 000000000..d070f719c
--- /dev/null
+++ b/java/lang/management/ManagementFactory.java
@@ -0,0 +1,81 @@
+/* ManagementFactory.java - Factory for obtaining system beans.
+ Copyright (C) 2006 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package java.lang.management;
+
+import gnu.java.lang.management.OperatingSystemMXBeanImpl;
+
+/**
+ * <p>
+ * Provides access to the system's management beans via a series
+ * of static methods.
+ * </p>
+ * <p>
+ * An instance of a system management bean can be obtained by
+ * using one of the following methods:
+ * </p>
+ * <ol>
+ * <li>Calling the appropriate static method of this factory.
+ * </li>
+ * </ol>
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.5
+ */
+public class ManagementFactory
+{
+
+ /**
+ * The operating system management bean.
+ */
+ private static OperatingSystemMXBean osBean;
+
+ /**
+ * Returns the operating system management bean for the
+ * operating system on which the virtual machine is running.
+ *
+ * @return an instance of {@link OperatingSystemMXBean} for
+ * the underlying operating system.
+ */
+ public static OperatingSystemMXBean getOperatingSystemMXBean()
+ {
+ if (osBean == null)
+ osBean = new OperatingSystemMXBeanImpl();
+ return osBean;
+ }
+
+}
diff --git a/java/lang/management/OperatingSystemMXBean.java b/java/lang/management/OperatingSystemMXBean.java
new file mode 100644
index 000000000..74b9ae5a1
--- /dev/null
+++ b/java/lang/management/OperatingSystemMXBean.java
@@ -0,0 +1,103 @@
+/* OperatingSystemMXBean.java - Interface for an operating system bean
+ Copyright (C) 2006 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package java.lang.management;
+
+/**
+ * Provides access to information about the underlying operating
+ * system. Instances of this bean are obtained by calling
+ * {@link ManagementFactory#getOperatingSystemMXBean()}.
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.5
+ */
+public interface OperatingSystemMXBean
+{
+
+ /**
+ * Returns the name of the underlying system architecture. This
+ * is equivalent to obtaining the <code>os.arch</code> property
+ * via {@link System#getProperty(String)}.
+ *
+ * @return the name of the underlying system architecture on which
+ * the VM is running.
+ * @throws SecurityException if a security manager exists which
+ * prevents access to the name property.
+ * @see java.lang.System#getProperty(String)
+ * @see java.lang.SecurityManager#checkPropertyAccess(String)
+ */
+ String getArch();
+
+ /**
+ * Returns the number of processors currently available to the
+ * virtual machine. This number is subject to change during
+ * execution of the virtual machine, and will always be >= 1.
+ * The call is equivalent to {@link Runtime#availableProcessors()}.
+ *
+ * @return the number of processors available to the VM.
+ */
+ int getAvailableProcessors();
+
+ /**
+ * Returns the name of the underlying operating system. This
+ * is equivalent to obtaining the <code>os.name</code> property
+ * via {@link System#getProperty(String)}.
+ *
+ * @return the name of the operating system on which the VM
+ * is running.
+ * @throws SecurityException if a security manager exists which
+ * prevents access to the name property.
+ * @see java.lang.System#getProperty(String)
+ * @see java.lang.SecurityManager#checkPropertyAccess(String)
+ */
+ String getName();
+
+ /**
+ * Returns the version of the underlying operating system. This
+ * is equivalent to obtaining the <code>os.version</code> property
+ * via {@link System#getProperty(String)}.
+ *
+ * @return the version of the operating system on which the VM
+ * is running.
+ * @throws SecurityException if a security manager exists which
+ * prevents access to the name property.
+ * @see java.lang.System#getProperty(String)
+ * @see java.lang.SecurityManager#checkPropertyAccess(String)
+ */
+ String getVersion();
+
+}
diff --git a/java/lang/management/package.html b/java/lang/management/package.html
new file mode 100644
index 000000000..1b37cc1a5
--- /dev/null
+++ b/java/lang/management/package.html
@@ -0,0 +1,64 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in java.lang.management package.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. -->
+
+<html>
+<head><title>GNU Classpath - java.lang.management</title></head>
+
+<body>
+
+<p>
+A series of management beans which provide access to information about the
+virtual machine and its underlying operating system.
+</p>
+<p>The following beans are provided:</p>
+<ul>
+<li>
+<span style="font-weight: bold;">{@link java.lang.management.OperatingSystemMXBean} </span>
+&mdash; Information about the underlying operating system.
+</li>
+</ul>
+<h2>Accessing the Beans</h2>
+<p>
+An instance of a bean can be obtained by using one of the following methods:
+</p>
+<ol>
+<li>Calling the appropriate static method of the {@link java.lang.management.ManagementFactory}
+</li>
+</ol>
+</body>
+</html>