org.rhq.core.system
Interface SystemInfo

All Known Implementing Classes:
JavaSystemInfo, NativeSystemInfo, WindowsNativeSystemInfo

public interface SystemInfo

Interface of all native system info objects plus the "non-native" generic JavaSystemInfo object. Implementations provide native access to low-level operations such as operating system process table access.


Method Summary
 ProcessExecutionResults executeProcess(ProcessExecution processExecution)
          Executes a process.
 List<NetworkAdapterInfo> getAllNetworkAdapters()
          Returns the information on all installed network adapters.
 List<ProcessInfo> getAllProcesses()
          Returns the information on all processes found in the process table.
 List<ServiceInfo> getAllServices()
          Returns the information on all installed services found in the services manager.
 CpuInformation getCpu(int cpuIndex)
          Returns information about a specified CPU installed on the hardware where the JVM is running.
 FileSystemInfo getFileSystem(String path)
          Returns information on the mounted file system that hosts the given file or directory.
 List<FileSystemInfo> getFileSystems()
          Returns information on all mounted file systems.
 String getHostname()
          Returns the hostname that the system is known as.
 org.hyperic.sigar.Mem getMemoryInfo()
          Returns information about memory installed on the platform.
 NetworkAdapterStats getNetworkAdapterStats(String interfaceName)
           
 NetworkStats getNetworkStats(String addressName, int port)
           
 int getNumberOfCpus()
          Returns the number of CPUs on the hardware platform.
 String getOperatingSystemName()
          Returns the name of the operating system.
 OperatingSystemType getOperatingSystemType()
          Returns the operating system type, if known; otherwise, OperatingSystemType.JAVA is returned (in which case, the caller can examine the Java system property "os.name" to try to detect the type).
 String getOperatingSystemVersion()
          Returns the version string of the operating system, as reported by the operating system.
 List<ProcessInfo> getProcesses(String processInfoQuery)
          Returns ProcessInfo objects for all processes that match the provided PIQL query string
 org.hyperic.sigar.Swap getSwapInfo()
          Returns information about the virtual, swap memory installed on the platform.
 String getSystemArchitecture()
          Returns the architecture of the underlying hardware
 ProcessInfo getThisProcess()
          Returns the process information for the Java VM process this object is running in.
 boolean isNative()
          Returns true if the actual implementation is backed by a native library.
 String readLineFromConsole(boolean noEcho)
          Reads a line of input from the console and returns that line as a string.
 void writeLineToConsole(String line)
          Writes a line of output to the console.
 

Method Detail

isNative

boolean isNative()
Returns true if the actual implementation is backed by a native library. An implementation that is backed by a native library has access to very low-level information from the operating system on which the JVM is currently running. If false, only the Java API can provide system level information. When this returns false, some methods from the SystemInfo API will throw an UnsupportedOperationException to indicate there is no native library available to perform the requested operation and the Java API does not provide similar functionality that is able to satisfy the request.

Returns:
true if there is a low-level native API available for the JVM's platform

getOperatingSystemType

OperatingSystemType getOperatingSystemType()
Returns the operating system type, if known; otherwise, OperatingSystemType.JAVA is returned (in which case, the caller can examine the Java system property "os.name" to try to detect the type).

Returns:
the type of operating system, as detected by the native layer

getOperatingSystemName

String getOperatingSystemName()
Returns the name of the operating system.

Returns:
OS name

getOperatingSystemVersion

String getOperatingSystemVersion()
Returns the version string of the operating system, as reported by the operating system.

Returns:
what the operating system says is its version

getSystemArchitecture

String getSystemArchitecture()
Returns the architecture of the underlying hardware

Returns:

getHostname

String getHostname()
                   throws SystemInfoException
Returns the hostname that the system is known as.

Returns:
machine host name
Throws:
SystemInfoException

getAllNetworkAdapters

List<NetworkAdapterInfo> getAllNetworkAdapters()
                                               throws SystemInfoException
Returns the information on all installed network adapters.

Returns:
list containing information on all network adapters
Throws:
SystemInfoException

getAllServices

List<ServiceInfo> getAllServices()
                                 throws SystemInfoException
Returns the information on all installed services found in the services manager.

Returns:
list container information on all services currently installed
Throws:
SystemInfoException

getAllProcesses

List<ProcessInfo> getAllProcesses()
Returns the information on all processes found in the process table. This means that all processes currently running and are visible to the user running the VM are returned.

Returns:
list containing information on all processes currently running at the time the method was called

getProcesses

List<ProcessInfo> getProcesses(String processInfoQuery)
Returns ProcessInfo objects for all processes that match the provided PIQL query string

Parameters:
processInfoQuery - the PIQL query string
Returns:
list containing process information

getThisProcess

ProcessInfo getThisProcess()
Returns the process information for the Java VM process this object is running in.

Returns:
this VM process's information

executeProcess

ProcessExecutionResults executeProcess(ProcessExecution processExecution)
Executes a process. The caller specifies the actual executable to run, the optional arguments to pass to the executable, the optional name=value set of environment variables the new process will have, the optional new working directory for the new process, the time (in milliseconds) to wait for the process to exit and the flag to indicate if the process's output should be captured and passed back in the returned results.

Parameters:
processExecution - the settings on how to execute the process
Returns:
the results of the execution

getNumberOfCpus

int getNumberOfCpus()
Returns the number of CPUs on the hardware platform.

Returns:
CPU count

getMemoryInfo

org.hyperic.sigar.Mem getMemoryInfo()
Returns information about memory installed on the platform.

Returns:
memory information

getSwapInfo

org.hyperic.sigar.Swap getSwapInfo()
Returns information about the virtual, swap memory installed on the platform.

Returns:
swap information

readLineFromConsole

String readLineFromConsole(boolean noEcho)
                           throws IOException
Reads a line of input from the console and returns that line as a string. You can ask the implementation to not echo what the user typed into the console by passing true as the value to noEcho. noEcho is a hint and not guaranteed to work since some implementations (like the Java-only fallback implementation) will not be able to stop the console from echoing input.

Parameters:
noEcho - if true, the implementation should try to not echo the input to the console
Returns:
the line read from the console input
Throws:
IOException - if failed to read console input

writeLineToConsole

void writeLineToConsole(String line)
                        throws IOException
Writes a line of output to the console. This method does not output any newline characters - if you wish to end the output with a newline character, you must append it to the end of line.

Parameters:
line -
Throws:
IOException

getCpu

CpuInformation getCpu(int cpuIndex)
Returns information about a specified CPU installed on the hardware where the JVM is running.

Parameters:
cpuIndex - identifies the CPU whose information is to be returned; on a single-CPU system, the index must be 0.
Returns:
information on the CPU

getFileSystems

List<FileSystemInfo> getFileSystems()
Returns information on all mounted file systems.

Returns:
list of all file systems on the platform

getFileSystem

FileSystemInfo getFileSystem(String path)
Returns information on the mounted file system that hosts the given file or directory.

Parameters:
path - the file or directory whose mounted file system should be returned
Returns:
the file system where the given file or directory is hosted

getNetworkAdapterStats

NetworkAdapterStats getNetworkAdapterStats(String interfaceName)

getNetworkStats

NetworkStats getNetworkStats(String addressName,
                             int port)


Copyright © 2008-2009 RHQ Project Advisory Board (Red Hat, Inc.). All Rights Reserved.