Search in sources :

Example 1 with Port

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());
}
Also used : Port(com.genericworkflownodes.knime.port.Port) Test(org.junit.Test)

Example 2 with Port

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());
}
Also used : Port(com.genericworkflownodes.knime.port.Port) Test(org.junit.Test)

Example 3 with Port

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;
}
Also used : Port(com.genericworkflownodes.knime.port.Port) Node(org.dom4j.Node)

Example 4 with 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()]));
}
Also used : Node(org.dom4j.Node) Port(com.genericworkflownodes.knime.port.Port)

Example 5 with Port

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;
}
Also used : SchemaFactory(javax.xml.validation.SchemaFactory) Schema(javax.xml.validation.Schema) CTDHandler(com.genericworkflownodes.knime.config.reader.handler.CTDHandler) CLIElement(com.genericworkflownodes.knime.cliwrapper.CLIElement) Port(com.genericworkflownodes.knime.port.Port) SchemaProvider(com.genericworkflownodes.knime.schemas.SchemaProvider) SAXParser(javax.xml.parsers.SAXParser) Relocator(com.genericworkflownodes.knime.relocator.Relocator) SAXParserFactory(javax.xml.parsers.SAXParserFactory)

Aggregations

Port (com.genericworkflownodes.knime.port.Port)19 IOException (java.io.IOException)8 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)8 FileParameter (com.genericworkflownodes.knime.parameter.FileParameter)7 IFileParameter (com.genericworkflownodes.knime.parameter.IFileParameter)7 ArrayList (java.util.ArrayList)7 NoBinaryAvailableException (com.genericworkflownodes.knime.custom.config.NoBinaryAvailableException)6 UnknownCommandGeneratorException (com.genericworkflownodes.knime.execution.UnknownCommandGeneratorException)6 UnknownToolExecutorException (com.genericworkflownodes.knime.execution.UnknownToolExecutorException)6 InvalidParameterValueException (com.genericworkflownodes.knime.parameter.InvalidParameterValueException)6 ExecutionException (java.util.concurrent.ExecutionException)6 FileListParameter (com.genericworkflownodes.knime.parameter.FileListParameter)5 IPrefixURIPortObject (com.genericworkflownodes.knime.base.data.port.IPrefixURIPortObject)4 File (java.io.File)4 IURIPortObject (org.knime.core.data.uri.IURIPortObject)4 ExecutionFailedException (com.genericworkflownodes.knime.generic_node.ExecutionFailedException)3 FileStorePrefixURIPortObject (com.genericworkflownodes.knime.base.data.port.FileStorePrefixURIPortObject)2 FileStoreURIPortObject (com.genericworkflownodes.knime.base.data.port.FileStoreURIPortObject)2 INodeConfiguration (com.genericworkflownodes.knime.config.INodeConfiguration)2 InvalidCTDFileException (com.genericworkflownodes.knime.config.reader.InvalidCTDFileException)2