use of com.genericworkflownodes.knime.port.Port in project GenericKnimeNodes by genericworkflownodes.
the class FileListParameterTest method testSetPort.
@Test
public void testSetPort() {
FileListParameter flp = new FileListParameter("flp", strings);
flp.setPort(new Port());
assertNotNull(flp.getPort());
}
use of com.genericworkflownodes.knime.port.Port in project GenericKnimeNodes by genericworkflownodes.
the class FileListParameterTest method testGetPort.
@Test
public void testGetPort() {
FileListParameter flp = new FileListParameter("flp", strings);
Port p = new Port();
p.setName("p1");
flp.setPort(p);
assertEquals("p1", flp.getPort().getName());
}
use of com.genericworkflownodes.knime.port.Port in project GenericKnimeNodes by genericworkflownodes.
the class GalaxyNodeConfigurationReader method readInPort.
private Port readInPort(Node portnode) throws Exception {
Port port = new Port();
port.setOptional(true);
Node n = DOMHelper.selectSingleNode(portnode, "label");
String portdescr = n.valueOf("text()");
port.setDescription(portdescr);
String extension = DOMHelper.valueOf(portnode, "@format");
port.addMimeType(extension);
String portname = DOMHelper.valueOf(portnode, "@name");
port.setName(portname);
String optional = DOMHelper.valueOf(portnode, "@optional");
if (optional.equals("false")) {
port.setOptional(false);
}
return port;
}
use of com.genericworkflownodes.knime.port.Port in project GenericKnimeNodes by genericworkflownodes.
the class GalaxyNodeConfigurationReader method readPorts.
private void readPorts() throws Exception {
List<Node> nodes = DOMHelper.selectNodes(doc, "/tool/inputs/param[@type='data']");
for (Node n : nodes) {
Port port = readInPort(n);
inports.add(port);
}
nodes = DOMHelper.selectNodes(doc, "/tool/outputs/data");
for (Node n : nodes) {
Port port = readOutPort(n);
outports.add(port);
}
config.setInports(inports.toArray(new Port[inports.size()]));
config.setOutports(outports.toArray(new Port[outports.size()]));
}
use of com.genericworkflownodes.knime.port.Port in project GenericKnimeNodes by genericworkflownodes.
the class CTDConfigurationReader method read.
@Override
public INodeConfiguration read(InputStream in) throws InvalidCTDFileException {
try {
// create schema and parser for validation and parsing
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema ctdSchema = schemaFactory.newSchema(SchemaProvider.class.getResource("CTD.xsd"));
SAXParserFactory spfac = SAXParserFactory.newInstance();
spfac.setValidating(false);
spfac.setSchema(ctdSchema);
SAXParser sp = spfac.newSAXParser();
CTDHandler handler = new CTDHandler(sp.getXMLReader());
sp.parse(in, handler);
m_config = handler.getNodeConfiguration();
} catch (Exception e) {
throw new InvalidCTDFileException("Failed to parse CTD file.", e);
}
// validate mappings of CLI config
for (CLIElement cliElement : m_config.getCLI().getCLIElement()) {
validateCLIElement(cliElement);
}
// validate mappings in OutputConverter
for (Relocator relocator : m_config.getRelocators()) {
validateRelocator(relocator);
}
// validate ports
for (Port port : m_config.getInputPorts()) {
validatePort(port);
}
for (Port port : m_config.getOutputPorts()) {
validatePort(port);
}
// return parsed and validated config
return m_config;
}
Aggregations