Skip to content

Commit b8d7bd3

Browse files
committed
scala: automatic convert with minimal changes
1 parent 4d75b2d commit b8d7bd3

13 files changed

Lines changed: 1132 additions & 127 deletions

RubyScript/.classpath

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<classpath>
3-
<classpathentry exported="true" kind="lib" path="lib/jruby-complete-1.7.18.jar"/>
4-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
5-
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
6-
<classpathentry kind="src" path="src"/>
7-
<classpathentry kind="lib" path="lib/rsyntaxtextarea.jar"/>
8-
<classpathentry kind="output" path="bin"/>
9-
</classpath>
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="lib" path="/home/projects/knime/ruby4knime/RubyScript/lib/jruby.jar"/>
4+
<classpathentry kind="con" path="org.scala-ide.sdt.launching.SCALA_CONTAINER"/>
5+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
6+
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
7+
<classpathentry kind="src" path="src"/>
8+
<classpathentry kind="lib" path="lib/rsyntaxtextarea.jar"/>
9+
<classpathentry kind="output" path="bin"/>
10+
</classpath>

RubyScript/.project

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<projectDescription>
3-
<name>RubyScript</name>
4-
<comment></comment>
5-
<projects>
6-
</projects>
7-
<buildSpec>
8-
<buildCommand>
9-
<name>org.eclipse.jdt.core.javabuilder</name>
10-
<arguments>
11-
</arguments>
12-
</buildCommand>
13-
<buildCommand>
14-
<name>org.eclipse.pde.ManifestBuilder</name>
15-
<arguments>
16-
</arguments>
17-
</buildCommand>
18-
<buildCommand>
19-
<name>org.eclipse.pde.SchemaBuilder</name>
20-
<arguments>
21-
</arguments>
22-
</buildCommand>
23-
</buildSpec>
24-
<natures>
25-
<nature>org.eclipse.pde.PluginNature</nature>
26-
<nature>org.eclipse.jdt.core.javanature</nature>
27-
</natures>
28-
</projectDescription>
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>RubyScript</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.pde.ManifestBuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.pde.SchemaBuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>org.scala-ide.sdt.core.scalabuilder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
</buildSpec>
24+
<natures>
25+
<nature>org.scala-ide.sdt.core.scalanature</nature>
26+
<nature>org.eclipse.pde.PluginNature</nature>
27+
<nature>org.eclipse.jdt.core.javanature</nature>
28+
</natures>
29+
</projectDescription>

RubyScript/META-INF/MANIFEST.MF

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ Bundle-SymbolicName: org.knime.ext.jruby; singleton:=true
55
Bundle-Version: 0.0.6
66
Bundle-ClassPath: rubyscript.jar,
77
lib/rsyntaxtextarea.jar,
8-
lib/jruby-complete-1.7.18.jar
8+
lib/jruby.jar
99
Bundle-Activator: org.knime.ext.jruby.RubyScriptNodePlugin
1010
Bundle-Vendor:
1111
Require-Bundle: org.eclipse.core.runtime,
1212
org.knime.workbench.core,
1313
org.knime.workbench.repository,
1414
org.knime.base,
1515
org.eclipse.ui,
16-
org.knime.ext.textprocessing;resolution:=optional
16+
org.knime.ext.textprocessing;resolution:=optional,
17+
org.scala-ide.scala.library
1718
Bundle-ActivationPolicy: lazy
1819
Export-Package: org.knime.ext.jruby

RubyScript/build.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ bin.includes = plugin.xml,\
66
icons/,\
77
rb/README.rdoc,\
88
lib/rsyntaxtextarea.jar,\
9-
lib/jruby-complete-1.7.18.jar
10-
src.includes = lib/jruby-complete-1.7.18.jar,\
9+
lib/jruby.jar
10+
src.includes = lib/jruby.jar,\
1111
rb/knime.rb,\
1212
icons/,\
1313
rb/README.rdoc,\

RubyScript/src/org/knime/ext/jruby/LoggerOutputStream.java renamed to RubyScript/src/org/knime/ext/jruby/LoggerOutputStream.scala

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,40 @@
1+
package org.knime.ext.jruby
2+
import org.knime.core.node.NodeLogger
3+
import java.io.Writer
4+
5+
class LoggerOutputStream(
6+
logger: NodeLogger,
7+
level: NodeLogger.LEVEL) extends Writer {
8+
9+
def this(inLogger: NodeLogger) {
10+
this(inLogger, null)
11+
}
12+
13+
override def close() {
14+
}
15+
16+
override def flush() {
17+
}
18+
19+
override def write(b: Array[Char], off: Int, len: Int) {
20+
var str = new String(b, off, len)
21+
if (str.endsWith("\n")) {
22+
str = str.substring(0, str.length - 1)
23+
}
24+
if (str.length == 0) return
25+
if (level == NodeLogger.LEVEL.INFO) {
26+
logger.info(str)
27+
} else if (level == NodeLogger.LEVEL.WARN) {
28+
logger.warn(str)
29+
} else if (level == NodeLogger.LEVEL.ERROR) {
30+
logger.error(str)
31+
} else {
32+
logger.debug(str)
33+
}
34+
}
35+
36+
/*
37+
Original Java:
138
package org.knime.ext.jruby;
239
340
import java.io.IOException;
@@ -49,3 +86,6 @@ public final void write(char[] b, int off, int len) throws IOException {
4986
}
5087
}
5188
}
89+
90+
*/
91+
}

0 commit comments

Comments
 (0)