Task #1346

TBX: x.x, Improve the OS detection

Ajouté par Sebastien Jacquot il y a presque 4 ans. Mis à jour il y a presque 4 ans.

Statut:Feedback Début:20/05/2015
Priorité:Normal Echéance:
Assigné à:- % réalisé:

80%

Catégorie:Development Temps passé: -
Version cible:TXM 0.7.7

Description

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

Historique

#1 Mis à jour par Sebastien Jacquot il y a presque 4 ans

  • Description mis à jour (diff)

#2 Mis à jour par Sebastien Jacquot il y a presque 4 ans

  • Description mis à jour (diff)

#3 Mis à jour par Sebastien Jacquot il y a presque 4 ans

  • Description mis à jour (diff)

#4 Mis à jour par Sebastien Jacquot il y a presque 4 ans

  • Statut changé de New à Feedback
  • % réalisé changé de 0 à 80

Solutions 2 and 5 have been implemented. The /org.txm.toolbox/src/java/org/txm/utils/OSDetector.java class is now used in ToolBox when creating start and kill command lines for RServe and CQP, replacing the System.getProperty("os.name").contains("win32") tests. It is also used in the ToolBox initialization method to load TBX preferences file as "ISO-8859-1" for Windows family runtime target, replacing the System.getProperty("os.name").contains("win32") test.

#5 Mis à jour par Sebastien Jacquot il y a presque 4 ans

  • Description mis à jour (diff)

#6 Mis à jour par Sebastien Jacquot il y a presque 4 ans

  • Description mis à jour (diff)

#7 Mis à jour par Sebastien Jacquot il y a presque 4 ans

  • Description mis à jour (diff)

Formats disponibles : Atom PDF