org.rhq.core.system
Class SystemInfoFactory

java.lang.Object
  extended by org.rhq.core.system.SystemInfoFactory

public class SystemInfoFactory
extends Object

Builds SystemInfo objects based on the native operating system the VM is running on.


Method Summary
static SystemInfo createJavaSystemInfo()
          Under some circumstances, you may want to force this factory to provide a Java-only SystemInfo implementation, regardless of whether the factory has disabled the native layer or not.
static SystemInfo createSystemInfo()
          Returns the appropriate SystemInfo implementation based on the platform/operating system the JVM is running on.
static void disableNativeSystemInfo()
          This will tell the factory to not create any native objects and to not load the native libraries - even if the native library is available.
static void enableNativeSystemInfo()
          This will allow the factory to load the native libraries and create native objects.
static String getNativeSystemInfoVersion()
          If the native system is both available and enabled, this will return the native system's version string.
static boolean isNativeSystemInfoAvailable()
          If there is a native library available for the JVM's platform/operating system, true is returned.
static boolean isNativeSystemInfoDisabled()
          Returns true if this factory was told to disable the native layer.
static boolean isNativeSystemInfoInitialized()
          This returns true iff the native libraries have actually been initialized.
static void shutdown()
          This method is reserved for those objects (like shutdown hooks) that are aware of the VM going down - at which time it would be appropriate to give the native libraries a chance to clean up after themselves.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getNativeSystemInfoVersion

public static String getNativeSystemInfoVersion()
If the native system is both available and enabled, this will return the native system's version string. Otherwise, a generic Java version message is returned.

Returns:
native system version string

disableNativeSystemInfo

public static void disableNativeSystemInfo()
This will tell the factory to not create any native objects and to not load the native libraries - even if the native library is available.


enableNativeSystemInfo

public static void enableNativeSystemInfo()
This will allow the factory to load the native libraries and create native objects. Note that this will have no effect if there are no native libraries available.


isNativeSystemInfoDisabled

public static boolean isNativeSystemInfoDisabled()
Returns true if this factory was told to disable the native layer. This only indicates if it was disabled; this has nothing to do with whether or not the native libraries actually exist and are available.

Returns:
true if the native layer is disabled

isNativeSystemInfoAvailable

public static boolean isNativeSystemInfoAvailable()
If there is a native library available for the JVM's platform/operating system, true is returned. If the JVM's platform does not have native libraries available, false is returned (in which case, the only SystemInfo implementation that is available is JavaSystemInfo).

Returns:
true if there are native library APIs available for the JVM platform
See Also:
JavaSystemInfo

isNativeSystemInfoInitialized

public static boolean isNativeSystemInfoInitialized()
This returns true iff the native libraries have actually been initialized. This will return false if this factory has been disabled from the start (i.e. prior to the first call to createSystemInfo() or getNativeSystemInfoVersion()). It will also return false after the native libraries have been shutdown().

Returns:
true if the native libraries have been loaded and initialized

createSystemInfo

public static SystemInfo createSystemInfo()
Returns the appropriate SystemInfo implementation based on the platform/operating system the JVM is running on.

Returns:
a NativeSystemInfo implementation or a JavaSystemInfo if the native libraries are not available for the platform or have been disabled.

createJavaSystemInfo

public static SystemInfo createJavaSystemInfo()
Under some circumstances, you may want to force this factory to provide a Java-only SystemInfo implementation, regardless of whether the factory has disabled the native layer or not. In the cases when you absolutely, positively have to have a non-native, Java-only implementation, you can use this method.

Returns:
Java-only SystemInfo implementation

shutdown

public static void shutdown()
This method is reserved for those objects (like shutdown hooks) that are aware of the VM going down - at which time it would be appropriate to give the native libraries a chance to clean up after themselves.



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