org.ka2ddo.yaac.os
Class OSAdapter

java.lang.Object
  extended by org.ka2ddo.yaac.os.OSAdapter

public abstract class OSAdapter
extends java.lang.Object

This abstract class provides service methods for accessing operating-system-specific information. No instances of this class should ever be instantiated, as all methods are static.


Method Summary
static java.lang.String[] getCachedSerialPortNames(java.lang.String deviceName)
          Get the list of serial port device names, including the specified name.
static java.io.File getDirectoryFromCache(java.lang.String cacheId)
          Get a File representing a remembered directory for a particular type of file operation.
static java.lang.String[] getSerialPortNames(java.lang.String currentDevName)
          Obtain the list of unused serial ports on this system, using RXTX.
static boolean isWindows()
          Test if the host operating system is Microsoft Windows.
static void openURL(java.lang.String url)
          Launch O/S-specific browser to view a particular URL.
static void purgeSerialPortCache()
          Purge the cached list of serial port device names, so the next query will have to build the list from scratch.
static void putDirectoryToCache(java.lang.String cacheId, java.io.File dir)
          remember the last directory used for a type of file operation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getSerialPortNames

public static java.lang.String[] getSerialPortNames(java.lang.String currentDevName)
Obtain the list of unused serial ports on this system, using RXTX.

Parameters:
currentDevName - String of an already-busy device name to add to list, or null for no additional name
Returns:
array String device names, or null if the system does not have access to serial ports

getCachedSerialPortNames

public static java.lang.String[] getCachedSerialPortNames(java.lang.String deviceName)
Get the list of serial port device names, including the specified name.

Parameters:
deviceName - device name to include (in case the device is already open)
Returns:
array of device name Strings

purgeSerialPortCache

public static void purgeSerialPortCache()
Purge the cached list of serial port device names, so the next query will have to build the list from scratch.


isWindows

public static boolean isWindows()
Test if the host operating system is Microsoft Windows.

Returns:
boolean true if running on Microsoft Windows (any release), false for any other operating system

openURL

public static void openURL(java.lang.String url)
Launch O/S-specific browser to view a particular URL.

Parameters:
url - String representation of URL to view

getDirectoryFromCache

public static java.io.File getDirectoryFromCache(java.lang.String cacheId)
Get a File representing a remembered directory for a particular type of file operation.

Parameters:
cacheId - String name of file operation (such as log files, or tile files)
Returns:
File pointing at the last directory for such operations, or null if never yet cached

putDirectoryToCache

public static void putDirectoryToCache(java.lang.String cacheId,
                                       java.io.File dir)
remember the last directory used for a type of file operation.

Parameters:
cacheId - String name of file type
dir - File pointing to the last directory used for those files