Skip to content
Snippets Groups Projects
Commit d6d2da51 authored by felmer's avatar felmer
Browse files

SSDM-3745: MasterDataRegistrationScriptRunner: create interpreter by trial-and-error

SVN: 36755
parent 48bf757c
No related branches found
No related tags found
No related merge requests found
...@@ -24,7 +24,8 @@ import ch.systemsx.cisd.common.filesystem.FileUtilities; ...@@ -24,7 +24,8 @@ import ch.systemsx.cisd.common.filesystem.FileUtilities;
import ch.systemsx.cisd.common.jython.IJythonInterpreter; import ch.systemsx.cisd.common.jython.IJythonInterpreter;
import ch.systemsx.cisd.common.jython.JythonScriptSplitter; import ch.systemsx.cisd.common.jython.JythonScriptSplitter;
import ch.systemsx.cisd.common.jython.JythonUtils; import ch.systemsx.cisd.common.jython.JythonUtils;
import ch.systemsx.cisd.common.jython.evaluator.Evaluator; import ch.systemsx.cisd.common.jython.v25.Jython25InterpreterFactory;
import ch.systemsx.cisd.common.jython.v27.Jython27InterpreterFactory;
/** /**
* A class for running python scripts that register master data. * A class for running python scripts that register master data.
...@@ -57,7 +58,7 @@ public class MasterDataRegistrationScriptRunner implements IMasterDataScriptRegi ...@@ -57,7 +58,7 @@ public class MasterDataRegistrationScriptRunner implements IMasterDataScriptRegi
MasterDataRegistrationService service = new MasterDataRegistrationService(commonServer); MasterDataRegistrationService service = new MasterDataRegistrationService(commonServer);
// Configure the evaluator // Configure the evaluator
IJythonInterpreter interpreter = Evaluator.getInterpreterFactory().createInterpreter(); IJythonInterpreter interpreter = createInterpreter();
interpreter.addToPath(jythonPath); interpreter.addToPath(jythonPath);
interpreter.set(SERVICE_VARIABLE_NAME, service); interpreter.set(SERVICE_VARIABLE_NAME, service);
...@@ -82,6 +83,17 @@ public class MasterDataRegistrationScriptRunner implements IMasterDataScriptRegi ...@@ -82,6 +83,17 @@ public class MasterDataRegistrationScriptRunner implements IMasterDataScriptRegi
service.commit(); service.commit();
} }
private IJythonInterpreter createInterpreter()
{
try
{
return new Jython25InterpreterFactory().createInterpreter();
} catch (Exception ex)
{
return new Jython27InterpreterFactory().createInterpreter();
}
}
private void checkValidJythonScript(File jythonScript) private void checkValidJythonScript(File jythonScript)
{ {
if (false == jythonScript.exists()) if (false == jythonScript.exists())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment