eu.beesoft.gaia.util
Enum OperatingSystem

java.lang.Object
  extended by java.lang.Enum<OperatingSystem>
      extended by eu.beesoft.gaia.util.OperatingSystem
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<OperatingSystem>

public enum OperatingSystem
extends java.lang.Enum<OperatingSystem>

Enumeration for types of operating systems. It has also implemented some static methods to support the operating system dependent operations.


Enum Constant Summary
MAC
           
UNIX
           
UNKNOWN
           
WINDOWS
           
 
Method Summary
static OperatingSystem getCurrent()
          Returns instance of OperatingSystem which corresponds to the running operating system.
static java.lang.String getCurrentName()
          Returns the name of the underlaying operating system.
static eu.beesoft.gaia.plugin.Version getCurrentVersion()
          Returns the version of the underlaying operating system.
 boolean isCurrent()
          Returns true if this enumeration constant corresponds to the running operating system.
static void setFileWriteable(java.io.File file, boolean value)
          Sets file writeable or read-only.
static void startBrowser(java.lang.String url)
          Starts browser for given url.
 java.lang.String toString()
          Returns the string representation of this instance of OperatingSystem (its name and version).
static OperatingSystem valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static OperatingSystem[] values()
          Returns an array containing the constants of this enum type, in the order they're declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, valueOf
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

WINDOWS

public static final OperatingSystem WINDOWS

UNIX

public static final OperatingSystem UNIX

MAC

public static final OperatingSystem MAC

UNKNOWN

public static final OperatingSystem UNKNOWN
Method Detail

values

public static final OperatingSystem[] values()
Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants as follows:
for(OperatingSystem c : OperatingSystem.values())
        System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they're declared

valueOf

public static OperatingSystem valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name

getCurrent

public static OperatingSystem getCurrent()
Returns instance of OperatingSystem which corresponds to the running operating system.

Returns:
enumeration constant for the running operating system

isCurrent

public boolean isCurrent()
Returns true if this enumeration constant corresponds to the running operating system.

Returns:
true if this is running operating system

getCurrentName

public static java.lang.String getCurrentName()
Returns the name of the underlaying operating system.

Returns:
the name of the running operating system

getCurrentVersion

public static eu.beesoft.gaia.plugin.Version getCurrentVersion()
Returns the version of the underlaying operating system.

Returns:
the version of the running operating system

toString

public java.lang.String toString()
Returns the string representation of this instance of OperatingSystem (its name and version).

Overrides:
toString in class java.lang.Enum<OperatingSystem>
Returns:
the string representation of this

startBrowser

public static void startBrowser(java.lang.String url)
Starts browser for given url.

Parameters:
url - - url of web page to view
Throws:
java.lang.RuntimeException - if some error occured

setFileWriteable

public static void setFileWriteable(java.io.File file,
                                    boolean value)
Sets file writeable or read-only. This method uses File.setWritable() on Java 1.6+. On older versions it invokes program from running operating system (e.g. attrib on Windows). When this fails, it tries to copy file, delete it and rename the copy to the file name.

Parameters:
file - - the file to change read-only attribute
value - - the value to set; false for read-only, true for writeable
Throws:
java.lang.RuntimeException - if cannot change read-only state