How to change the type of a port on a custom node?

Hi, I try to create my custom node. I can manipulate the number of inputs and outputs, but how do I change its type?

I saw on GitHub that there was a line added to the XML NodeNameNodeFactory.xml in the <ports> tag:

<dynInPort insert-before="0" name="File system connection"
			group-identifier="File System Connection">
			The file system connection.
</dynInPort>

(I need it to be a File system port)

But that does not seem to change the type.

Any ideas? Thanks!

1 Like

Hi @Nikol,

welcome to the KNIME Community :smiley:
You were actually looking in the right package, but in the wrong class. Take at the NodeFactory knime-base/CreateDirectory2NodeFactory.java at master · knime/knime-base · GitHub.

This is the special case if you want dynamic ports. If you want to use static ports, all you need to do is to extend the PortObject[] constructor in the NodeModel, see here:

best,
Gabriel

1 Like

Hi! Thank you for your answer,

I changed the NodeModel and NodeFactory accordingly (used the second example). But how do I make the input port File System port (which could read data from the SSH Connector node)?

Thanks :slight_smile:
Nikol

Hi Nikol,

In that case you need to use FileSystemPortObject.TYPE
best,
Gabriel

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.