com.denova.runtime
Class UnixCommands

java.lang.Object
  |
  +--com.denova.runtime.UnixCommands

public class UnixCommands
extends java.lang.Object

Issue standard unix commands.

Author:
DeNova Copyright © 1997-2008 DeNova All rights reserved worldwide.

Field Summary
static java.lang.String UnixOsLogFilename
          Diagnostic log for class.
 
Constructor Summary
UnixCommands()
           
 
Method Summary
static boolean chmod(java.lang.String permissions, java.lang.String fullpath)
          Change the permissions on a file.
static java.lang.String[] getEnvironment()
           
static java.lang.String getSystemPath()
          Get the system's path from the environment.
static void ln(java.lang.String existingFilename, java.lang.String linkedFilename)
          Symbolically link a file.
static boolean mkdirs(java.lang.String dirPath, java.lang.String permissions)
          Creates dir path, and sets specified permissions on dirs.
static void setLog(com.denova.io.Log l)
          Set the filename for the log.
static void symbolicallyLinkFile(java.lang.String existingFilename, java.lang.String linkedFilename)
          Symbolically link a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UnixOsLogFilename

public static final java.lang.String UnixOsLogFilename
Diagnostic log for class.

See Also:
Constant Field Values
Constructor Detail

UnixCommands

public UnixCommands()
Method Detail

getSystemPath

public static java.lang.String getSystemPath()
Get the system's path from the environment.

This algorithm seems to be more for MSWindows than any *nix. What *nix uses "set"? We're getting away with this because "echo $PATH" works.

First, tries to get the path with an "echo $PATH" command; then with the "echo $path" command, and finall with a "set" command. Assumes the results of all of these commands can be redirected to a file. If the unix system doesn't support redirection on these commands, then the method returns an empty string.

returns: string with the full list; depending on the shell, the string can be separated by the path separator or blanks.

Returns:
the systemPath

chmod

public static boolean chmod(java.lang.String permissions,
                            java.lang.String fullpath)
Change the permissions on a file. The Unix chmod command is executed so you use the same permissions and wildcard details available via this standard command.

Parameters:
permissions - permissions for the file
fullpath - full path to the file
Returns:
true if successful changing the permissions

ln

public static void ln(java.lang.String existingFilename,
                      java.lang.String linkedFilename)
Symbolically link a file.
Sames as symbolicallyLinkFile().

Parameters:
existingFilename - file to create a link to
linkedFilename - symbolically linked file

symbolicallyLinkFile

public static void symbolicallyLinkFile(java.lang.String existingFilename,
                                        java.lang.String linkedFilename)
Symbolically link a file.

Parameters:
existingFilename - file to create a link to
linkedFilename - symbolically linked file

setLog

public static void setLog(com.denova.io.Log l)
Set the filename for the log.

Parameters:
l - The new log value

getEnvironment

public static java.lang.String[] getEnvironment()

mkdirs

public static boolean mkdirs(java.lang.String dirPath,
                             java.lang.String permissions)
Creates dir path, and sets specified permissions on dirs. Permissions must be octal instead of symbolic because under OSX (at least as of 10.2) chmod can't handle symbolic permission strings.

Parameters:
dirPath - directory or directory path
permissions - as an octal string
Returns:
success