com.izforge.izpack.util
Class Platforms

java.lang.Object
  extended by com.izforge.izpack.util.Platforms

public class Platforms
extends Object

Factory for Platform instances.

Author:
Tim Anderson

Field Summary
static Platform AIX
          AIX platform.
static Platform DEBIAN_LINUX
          Debian Linux platform.
static Platform FEDORA_LINUX
          Fedora Linux platform.
static Platform FREEBSD
          FreeBSD platform.
static Platform HP_UX
          HP/UX platform.
static Platform LINUX
          Generic Linux platform.
static Platform MAC
          Mac platform.
static Platform MAC_OSX
          Mac OSX platform.
static Platform MANDRAKE_LINUX
          Mandrake Linux platform.
static Platform MANDRIVA_LINUX
          Mandriva Linux platform.
static Platform OS_2
          OS/2 platform.
static Platform[] PLATFORMS
          Known platforms.
static Platform RED_HAT_LINUX
          Red Hat Linux platform.
static Platform SUNOS
          SunOS platform.
static Platform SUNOS_SPARC
          SunOS/SPARC platform.
static Platform SUNOS_X86
          SunOS/x86 platform.
static Platform SUSE_LINUX
          SuSE Linux platform.
static Platform UBUNTU_LINUX
          Ubuntu Linux platform.
static Platform UNIX
          Generic UNIX platform.
static Platform WINDOWS
          Windows platform.
static Platform WINDOWS_2003
          Windows 2003 platform.
static Platform WINDOWS_7
          Windows 7 platform.
static Platform WINDOWS_8
          Windows 7 platform.
static Platform WINDOWS_VISTA
          Windows Vista platform.
static Platform WINDOWS_XP
          Windows XP platform.
 
Constructor Summary
Platforms()
           
 
Method Summary
protected  boolean exists(String path)
          Determines if the specified path exists.
protected  Platform findMatch(String name, Platform.Name pname, Platform.Arch arch, String version)
          Attempts to find a platform that matches the platform name, architecture and version.
 Platform.Arch getArch(String arch)
          Returns the platform family name given the operating system or symbolic name.
 Platform.Name getCurrentOSName()
          Returns the platform family name for the current operating system.
protected  Platform.Name getCurrentOSName(String name)
          Returns the platform family name for the current operating system.
 Platform getCurrentPlatform()
          Returns the current platform.
 Platform getCurrentPlatform(String name, String arch)
          Returns the platform for the specified operating system name and architecture.
 Platform getCurrentPlatform(String name, String arch, String version)
          Returns the current platform given the operating system name, architecture and version.
 Platform getCurrentPlatform(String name, String arch, String version, String javaVersion)
          Returns the current platform given the operating system name, architecture and version.
protected  Platform.Name getLinuxName()
          Returns the Linux platform family name.
 Platform.Name getName(String name)
          Returns the platform family name for the specified operating system name.
protected  Platform getPlatform(Platform match, Platform.Arch arch, String version, String javaVersion)
          Constructs a new Platform given a match, architecture, version and java version
 Platform getPlatform(String name, String arch)
          Returns the platform for the specified operating system name and architecture.
 Platform getPlatform(String name, String arch, String version)
          Returns the platform given the operating system name, architecture and version.
 Platform getPlatform(String name, String arch, String version, String javaVersion)
          Returns the platform given the operating system name, architecture and version.
protected  String getReleasePath()
          Returns the release info file path, for Linux distributions.
protected  List<String> getText(String path)
          Returns the text from the specified file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AIX

public static Platform AIX
AIX platform.


DEBIAN_LINUX

public static Platform DEBIAN_LINUX
Debian Linux platform.


FEDORA_LINUX

public static Platform FEDORA_LINUX
Fedora Linux platform.


FREEBSD

public static Platform FREEBSD
FreeBSD platform.


HP_UX

public static Platform HP_UX
HP/UX platform.


LINUX

public static Platform LINUX
Generic Linux platform.


MAC

public static Platform MAC
Mac platform.


MAC_OSX

public static Platform MAC_OSX
Mac OSX platform.


MANDRAKE_LINUX

public static Platform MANDRAKE_LINUX
Mandrake Linux platform.


MANDRIVA_LINUX

public static Platform MANDRIVA_LINUX
Mandriva Linux platform.


OS_2

public static Platform OS_2
OS/2 platform.


RED_HAT_LINUX

public static Platform RED_HAT_LINUX
Red Hat Linux platform.


SUNOS

public static Platform SUNOS
SunOS platform.


SUNOS_X86

public static Platform SUNOS_X86
SunOS/x86 platform.


SUNOS_SPARC

public static Platform SUNOS_SPARC
SunOS/SPARC platform.


SUSE_LINUX

public static Platform SUSE_LINUX
SuSE Linux platform.


UNIX

public static Platform UNIX
Generic UNIX platform.


UBUNTU_LINUX

public static Platform UBUNTU_LINUX
Ubuntu Linux platform.


