From 5e1a060756c05032cd172ac6720b73c8998ce110 Mon Sep 17 00:00:00 2001 From: Peter Donald Date: Sat, 22 Dec 2001 23:11:34 +0000 Subject: [PATCH] Add in an interface via which requests to execute a command can be made. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270330 13f79535-47bb-0310-9956-ffa450edef68 --- .../myrmidon/framework/exec/ExecManager.java | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 proposal/myrmidon/src/java/org/apache/myrmidon/framework/exec/ExecManager.java diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/framework/exec/ExecManager.java b/proposal/myrmidon/src/java/org/apache/myrmidon/framework/exec/ExecManager.java new file mode 100644 index 000000000..cdbf9b96f --- /dev/null +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/framework/exec/ExecManager.java @@ -0,0 +1,57 @@ +/* + * Copyright (C) The Apache Software Foundation. All rights reserved. + * + * This software is published under the terms of the Apache Software License + * version 1.1, a copy of which has been included with this distribution in + * the LICENSE.txt file. + */ +package org.apache.myrmidon.framework.exec; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import org.apache.myrmidon.api.TaskException; + +/** + * Interface via which clients can request that a native + * process be executed. This manages all aspects of running + * a native command including such things as; + * + * + * + * @author Peter Donald + * @version $Revision$ $Date$ + */ +public interface ExecManager +{ + /** + * Execute a process and wait for it to finish before + * returning. + * + * @param execMetaData the metaData for native command to execute + * @param input the stream to read from and write to standard input. + * May be null in which case nothing will be written to standard. + * input + * @param output the stream to write the processes standard output to. + * May be null in which case that output will go into the void. + * @param error the stream to write the processes standard error to. + * May be null in which case that error will go into the void. + * @param timeout the maximum duration in milliseconds that a process + * can execute. The value must be positive or zero. If it is zero + * then the process will not timeout. If the process times out it + * will be forcibly shutdown and a TimeoutException thrown + */ + int execute( ExecMetaData execMetaData, + InputStream input, + OutputStream output, + OutputStream error, + long timeout ) + throws IOException, TaskException /*TimeoutException*/; +}