1  /*
     2   * Copyright the original author or authors.
     3   * 
     4   * Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1 (the "License");
     5   * you may not use this file except in compliance with the License.
     6   * You may obtain a copy of the License at
     7   * 
     8   *      http://www.mozilla.org/MPL/MPL-1.1.html
     9   * 
    10   * Unless required by applicable law or agreed to in writing, software
    11   * distributed under the License is distributed on an "AS IS" BASIS,
    12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   * See the License for the specific language governing permissions and
    14   * limitations under the License.
    15   */
    16  
    17  import org.as2lib.app.exec.AbstractProcess;
    18  import org.as2lib.app.exec.Executable;
    19  import org.as2lib.util.MethodUtil;
    20  
    21  /**
    22   * {@code ExecutableProcess} is a Wrapper for {@link Executable}'s to be
    23   * executable as a {@link org.as2lib.app.exec.Process}.
    24   * 
    25   * <p>As Executables have no response features this is a wrapper for using any
    26   * executable as process.
    27   *
    28   * @author Martin Heidegger
    29   * @version 1.0
    30   */
    31  class org.as2lib.app.exec.ExecutableProcess extends AbstractProcess {
    32  
    33  	/** Arguments to be applied to the executable at execution */
    34  	private var args:Array;
    35  	
    36  	/** Executable to be executed */
    37  	private var executable:Executable;
    38  	
    39  	/**
    40  	 * Creates a new ExecutableProcess.
    41  	 * 
    42  	 * @param executable Executeable to be executed on process start.
    43  	 */
    44  	public function ExecutableProcess(executable:Executable, args:Array) {
    45  		super();
    46  		this.executable = executable;
    47  		this.args = args;
    48  	}
    49  	
    50  	/**
    51  	 * Implementation of {@link AbstractProcess#run}.
    52  	 */
    53  	private function run() {
    54  		MethodUtil.invoke("execute", executable, args);
    55  	}
    56  }