com.izforge.izpack.util
Class Platform

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

public class Platform
extends Object

Encapsulates details of the operating system platform.

Author:
Tim Anderson

Nested Class Summary
static class Platform.Arch
          The operating system architecture.
static class Platform.Name
          Platform family name.
 
Field Summary
static String[] invalidWindowsDirectoryChars
          Invalid Windows Characters http://msdn.microsoft.com/en-us/library/aa365247.aspx Forward slash not included because installer will end up creating directory with backslash NOTE: We choose double backslash to be invalid rather than just backslash, because we are checking against paths A normal backslash would just represent another folder
 
Constructor Summary
Platform(Platform.Name name)
          Constructs a Platform from the specified name.
Platform(Platform.Name name, Platform.Arch arch)
          Constructs a Platform.
Platform(Platform.Name name, String version)
          Constructs a Platform from the specified name and version.
Platform(Platform.Name name, String symbolicName, Platform.Arch arch)
          Constructs a Platform.
Platform(Platform.Name name, String symbolicName, String version)
          Constructs a Platform.
Platform(Platform.Name name, String symbolicName, String version, Platform.Arch arch)
          Constructs a Platform.
Platform(Platform.Name name, String symbolicName, String version, Platform.Arch arch, String javaVersion)
          Constructs a Platform.
Platform(Platform platform, Platform.Arch arch)
          Constructs a Platform from another, with the specified architecture.
 
Method Summary
 boolean equals(Object other)
          Determines if this platform equals another.
 Platform.Arch getArch()
          Returns the operating system architecture.
 String getJavaVersion()
          Returns the java version.
 Platform.Name getName()
          Returns the platform family name.
 String getSymbolicName()
          Returns the symbolic name for the platform.
 String getVersion()
          Returns the operating system version.
 int hashCode()
          Returns a hash for the platform.
 boolean isA(Platform.Arch arch)
          Determines if this platform is the specified architecture.
 boolean isA(Platform.Name name)
          Determines if this platform is an instance of the platform family name.
 boolean isA(Platform platform)
          Determines if this platform is an instance of another.
 boolean isValidDirectoryPath(File directory)
          Check if a fully qualified directory path contains valid syntax.
 boolean isValidDirectoryPath(String directoryPath)
           
 boolean isValidDirectorySyntax(String directoryPath)
          Determine invalid directory character for the given OS.
 String toString()
          Returns a string representation of the platform.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

invalidWindowsDirectoryChars

public static final String[] invalidWindowsDirectoryChars
Invalid Windows Characters http://msdn.microsoft.com/en-us/library/aa365247.aspx Forward slash not included because installer will end up creating directory with backslash NOTE: We choose double backslash to be invalid rather than just backslash, because we are checking against paths A normal backslash would just represent another folder

Constructor Detail

Platform

public Platform(Platform.Name name)
Constructs a Platform from the specified name.

Parameters:
name - the platform name

Platform

public Platform(Platform.Name name,
                String version)
Constructs a Platform from the specified name and version.

Parameters:
name - the platform name
version - the platform version. May be null

Platform

public Platform(Platform.Name name,
                String symbolicName,
                String version)
Constructs a Platform.

Parameters:
name - the platform name
symbolicName - the symbolic name. May be null
version - the platform version. May be null
Throws:
IllegalArgumentException - if symbolicName contains spaces or commas

Platform

public Platform(Platform.Name name,
                Platform.Arch arch)
Constructs a Platform.

Parameters:
name - the platform name
arch - the platform architecture. May be null

Platform

public Platform(Platform.Name name,
                String symbolicName,
                Platform.Arch arch)
Constructs a Platform.

Parameters:
name - the platform name
symbolicName - the symbolic name. May be null
arch - the platform architecture. May be null
Throws:
IllegalArgumentException - if symbolicName contains spaces or commas

Platform

public Platform(Platform.Name name,
                String symbolicName,
                String version,
                Platform.Arch arch)
Constructs a Platform.

Parameters:
name - the platform name
symbolicName - the symbolic name. May be null
version - the platform version. May be null
arch - the platform architecture. May be null
Throws:
IllegalArgumentException - if symbolicName contains spaces or commas

Platform

public Platform(Platform.Name name,
                String symbolicName,
                String version,
                Platform.Arch arch,
                String javaVersion)
Constructs a Platform.

Parameters:
name - the platform name
symbolicName - the symbolic name. May be null
version - the platform version. May be null
arch - the platform architecture. May be null
javaVersion - the java version. May be null
Throws:
IllegalArgumentException - if symbolicName contains spaces or commas

Platform

public Platform(Platform platform,
                Platform.Arch arch)
Constructs a Platform from another, with the specified architecture.

Parameters:
platform - the template
arch - the architecture
Method Detail

getName

public Platform.Name getName()
Returns the platform family name.

Returns:
the platform family name

getSymbolicName

public String getSymbolicName()
Returns the symbolic name for the platform.

This is not the OS name. It is an arbitrary name that may be used to help identify a platform. E.g. windows_7 for name=WINDOWS,version=6.1.

Returns:
the symbolic name for the platform. May be null

getVersion

public String getVersion()
Returns the operating system version.

Returns:
the operating system version. May be null

getJavaVersion

public String getJavaVersion()
Returns the java version.

Returns:
the java version. May be null

getArch

public Platform.Arch getArch()
Returns the operating system architecture.

Returns:
the operating system architecture

isA

public boolean isA(Platform platform)
Determines if this platform is an instance of another.

Parameters:
platform - the platform to compare against
Returns:
true if the platform is an instance of platform

isA

public boolean isA(Platform.Name name)
Determines if this platform is an instance of the platform family name.

Parameters:
name - the platform family name
Returns:
true if the platform is an instance of name

isA

public boolean isA(Platform.Arch arch)
Determines if this platform is the specified architecture.

Parameters:
arch - the architecture
Returns:
true if this platform is the specified architecture, otherwise false

isValidDirectorySyntax

public boolean isValidDirectorySyntax(String directoryPath)
Determine invalid directory character for the given OS. Expects the the driver name has already been trimmed of.

Returns:

isValidDirectoryPath

public boolean isValidDirectoryPath(File directory)
Check if a fully qualified directory path contains valid syntax.

Parameters:
directory -
Returns:

isValidDirectoryPath

public boolean isValidDirectoryPath(String directoryPath)

equals

public boolean equals(Object other)
Determines if this platform equals another.

Overrides:
equals in class Object
Parameters:
other - the other instance
Returns:
true if the name, arch and version are identical, otherwise false

hashCode

public int hashCode()
Returns a hash for the platform.

Overrides:
hashCode in class Object
Returns:
a hash for the platform

toString

public String toString()
Returns a string representation of the platform.

Overrides:
toString in class Object
Returns:
a string representation of the platform


Copyright © 2015. All rights reserved.