TBX: x.x, Improve the OS detection
OS detection in TBX is actually done by strings comparison and used in
various places, e.g. System.getProperty(“os.name”).contains(“win32”) for
Windows.
On some systems, System.getProperty(“os.name”) now returns “Windows 7”
on Windows 7 OS leading to a failure of R/CQP launching on Win 7 because
the Linux launching native code is executed instead of Win native code.
Result in log is:
Failed to start RServe : org.txm.stat.engine.r.RWorkspaceException: ** The Statistics Engine program path is set but we couldn't find it : C:\XXXXXX\R\bin\R.exe
Solution 1
- use org.ecplise.core.runtime.Platform.getOS()
- bundle is present in TBX project
- NOTE to clarify this issue: using Platform.getOS() in TBX layer
leads to an Eclipse classloader problem in TXM Web/Portal layer.
This solution 1 was used since revision 2967. To fix these
classloader problems, the use of
System.getProperty(“os.name”).contains(“win32”) comparison has been
introduced in r2967 leading to the Windows bug detailed above.
In future we should use this Platform class which really seems a better solution.
Solution 2
- use org.apache.tools.ant.taskdefs.condition.Os
- bundle is present in TBX project
Solution 3
- org.apache.commons.exec.OS
- bundle is NOT present in TBX project
Solution 4
- implement own custom class using System.getProperty(“os.name”)
Solution 5
- use solution 1, 2 or 3
- centralize/encapsulate the OS detection code in a class, e.g. OSDetector in TBX layer to minimize impact of further string definition potential changes
Validation tests
- start TXM on Linux
- look for the following line in the console log:
=>“Statistical Engine launched.” - create an AFC chart
- start TXM on Windows
- look for the following line in the console log:
=>“Statistical Engine launched.” - create an AFC chart
- start TXM on Mac
- look for the following line in the console log:
=>“Statistical Engine launched.” - create an AFC chart
(from redmine: issue id 1346, created on 2015/05/20 by Sebastien Jacquot)