Hi

Brett Porter wrote:
Hi,

Back in September 05 (wow, is it really 2006 already? :) Jerome sent a
comprehensive vision for exec. I found myself agreeing with most
everything in there (I'll reply to a couple of specifics shortly).

Message ID from then: <[EMAIL PROTECTED]>

However, it was long and wordy. I think the key part was that "we should
have a minimal exposed API". Maybe a good step forward is to sketch that
API, then write implementations that reuse existing code, then refactor
code behind the scenes later?

With this, we could get something up and working *reasonably* quickly
that is *reasonably* stable.

Jerome, Niklas, Trygve - anyone interested in picking this up? In some
ways the above email described it and this is just an interface sketch.

I think getting a very clear and simple API working would be an excellent next step. Given such an API, we can refactor Execute and Exec to fit the API. Here's a quick stab at a first proposal for a new Execute class:

/*
 * StreamHandlers are used for providing input,
 * retriving the output. Also used for logging.
 */
StreamHandler getStreamHandler();
void setStreamHandler(StreamHandler streamHandler);

/*
 * Watchdog is used to kill of processes running,
 * typically, to long time.
 */
ExecuteWatchdog getWatchdog();
void setWatchdog(ExecuteWatchdog watchDog);

File getWorkingDirectory();
void setWorkingDirectory(File dir);

/*
 * Methods for starting synchronous execution.
 * Returns process exit value
 */
int execute(String[] command) throws ExecuteException;
int execute(String[] command, Map environment) throws ExecuteException;

/*
* Methods for starting asynchronous execution. Result provided to callback handler
 */
void execute(String[] command, ExecuteResultHandler handler) throws ExecuteException; void execute(String[] command, Map environment, ExecuteResultHandler handler) throws ExecuteException;

Besides this API, I think we should provide utility classes for retrieving the current Environment. I also think we should get rid of the current environment classes and use a Map instead. This simplifies working with our API and gets us inline with the Java 1.5 environment support.

/niklas

-------
Niklas Gustavsson
http://www.protocol7.com
mailto:[EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to