WINDOWS

public static Platform WINDOWS
Windows platform.


WINDOWS_XP

public static Platform WINDOWS_XP
Windows XP platform.


WINDOWS_2003

public static Platform WINDOWS_2003
Windows 2003 platform.


WINDOWS_VISTA

public static Platform WINDOWS_VISTA
Windows Vista platform.


WINDOWS_7

public static Platform WINDOWS_7
Windows 7 platform.


WINDOWS_8

public static Platform WINDOWS_8
Windows 7 platform.


PLATFORMS

public static Platform[] PLATFORMS
Known platforms.

Constructor Detail

Platforms

public Platforms()
Method Detail

getCurrentPlatform

public Platform getCurrentPlatform()
Returns the current platform.

This may query the underlying OS to determine the platform name.

Returns:
the current platform

getCurrentPlatform

public Platform getCurrentPlatform(String name,
                                   String arch)
Returns the platform for the specified operating system name and architecture.

This may query the underlying OS to determine the platform name.

Parameters:
name - the operating system name
arch - the operating system architecture, or symbolic architecture
Returns:
the corresponding platform

getCurrentPlatform

public Platform getCurrentPlatform(String name,
                                   String arch,
                                   String version)
Returns the current platform given the operating system name, architecture and version.

This may query the underlying OS to determine the platform name.

Parameters:
name - the operating system name
arch - the operating system architecture, or symbolic architecture
version - the operating system version. May be null
Returns:
the corresponding platform

getCurrentPlatform

public Platform getCurrentPlatform(String name,
                                   String arch,
                                   String version,
                                   String javaVersion)
Returns the current platform given the operating system name, architecture and version.

This may query the underlying OS to determine the platform name.

Parameters:
name - the operating system name
arch - the operating system architecture, or symbolic architecture
version - the operating system version. May be null
javaVersion - the java version. May be null
Returns:
the corresponding platform

getPlatform

public Platform getPlatform(String name,
                            String arch)
Returns the platform for the specified operating system name and architecture.

Parameters:
name - the operating system name or symbolic name
arch - the operating system architecture, or symbolic architecture
Returns:
the corresponding platform

getPlatform

public Platform getPlatform(String name,
                            String arch,
                            String version)
Returns the platform given the operating system name, architecture and version.

Parameters:
name - the operating system name or symbolic name
arch - the operating system architecture, or symbolic architecture
version - the operating system version. May be null
Returns:
the corresponding platform

getPlatform

public Platform getPlatform(String name,
                            String arch,
                            String version,
                            String javaVersion)
Returns the platform given the operating system name, architecture and version.

Parameters:
name - the operating system name or symbolic name
arch - the operating system architecture, or symbolic architecture
version - the operating system version. May be null
javaVersion - the java version
Returns:
the corresponding platform

getArch

public Platform.Arch getArch(String arch)
Returns the platform family name given the operating system or symbolic name.

Parameters:
arch - the operating system architecture or symbolic architecture. May be null
Returns:
the corresponding platform architecture

getCurrentOSName

public Platform.Name getCurrentOSName()
Returns the platform family name for the current operating system. This may query the underlying OS to determine the platform name.

Returns:
the corresponding platform family name

getName

public Platform.Name getName(String name)
Returns the platform family name for the specified operating system name.

Parameters:
name - the operating system name, or symbolic name
Returns:
the corresponding platform family name

getCurrentOSName

protected Platform.Name getCurrentOSName(String name)
Returns the platform family name for the current operating system. This may query the underlying OS to determine the platform name.

Returns:
the corresponding platform family name

getPlatform

protected Platform getPlatform(Platform match,
                               Platform.Arch arch,
                               String version,
                               String javaVersion)
Constructs a new Platform given a match, architecture, version and java version

Parameters:
match - the matching platform. If null the new platform will have name set to Platform.Name.UNKNOWN.
arch - the platform architecture
version - the platform version. May be null
javaVersion - the java version. May be null
Returns:
a new platform

findMatch

protected Platform findMatch(String name,
                             Platform.Name pname,
                             Platform.Arch arch,
                             String version)
Attempts to find a platform that matches the platform name, architecture and version.

Parameters:
name - the platform name or symbolic name
pname - the resolved platform name
arch - the resolved architecture
version - the version. May be null
Returns:
the closest match to the arguments, or null if none is found

getLinuxName

protected Platform.Name getLinuxName()
Returns the Linux platform family name.

Returns:
the Linux platform family name

getText

protected List<String> getText(String path)
Returns the text from the specified file.

Parameters:
path - the file path
Returns:
the corresponding text, or null if the file could not be read

getReleasePath

protected String getReleasePath()
Returns the release info file path, for Linux distributions.

Returns:
name of the file the release info is stored in for Linux distributions

exists

protected boolean exists(String path)
Determines if the specified path exists.

Parameters:
path - the path
Returns:
true if the path exists, otherwise false


Copyright © 2015. All rights reserved.