All Packages  This Package  Class Hierarchy  Class Search  Index

Class glguerin.authkit.imp.macosx.AuthProcess
java.lang.Object
   |
   +----java.lang.Process
           |
           +----glguerin.authkit.imp.macosx.AuthProcess

  Summary

public final class  AuthProcess
     extends java.lang.Process
{
          // Constructors 1
     protected AuthProcess(String, int, int);

          // Methods 10
     protected static native int close(int);
     protected static native int read(int, byte[], int, int);
     protected static native int write(int, byte[], int, int);

     public void destroy();
     public int exitValue();
     public InputStream getErrorStream();
     public InputStream getInputStream();
     public OutputStream getOutputStream();
     public String toString();
     public int waitFor() throws InterruptedException;

          // Inner Classes 2
     public static class AuthProcess.FIn
     public static class AuthProcess.FOut
}

AuthProcess represents the privileged child-process created by MacOSXAuthorization. This class owes much of its decrepitude to the decrepitude of the Authorization Services API function that runs the privileged process. That is, this class sucks because AuthorizationExecuteWithPrivileges() sucks.

The nested classes FIn and FOut are needed because I have no details on how Java's normal file-descriptor class, FileDescriptor, is actually implemented in a given JVM. IMHO, exposing FileDescriptor without a clearly defined API or rationale for it was a mistake. It should be internal, or it should have a reason for being public. As it now stands, it's just a pointless impediment to clarity and portability.




  Constructors

· AuthProcess

Summary  |  Top

   protected AuthProcess(String name, 
                         int inFD, 
                         int outFD) 

The FD's may be identical, in which case the pipe is bidirectional, and closing either stream will close the other, too. This is bad, but all the other options are worse.



  Methods

· toString

Summary  |  Top
   public String toString() 

Return name at creation.

Overrides:
toString in class Object


· getOutputStream

Summary  |  Top
   public OutputStream getOutputStream() 

Return the stream feeding stdin of the subprocess.

Overrides:
getOutputStream in class Process


· getInputStream

Summary  |  Top
   public InputStream getInputStream() 

Return the stream fed by stdout of the subprocess.

Overrides:
getInputStream in class Process


· getErrorStream

Summary  |  Top
   public InputStream getErrorStream() 

Return the stream fed by stderr of the subprocess.

Not implemented, so always throws an IllegalArgumentException.

Overrides:
getErrorStream in class Process


· waitFor

Summary  |  Top
   public int waitFor()  throws InterruptedException

Wait for the subprocess to terminate (exit).

Not implemented, so always throws an IllegalArgumentException.

Overrides:
waitFor in class Process


· exitValue

Summary  |  Top
   public int exitValue() 

Return the exit value, or throw an IllegalThreadStateException if this Process has not terminated (exited) yet.

Not implemented, so always throws an IllegalArgumentException.

Overrides:
exitValue in class Process


· destroy

Summary  |  Top
   public void destroy() 

Forcibly terminate this Process.

Not implemented, so always throws an IllegalArgumentException.

Overrides:
destroy in class Process


· read

Summary  |  Top
   protected static native int read(int inFD, 
                                    byte[] buf, 
                                    int offset, 
                                    int count) 

Read bytes, returning count actually read, or 0 on EOF, or -errno on error.

The specific reasons for failure may be distinguished by decoding negative numbers as errno negatives, or all failures can be lumped together into one IOException flavor.



· write

Summary  |  Top
   protected static native int write(int outFD, 
                                     byte[] buf, 
                                     int offset, 
                                     int count) 

Write bytes, returning count actually written, or -errno on error.

The specific reasons for failure may be distinguished by decoding negative numbers as errno negatives, or all failures can be lumped together into one IOException flavor.



· close

Summary  |  Top
   protected static native int close(int aFD) 

Close the file-descriptor, returning 0 on success or errno on failure. Unlike read() and write(), the actual errno value, not its negative, is returned.



All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7