use of com.genericworkflownodes.knime.commandline.CommandLineElement in project GenericKnimeNodes by genericworkflownodes.
the class CLICommandGenerator method handleNonListParameter.
private void handleNonListParameter(final List<List<? extends CommandLineElement>> extractedParameterValues, final Parameter<?> p) {
final List<CommandLineElement> l = new ArrayList<CommandLineElement>();
final CommandLineElement commandLineElement;
if (p instanceof FileParameter) {
commandLineElement = new CommandLineFile((FileParameter) p);
} else {
commandLineElement = new CommandLineParameter(p);
}
l.add(commandLineElement);
extractedParameterValues.add(l);
}
use of com.genericworkflownodes.knime.commandline.CommandLineElement in project GenericKnimeNodes by genericworkflownodes.
the class DockerCommandGenerator method handleFileParameter.
/**
* Process a file parameter by specifying the docker mount point and
* altering the file paths to fit the internal docker path
*
* @param hostFile string to file on host system
* @param dockerCommands a list of specific docker commands
* @param hostDockerMap a map of host paths to docker paths that have already been mapped
* @return List of extracted commands
* @throws IOException
*/
private List<? extends CommandLineElement> handleFileParameter(String hostFile, List<CommandLineElement> dockerCommands, Map<String, String> hostDockerMap) throws IOException {
String dockerMount;
File fileParam = new File(hostFile);
String hostPath = toUnixPath(fileParam.getParentFile().getCanonicalPath());
if (hostDockerMap.containsKey(hostPath)) {
dockerMount = hostDockerMap.get(hostPath);
} else {
dockerMount = DOCKER_INTERNAL_MOUNT + dockerCommands.size() + DOCKER_DIR_SEP;
hostDockerMap.put(hostPath, dockerMount);
dockerCommands.add(new CommandLineFixedString(DOCKER_MOUNT_COMMAND));
dockerCommands.add(new CommandLineFixedString(hostPath + ":" + dockerMount));
}
List<CommandLineElement> l = new ArrayList<CommandLineElement>();
l.add(new CommandLineFixedString(dockerMount + fileParam.getName()));
return l;
}
use of com.genericworkflownodes.knime.commandline.CommandLineElement in project GenericKnimeNodes by genericworkflownodes.
the class BALLCommandGenerator method generateCommands.
@Override
public List<CommandLineElement> generateCommands(INodeConfiguration nodeConfiguration, IPluginConfiguration pluginConfiguration, File workingDirectory) throws Exception {
File paramFile = writePARFile(nodeConfiguration, workingDirectory);
List<CommandLineElement> commands = new ArrayList<CommandLineElement>();
commands.add(new CommandLineFixedString(PAR_SWITCH));
commands.add(new CommandLineCTDFile(paramFile));
return commands;
}
use of com.genericworkflownodes.knime.commandline.CommandLineElement in project GenericKnimeNodes by genericworkflownodes.
the class OpenMSCommandGenerator method generateCommands.
@Override
public List<CommandLineElement> generateCommands(INodeConfiguration nodeConfiguration, IPluginConfiguration pluginConfiguration, File workingDirectory) throws Exception {
File iniFile = createINIFile(nodeConfiguration, workingDirectory);
List<CommandLineElement> commands = new ArrayList<CommandLineElement>();
commands.add(new CommandLineFixedString(INI_SWITCH));
commands.add(new CommandLineCTDFile(iniFile));
return commands;
}
use of com.genericworkflownodes.knime.commandline.CommandLineElement in project GenericKnimeNodes by genericworkflownodes.
the class CLICommandGenerator method handleListParameter.
private void handleListParameter(final List<List<? extends CommandLineElement>> extractedParameterValues, final ListParameter listParameter) {
final int nValues = listParameter.getStrings().size();
final String key = ((Parameter<?>) listParameter).getKey();
final List<CommandLineElement> tmpList = new LinkedList<CommandLineElement>();
// there's only one element in the list
if (nValues > 1) {
int sequence = 0;
for (final String value : listParameter.getStrings()) {
final CommandLineElement commandLineElement;
if (listParameter instanceof IFileParameter) {
commandLineElement = new CommandLineFile(new FileParameter(key, value));
} else {
commandLineElement = new CommandLineParameter(new StringParameter(key, value));
}
commandLineElement.setSequenceNumber(sequence++);
tmpList.add(commandLineElement);
}
} else {
// only one value in the list, no need to use sequence numbers
final String value = listParameter.getStrings().get(0);
if (listParameter instanceof IFileParameter) {
tmpList.add(new CommandLineFile(new FileParameter(key, value)));
} else {
tmpList.add(new CommandLineParameter(new StringParameter(key, value)));
}
}
extractedParameterValues.add(tmpList);
}
Aggregations