View Javadoc

1   /**
2    * Copyright 2010-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (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.opensource.org/licenses/ecl2.php
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  package org.kuali.common.util.service;
17  
18  import java.io.File;
19  import java.io.InputStream;
20  import java.util.List;
21  
22  import org.codehaus.plexus.util.cli.StreamConsumer;
23  
24  public class DefaultExecContext implements ExecContext {
25  
26  	InputStream input;
27  	String executable;
28  	List<String> args;
29  	int timeoutInSeconds;
30  	File workingDirectory;
31  	StreamConsumer standardOutConsumer;
32  	StreamConsumer standardErrConsumer;
33  	boolean addSystemEnvironment = false;
34  
35  	@Override
36  	public InputStream getInput() {
37  		return input;
38  	}
39  
40  	public void setInput(InputStream input) {
41  		this.input = input;
42  	}
43  
44  	@Override
45  	public String getExecutable() {
46  		return executable;
47  	}
48  
49  	public void setExecutable(String executable) {
50  		this.executable = executable;
51  	}
52  
53  	@Override
54  	public List<String> getArgs() {
55  		return args;
56  	}
57  
58  	public void setArgs(List<String> args) {
59  		this.args = args;
60  	}
61  
62  	@Override
63  	public int getTimeoutInSeconds() {
64  		return timeoutInSeconds;
65  	}
66  
67  	public void setTimeoutInSeconds(int timeoutInSeconds) {
68  		this.timeoutInSeconds = timeoutInSeconds;
69  	}
70  
71  	@Override
72  	public File getWorkingDirectory() {
73  		return workingDirectory;
74  	}
75  
76  	public void setWorkingDirectory(File workingDirectory) {
77  		this.workingDirectory = workingDirectory;
78  	}
79  
80  	@Override
81  	public StreamConsumer getStandardOutConsumer() {
82  		return standardOutConsumer;
83  	}
84  
85  	public void setStandardOutConsumer(StreamConsumer standardOutConsumer) {
86  		this.standardOutConsumer = standardOutConsumer;
87  	}
88  
89  	@Override
90  	public StreamConsumer getStandardErrConsumer() {
91  		return standardErrConsumer;
92  	}
93  
94  	public void setStandardErrConsumer(StreamConsumer standardErrConsumer) {
95  		this.standardErrConsumer = standardErrConsumer;
96  	}
97  
98  	public boolean isAddSystemEnvironment() {
99  		return addSystemEnvironment;
100 	}
101 
102 	public void setAddSystemEnvironment(boolean addSystemEnvironment) {
103 		this.addSystemEnvironment = addSystemEnvironment;
104 	}
105 
106 }