moss.kernel
Class MExec

java.lang.Object
  extended by moss.kernel.MExec

public class MExec
extends java.lang.Object

the MExec class provides the necessary to allow the kernel to load some program from the file-system


Field Summary
static int EXEC_CLASS
          Java class (that should implement an appropriate executable interface)
static int EXEC_INVALID
          invalid executable
static int EXEC_SCRIPT
          script-based command
 
Constructor Summary
MExec()
          constructor: creates a new MExec
 
Method Summary
 java.lang.String classnameof()
          returns a string providing a class-name for MExecCL objects.
 int errorof()
          returns the last reported error for this MExec object
 java.lang.ClassLoader getclassloader()
          returns a class loader for some executable
static MExec load_active(java.lang.String path)
          this is called to return an already loaded MExec for a path (ie something that is already running).
 int setpath(java.lang.String path)
          sets the file for an MExec -- this will look at the file and attempt to determine what type it is.
 java.lang.String[] shebangof()
          returns the array of strings that represents the hash-bang path, with this executable's name attached
static void store_active(MExec exec, java.lang.String path)
          adds an MExec to the list of those loaded
static void trash_active(MExec exec, java.lang.String path)
          this removes a loaded MExec, called when a process is done using it (during process shutdown)
 int typeof()
          return the MExec type of this object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXEC_INVALID

public static final int EXEC_INVALID
invalid executable

See Also:
Constant Field Values

EXEC_CLASS

public static final int EXEC_CLASS
Java class (that should implement an appropriate executable interface)

See Also:
Constant Field Values

EXEC_SCRIPT

public static final int EXEC_SCRIPT
script-based command

See Also:
Constant Field Values
Constructor Detail

MExec

public MExec()
constructor: creates a new MExec

Method Detail

setpath

public int setpath(java.lang.String path)
sets the file for an MExec -- this will look at the file and attempt to determine what type it is.

Parameters:
path - path to executable file
Returns:
0 on success, or < 0 indicating error

getclassloader

public java.lang.ClassLoader getclassloader()
returns a class loader for some executable

Returns:
class-loader on success or null on error

classnameof

public java.lang.String classnameof()
returns a string providing a class-name for MExecCL objects. This is needed since the Java class-loading mechanism (sensibly) won't allow things like lowercase file-names as class names. This just fudges a name -- the actual classloader knows what it really is.


shebangof

public java.lang.String[] shebangof()
returns the array of strings that represents the hash-bang path, with this executable's name attached


errorof

public int errorof()
returns the last reported error for this MExec object

Returns:
error-code

typeof

public int typeof()
return the MExec type of this object

Returns:
EXEC_... type constant

load_active

public static MExec load_active(java.lang.String path)
this is called to return an already loaded MExec for a path (ie something that is already running).

Parameters:
path - path to executable
Returns:
MExec class or null if not found

store_active

public static void store_active(MExec exec,
                                java.lang.String path)
adds an MExec to the list of those loaded

Parameters:
exec - MExec representing the executable
path - path to the executable

trash_active

public static void trash_active(MExec exec,
                                java.lang.String path)
this removes a loaded MExec, called when a process is done using it (during process shutdown)

Parameters:
exec - MExec representing the executable
path - path to the executable