com.starteam.util
Class Platform

java.lang.Object
  extended by com.starteam.util.Platform

public final class Platform
extends java.lang.Object

Information about the current platform.


Nested Class Summary
static class Platform.EOL
          The end-of-line sequence on different platforms
static interface Platform.WorkStationOptions
          Platform specific options saved in local workstation .ini files A Windows & a Unix implementation are available Applications should have no reason to implement this interface
 
Field Summary
static java.lang.String ONWINDOWSPROP
          You can set this system property on (any value will do) if you want to force the Platform class to use Win32 access to file properties and ConnectionManager.ini file.
 
Method Summary
static boolean getCaseSensitiveFileNames()
          Returns true if file names are case sensitive.
static java.lang.String getEOL()
          Return the end of line convention.
static boolean getFileExecutable(java.io.File file)
          Return true if the file is "executable" by the user.
static DateTime getFileLastModified(java.io.File file)
          returns the last modified time for the given file via a native platform call
static DateTime getFileLastModified(java.lang.String fileName)
          returns the last modified time for the given file via a native platform call
static long getFileLength(java.lang.String fileName)
           
static java.lang.String getFilePathDelimiter()
          Return file name path delimiter.
static boolean getFileWritable(java.io.File file)
          return true if the file is writable
static java.lang.String getHostAddress()
          Return this machine's host IP Address
static long getLastModified(java.io.File file)
          returns the last modified time for the given file via a native platform call
static long getLastModified(java.lang.String fileName)
          returns the last modified time for the given file via a native platform call
static java.lang.String getMachineName()
          Return this machine's name
static java.lang.String getOSName()
          Gets a descriptive name for the operating system.
static java.lang.String getSetReadOnlyCmd()
          return the 'set read only' command
static java.lang.String getSetWritableCmd()
          return the 'set writable' command
static java.lang.String getTempDirectoryPath()
          returns the path to the temp directory, if available, or to the local directory if not
static java.lang.String getTouchCmd()
          return the touch command
static GUID getWorkStationID()
          return the Workstation GUID
static Platform.WorkStationOptions getWSOptions()
           
static boolean isDotNET()
          Determines whether or not we are running in a .NET environment.
static boolean isRemoteDrive(java.lang.String fileName)
           
static boolean isWin32()
          Determines whether or not we are running on a Win32 computer.
static void loadFileAttributes(FileAccess.Attributes[] attributes)
          Load all available attributes from the file system in bulk (where necessary) Each attribute object in the array should have the fully qualified file name (with path) specified.
static java.lang.String[] parse(java.lang.String payload, java.lang.String pattern)
          Parse the given payload using a regular expression pattern Picks an appropriate platform specific pattern matcher, i.e, this implementation depends upon a core-edge strategy using the Pattern class in java and the RegEx class in .NET
static void setFileExecutable(java.io.File file, boolean executable)
          Change whether or not the specified file should be marked "executable".
static void setFileLastModified(java.io.File file, double oletime)
          Set the last modification time for the file
static void setFileWritable(java.io.File file, boolean val)
          set the file writable bit
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ONWINDOWSPROP

public static final java.lang.String ONWINDOWSPROP
You can set this system property on (any value will do) if you want to force the Platform class to use Win32 access to file properties and ConnectionManager.ini file.

See Also:
Constant Field Values
Method Detail

isWin32

public static boolean isWin32()
Determines whether or not we are running on a Win32 computer. Currently, this is determined from the operating system name. To force the SDK to use Win32 behaviors, set the "onwin32" system property (e.g., -Donwin32=y).

Returns:
true if running under Win32.

isDotNET

public static boolean isDotNET()
Determines whether or not we are running in a .NET environment.

Returns:
true if we are running in a .NET environment.

getOSName

public static java.lang.String getOSName()
Gets a descriptive name for the operating system.

Returns:
A descriptive name for the operating system.

getTempDirectoryPath

public static java.lang.String getTempDirectoryPath()
returns the path to the temp directory, if available, or to the local directory if not

Returns:
the path to the temp directory, if available, or to the local directory if not

getWSOptions

public static Platform.WorkStationOptions getWSOptions()

getMachineName

public static final java.lang.String getMachineName()
Return this machine's name


getHostAddress

public static final java.lang.String getHostAddress()
Return this machine's host IP Address


getEOL

public static final java.lang.String getEOL()
Return the end of line convention.


