org.annolab.tt4j
Class PlatformDetector

java.lang.Object
  extended by org.annolab.tt4j.PlatformDetector

public class PlatformDetector
extends Object

Detect platform information and normalize it.

Author:
Richard Eckart de Castilho

Field Summary
static String ARCH_PPC
           
static String ARCH_SPARC
           
static String ARCH_X86_32
           
static String ARCH_X86_64
           
static String OS_LINUX
           
static String OS_OSX
           
static String OS_SOLARIS
           
static String OS_WINDOWS
           
 
Constructor Summary
PlatformDetector()
           
 
Method Summary
 String getArch()
          Get the platform architecture.
 String getByteOrder()
          Get the byte order.
 String[] getChmodCmd()
          Get the chmod (change permissions) command for the current platform (if one is necessary).
 String getExecutableSuffix()
          Get the file suffix used for executable files on the currently configured platform.
 String getOs()
          Get the operating system.
 String getPlatformId()
          Get the platform ID which is getOs() and getArch() separated by a "-" (dash).
 void setArch(String aArch)
          Override the architecture.
 void setByteOrder(ByteOrder aByteOrder)
          Set the byte order.
 void setOs(String aOs)
          Override the operating system name.
 void updatePlatform(String aOs, String aArch, ByteOrder aByteOrder)
          Updates the platform-specific settings and normalizes them.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OS_WINDOWS

public static String OS_WINDOWS

OS_OSX

public static String OS_OSX

OS_SOLARIS

public static String OS_SOLARIS

OS_LINUX

public static String OS_LINUX

ARCH_PPC

public static String ARCH_PPC

ARCH_X86_32

public static String ARCH_X86_32

ARCH_X86_64

public static String ARCH_X86_64

ARCH_SPARC

public static String ARCH_SPARC
Constructor Detail

PlatformDetector

public PlatformDetector()
Method Detail

setOs

public void setOs(String aOs)
Override the operating system name. This should only be used in test cases.

Parameters:
aOs - an OS name as could be found in the os.name system property.

getOs

public String getOs()
Get the operating system.

Returns:
"windows", "osx", "linux" or "solaris".

setArch

public void setArch(String aArch)
Override the architecture. This should only be used in test cases.

Parameters:
aArch - "big-endian" for PowerPC or Sparc systems or "little-endian" for x86 systems.

getArch

public String getArch()
Get the platform architecture.

Returns:
"ppc", "x86_32", "x86_64" or {"amd64"}

setByteOrder

public void setByteOrder(ByteOrder aByteOrder)
Set the byte order. TreeTagger models are sensitive to the byte order. This should only be used in test cases.

Parameters:
aByteOrder - the byte order.

getExecutableSuffix

public String getExecutableSuffix()
Get the file suffix used for executable files on the currently configured platform.

Returns:
the file suffix used for executable files.

getByteOrder

public String getByteOrder()
Get the byte order.

Returns:
the byte order.

getPlatformId

public String getPlatformId()
Get the platform ID which is getOs() and getArch() separated by a "-" (dash).

Returns:
the platform ID.

updatePlatform

public void updatePlatform(String aOs,
                           String aArch,
                           ByteOrder aByteOrder)
Updates the platform-specific settings and normalizes them.

Parameters:
aOs - the operating system string.
aArch - the architecture string.
aByteOrder - the byte-order string.

getChmodCmd

public String[] getChmodCmd()
Get the chmod (change permissions) command for the current platform (if one is necessary).

Returns:
the name of the chmod command.


Copyright © 2012. All Rights Reserved.