Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.tuneology.avm
Class Native  view Native download Native.java

java.lang.Object
  extended bycom.tuneology.avm.Native

public class Native
extends java.lang.Object

This class extends the System and Runtime classes to provide extra functionality.

Version:
$Id: Native.java,v 1.5 2002/11/06 09:22:57 xnarf Exp $

Nested Class Summary
static interface Native.LineReader
          This class gets called for each line of output generated by the program.
static interface Native.Logger
          This class is called for each line of output generated by a shell program.
private static class Native.ProcReader
           
 
Field Summary
static java.lang.String distName
          For linux, contains the name and version of the distribution.
static boolean isLinux
          True if the jvm is running on Linux.
static boolean isSolaris
          True if the jvm is running on Solaris.
static boolean isWindows
          True if the jvm is running on some sort of Windows.
private static Native.Logger logger
           
private static java.lang.String mkfifoCmd
           
private static java.lang.String osName
           
private static java.util.ResourceBundle resources
           
static java.lang.String version
          Contains the version information for java-avm.
 
Constructor Summary
private Native()
           
 
Method Summary
static java.lang.Process exec(java.lang.String[] cmd)
           
static java.lang.String getArgString(java.lang.String[] cmd)
          Returns the list of arguments quoted in a single string, for logging purposes.
static java.lang.String getArgString(java.util.Vector cmd)
          Returns the list of arguments quoted in a single string, for logging purposes.
(package private) static java.util.Vector getMkfifoCmd()
          Returns the mkfifo command.
static java.lang.String getResourceString(java.lang.String str)
          Returns a string from the resource bundle.
static java.lang.String[] getStringArray(java.util.Vector v)
          Takes a vector of strings and creates an array of strings.
private static boolean i_isExecutable(java.lang.String path)
           
static boolean isExecutable(java.lang.String path)
          Returns true if the pathname specifies an executable program.
private static java.lang.String logCmd(java.lang.String[] cmd, java.io.File dir)
           
private static java.lang.String logCmd(java.lang.String cmd, java.io.File dir)
           
static void mkfifo(java.io.File f)
          For Unix only: executes the mkfifo command.
static java.util.Vector parseUserInput(java.lang.String str)
          Parses the user input and returns it in the form of a vector of strings, ready to pass to runCommand.
private static boolean processLine(Native.LineReader rdr, java.lang.String str)
           
private static int runCommand(java.lang.Process proc, java.lang.String logStr, Native.LineReader lrdr, boolean logOutput, long startTime)
           
static int runCommand(java.lang.String[] cmd, java.io.File dir, Native.LineReader lrdr, boolean logOutput)
          Runs the specified external program.
static int runCommand(java.lang.String cmd, java.io.File dir, Native.LineReader lrdr, boolean logOutput)
          Runs the specified external program.
static int runCommand(java.util.Vector v, java.io.File dir, Native.LineReader lrdr, boolean logOutput)
          Runs the specified external program.
static void setLogger(Native.Logger l)
          All process I/O is logged to this interface.
static void setMkfifoCmd(java.lang.String s)
          Sets the shell command used for mkfifo.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isWindows

public static final boolean isWindows
True if the jvm is running on some sort of Windows.


isLinux

public static final boolean isLinux
True if the jvm is running on Linux.


isSolaris

public static final boolean isSolaris
True if the jvm is running on Solaris.


distName

public static final java.lang.String distName
For linux, contains the name and version of the distribution.


version

public static final java.lang.String version
Contains the version information for java-avm.

See Also:
Constant Field Values

osName

private static final java.lang.String osName

mkfifoCmd

private static java.lang.String mkfifoCmd

logger

private static Native.Logger logger

resources

private static java.util.ResourceBundle resources
Constructor Detail

Native

private Native()
Method Detail

getArgString

public static java.lang.String getArgString(java.lang.String[] cmd)
Returns the list of arguments quoted in a single string, for logging purposes.


getArgString

public static java.lang.String getArgString(java.util.Vector cmd)
Returns the list of arguments quoted in a single string, for logging purposes.


parseUserInput

public static java.util.Vector parseUserInput(java.lang.String str)
Parses the user input and returns it in the form of a vector of strings, ready to pass to runCommand. Values within double quotes are preserved as is otherwise, spaces delimit args.


exec

public static java.lang.Process exec(java.lang.String[] cmd)
                              throws java.io.IOException

runCommand

public static int runCommand(java.lang.String cmd,
                             java.io.File dir,
                             Native.LineReader lrdr,
                             boolean logOutput)
                      throws java.lang.Exception
Runs the specified external program. Blocks until the program exits.


runCommand

public static int runCommand(java.util.Vector v,
                             java.io.File dir,
                             Native.LineReader lrdr,
                             boolean logOutput)
                      throws java.lang.Exception
Runs the specified external program. Blocks until the program exits.


runCommand

public static int runCommand(java.lang.String[] cmd,
                             java.io.File dir,
                             Native.LineReader lrdr,
                             boolean logOutput)
                      throws java.lang.Exception
Runs the specified external program. Blocks until the program exits.


getStringArray

public static java.lang.String[] getStringArray(java.util.Vector v)
Takes a vector of strings and creates an array of strings.


mkfifo

public static void mkfifo(java.io.File f)
                   throws java.lang.Exception
For Unix only: executes the mkfifo command.


isExecutable

public static boolean isExecutable(java.lang.String path)
Returns true if the pathname specifies an executable program.


setMkfifoCmd

public static void setMkfifoCmd(java.lang.String s)
Sets the shell command used for mkfifo.


setLogger

public static void setLogger(Native.Logger l)
All process I/O is logged to this interface.


getResourceString

public static java.lang.String getResourceString(java.lang.String str)
Returns a string from the resource bundle.


getMkfifoCmd

static java.util.Vector getMkfifoCmd()
Returns the mkfifo command.


processLine

private static boolean processLine(Native.LineReader rdr,
                                   java.lang.String str)
                            throws java.lang.Exception

logCmd

private static java.lang.String logCmd(java.lang.String cmd,
                                       java.io.File dir)

logCmd

private static java.lang.String logCmd(java.lang.String[] cmd,
                                       java.io.File dir)

runCommand

private static int runCommand(java.lang.Process proc,
                              java.lang.String logStr,
                              Native.LineReader lrdr,
                              boolean logOutput,
                              long startTime)
                       throws java.lang.Exception

i_isExecutable

private static boolean i_isExecutable(java.lang.String path)