getFilePathDelimiter

public static final java.lang.String getFilePathDelimiter()
Return file name path delimiter.


parse

public static java.lang.String[] parse(java.lang.String payload,
                                       java.lang.String pattern)
Parse the given payload using a regular expression pattern Picks an appropriate platform specific pattern matcher, i.e, this implementation depends upon a core-edge strategy using the Pattern class in java and the RegEx class in .NET

Parameters:
payload - the string to be parsed
pattern - the regular expression to match
Returns:
an array of matches (if any), which may be empty, but never NULL

getCaseSensitiveFileNames

public static boolean getCaseSensitiveFileNames()
Returns true if file names are case sensitive.

Returns:
true if file names are case sensitive.

getTouchCmd

public static java.lang.String getTouchCmd()
return the touch command

Returns:
the touch command

getSetReadOnlyCmd

public static java.lang.String getSetReadOnlyCmd()
return the 'set read only' command

Returns:
the 'set read only' command

getSetWritableCmd

public static java.lang.String getSetWritableCmd()
return the 'set writable' command

Returns:
the 'set writable' command

getWorkStationID

public static GUID getWorkStationID()
return the Workstation GUID

Returns:
the Workstation GUID

getLastModified

public static long getLastModified(java.io.File file)
                            throws java.io.IOException
returns the last modified time for the given file via a native platform call

Parameters:
file - File
Returns:
long the last modified time
Throws:
java.io.IOException

getFileLastModified

public static DateTime getFileLastModified(java.io.File file)
                                    throws java.io.IOException
returns the last modified time for the given file via a native platform call

Parameters:
file - File
Returns:
double the last modified time converted to an OLE double
Throws:
java.io.IOException

getLastModified

public static long getLastModified(java.lang.String fileName)
                            throws java.io.IOException
returns the last modified time for the given file via a native platform call

Parameters:
fileName - String the absolute path to the file
Returns:
long the last modified time
Throws:
java.io.IOException

getFileLastModified

public static DateTime getFileLastModified(java.lang.String fileName)
                                    throws java.io.IOException
returns the last modified time for the given file via a native platform call

Parameters:
fileName - String the absolute path to the file
Returns:
double the last modified time converted to an OLE double
Throws:
java.io.IOException

getFileLength

public static long getFileLength(java.lang.String fileName)
                          throws java.io.IOException
Parameters:
fileName - the name of the specified file
Returns:
The length of the file.
Throws:
java.io.IOException - if an I/0 error occurs trying to access the file.

isRemoteDrive

public static boolean isRemoteDrive(java.lang.String fileName)
Parameters:
fileName - the fully qualified name of the specified file
Returns:
true if the path represented by the file is a remote drive only supported on Windows patforms

setFileLastModified

public static void setFileLastModified(java.io.File file,
                                       double oletime)
                                throws java.io.IOException
Set the last modification time for the file

Parameters:
file - the file
oletime - the last modified time
Throws:
java.io.IOException - throw an excpetion on error

getFileWritable

public static final boolean getFileWritable(java.io.File file)
return true if the file is writable

Parameters:
file - the file
Returns:
true if the file is writable

setFileWritable

public static void setFileWritable(java.io.File file,
                                   boolean val)
                            throws java.io.IOException
set the file writable bit

Parameters:
file - the file
val - true to mark the file as writable
Throws:
java.io.IOException - throw an exception on error

getFileExecutable

public static boolean getFileExecutable(java.io.File file)
                                 throws java.io.IOException
Return true if the file is "executable" by the user. The interpretation of what this means will vary by platform.

Parameters:
file - the specified file
Throws:
java.io.IOException - if an I/0 error occurs trying to access the file.

setFileExecutable

public static void setFileExecutable(java.io.File file,
                                     boolean executable)
                              throws java.io.IOException
Change whether or not the specified file should be marked "executable".

Parameters:
file - the specified file
executable - true if the file should be marked executable
Throws:
java.io.IOException - if an I/0 error occurs trying to access the file.

loadFileAttributes

public static void loadFileAttributes(FileAccess.Attributes[] attributes)
Load all available attributes from the file system in bulk (where necessary) Each attribute object in the array should have the fully qualified file name (with path) specified. The returned results will contain the rest of the attributes;

Parameters:
attributes - the attributes to load


StarTeam SDK 14.0, Build 21
Copyright © 2003-2012 Borland Software Corporation. All rights reserved.