I want to use a Quick Form File Upload node within a meta node that will be deployed to the node repository afterwards.
In the config dialog of the File Upload node you can specify the default file. This path is then given as an absolut path. I want to use a file inside my plugin folder as default, however, I want to avoid using an abosolut path which would only be valid on my local machine.
Is there a way to use kind of a placeholder to point to the KNIME installation directory and specify the plugin folder from that point on?
You have built a node that you will deploy and this node provides a file you want to read into KNIME?
If you have a Java snippet / edit variable you can make a new string output and use the following
out_yourVar = System.getProperty("eclipse.home.location") + yourPluginLocation + yourFile;
to generate the filepath?
Ok, thank you.
This makes it at least independent of my specific home directory and the folder tree down to the eclipse location. But the path will still depend on "yourPluginLocation", meaning that the absolute plugin location within the KNIME root directory had to be the same on all machines where this node is used.
Is there also a way to avoid this dependency?
Or more general, what is the preferred way to reference a data file that comes along with a plugin (from within that plugin)? The file is used for some config stuff and I want to offer the user the possibility to select a customized file via the Quick Form node, but still provide a default which is deployed along with the plugin itself.
My Java knowdlege isn't extensive enough to come up with a 'proper' solution. You can programatically get the installed location of a plugin. But I'm not sure how you would do this from a Java snippet.
You could potentially write an eclipse preference which you could retrive and have it programatically set the preference value?
Hopefully someone else has some more useful suggestions.
File Upload doesn't appear to understand the new "knime://server/folder/data.csv" type url's.
Not clear if the default file is used in web portal if user does not upload file, or is this just used at 'design time'?
The File Upload Quickform node does only support a local file path as default value, no URLs.
Sam's suggestion should work. You would have to create the path in your plugin code and push it as a system property with System.setProperty("myPath", path). Then you can use a Java Edit Variable node to put the path into a variable with out_Path = System.getProperty("myPath") and then use this variable to overwrite value.location in the File Upload node.