Skip to content
Snippets Groups Projects
Commit 6ba82d77 authored by brinn's avatar brinn
Browse files

upgrade: jython to 2.5.2

Note that all references to objects used in a Jython script need to be public now.

SVN: 22397
parent a8381a0c
No related branches found
No related tags found
No related merge requests found
Showing
with 108 additions and 78 deletions
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<classpathentry kind="lib" path="/libraries/cisd-base/cisd-base-test.jar" sourcepath="/libraries/cisd-base/cisd-base-src.zip"/> <classpathentry kind="lib" path="/libraries/cisd-base/cisd-base-test.jar" sourcepath="/libraries/cisd-base/cisd-base-src.zip"/>
<classpathentry kind="lib" path="/libraries/cisd-base/cisd-base.jar" sourcepath="/libraries/cisd-base/cisd-base-src.zip"/> <classpathentry kind="lib" path="/libraries/cisd-base/cisd-base.jar" sourcepath="/libraries/cisd-base/cisd-base-src.zip"/>
<classpathentry kind="lib" path="/libraries/fast-md5/fast-md5.jar" sourcepath="/libraries/fast-md5/src.zip"/> <classpathentry kind="lib" path="/libraries/fast-md5/fast-md5.jar" sourcepath="/libraries/fast-md5/src.zip"/>
<classpathentry kind="lib" path="/libraries/jython/jython.jar" sourcepath="/libraries/jython/src.zip"/> <classpathentry kind="lib" path="/libraries/jython/jython.jar" sourcepath="/libraries/jython/jython_src.zip"/>
<classpathentry kind="lib" path="/libraries/commons-httpclient/commons-httpclient.jar" sourcepath="/libraries/commons-httpclient/src.zip"/> <classpathentry kind="lib" path="/libraries/commons-httpclient/commons-httpclient.jar" sourcepath="/libraries/commons-httpclient/src.zip"/>
<classpathentry kind="lib" path="/libraries/commons-logging/commons-logging.jar" sourcepath="/libraries/commons-logging/src.zip"/> <classpathentry kind="lib" path="/libraries/commons-logging/commons-logging.jar" sourcepath="/libraries/commons-logging/src.zip"/>
<classpathentry kind="lib" path="/libraries/jaxb/jaxb-api.jar" sourcepath="/libraries/jaxb/jaxb-api-src.zip"/> <classpathentry kind="lib" path="/libraries/jaxb/jaxb-api.jar" sourcepath="/libraries/jaxb/jaxb-api-src.zip"/>
......
package ch.systemsx.cisd.common.evaluator;
/* /*
* Copyright 2009 ETH Zuerich, CISD * Copyright 2009 ETH Zuerich, CISD
* *
...@@ -16,17 +14,22 @@ package ch.systemsx.cisd.common.evaluator; ...@@ -16,17 +14,22 @@ package ch.systemsx.cisd.common.evaluator;
* limitations under the License. * limitations under the License.
*/ */
package ch.systemsx.cisd.common.evaluator;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.python.core.CompileMode;
import org.python.core.CompilerFlags;
import org.python.core.Py;
import org.python.core.PyBoolean;
import org.python.core.PyCode; import org.python.core.PyCode;
import org.python.core.PyException; import org.python.core.PyException;
import org.python.core.PyFloat; import org.python.core.PyFloat;
import org.python.core.PyFunction; import org.python.core.PyFunction;
import org.python.core.PyInteger; import org.python.core.PyInteger;
import org.python.core.PyJavaInstance;
import org.python.core.PyList; import org.python.core.PyList;
import org.python.core.PyLong; import org.python.core.PyLong;
import org.python.core.PyNone; import org.python.core.PyNone;
...@@ -34,7 +37,6 @@ import org.python.core.PyObject; ...@@ -34,7 +37,6 @@ import org.python.core.PyObject;
import org.python.core.PyString; import org.python.core.PyString;
import org.python.core.PyStringMap; import org.python.core.PyStringMap;
import org.python.core.PySystemState; import org.python.core.PySystemState;
import org.python.core.__builtin__;
import org.python.util.PythonInterpreter; import org.python.util.PythonInterpreter;
/** /**
...@@ -45,7 +47,7 @@ import org.python.util.PythonInterpreter; ...@@ -45,7 +47,7 @@ import org.python.util.PythonInterpreter;
* <ol> * <ol>
* <li>Construct an {@link Evaluator} with an appropriate expression.</li> * <li>Construct an {@link Evaluator} with an appropriate expression.</li>
* <li>Set all variables needed for evaluation via {@link #set(String, Object)}</li> * <li>Set all variables needed for evaluation via {@link #set(String, Object)}</li>
* <li>Call one of {@link #getType()}, {@link #evalAsString()}, {@link #evalToBoolean()}, * <li>Call one of {@link #getType()}, {@link #evalAsString}, {@link #evalToBoolean()},
* {@link #evalToInt()}, {@link #evalToBigInt()}, {@link #evalToDouble()}.</li> * {@link #evalToInt()}, {@link #evalToBigInt()}, {@link #evalToDouble()}.</li>
* <li>Repeat from step 2</li> * <li>Repeat from step 2</li>
* </ol> * </ol>
...@@ -73,7 +75,7 @@ public final class Evaluator ...@@ -73,7 +75,7 @@ public final class Evaluator
*/ */
public enum ReturnType public enum ReturnType
{ {
INTEGER_OR_BOOLEAN, BIGINT, DOUBLE, STRING, OTHER BOOLEAN, INTEGER, BIGINT, DOUBLE, STRING, OTHER
} }
/** /**
...@@ -173,7 +175,7 @@ public final class Evaluator ...@@ -173,7 +175,7 @@ public final class Evaluator
if (pyObject instanceof PyFunction == false) if (pyObject instanceof PyFunction == false)
{ {
throw new PyException(new PyString("Not a function"), "'" + functionName throw new PyException(new PyString("Not a function"), "'" + functionName
+ "' is of type " + pyObject.getType().getFullName() + "."); + "' is of type " + pyObject.getType().getName() + ".");
} }
PyFunction func = (PyFunction) pyObject; PyFunction func = (PyFunction) pyObject;
PyObject[] pyArgs = new PyObject[args.length]; PyObject[] pyArgs = new PyObject[args.length];
...@@ -204,7 +206,7 @@ public final class Evaluator ...@@ -204,7 +206,7 @@ public final class Evaluator
{ {
return new PyString((String) javaObject); return new PyString((String) javaObject);
} }
return new PyJavaInstance(javaObject); return Py.java2py(javaObject);
} }
/** /**
...@@ -215,8 +217,8 @@ public final class Evaluator ...@@ -215,8 +217,8 @@ public final class Evaluator
{ {
try try
{ {
return __builtin__.compile("__result__=(" + expression + ")", "expression: " return Py.compile_flags("__result__=(" + expression + ")", "expression: " + expression,
+ expression, "exec"); CompileMode.exec, new CompilerFlags());
} catch (PyException ex) } catch (PyException ex)
{ {
throw toEvaluatorException(ex, expression); throw toEvaluatorException(ex, expression);
...@@ -255,9 +257,12 @@ public final class Evaluator ...@@ -255,9 +257,12 @@ public final class Evaluator
{ {
doEval(); doEval();
final Object obj = getInterpreterResult(); final Object obj = getInterpreterResult();
if (obj instanceof PyInteger) if (obj instanceof PyBoolean)
{ {
return ReturnType.INTEGER_OR_BOOLEAN; return ReturnType.BOOLEAN;
} else if (obj instanceof PyInteger)
{
return ReturnType.INTEGER;
} else if (obj instanceof PyLong) } else if (obj instanceof PyLong)
{ {
return ReturnType.BIGINT; return ReturnType.BIGINT;
...@@ -276,16 +281,19 @@ public final class Evaluator ...@@ -276,16 +281,19 @@ public final class Evaluator
/** /**
* Evaluates the expression of this evaluator and returns the result. Use this method if you do * Evaluates the expression of this evaluator and returns the result. Use this method if you do
* not know what will be the result type. * not know what will be the result type.
* <p>
* <i>This is a legacy function to mimic the old Jython 2.2 Evaluator's behavior which will only
* return Long, Double or String and doesn't know boolean.</i>
* *
* @return evaluation result which can be of Long, Double or String type. All other types are * @return evaluation result which can be of Long, Double or String type. All other types are
* converted to String representation except {@link PyNone} that represents null value * converted to String representation except {@link PyNone} that represents null value
* and will be converted to <code>null</code>. * and will be converted to <code>null</code>.
*/ */
public Object eval() public Object evalLegacy2_2()
{ {
doEval(); doEval();
final PyObject obj = getInterpreterResult(); final PyObject obj = getInterpreterResult();
Object result = translateToJava(obj); Object result = translateToJavaLegacy(obj);
if (result != null && result instanceof Long == false && result instanceof Double == false if (result != null && result instanceof Long == false && result instanceof Double == false
&& result instanceof String == false) && result instanceof String == false)
{ {
...@@ -294,7 +302,19 @@ public final class Evaluator ...@@ -294,7 +302,19 @@ public final class Evaluator
return result; return result;
} }
private Object translateToJava(final PyObject obj) /**
* Evaluates the expression of this evaluator and returns the result. Use this method if you do
* not know what will be the result type.
*
* @return evaluation result as translated by the Jython interpreter..
*/
public Object eval()
{
doEval();
return translateToJava(getInterpreterResult());
}
private Object translateToJavaLegacy(final PyObject obj)
{ {
if (obj instanceof PyInteger) if (obj instanceof PyInteger)
{ {
...@@ -315,18 +335,20 @@ public final class Evaluator ...@@ -315,18 +335,20 @@ public final class Evaluator
List<Object> list = new ArrayList<Object>(); List<Object> list = new ArrayList<Object>();
for (int i = 0, n = pyList.size(); i < n; i++) for (int i = 0, n = pyList.size(); i < n; i++)
{ {
list.add(translateToJava(array[i])); list.add(translateToJavaLegacy(array[i]));
} }
return list; return list;
} else if (obj instanceof PyJavaInstance)
{
return ((PyJavaInstance) obj).__tojava__(Object.class);
} else } else
{ {
return obj == null ? null : obj.toString(); return translateToJava(obj);
} }
} }
private Object translateToJava(final PyObject obj)
{
return (obj == null) ? null : obj.__tojava__(Object.class);
}
private PyObject getInterpreterResult() private PyObject getInterpreterResult()
{ {
return interpreter.get("__result__"); return interpreter.get("__result__");
...@@ -341,12 +363,12 @@ public final class Evaluator ...@@ -341,12 +363,12 @@ public final class Evaluator
doEval(); doEval();
try try
{ {
return ((PyInteger) getInterpreterResult()).getValue() > 0; return ((PyBoolean) getInterpreterResult()).getValue() > 0;
} catch (ClassCastException ex) } catch (ClassCastException ex)
{ {
final ReturnType type = getType(); final ReturnType type = getType();
throw new EvaluatorException("Expected a result of type " throw new EvaluatorException("Expected a result of type " + ReturnType.INTEGER
+ ReturnType.INTEGER_OR_BOOLEAN + ", found " + type); + ", found " + type);
} }
} }
...@@ -363,8 +385,8 @@ public final class Evaluator ...@@ -363,8 +385,8 @@ public final class Evaluator
} catch (ClassCastException ex) } catch (ClassCastException ex)
{ {
final ReturnType type = getType(); final ReturnType type = getType();
throw new EvaluatorException("Expected a result of type " throw new EvaluatorException("Expected a result of type " + ReturnType.INTEGER
+ ReturnType.INTEGER_OR_BOOLEAN + ", found " + type); + ", found " + type);
} }
} }
...@@ -404,6 +426,21 @@ public final class Evaluator ...@@ -404,6 +426,21 @@ public final class Evaluator
} }
} }
/**
* Evaluates the expression of this evaluator and returns the result as a String. This method
* can always be called.
* <p>
* <i>This is a legacy function to mimic the old Jython 2.2 Evaluator's behavior which first
* translates to Long and Double and doesn't know boolean.</i>
* <p>
* NOTE: null will be returned if expression results in {@link PyNone}
*/
public String evalAsStringLegacy2_2() throws EvaluatorException
{
Object result = evalLegacy2_2();
return result == null ? null : result.toString();
}
/** /**
* Evaluates the expression of this evaluator and returns the result as a String. This method * Evaluates the expression of this evaluator and returns the result as a String. This method
* can always be called. * can always be called.
...@@ -436,13 +473,10 @@ public final class Evaluator ...@@ -436,13 +473,10 @@ public final class Evaluator
{ {
Exception exception = null; Exception exception = null;
PyObject value = ex.value; PyObject value = ex.value;
if (value instanceof PyJavaInstance) Object object = value.__tojava__(Object.class);
if (object instanceof Exception)
{ {
Object object = ((PyJavaInstance) value).__tojava__(Object.class); exception = (Exception) object;
if (object instanceof Exception)
{
exception = (Exception) object;
}
} }
String msg = extractExceptionMessage(ex); String msg = extractExceptionMessage(ex);
if (expressionOrNull != null) if (expressionOrNull != null)
......
...@@ -99,12 +99,12 @@ public class EvaluatorTest extends AssertJUnit ...@@ -99,12 +99,12 @@ public class EvaluatorTest extends AssertJUnit
public static class Functions public static class Functions
{ {
public static double Min(double a, double b) public static double MinDbl(double a, double b)
{ {
return (a < b) ? a : b; return (a < b) ? a : b;
} }
public static double Min(double... vals) public static double MinDbl(double[] vals)
{ {
double result = Double.MAX_VALUE; double result = Double.MAX_VALUE;
for (double v : vals) for (double v : vals)
...@@ -117,20 +117,21 @@ public class EvaluatorTest extends AssertJUnit ...@@ -117,20 +117,21 @@ public class EvaluatorTest extends AssertJUnit
return result; return result;
} }
public static int Min(int a, int b) public static int MinInt(int a, int b)
{ {
return (a < b) ? a : b; return (a < b) ? a : b;
} }
} }
@Test @Test
public void testFunctionEval() public void testFunctionEval()
{ {
Evaluator eval = new Evaluator("Min(1,2)", Functions.class, null); Evaluator eval = new Evaluator("MinInt(1,2)", Functions.class, null);
assertEquals(1, eval.evalToInt()); assertEquals(1, eval.evalToInt());
eval = new Evaluator("Min([1,2,0.1])", Functions.class, null); eval = new Evaluator("MinDbl([1,2,0.1])", Functions.class, null);
assertEquals(0.1, eval.evalToDouble(), 1e-15); assertEquals(0.1, eval.evalToDouble(), 1e-15);
eval = new Evaluator("Min(v)", Functions.class, null); eval = new Evaluator("MinDbl(v)", Functions.class, null);
eval.set("v", new double[] eval.set("v", new double[]
{ 1, 2, -99.9, 3 }); { 1, 2, -99.9, 3 });
assertEquals(-99.9, eval.evalToDouble(), 1e-15); assertEquals(-99.9, eval.evalToDouble(), 1e-15);
...@@ -149,7 +150,7 @@ public class EvaluatorTest extends AssertJUnit ...@@ -149,7 +150,7 @@ public class EvaluatorTest extends AssertJUnit
{ {
final Evaluator eval = new Evaluator("a"); final Evaluator eval = new Evaluator("a");
eval.set("a", 2); eval.set("a", 2);
assertEquals(ReturnType.INTEGER_OR_BOOLEAN, eval.getType()); assertEquals(ReturnType.INTEGER, eval.getType());
eval.set("a", "2"); eval.set("a", "2");
assertEquals(ReturnType.STRING, eval.getType()); assertEquals(ReturnType.STRING, eval.getType());
} }
...@@ -178,15 +179,16 @@ public class EvaluatorTest extends AssertJUnit ...@@ -178,15 +179,16 @@ public class EvaluatorTest extends AssertJUnit
{ {
final Evaluator eval = new Evaluator("a"); final Evaluator eval = new Evaluator("a");
eval.set("a", true); eval.set("a", true);
assertEquals(ReturnType.INTEGER_OR_BOOLEAN, eval.getType()); assertEquals(ReturnType.BOOLEAN, eval.getType());
assertEquals("1", eval.evalAsString()); assertEquals("true", eval.evalAsString());
try try
{ {
eval.evalToDouble(); eval.evalToDouble();
fail("Type mismatch not detected.");
} catch (EvaluatorException ex) } catch (EvaluatorException ex)
{ {
assertEquals(ex.getMessage(), assertEquals(ex.getMessage(),
"Expected a result of type DOUBLE, found INTEGER_OR_BOOLEAN", ex.getMessage()); "Expected a result of type DOUBLE, found BOOLEAN", ex.getMessage());
} }
} }
...@@ -245,7 +247,7 @@ public class EvaluatorTest extends AssertJUnit ...@@ -245,7 +247,7 @@ public class EvaluatorTest extends AssertJUnit
Evaluator evaluator = new Evaluator("", null, "def get():\n return ['a','b']"); Evaluator evaluator = new Evaluator("", null, "def get():\n return ['a','b']");
Object result = evaluator.evalFunction("get"); Object result = evaluator.evalFunction("get");
assertEquals("Result " + result.getClass(), true, result instanceof List); assertEquals("Result " + result.getClass(), true, result instanceof List);
assertEquals("[a, b]", result.toString()); assertEquals("['a', 'b']", result.toString());
} }
@Test @Test
...@@ -258,7 +260,9 @@ public class EvaluatorTest extends AssertJUnit ...@@ -258,7 +260,9 @@ public class EvaluatorTest extends AssertJUnit
fail("EvaluatorException expected"); fail("EvaluatorException expected");
} catch (EvaluatorException ex) } catch (EvaluatorException ex)
{ {
assertEquals("Error evaluating 'hello(world)': NameError: unknown", ex.getMessage()); assertEquals(
"Error evaluating 'hello(world)': NameError: global name 'unknown' is not defined",
ex.getMessage());
} }
} }
...@@ -316,7 +320,7 @@ public class EvaluatorTest extends AssertJUnit ...@@ -316,7 +320,7 @@ public class EvaluatorTest extends AssertJUnit
} catch (EvaluatorException ex) } catch (EvaluatorException ex)
{ {
assertEquals("Error evaluating 'hello()': TypeError: " assertEquals("Error evaluating 'hello()': TypeError: "
+ "hello() takes at least 1 argument (0 given)", ex.getMessage()); + "hello() takes exactly 1 argument (0 given)", ex.getMessage());
} }
} }
...@@ -331,7 +335,7 @@ public class EvaluatorTest extends AssertJUnit ...@@ -331,7 +335,7 @@ public class EvaluatorTest extends AssertJUnit
} catch (EvaluatorException ex) } catch (EvaluatorException ex)
{ {
assertEquals("Error evaluating 'hello(world, universe)': TypeError: " assertEquals("Error evaluating 'hello(world, universe)': TypeError: "
+ "hello() too many arguments; expected 1 got 2", ex.getMessage()); + "hello() takes exactly 1 argument (2 given)", ex.getMessage());
} }
} }
...@@ -347,7 +351,7 @@ public class EvaluatorTest extends AssertJUnit ...@@ -347,7 +351,7 @@ public class EvaluatorTest extends AssertJUnit
} catch (EvaluatorException ex) } catch (EvaluatorException ex)
{ {
assertEquals("Error evaluating 'get(world, universe)': AttributeError: " assertEquals("Error evaluating 'get(world, universe)': AttributeError: "
+ "'string' object has no attribute 'get'", ex.getMessage()); + "'str' object has no attribute 'get'", ex.getMessage());
} }
} }
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
<classpathentry kind="src" path="resource"/> <classpathentry kind="src" path="resource"/>
<classpathentry kind="src" path="sourceTest/java"/> <classpathentry kind="src" path="sourceTest/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="/libraries/jython/standalone/jython.jar" sourcepath="/Users/gpawel/Downloads/jython_installer-2.2.1.jar"/>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/common"/> <classpathentry combineaccessrules="false" exported="true" kind="src" path="/common"/>
<classpathentry kind="lib" path="/libraries/log4j/log4j.jar" sourcepath="/libraries/log4j/src.zip"/> <classpathentry kind="lib" path="/libraries/log4j/log4j.jar" sourcepath="/libraries/log4j/src.zip"/>
<classpathentry kind="lib" path="/libraries/commons-lang/commons-lang.jar" sourcepath="/libraries/commons-lang/src.zip"/> <classpathentry kind="lib" path="/libraries/commons-lang/commons-lang.jar" sourcepath="/libraries/commons-lang/src.zip"/>
...@@ -71,5 +70,6 @@ ...@@ -71,5 +70,6 @@
<classpathentry kind="lib" path="/libraries/poi/ooxml-lib/xmlbeans-2.3.0.jar"/> <classpathentry kind="lib" path="/libraries/poi/ooxml-lib/xmlbeans-2.3.0.jar"/>
<classpathentry kind="lib" path="/libraries/ftpserver/ftpserver-core.jar"/> <classpathentry kind="lib" path="/libraries/ftpserver/ftpserver-core.jar"/>
<classpathentry kind="lib" path="/libraries/mina/mina-core.jar"/> <classpathentry kind="lib" path="/libraries/mina/mina-core.jar"/>
<classpathentry kind="lib" path="/libraries/jython/jython.jar" sourcepath="/libraries/jython/jython_src.zip"/>
<classpathentry kind="output" path="targets/classes"/> <classpathentry kind="output" path="targets/classes"/>
</classpath> </classpath>
...@@ -150,9 +150,6 @@ ...@@ -150,9 +150,6 @@
<copy file="${lib}/jython/jython.jar" todir="${dist.datastore_server.lib}" /> <copy file="${lib}/jython/jython.jar" todir="${dist.datastore_server.lib}" />
<copy file="${lib}/mina/mina-core.jar" todir="${dist.datastore_server.lib}" /> <copy file="${lib}/mina/mina-core.jar" todir="${dist.datastore_server.lib}" />
<copy file="${lib}/ftpserver/ftpserver-core.jar" todir="${dist.datastore_server.lib}" /> <copy file="${lib}/ftpserver/ftpserver-core.jar" todir="${dist.datastore_server.lib}" />
<copy todir="${dist.datastore_server.lib}/jython-lib" >
<fileset dir="${lib}/jython/jython-lib" />
</copy>
<copy file="${lib}/truezip/truezip.jar" todir="${dist.datastore_server.lib}" /> <copy file="${lib}/truezip/truezip.jar" todir="${dist.datastore_server.lib}" />
<copy todir="${dist.datastore_server.lib}/${dss_upload_gui}" > <copy todir="${dist.datastore_server.lib}/${dss_upload_gui}" >
<fileset dir="${dist.dss_upload_gui.lib}" /> <fileset dir="${dist.dss_upload_gui.lib}" />
...@@ -283,7 +280,7 @@ ...@@ -283,7 +280,7 @@
<copy file="${lib}/commons-httpclient/commons-httpclient.jar" todir="${dist.dss_client.lib}" /> <copy file="${lib}/commons-httpclient/commons-httpclient.jar" todir="${dist.dss_client.lib}" />
<copy file="${lib}/spring/spring.jar" todir="${dist.dss_client.lib}" /> <copy file="${lib}/spring/spring.jar" todir="${dist.dss_client.lib}" />
<copy file="${lib}/jline/jline.jar" todir="${dist.dss_client.lib}" /> <copy file="${lib}/jline/jline.jar" todir="${dist.dss_client.lib}" />
<copy file="${lib}/jython/standalone/jython.jar" todir="${dist.dss_client.lib}" /> <copy file="${lib}/jython/jython.jar" todir="${dist.dss_client.lib}" />
<copy file="${lib}/poi/poi-3.7-20101029.jar" todir="${dist.dss_client.lib}" /> <copy file="${lib}/poi/poi-3.7-20101029.jar" todir="${dist.dss_client.lib}" />
<copy file="${lib}/poi/poi-ooxml-3.7-20101029.jar" todir="${dist.dss_client.lib}" /> <copy file="${lib}/poi/poi-ooxml-3.7-20101029.jar" todir="${dist.dss_client.lib}" />
<copy file="${lib}/poi/poi-ooxml-schemas-3.7-20101029.jar" todir="${dist.dss_client.lib}" /> <copy file="${lib}/poi/poi-ooxml-schemas-3.7-20101029.jar" todir="${dist.dss_client.lib}" />
...@@ -400,7 +397,7 @@ ...@@ -400,7 +397,7 @@
<param name="jar" value="stream-supporting-httpinvoker.jar" /> <param name="jar" value="stream-supporting-httpinvoker.jar" />
</antcall> </antcall>
<antcall target="copy-and-sign-jar"> <antcall target="copy-and-sign-jar">
<param name="dir" value="${lib}/jython/standalone" /> <param name="dir" value="${lib}/jython" />
<param name="jar" value="jython.jar" /> <param name="jar" value="jython.jar" />
</antcall> </antcall>
<antcall target="copy-and-sign-jar"> <antcall target="copy-and-sign-jar">
......
...@@ -298,7 +298,7 @@ public class DataSetRegistrationService<T extends DataSetInformation> implements ...@@ -298,7 +298,7 @@ public class DataSetRegistrationService<T extends DataSetInformation> implements
return encounteredErrors; return encounteredErrors;
} }
protected IDataSetRegistrationDetailsFactory<T> getDataSetRegistrationDetailsFactory() public IDataSetRegistrationDetailsFactory<T> getDataSetRegistrationDetailsFactory()
{ {
return dataSetRegistrationDetailsFactory; return dataSetRegistrationDetailsFactory;
} }
......
...@@ -101,7 +101,7 @@ public class JythonTopLevelDataSetHandler<T extends DataSetInformation> extends ...@@ -101,7 +101,7 @@ public class JythonTopLevelDataSetHandler<T extends DataSetInformation> extends
} }
@Override @Override
protected void handleDataSet(File dataSetFile, DataSetRegistrationService<T> genericService) public void handleDataSet(File dataSetFile, DataSetRegistrationService<T> genericService)
throws Throwable throws Throwable
{ {
// Load the script // Load the script
...@@ -221,7 +221,7 @@ public class JythonTopLevelDataSetHandler<T extends DataSetInformation> extends ...@@ -221,7 +221,7 @@ public class JythonTopLevelDataSetHandler<T extends DataSetInformation> extends
{ {
try try
{ {
PyFunction function = (PyFunction) interpreter.get(functionName, PyFunction.class); PyFunction function = interpreter.get(functionName, PyFunction.class);
return function; return function;
} catch (Exception e) } catch (Exception e)
{ {
...@@ -317,7 +317,7 @@ public class JythonTopLevelDataSetHandler<T extends DataSetInformation> extends ...@@ -317,7 +317,7 @@ public class JythonTopLevelDataSetHandler<T extends DataSetInformation> extends
} }
} }
protected static class JythonDataSetRegistrationService<T extends DataSetInformation> extends public static class JythonDataSetRegistrationService<T extends DataSetInformation> extends
DataSetRegistrationService<T> DataSetRegistrationService<T>
{ {
private final PythonInterpreter interpreter; private final PythonInterpreter interpreter;
......
...@@ -146,7 +146,7 @@ public class ValidationScriptRunner ...@@ -146,7 +146,7 @@ public class ValidationScriptRunner
{ {
try try
{ {
PyFunction function = (PyFunction) interpreter.get(functionName, PyFunction.class); PyFunction function = interpreter.get(functionName, PyFunction.class);
return function; return function;
} catch (Exception e) } catch (Exception e)
{ {
......
...@@ -1150,7 +1150,7 @@ public class JythonTopLevelDataSetRegistratorTest extends AbstractFileSystemTest ...@@ -1150,7 +1150,7 @@ public class JythonTopLevelDataSetRegistratorTest extends AbstractFileSystemTest
((JythonDataSetRegistrationService<DataSetInformation>) service) ((JythonDataSetRegistrationService<DataSetInformation>) service)
.getInterpreter(); .getInterpreter();
didRollbackServiceFunctionRun = didRollbackServiceFunctionRun =
(Boolean) interpreter.get("didRollbackServiceFunctionRun", Boolean.class); interpreter.get("didRollbackServiceFunctionRun", Boolean.class);
} }
@Override @Override
...@@ -1165,7 +1165,7 @@ public class JythonTopLevelDataSetRegistratorTest extends AbstractFileSystemTest ...@@ -1165,7 +1165,7 @@ public class JythonTopLevelDataSetRegistratorTest extends AbstractFileSystemTest
((JythonDataSetRegistrationService<DataSetInformation>) service) ((JythonDataSetRegistrationService<DataSetInformation>) service)
.getInterpreter(); .getInterpreter();
didRollbackDataSetRegistrationFunctionRun = didRollbackDataSetRegistrationFunctionRun =
(Boolean) interpreter.get("didRollbackServiceFunctionRun", Boolean.class); interpreter.get("didRollbackServiceFunctionRun", Boolean.class);
} }
@Override @Override
...@@ -1182,7 +1182,7 @@ public class JythonTopLevelDataSetRegistratorTest extends AbstractFileSystemTest ...@@ -1182,7 +1182,7 @@ public class JythonTopLevelDataSetRegistratorTest extends AbstractFileSystemTest
((JythonDataSetRegistrationService<DataSetInformation>) service) ((JythonDataSetRegistrationService<DataSetInformation>) service)
.getInterpreter(); .getInterpreter();
didRollbackTransactionFunctionRunHappen = didRollbackTransactionFunctionRunHappen =
(Boolean) interpreter.get("didTransactionRollbackHappen", Boolean.class); interpreter.get("didTransactionRollbackHappen", Boolean.class);
} }
@Override @Override
...@@ -1196,7 +1196,7 @@ public class JythonTopLevelDataSetRegistratorTest extends AbstractFileSystemTest ...@@ -1196,7 +1196,7 @@ public class JythonTopLevelDataSetRegistratorTest extends AbstractFileSystemTest
((JythonDataSetRegistrationService<DataSetInformation>) service) ((JythonDataSetRegistrationService<DataSetInformation>) service)
.getInterpreter(); .getInterpreter();
didCommitTransactionFunctionRunHappen = didCommitTransactionFunctionRunHappen =
(Boolean) interpreter.get("didTransactionCommitHappen", Boolean.class); interpreter.get("didTransactionCommitHappen", Boolean.class);
} }
@Override @Override
......
...@@ -723,10 +723,6 @@ ...@@ -723,10 +723,6 @@
<lib dir="${lib}/jython"> <lib dir="${lib}/jython">
<include name="jython.jar" /> <include name="jython.jar" />
</lib> </lib>
<!-- modules for jython scripting -->
<webinf dir="${lib}/jython/">
<include name="jython-lib/**/*.*" />
</webinf>
</war> </war>
<!-- Does some cleaning. --> <!-- Does some cleaning. -->
<delete file="${jar.file}" failonerror="true" /> <delete file="${jar.file}" failonerror="true" />
......
...@@ -25,7 +25,7 @@ package ch.systemsx.cisd.openbis.generic.client.web.server.calculator; ...@@ -25,7 +25,7 @@ package ch.systemsx.cisd.openbis.generic.client.web.server.calculator;
* *
* @author Franz-Josef Elmer * @author Franz-Josef Elmer
*/ */
class ColumnDefinition public class ColumnDefinition
{ {
private final String columnID; private final String columnID;
private final ITableDataProvider provider; private final ITableDataProvider provider;
......
...@@ -26,7 +26,7 @@ import java.util.List; ...@@ -26,7 +26,7 @@ import java.util.List;
* *
* @author Franz-Josef Elmer * @author Franz-Josef Elmer
*/ */
class ColumnGroup public class ColumnGroup
{ {
private final String propertyValue; private final String propertyValue;
private final List<Object> values; private final List<Object> values;
......
...@@ -35,7 +35,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ISerializableComparable ...@@ -35,7 +35,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ISerializableComparable
* *
* @author Franz-Josef Elmer * @author Franz-Josef Elmer
*/ */
final class Row public final class Row
{ {
private final Map<String, List<ColumnDefinition>> definitionsByProperties = private final Map<String, List<ColumnDefinition>> definitionsByProperties =
new HashMap<String, List<ColumnDefinition>>(); new HashMap<String, List<ColumnDefinition>>();
......
...@@ -28,7 +28,7 @@ import ch.systemsx.cisd.openbis.generic.shared.calculator.AbstractCalculator; ...@@ -28,7 +28,7 @@ import ch.systemsx.cisd.openbis.generic.shared.calculator.AbstractCalculator;
/** /**
* @author Franz-Josef Elmer * @author Franz-Josef Elmer
*/ */
class RowCalculator extends AbstractCalculator public class RowCalculator extends AbstractCalculator
{ {
private final Row row; private final Row row;
......
...@@ -29,7 +29,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.EntityTypePropertyTypePE; ...@@ -29,7 +29,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.EntityTypePropertyTypePE;
* *
* @author Piotr Buczek * @author Piotr Buczek
*/ */
class DynamicPropertyAdaptor implements IEntityPropertyAdaptor public class DynamicPropertyAdaptor implements IEntityPropertyAdaptor
{ {
/** state of lazy evaluation of the property value (analogy to graph search) */ /** state of lazy evaluation of the property value (analogy to graph search) */
private enum State private enum State
......
...@@ -25,7 +25,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialIdentifier; ...@@ -25,7 +25,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialIdentifier;
* *
* @author Piotr Buczek * @author Piotr Buczek
*/ */
final class DynamicPropertyFunctions public final class DynamicPropertyFunctions
{ {
/** /**
* @return String representation of material identifier for given material code and material * @return String representation of material identifier for given material code and material
......
...@@ -26,7 +26,7 @@ import ch.systemsx.cisd.openbis.generic.shared.util.XmlUtils; ...@@ -26,7 +26,7 @@ import ch.systemsx.cisd.openbis.generic.shared.util.XmlUtils;
* *
* @author Piotr Buczek * @author Piotr Buczek
*/ */
class XmlPropertyAdaptor extends BasicPropertyAdaptor public class XmlPropertyAdaptor extends BasicPropertyAdaptor
{ {
private final String xsltTransformation; private final String xsltTransformation;
......
...@@ -49,7 +49,7 @@ public class AbstractCalculator ...@@ -49,7 +49,7 @@ public class AbstractCalculator
public PrimitiveValue getTypedResult() public PrimitiveValue getTypedResult()
{ {
Object value = evaluator.eval(); Object value = evaluator.evalLegacy2_2();
if (value == null) if (value == null)
{ {
return PrimitiveValue.NULL; return PrimitiveValue.NULL;
...@@ -88,12 +88,12 @@ public class AbstractCalculator ...@@ -88,12 +88,12 @@ public class AbstractCalculator
public String evalAsString() throws EvaluatorException public String evalAsString() throws EvaluatorException
{ {
return evaluator.evalAsString(); return evaluator.evalAsStringLegacy2_2();
} }
public Object eval() throws EvaluatorException public Object eval() throws EvaluatorException
{ {
return evaluator.eval(); return evaluator.evalLegacy2_2();
} }
} }
\ No newline at end of file
...@@ -41,7 +41,7 @@ import ch.systemsx.cisd.common.utilities.ExceptionUtils; ...@@ -41,7 +41,7 @@ import ch.systemsx.cisd.common.utilities.ExceptionUtils;
* *
* @author Franz-Josef Elmer * @author Franz-Josef Elmer
*/ */
final class StandardFunctions public final class StandardFunctions
{ {
static final Double DOUBLE_DEFAULT_VALUE = new Double(-Double.MAX_VALUE); static final Double DOUBLE_DEFAULT_VALUE = new Double(-Double.MAX_VALUE);
......
...@@ -115,7 +115,6 @@ public final class CachedResultSetManagerTest extends AssertJUnit ...@@ -115,7 +115,6 @@ public final class CachedResultSetManagerTest extends AssertJUnit
{ {
resultSetConfig.setAvailableColumns(new LinkedHashSet<IColumnDefinition<DataHolder>>( resultSetConfig.setAvailableColumns(new LinkedHashSet<IColumnDefinition<DataHolder>>(
cols.values())); cols.values()));
System.out.println(resultSetConfig.getAvailableColumns().size());
if (columnFilters.isEmpty() == false) if (columnFilters.isEmpty() == false)
{ {
resultSetConfig.setFilters(GridFilters.createColumnFilter(columnFilters)); resultSetConfig.setFilters(GridFilters.createColumnFilter(columnFilters));
......
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