Skip to content
Snippets Groups Projects
Commit 13a10b59 authored by jakubs's avatar jakubs
Browse files

SSDM-3510 - make it possible to use jython 2.7 everywhere where we use python

SVN: 36198
parent 12b636bc
No related branches found
No related tags found
No related merge requests found
......@@ -510,4 +510,4 @@ post-registration.pathinfo-feeding.class = ch.systemsx.cisd.etlserver.path.PathI
# Example (will only show PNG files for data sets of type HCS_IMAGE):
# ftp.server.dataset.filelist.filter.HCS_IMAGE= .*png
jython-version=2.7
......@@ -48,7 +48,7 @@ public class JythonTopLevelDataSetHandlerV2<T extends DataSetInformation> extend
{
protected final IJythonInterpreterFactory jythonInterpreterFactory;
// version of jython. 2.7 for jython 2.7. Default is jython 2.5
// version of jython. Available options are "2.7" and "2.5". Default is jython 2.7
public static final String JYTHON_VERSION = "jython-version";
/**
......@@ -73,13 +73,12 @@ public class JythonTopLevelDataSetHandlerV2<T extends DataSetInformation> extend
String jythonVersion = PropertyUtils.getProperty(globalState.getThreadParameters()
.getThreadProperties(), JYTHON_VERSION);
if ("2.7".equals(jythonVersion))
{
jythonInterpreterFactory = new Jython27InterpreterFactory();
}
else
if ("2.5".equals(jythonVersion))
{
jythonInterpreterFactory = new Jython25InterpreterFactory();
} else
{
jythonInterpreterFactory = new Jython27InterpreterFactory();
}
DssRegistrationHealthMonitor.getInstance(globalState.getOpenBisService(),
......
......@@ -29,6 +29,7 @@ import ch.systemsx.cisd.common.exceptions.Status;
import ch.systemsx.cisd.common.jython.JythonUtils;
import ch.systemsx.cisd.common.jython.evaluator.Evaluator;
import ch.systemsx.cisd.common.jython.evaluator.EvaluatorException;
import ch.systemsx.cisd.common.jython.evaluator.IJythonEvaluator;
import ch.systemsx.cisd.common.jython.v27.Evaluator27;
import ch.systemsx.cisd.common.logging.LogCategory;
import ch.systemsx.cisd.common.logging.LogFactory;
......@@ -89,7 +90,7 @@ public class PluginScriptRunnerFactory implements IPluginScriptRunnerFactory
public PluginScriptRunnerFactory(String scriptPath)
{
this.scriptPath = scriptPath;
Evaluator.initialize();
Evaluator.getFactory().initialize();
}
/**
......@@ -104,7 +105,7 @@ public class PluginScriptRunnerFactory implements IPluginScriptRunnerFactory
try
{
Evaluator evaluator =
IJythonEvaluator evaluator =
createEvaluatorWithContentProviders(context, scriptString, pythonPath);
return new AggregationServiceReportingPluginScriptRunner(evaluator);
......@@ -123,7 +124,7 @@ public class PluginScriptRunnerFactory implements IPluginScriptRunnerFactory
try
{
Evaluator evaluator =
IJythonEvaluator evaluator =
createEvaluatorWithContentProviders(context, scriptString, pythonPath);
return new DbModifyingAggregationServiceReportingPluginScriptRunner(evaluator);
......@@ -217,9 +218,9 @@ public class PluginScriptRunnerFactory implements IPluginScriptRunnerFactory
return evaluator;
}
protected Evaluator createEvaluator(String scriptString, String[] pythonPath, DataSetProcessingContext context)
protected IJythonEvaluator createEvaluator(String scriptString, String[] pythonPath, DataSetProcessingContext context)
{
final Evaluator evaluator = new Evaluator("", pythonPath, null, scriptString, false);
final IJythonEvaluator evaluator = Evaluator.getFactory().create("", pythonPath, null, null, scriptString, false);
evaluator.set(SEARCH_SERVICE_VARIABLE_NAME, createUserSearchService(context));
evaluator.set(SEARCH_SERVICE_UNFILTERED_VARIABLE_NAME, createUnfilteredSearchService());
......@@ -238,10 +239,10 @@ public class PluginScriptRunnerFactory implements IPluginScriptRunnerFactory
return evaluator;
}
private Evaluator createEvaluatorWithContentProviders(
private IJythonEvaluator createEvaluatorWithContentProviders(
DataSetProcessingContext context, String scriptString, String[] pythonPath)
{
Evaluator evaluator = createEvaluator(scriptString, pythonPath, context);
IJythonEvaluator evaluator = createEvaluator(scriptString, pythonPath, context);
DataSetContentProvider contentProvider =
new DataSetContentProvider(context.getHierarchicalContentProvider());
......@@ -320,11 +321,11 @@ public class PluginScriptRunnerFactory implements IPluginScriptRunnerFactory
private abstract static class AbstractAggregationServiceReportingPluginScriptRunner
{
final Evaluator evaluator;
final IJythonEvaluator evaluator;
protected abstract String getFunctionName();
public AbstractAggregationServiceReportingPluginScriptRunner(Evaluator evaluator)
public AbstractAggregationServiceReportingPluginScriptRunner(IJythonEvaluator evaluator)
{
this.evaluator = evaluator;
......@@ -354,7 +355,7 @@ public class PluginScriptRunnerFactory implements IPluginScriptRunnerFactory
}
AggregationServiceReportingPluginScriptRunner(
Evaluator evaluator)
IJythonEvaluator evaluator)
{
super(evaluator);
}
......@@ -375,7 +376,7 @@ public class PluginScriptRunnerFactory implements IPluginScriptRunnerFactory
private final static String FUNCTION_NAME = "process";
DbModifyingAggregationServiceReportingPluginScriptRunner(
Evaluator evaluator)
IJythonEvaluator evaluator)
{
super(evaluator);
}
......@@ -389,7 +390,7 @@ public class PluginScriptRunnerFactory implements IPluginScriptRunnerFactory
@Override
public void process(IDataSetRegistrationTransactionV2 transaction,
Map<String, Object> parameters, ISimpleTableModelBuilderAdaptor tableBuilder)
throws EvaluatorException
throws EvaluatorException
{
evaluator.evalFunction(FUNCTION_NAME, transaction, parameters, tableBuilder);
}
......@@ -400,9 +401,9 @@ public class PluginScriptRunnerFactory implements IPluginScriptRunnerFactory
{
private final static String DESCRIBE_FUNCTION_NAME = "describe";
private final Evaluator evaluator;
private final IJythonEvaluator evaluator;
ReportingPluginScriptRunner(Evaluator evaluator)
ReportingPluginScriptRunner(IJythonEvaluator evaluator)
{
this.evaluator = evaluator;
if (false == evaluator.hasFunction(DESCRIBE_FUNCTION_NAME))
......@@ -429,9 +430,9 @@ public class PluginScriptRunnerFactory implements IPluginScriptRunnerFactory
{
private final static String PROCESS_FUNCTION_NAME = "process";
private final Evaluator evaluator;
private final IJythonEvaluator evaluator;
ProcessingPluginScriptRunner(Evaluator evaluator)
ProcessingPluginScriptRunner(IJythonEvaluator evaluator)
{
this.evaluator = evaluator;
if (false == evaluator.hasFunction(PROCESS_FUNCTION_NAME))
......@@ -467,9 +468,9 @@ public class PluginScriptRunnerFactory implements IPluginScriptRunnerFactory
{
private final static String FUNCTION_NAME = "handle";
private final Evaluator27 evaluator;
private final IJythonEvaluator evaluator;
RequestHandlerPluginScriptRunner(Evaluator27 evaluator)
RequestHandlerPluginScriptRunner(IJythonEvaluator evaluator)
{
this.evaluator = evaluator;
if (false == evaluator.hasFunction(FUNCTION_NAME))
......
......@@ -41,7 +41,7 @@
<bean id="data-set-path-infos-provider" class="ch.systemsx.cisd.openbis.dss.generic.server.DatabaseBasedDataSetPathInfoProvider"/>
<bean id="plugin-tasks" class="ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.PluginTaskInfoProvider"
<bean id="plugin-tasks" class="ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.PluginTaskInfoProvider" depends-on="jython-evaluator"
factory-method="create" />
<bean id="etl-lims-service" class="ch.systemsx.cisd.openbis.dss.generic.server.EncapsulatedOpenBISService"
......@@ -278,5 +278,8 @@
<constructor-arg ref="general-information-service"/>
<constructor-arg ref="adapted-ftp-user-manager"/>
</bean>
<bean id="jython-evaluator" class="ch.systemsx.cisd.common.jython.evaluator.JythonEvaluatorSpringComponent" >
<constructor-arg ref="propertyConfigurer" />
</bean>
</beans>
\ No newline at end of file
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