package net.raymanoz.migrate;
import java.io.InputStream;
import java.io.PrintStream;
import net.raymanoz.config.ConditionDecoder;
import net.raymanoz.config.ConditionDecoderImpl;
import net.raymanoz.config.Configuration;
import net.raymanoz.config.ConditionHandlerListAssembler;
import net.raymanoz.config.VariableEvaluaterImpl;
import net.raymanoz.io.FileImpl;
import net.raymanoz.io.File;
import net.raymanoz.ui.UserInteractionStrategy;
import net.raymanoz.util.FileUtilImpl;
import net.raymanoz.util.FileUtil;
import net.raymanoz.util.ScriptExecuterCommandLineParser;
import net.raymanoz.util.ScriptExecuterCommandLineParserImpl;
import net.raymanoz.util.StreamUtilImpl;
import net.raymanoz.util.InputStreamPrinter;
import net.raymanoz.util.Properties;
public class ScriptAssemblerImpl implements ScriptAssembler {
private Configuration configuration;
public ScriptAssemblerImpl(Configuration configuration){
this.configuration = configuration;
}
public ScriptProcessBuilder newProcessBuilder() {
ProcessBuilder processBuilder = new ProcessBuilder();
return new ScriptProcessBuilderImpl(processBuilder);
}
public InputStreamPrinter newInputStreamPrinter(InputStream inputStream, PrintStream printStream, UserInteractionStrategy userInteractionStrategy) {
return new InputStreamPrinter(inputStream, printStream, userInteractionStrategy);
}
public Configuration getConfiguration() {
return configuration;
}
public FileUtil getFileUtil() {
return new FileUtilImpl(new StreamUtilImpl());
}
public File newFile(File parent, String fileName) {
return new FileImpl(parent, fileName);
}
public Properties getProperties() {
return configuration.uMigrateProperties();
}
public ConditionDecoder getConditionDecoder() {
return new ConditionDecoderImpl(ConditionHandlerListAssembler.getHandlers(), new VariableEvaluaterImpl(getProperties()));
}
@Override
public ScriptExecuterCommandLineParser getScriptExecuterCommandLineParser() {
return new ScriptExecuterCommandLineParserImpl(configuration.getExecutionCommand());
}
}