Skip to content

Commit 3ec70ec

Browse files
committed
Java files for jar execution
1 parent 01939f2 commit 3ec70ec

File tree

4 files changed

+52
-0
lines changed

4 files changed

+52
-0
lines changed

src/java/META-INF/MANIFEST.MF

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Manifest-Version: 1.0
2+
Built-By: janne
3+
Main-Class: org.robotframework.RobotJarRunner
4+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package org.robotframework;
2+
3+
import org.robotframework.RunnerFactory;
4+
import org.robotframework.RobotRunner;
5+
6+
public class JarRobot {
7+
8+
public static void main(String[] args) {
9+
int rc = run(args);
10+
System.exit(rc);
11+
}
12+
13+
public static int run(String[] args) {
14+
RobotRunner runner = new RunnerFactory().createRunner();
15+
return runner.run(args);
16+
}
17+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package org.robotframework;
2+
3+
public interface RobotRunner {
4+
5+
public int run(String[] args);
6+
7+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package org.robotframework;
2+
3+
import org.python.core.PyObject;
4+
import org.python.util.PythonInterpreter;
5+
6+
public class RunnerFactory {
7+
8+
private PyObject runnerClass;
9+
10+
public RunnerFactory() {
11+
runnerClass = importRunnerClass();
12+
}
13+
14+
private PyObject importRunnerClass() {
15+
PythonInterpreter interpreter = new PythonInterpreter();
16+
interpreter.exec("import robot; from robot.jarrunner import JarRunner");
17+
return interpreter.get("JarRunner");
18+
}
19+
20+
public RobotRunner createRunner() {
21+
PyObject runnerObject = runnerClass.__call__();
22+
return (RobotRunner)runnerObject.__tojava__(RobotRunner.class);
23+
}
24+
}

0 commit comments

Comments
 (0)