001 /**
002 * Copyright 2010-2012 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.common.util.service;
017
018 import java.io.File;
019 import java.io.InputStream;
020 import java.util.List;
021
022 import org.codehaus.plexus.util.cli.StreamConsumer;
023
024 public class DefaultExecContext implements ExecContext {
025
026 InputStream input;
027 String executable;
028 List<String> args;
029 int timeoutInSeconds;
030 File workingDirectory;
031 StreamConsumer standardOutConsumer;
032 StreamConsumer standardErrConsumer;
033 boolean addSystemEnvironment = false;
034
035 @Override
036 public InputStream getInput() {
037 return input;
038 }
039
040 public void setInput(InputStream input) {
041 this.input = input;
042 }
043
044 @Override
045 public String getExecutable() {
046 return executable;
047 }
048
049 public void setExecutable(String executable) {
050 this.executable = executable;
051 }
052
053 @Override
054 public List<String> getArgs() {
055 return args;
056 }
057
058 public void setArgs(List<String> args) {
059 this.args = args;
060 }
061
062 @Override
063 public int getTimeoutInSeconds() {
064 return timeoutInSeconds;
065 }
066
067 public void setTimeoutInSeconds(int timeoutInSeconds) {
068 this.timeoutInSeconds = timeoutInSeconds;
069 }
070
071 @Override
072 public File getWorkingDirectory() {
073 return workingDirectory;
074 }
075
076 public void setWorkingDirectory(File workingDirectory) {
077 this.workingDirectory = workingDirectory;
078 }
079
080 @Override
081 public StreamConsumer getStandardOutConsumer() {
082 return standardOutConsumer;
083 }
084
085 public void setStandardOutConsumer(StreamConsumer standardOutConsumer) {
086 this.standardOutConsumer = standardOutConsumer;
087 }
088
089 @Override
090 public StreamConsumer getStandardErrConsumer() {
091 return standardErrConsumer;
092 }
093
094 public void setStandardErrConsumer(StreamConsumer standardErrConsumer) {
095 this.standardErrConsumer = standardErrConsumer;
096 }
097
098 public boolean isAddSystemEnvironment() {
099 return addSystemEnvironment;
100 }
101
102 public void setAddSystemEnvironment(boolean addSystemEnvironment) {
103 this.addSystemEnvironment = addSystemEnvironment;
104 }
105
106 }