Scala development

Hello developers,

I have created a node wizard to create KNIME plugins using Scala language. There is no update-site (or feature) yet, but if you want to test it, that is really appreciated.

You can find the sources here: https://github.com/aborg0/knime_scala_node_wizard

You can grab them with SVN or git. It requires Scala IDE plugin for Scala 2.10.

In my opinion it is easier to program in Scala, with it's functional libraries, but I am not so sure about the templates with implicits (example), so feedback in that regard is really appreciated.

Thanks, gabor

PS: everything is type-safe, nothing is dynamically typed.

Thanks for sharing. Implementing algorithms in Scala is so much easier. I will try out your plugin and try to give you some feedback. Implicits are good, but I think you defined too much (especially for inherited classes). For details, I will open a pull request.

Thanks, very appreciated.

Do you have an idea for the view template? Should it contain reference to scala.react or scala.swing? (I doubt scala.swing is available for Java 7 yet.) Do you have preference? Or it is ok to be as is (Scala version of the Java template)?

Just curious if this is still being maintained?  Looks like updated 2 years ago - curious if anyone still using it with success, etc? ;)

Also curious if this would work:

1. Create typical Java KNIME Node Extension Project

2. Add Scala Nature (via Scala IDE)

3. Replace desired pieces in Scala (i.e. typically for me just Model where hte "work" happens - would still use Java / Swing for GUI, etc in Dialog).

Any chance this mixed setup would work?  Would I have to manually add libs, etc to get the Scala code to work or would that just "come out in the wash" b/c the .jar would be compiled to bytecode....

I'm going to try anyhow probably but fun to ponder the thought experiment before I blow up my Knime Dev environment ;)

These should just work.

I plan to update the plugin before the UGM2015 and make it a community contribution. I hope by that time the Scala development will be easier. :)

I have just committed some changes. I hope you do not mind switching to Scala IDE 4 and Scala 2.11.4 (I know, 2.11.5 is on its way, but it is not yet bundled to a Scala IDE).

I have added some project specific Scala compiler settings too. In case you have problems with them, feel free to raise an issue on github.

Cheers, gabor

PS.: Sorry, the distribution is still not user-friendly. :(
 

So I was able to add the Scala Nature to my Knime Dev environment (via Scala IDE plugin) and pretty easy to create a NodeModel using scala extending knime NodeModel:

class CloneNodeModel extends NodeModel(1,1)

And everything works great inside of Eclipse Debugger.  When I build as a Feature/Update Site though and install in Knime I get the following erorrs:

java.lang.IllegalArgumentException: Can't load factory class for node: com.pg.util.clone.CloneNodeFactory
	at org.knime.workbench.repository.RepositoryFactory.createNode(RepositoryFactory.java:132)
	at org.knime.workbench.repository.RepositoryManager.readNodes(RepositoryManager.java:356)
	at org.knime.workbench.repository.RepositoryManager.readRepository(RepositoryManager.java:167)
	at org.knime.workbench.repository.RepositoryManager.getRoot(RepositoryManager.java:610)
	at org.knime.workbench.repository.view.AbstractRepositoryView.readRepository(AbstractRepositoryView.java:220)
	at org.knime.workbench.repository.view.AbstractRepositoryView$2.run(AbstractRepositoryView.java:201)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: java.lang.Error: Unresolved compilation problems: 
	The type CloneNodeFactory must implement the inherited abstract method NodeFactory<CloneNodeModel>.createNodeView(int, CloneNodeModel)
	CloneNodeModel cannot be resolved to a type
	CloneNodeModel cannot be resolved to a type
	CloneNodeModel cannot be resolved to a type
	CloneNodeModel cannot be resolved to a type
	CloneNodeModel cannot be resolved to a type

Since it works in one and not the other I'm guessing something to do with Classpath?  I've tried adding scala-library.jar to plugins lib.  Are oher libs needed too?

Hm... looked in the installed .jar file for the plugin and the scala file is still .scala so I'm guessing it isn't getting built by the Feature Project / Update Site Build :(  All the Java files are .class so they are being converted but Eclipse is treating .scala like a resource (.txt, .img, etc) apparently.  Not sure how to fix / change that - any thoughts?

Looks like I might have to build through Buckminister instead: https://www.assembla.com/wiki/show/scala-ide/Eclipse_Plugin_Development_using_the_Scala_IDE

I only have a workaround yet. Check the export wizard's Options | Use class files compiled in the workspace. I try to make things work with Buckminster. (I was hoping this might help, but I was tricked by the option I used before. Here is my attempt.)

Thanks, gabor

Finally I managed to create a Buckminster build based on the following articles: Build Scala projects with Eclipse Buckminster and Headless Eclipse RCP builds with Buckminster and Hudson. I would not say it is nice or easy to perform, but hopefully work for others too. If you could try the steps described in the README and report whether it also worked for you that would be very helpful.

Thanks, gabor

I actually went the Buckminster route to but using this article: https://www.assembla.com/wiki/show/scala-ide/Eclipse_Plugin_Development_using_the_Scala_IDE

It was actually pretty easy to setup:

1. Install Eclipse Buckminster Plugin: http://download.eclipse.org/tools/buckminster/updates-3.7/

Make sure to include the PDT components.

2. Create Features as usual

3. Instead of creating an Update Site Project create *another* Feature project and add your existing Features to this project (I have no idea why Buckminster wants a Multi-Feature projects instead of an Update site project but oh well...)

4. Select the Multi-Feature project (i.e. Update Site wanna-be) and click Buckminster... Invoke Actions ... site.p2

Odd - I keep posting a few comments to this thread but says awaiting moderation and not showing up?

That is unfortunate. Anyway, you can reach me through github or at https://gitter.im/aborg0/knime_scala_node_wizard as an alternative.

Cheers, gabor