jwrapper.jwutils
Class JWGenericOS

java.lang.Object
  extended by jwrapper.jwutils.JWGenericOS
Direct Known Subclasses:
JWLinuxOS, JWMacOS, JWWindowsOS

public abstract class JWGenericOS
extends java.lang.Object

Utility methods for OS level interactions which are cross platform (Windows/Linux/Mac)


Constructor Summary
JWGenericOS()
           
 
Method Summary
abstract  java.lang.String[] getAllConsoleUsers()
           
 int getCurrentProcessID()
          Get the process ID of this JVM
 java.lang.String getHostname()
           
static JWGenericOS getInstance()
           
 java.lang.String getOSName()
          Return the OS name - utility for getting accurate OS names even with older JVMs.
 java.lang.String getOSNameWithBitness()
          Return the OS name with x86 for 32bit systems and x64 for 64bit systems
 java.lang.String getOSVersion()
          Return the OS version
static void setCurrentDirectory(java.io.File dir)
          Change the current working directory for the entire JVM (warning - not guaranteed to be supported or work properly - use with caution)
static java.lang.Process setReadableForAllUsers(java.io.File dir, boolean recursive)
           
static void setReadableForAllUsersAndWait(java.io.File dir, boolean recursive)
          Recursively sets the file or folder to be accessible / modifiable for all users
static java.lang.Process setWritableForAllUsers(java.io.File dir, boolean recursive)
           
static void setWritableForAllUsersAndWait(java.io.File dir, boolean recursive)
          Recursively sets the file or folder to be accessible / modifiable for all users
static boolean terminateProcess(int pid)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JWGenericOS

public JWGenericOS()
Method Detail

getAllConsoleUsers

public abstract java.lang.String[] getAllConsoleUsers()

getCurrentProcessID

public int getCurrentProcessID()
Get the process ID of this JVM


getHostname

public java.lang.String getHostname()

getInstance

public static JWGenericOS getInstance()

getOSName

public java.lang.String getOSName()
Return the OS name - utility for getting accurate OS names even with older JVMs.


getOSNameWithBitness

public java.lang.String getOSNameWithBitness()
Return the OS name with x86 for 32bit systems and x64 for 64bit systems


getOSVersion

public java.lang.String getOSVersion()
Return the OS version


setCurrentDirectory

public static void setCurrentDirectory(java.io.File dir)
                                throws java.io.IOException
Change the current working directory for the entire JVM (warning - not guaranteed to be supported or work properly - use with caution)

Parameters:
dir -
Throws:
java.io.IOException

setReadableForAllUsers

public static java.lang.Process setReadableForAllUsers(java.io.File dir,
                                                       boolean recursive)
                                                throws java.io.IOException
Throws:
java.io.IOException

setReadableForAllUsersAndWait

public static void setReadableForAllUsersAndWait(java.io.File dir,
                                                 boolean recursive)
                                          throws java.io.IOException
Recursively sets the file or folder to be accessible / modifiable for all users

Parameters:
dir -
Throws:
java.io.IOException

setWritableForAllUsers

public static java.lang.Process setWritableForAllUsers(java.io.File dir,
                                                       boolean recursive)
                                                throws java.io.IOException
Throws:
java.io.IOException

setWritableForAllUsersAndWait

public static void setWritableForAllUsersAndWait(java.io.File dir,
                                                 boolean recursive)
                                          throws java.io.IOException
Recursively sets the file or folder to be accessible / modifiable for all users

Parameters:
dir -
Throws:
java.io.IOException

terminateProcess

public static boolean terminateProcess(int pid)