Révision 338

tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/preferences/RPreferences.java (revision 338)
2 2

  
3 3

  
4 4
import org.eclipse.core.runtime.preferences.DefaultScope;
5
import org.osgi.framework.FrameworkUtil;
5 6
import org.osgi.service.prefs.Preferences;
6 7
import org.txm.core.preferences.TXMPreferences;
7 8

  
......
16 17

  
17 18

  
18 19
	// auto populate the preference node qualifier from the current bundle id
19
	public static final String PREFERENCES_NODE = RPreferences.class.getName();//FrameworkUtil.getBundle(RPreferences.class).getSymbolicName();
20
	public static final String PREFERENCES_NODE = FrameworkUtil.getBundle(RPreferences.class).getSymbolicName();
20 21
	
22
	//public static final String PREFERENCES_NODE = RPreferences.class.getName();//FrameworkUtil.getBundle(RPreferences.class).getSymbolicName();
21 23
	//FIXME: tests
22 24
	//public static final String PREFERENCES_NODE = "org.txm.statsengine.r.core";
23 25

  
......
70 72
	public void initializeDefaultPreferences() {
71 73
		System.out.println("INITIALIZE R PREFERENCES");
72 74
		Preferences preferences = DefaultScope.INSTANCE.getNode(PREFERENCES_NODE);
75

  
76
		//FIXME: need to define here the PATH_TO_EXECUTABLE preference according to current OS and the current TXM install directory
77
		// If the paths are different according to the current OS, a good way could be to have the same projects as for CQP
78
		// Project: org.txm.r
79
		// Fragment: org.txm.r.win64
80
		// Fragment: org.txm.r.linux
81
		// and the fragment should initialize this preference
82
		preferences.put(PATH_TO_EXECUTABLE, "undefined");
73 83
		
74 84
		preferences.putBoolean(IS_MANDATORY, false);
75
		preferences.put(PATH_TO_EXECUTABLE, "undefined");
76 85
		preferences.put(SERVER_ADDRESS, "127.0.0.1");
77 86
		preferences.putBoolean(REMOTE, false);
78 87
		preferences.putBoolean(DISABLE, false);
tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RStatsEngine.java (revision 338)
32 32

  
33 33
	
34 34
	/**
35
	 * start the statengine if the engine is not remote then launch Rserve.
35
	 * Starts the stats engine if the engine is not remote then launch RServe.
36 36
	 *
37 37
	 * @return true, if successful
38 38
	 */
......
55 55
			mandatory = TXMPreferences.getBoolean(RPreferences.PREFERENCES_NODE, RPreferences.IS_MANDATORY);
56 56

  
57 57
			
58
			Log.info(RCoreMessages.Log_STARTING_STATS_ENGINE + user + RCoreMessages.Log_REMOTE + remote + RCoreMessages.Log_PORT + port + RCoreMessages.Log_DEBUG + debug);
58
			Log.info(RCoreMessages.log_startingStatsEngine + user + RCoreMessages.log_remote + remote + RCoreMessages.log_port + port + RCoreMessages.log_debug + debug);
59 59
			// System.out.println("test remote :" + R_PATH_TO_EXECUTABLE + ":" + properties.getProperty(R_PATH_TO_EXECUTABLE));
60 60
			if (!remote) {
61 61
				// start Rserve executable
......
83 83
			//	System.out.println("success");
84 84
			//System.out.println("file transfert ? "+RWorkspace.isFileTranfert());
85 85
		} catch (RWorkspaceException e) {
86
			System.err.println(RCoreMessages.Error_CONNECTION_FAILED_2); 
86
			System.err.println(RCoreMessages.error_connectionFailed); 
87 87
			started = false;
88 88
		}
89 89

  
......
106 106
					p.waitFor();
107 107
					started = false;
108 108
				} catch (IOException e) {
109
					Log.severe(RCoreMessages.Error_FAILED_TO_KILL_RSERVE+Log.toString(e));
110
					System.out.println(RCoreMessages.Error_FAILED_TO_KILL_RSERVE+Log.toString(e));
109
					Log.severe(RCoreMessages.error_failedToKillRServe+Log.toString(e));
110
					System.out.println(RCoreMessages.error_failedToKillRServe+Log.toString(e));
111 111
					try {
112 112
						Process p = Runtime.getRuntime().exec(
113 113
								//"tskill Rserve.exe"); //$NON-NLS-1$
......
115 115
						p.waitFor();
116 116
						started = false;
117 117
					} catch (IOException e2) {
118
						Log.severe(RCoreMessages.Error_FAILED_TO_KILL_RSERVE_2+Log.toString(e2));
119
						System.out.println(RCoreMessages.Error_FAILED_TO_KILL_RSERVE_2+Log.toString(e2));
118
						Log.severe(RCoreMessages.error_failedToKillRServe2+Log.toString(e2));
119
						System.out.println(RCoreMessages.error_failedToKillRServe2+Log.toString(e2));
120 120
						Log.printStackTrace(e2);
121 121
					} catch (InterruptedException e3) {
122 122
						Log.severe(Log.toString(e3));
......
137 137
					p.waitFor();
138 138
					started = false;
139 139
				} catch (IOException e) {
140
					Log.severe(RCoreMessages.Error_FAILED_TO_KILL_RSERVE_3 + Log.toString(e));
141
					System.out.println(RCoreMessages.Error_FAILED_TO_KILL_RSERVE_3 + Log.toString(e));
140
					Log.severe(RCoreMessages.error_failedToKillRServe3 + Log.toString(e));
141
					System.out.println(RCoreMessages.error_failedToKillRServe3 + Log.toString(e));
142 142
					org.txm.utils.logger.Log.printStackTrace(e);
143 143
				} catch (InterruptedException e) {
144 144
					Log.severe("Error while closing R: " + e.getLocalizedMessage());
......
164 164
	}
165 165
	
166 166
	/**
167
	 * Retuns the running state of the stats engine.
167
	 * Returns the running state of the stats engine.
168 168
	 */
169 169
	public static boolean isStarted()	{
170 170
		return started;
......
172 172

  
173 173

  
174 174
	/**
175
	 * Checks if the engine is mandatory.
175 176
	 * @return the mandatory
176 177
	 */
177 178
	public static boolean isMandatory() {
tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/messages/messages_fr.properties (revision 338)
1 1

  
2
Error_CONNECTION_FAILED_2                      = ** La connexion au moteur statistique a échoué.
3
Error_FAILED_TO_KILL_RSERVE                    = Echec de la commande 'taskkill /IM Rserve.exe /F': 
4
Error_FAILED_TO_KILL_RSERVE_2                  = Echec de la commande 'tskill Rserve.exe': 
5
Error_FAILED_TO_KILL_RSERVE_3                  = Echec de la commande 'killall -9 Rserve-bin.so': 
6
Error_STATS_ENGINE_NOT_READY_CANCELING_COMMAND = Le moteur de statistiques n'est pas initialisé, annulation de la commande.
2
CHAR_VECTOR_ADDED_TO_WORKSPACE = Le vecteur "{1}" ({0,number,integer} valeurs "character") a été transmis au Moteur Statistique.
7 3

  
4
CONNECTED_TO_STATS_MODULE = connecté.
5

  
6
CONNECTION_OK = Connexion au Moteur Statistique établie.
7

  
8
ERROR_EXTRACT_ITEM = ** Erreur lors de l'extraction de la liste d'items : \	
9

  
8 10
LIBRARY_NOT_LOADED = La librairie {0} n''a pu être chargée : {1}
9 11

  
10
Log_DEBUG                 = debug : 
11
Log_PORT                  = \ port : 
12
Log_REMOTE                = \ distant : 
13
Log_STARTING_STATS_ENGINE = Démarrage du moteur de statistiques par l'utilisateur :
12
REQUESTED_OBJECT_NOT_FOUND_IN_R = L'objet demandé ({0}) n'a pas été trouvé dans l'espace de travail R.
14 13

  
15 14
RException_0 = ** Erreur R : "
16 15
RException_1 = "
......
31 30
RWorkspace_7  = La matrice est vide
32 31
RWorkspace_8  = Impossible de démarrer RServe : 
33 32

  
34
R_EXPR                    = Expression transmise au Moteur Statistique pour évaluation : {0}.
35
R_READ_CONSOLE            = Le Moteur Statistique attend une réponse de la console ({0}, {1}).
36
R_SAVE_HISTORY            = Le Moteur Statistique a sauvegardé un historique ({0}).
37
R_SHOW_MESSAGE            = Le Moteur Statistique a affiché ce message : {0}.
38
R_WRITE_CONSOLE           = Le Moteur Statistique a afiché ce message dans la console: {0}.
33
R_EXPR                          = Expression transmise au Moteur Statistique pour évaluation : {0}.
34
R_READ_CONSOLE                  = Le Moteur Statistique attend une réponse de la console ({0}, {1}).
35
R_SAVE_HISTORY                  = Le Moteur Statistique a sauvegardé un historique ({0}).
36
R_SHOW_MESSAGE                  = Le Moteur Statistique a affiché ce message : {0}.
37
R_WRITE_CONSOLE                 = Le Moteur Statistique a afiché ce message dans la console: {0}.
39 38

  
40 39
StartRserve_0  = Démarrage de R avec la ligne de commande: 
41 40
StartRserve_2  = Chemin d'accès à R non fourni, tentative de résolution...
......
47 46
StartRserve_4  = Essai du chemin de R : 'R'
48 47
StartRserve_6  = Essai du chemin de R : 
49 48

  
49
error_connectionFailed                    = ** La connexion au moteur statistique a échoué.
50
error_failedToKillRServe                  = Echec de la commande 'taskkill /IM Rserve.exe /F': 
51
error_failedToKillRServe2                 = Echec de la commande 'tskill Rserve.exe': 
52
error_failedToKillRServe3                 = Echec de la commande 'killall -9 Rserve-bin.so': 
53
error_statsEngineNotReadyCancelingCommand = Le moteur de statistiques n'est pas initialisé, annulation de la commande.
50 54

  
51
CHAR_VECTOR_ADDED_TO_WORKSPACE = Le vecteur "{1}" ({0,number,integer} valeurs "character") a été transmis au Moteur Statistique.
52
CONNECTED_TO_STATS_MODULE = connecté.
53
CONNECTION_OK = Connexion au Moteur Statistique établie.
54
ERROR_EXTRACT_ITEM = ** Erreur lors de l'extraction de la liste d'items : \	
55
REQUESTED_OBJECT_NOT_FOUND_IN_R = L'objet demandé ({0}) n'a pas été trouvé dans l'espace de travail R.
56

  
57

  
58

  
55
log_debug               = debug : 
56
log_port                = \ port : 
57
log_remote              = \ distant : 
58
log_startingStatsEngine = Démarrage du moteur de statistiques par l'utilisateur :
tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/messages/RCoreMessages.java (revision 338)
8 8
	private static final String BUNDLE_NAME = "org.txm.statsengine.r.core.messages.messages"; //$NON-NLS-1$
9 9

  
10 10
	
11
	public static String Error_STATS_ENGINE_NOT_READY_CANCELING_COMMAND;
11
	public static String error_statsEngineNotReadyCancelingCommand;
12 12
	
13
	public static String Log_STARTING_STATS_ENGINE;
14
	public static String Log_REMOTE;
15
	public static String Log_PORT;
16
	public static String Log_DEBUG;
13
	public static String log_startingStatsEngine;
14
	public static String log_remote;
15
	public static String log_port;
16
	public static String log_debug;
17 17

  
18
	public static String Error_CONNECTION_FAILED_2;
19
	public static String Error_FAILED_TO_KILL_RSERVE;
20
	public static String Error_FAILED_TO_KILL_RSERVE_2;
21
	public static String Error_FAILED_TO_KILL_RSERVE_3;
18
	public static String error_connectionFailed;
19
	public static String error_failedToKillRServe;
20
	public static String error_failedToKillRServe2;
21
	public static String error_failedToKillRServe3;
22 22

  
23 23
	public static String StartRserve_2;
24 24
	public static String StartRserve_21;
tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/messages/messages.properties (revision 338)
1 1

  
2
Error_CONNECTION_FAILED_2                      = ** Error while connecting to the stat engine.
3
Error_FAILED_TO_KILL_RSERVE                    = Failed to exec 'taskkill /IM Rserve.exe /F': 
4
Error_FAILED_TO_KILL_RSERVE_2                  = Failed to exec 'tskill Rserve.exe': 
5
Error_FAILED_TO_KILL_RSERVE_3                  = Failed to exec 'killall -9 Rserve-bin.so': 
6
Error_STATS_ENGINE_NOT_READY_CANCELING_COMMAND = Statistics Engine is not ready, canceling command.
2
CHAR_VECTOR_ADDED_TO_WORKSPACE = Vector "{1}" ({0,number,integer} "character") has been transmited to the Statistics Engine.
7 3

  
4
CONNECTED_TO_STATS_MODULE = connected.
5

  
6
CONNECTION_OK = Connected to the Statistics Engine.
7

  
8
ERROR_EXTRACT_ITEM = ** Error extracting list item: 
9

  
8 10
LIBRARY_NOT_LOADED = Failed to load the {0} library: {1}
9 11

  
10
Log_DEBUG                 = debug:
11
Log_PORT                  = \ port: 
12
Log_REMOTE                = \ remote:
13
Log_STARTING_STATS_ENGINE = Starting Statistics Engine: user: 
12
REQUESTED_OBJECT_NOT_FOUND_IN_R = The requested object ({0}) was not found in the R workspace.
14 13

  
15 14
RException_0 = ** R error: "
16 15
RException_1 = "
......
31 30
RWorkspace_7  = Matrix is empty
32 31
RWorkspace_8  = Failed to start RServe : 
33 32

  
34
R_EXPR                    = Expression sent to the Statistics Engine for evaluation: {0}.
35
R_READ_CONSOLE            = The Statistics Engine waits for something to read from the console ({0}, {1}).
36
R_SAVE_HISTORY            = The Statistics Engine has saved an history ({0}).
37
R_SHOW_MESSAGE            = The Statistics Engine displayed this message: {0}.
38
R_WRITE_CONSOLE           = The Statistics Engine displayed this message in the console: {0}.
33
R_EXPR                          = Expression sent to the Statistics Engine for evaluation: {0}.
34
R_READ_CONSOLE                  = The Statistics Engine waits for something to read from the console ({0}, {1}).
35
R_SAVE_HISTORY                  = The Statistics Engine has saved an history ({0}).
36
R_SHOW_MESSAGE                  = The Statistics Engine displayed this message: {0}.
37
R_WRITE_CONSOLE                 = The Statistics Engine displayed this message in the console: {0}.
39 38

  
40 39
StartRserve_0  = Starting R with command line: 
41 40
StartRserve_2  = No R path given, trying to find it...
......
47 46
StartRserve_4  = try R path : 'R'
48 47
StartRserve_6  = try R path : 
49 48

  
49
error_connectionFailed                    = ** Error while connecting to the stat engine.
50
error_failedToKillRServe                  = Failed to exec 'taskkill /IM Rserve.exe /F': 
51
error_failedToKillRServe2                 = Failed to exec 'tskill Rserve.exe': 
52
error_failedToKillRServe3                 = Failed to exec 'killall -9 Rserve-bin.so': 
53
error_statsEngineNotReadyCancelingCommand = Statistics Engine is not ready, canceling command.
50 54

  
51
CHAR_VECTOR_ADDED_TO_WORKSPACE = Vector "{1}" ({0,number,integer} "character") has been transmited to the Statistics Engine.
52
CONNECTED_TO_STATS_MODULE = connected.
53
CONNECTION_OK = Connected to the Statistics Engine.
54

  
55
ERROR_EXTRACT_ITEM = ** Error extracting list item: 
56

  
57
REQUESTED_OBJECT_NOT_FOUND_IN_R = The requested object ({0}) was not found in the R workspace.
55
log_debug               = debug:
56
log_port                = \ port: 
57
log_remote              = \ remote:
58
log_startingStatsEngine = Starting Statistics Engine: user: 

Formats disponibles : Unified diff