Révision 2516

tmp/org.txm.libs.cqp/src/org/txm/libs/cqp/CQPLibPreferences.java (revision 2516)
58 58
		
59 59
		// FIXME: SJ: some code in this method should be done only at TXM first run
60 60
		
61
		Preferences preferences = DefaultScope.INSTANCE.getNode(getPreferencesNodeQualifier());
61
		Preferences preferences = this.getDefaultPreferencesNode();
62 62
		
63
		preferences.put(CQI_SERVER_ADDITIONAL_OPTIONS, "-b 1000000 -d OFF"); //$NON-NLS-1$
64
		preferences.put(CQI_SERVER_PORT, "4877"); //$NON-NLS-1$
65
		preferences.put(CQI_SERVER_HOST, "localhost"); //$NON-NLS-1$
66
		preferences.put(CQI_SERVER_LOGIN, "anonymous"); //$NON-NLS-1$
67
		preferences.put(CQI_SERVER_PASSWORD, ""); //$NON-NLS-1$
68
		preferences.put(CQI_SERVER_IS_REMOTE, "" + false); //$NON-NLS-1$
69
		preferences.putBoolean(CQI_NETWORK_MODE, false); // $NON-NLS-1$
70 63
		
64
		
71 65
		String CQPFRAGMENT = "org.txm.libs.cqp." + System.getProperty("osgi.os");
72 66
		// TODO: fix preferences logic between org.txm.cqp.lib and org.txm.searchengine.cqp
73 67
		Log.fine("CQPLibPreferences.initializeDefaultPreferences()");
......
144 138
			}
145 139
		}
146 140
		
141
		
147 142
		preferences.put(CQI_SERVER_PATH_TO_CQPLIB, OSDir.getAbsolutePath());
148 143
		preferences.put(CQI_SERVER_PATH_TO_INIT_FILE, initFile.getAbsolutePath());
149 144
		preferences.put(CQI_SERVER_PATH_TO_EXECUTABLE, execFile.getAbsolutePath());
145
		preferences.put(CQI_SERVER_ADDITIONAL_OPTIONS, "-b 1000000 -d OFF"); //$NON-NLS-1$
146
		preferences.put(CQI_SERVER_PORT, "4877"); //$NON-NLS-1$
147
		preferences.put(CQI_SERVER_HOST, "localhost"); //$NON-NLS-1$
148
		preferences.put(CQI_SERVER_LOGIN, "anonymous"); //$NON-NLS-1$
149
		preferences.put(CQI_SERVER_PASSWORD, ""); //$NON-NLS-1$
150
		preferences.putBoolean(CQI_SERVER_IS_REMOTE, false);
151
		preferences.putBoolean(CQI_NETWORK_MODE, false); // $NON-NLS-1$
150 152
		
153
		
151 154
		if (saved != null && saved.length() > 0) {
152 155
			Version savedVersion = new Version(saved);
153 156
			if (currentVersion.compareTo(savedVersion) <= 0) {
......
160 163
		Log.fine("SearchEngine preferences set with: " + OSDir.getAbsolutePath() + ", " + initFile.getAbsolutePath() + " and " + execFile.getAbsolutePath());
161 164
		put(CQPLibPreferences.VERSION, currentVersion.toString());
162 165
		
163
		put(CQI_SERVER_PATH_TO_CQPLIB, OSDir.getAbsolutePath());
164
		put(CQI_SERVER_PATH_TO_INIT_FILE, initFile.getAbsolutePath());
165
		put(CQI_SERVER_PATH_TO_EXECUTABLE, execFile.getAbsolutePath());
166
		put(CQI_SERVER_ADDITIONAL_OPTIONS, "-b 1000000 -d OFF"); //$NON-NLS-1$
167
		put(CQI_SERVER_PORT, "4877"); //$NON-NLS-1$
168
		put(CQI_SERVER_HOST, "localhost"); //$NON-NLS-1$
169
		put(CQI_SERVER_LOGIN, "anonymous"); //$NON-NLS-1$
170
		put(CQI_SERVER_PASSWORD, ""); //$NON-NLS-1$
171
		put(CQI_SERVER_IS_REMOTE, "" + false); //$NON-NLS-1$
172
		put(CQI_NETWORK_MODE, false); // $NON-NLS-1$
166
		// put(CQI_SERVER_PATH_TO_CQPLIB, OSDir.getAbsolutePath());
167
		// put(CQI_SERVER_PATH_TO_INIT_FILE, initFile.getAbsolutePath());
168
		// put(CQI_SERVER_PATH_TO_EXECUTABLE, execFile.getAbsolutePath());
169
		// put(CQI_SERVER_ADDITIONAL_OPTIONS, "-b 1000000 -d OFF"); //$NON-NLS-1$
170
		// put(CQI_SERVER_PORT, "4877"); //$NON-NLS-1$
171
		// put(CQI_SERVER_HOST, "localhost"); //$NON-NLS-1$
172
		// put(CQI_SERVER_LOGIN, "anonymous"); //$NON-NLS-1$
173
		// put(CQI_SERVER_PASSWORD, ""); //$NON-NLS-1$
174
		// put(CQI_SERVER_IS_REMOTE, "" + false); //$NON-NLS-1$
175
		// put(CQI_NETWORK_MODE, false); // $NON-NLS-1$
173 176
		flush();
174 177
	}
175 178
	
tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/preferences/RPreferences.java (revision 2516)
94 94
		
95 95
		Preferences preferences = this.getDefaultPreferencesNode();
96 96
		
97
		preferences.putBoolean(IS_MANDATORY, false);
98
		preferences.put(SERVER_ADDRESS, "127.0.0.1");
99
		preferences.putBoolean(REMOTE, false);
100
		preferences.putBoolean(DISABLE, false);
101
		preferences.putBoolean(DEBUG, false);
102
		preferences.put(PORT, "6311");
103
		preferences.put(USER, "");
104
		preferences.put(PASSWORD, "");
105
		preferences.put(RARGS, "");
106
		preferences.put(RSERVEARGS, "");
107
		preferences.putBoolean(FILE_TRANSFERT, false);
108
		preferences.put(SVG_DEVICE, "svg");
109
		preferences.putBoolean(SHOW_EVAL_LOGS, false);
110 97
		
111 98
		String RFRAGMENT = "org.txm.statsengine.r.core." + System.getProperty("osgi.os"); //$NON-NLS-1$
112 99
		
113 100
		Log.fine("RPreferences.initializeDefaultPreferences()");
114 101
		
115
		String saved = getString(RPreferences.VERSION);
102
		String saved = this.getString(RPreferences.VERSION);
116 103
		Version currentVersion = BundleUtils.getBundleVersion(RFRAGMENT); // the RFRAGMENT plugin contains the right version
117 104
		
118 105
		// ensure plugin binary files rights are ok
......
140 127
			return;
141 128
		}
142 129
		File rpluginDir = new File(bundleDir, "res"); //$NON-NLS-1$
143
		File OSDir = new File(rpluginDir, os);
144
		File execFile = new File(OSDir, "bin/" + extraSubPath + "R" + ext); //$NON-NLS-1$ //$NON-NLS-2$
130
		File rRootDir = new File(rpluginDir, os);
131
		File execFile = new File(rRootDir, "bin/" + extraSubPath + "R" + ext); //$NON-NLS-1$ //$NON-NLS-2$
145 132
		
146 133
		if (!execFile.setExecutable(true)) {
147 134
			Log.severe(TXMCoreMessages.bind("Error while setting execution file rights to: {0}.", execFile.getAbsolutePath()));
......
150 137
		
151 138
		if (!osName.contains("windows")) {  //$NON-NLS-1$
152 139
			try {
153
				Log.fine(TXMCoreMessages.bind("Setting execution file rights to: {0}.", OSDir.getAbsolutePath()));
154
				Process p = Runtime.getRuntime().exec("chmod -R +x " + OSDir.getAbsolutePath()); //$NON-NLS-1$
140
				Log.fine(TXMCoreMessages.bind("Setting execution file rights to: {0}.", rRootDir.getAbsolutePath()));
141
				Process p = Runtime.getRuntime().exec("chmod -R +x " + rRootDir.getAbsolutePath()); //$NON-NLS-1$
155 142
				new StreamHog(p.getInputStream(), false);
156 143
				new StreamHog(p.getErrorStream(), false);
157 144
				p.waitFor();
158 145
			}
159 146
			catch (Exception e) {
160
				Log.severe(TXMCoreMessages.bind("Error while setting execution file rights to: {0}.", OSDir.getAbsolutePath()));
147
				Log.severe(TXMCoreMessages.bind("Error while setting execution file rights to: {0}.", rRootDir.getAbsolutePath()));
161 148
				e.printStackTrace();
162 149
				return;
163 150
			}
......
174 161
		}
175 162
		
176 163
		preferences.put(PATH_TO_EXECUTABLE, execFile.getAbsolutePath());
164
		preferences.putBoolean(IS_MANDATORY, false);
165
		preferences.put(SERVER_ADDRESS, "127.0.0.1");
166
		preferences.putBoolean(REMOTE, false);
167
		preferences.putBoolean(DISABLE, false);
168
		preferences.putBoolean(DEBUG, false);
169
		preferences.put(PORT, "6311");
170
		preferences.put(USER, "");
171
		preferences.put(PASSWORD, "");
172
		preferences.put(RARGS, "");
173
		preferences.put(RSERVEARGS, "");
174
		preferences.putBoolean(FILE_TRANSFERT, false);
175
		preferences.put(SVG_DEVICE, "svg");
176
		preferences.putBoolean(SHOW_EVAL_LOGS, false);
177 177
		
178 178
		
179
		
179 180
		if (saved != null && saved.length() > 0) {
180 181
			Version savedVersion = new Version(saved);
181 182
			if (currentVersion.compareTo(savedVersion) <= 0) {
......
187 188
		
188 189
		put(RPreferences.VERSION, currentVersion.toString());
189 190
		
190
		put(PATH_TO_EXECUTABLE, execFile.getAbsolutePath());
191 191
		
192 192
		// FIXME: SJ: useless since the values are the same than the default ones?
193
		put(IS_MANDATORY, false);
194
		put(SERVER_ADDRESS, "127.0.0.1"); //$NON-NLS-1$
195
		put(REMOTE, false);
196
		put(DISABLE, false);
197
		put(DEBUG, false);
198
		put(PORT, "6311"); //$NON-NLS-1$
199
		put(USER, ""); //$NON-NLS-1$
200
		put(PASSWORD, ""); //$NON-NLS-1$
201
		put(RARGS, ""); //$NON-NLS-1$
202
		put(RSERVEARGS, ""); //$NON-NLS-1$
203
		put(FILE_TRANSFERT, false);
204
		put(SVG_DEVICE, "svg"); //$NON-NLS-1$
205
		put(SHOW_EVAL_LOGS, false);
193
		// put(PATH_TO_EXECUTABLE, execFile.getAbsolutePath());
194
		// put(IS_MANDATORY, false);
195
		// put(SERVER_ADDRESS, "127.0.0.1"); //$NON-NLS-1$
196
		// put(REMOTE, false);
197
		// put(DISABLE, false);
198
		// put(DEBUG, false);
199
		// put(PORT, "6311"); //$NON-NLS-1$
200
		// put(USER, ""); //$NON-NLS-1$
201
		// put(PASSWORD, ""); //$NON-NLS-1$
202
		// put(RARGS, ""); //$NON-NLS-1$
203
		// put(RSERVEARGS, ""); //$NON-NLS-1$
204
		// put(FILE_TRANSFERT, false);
205
		// put(SVG_DEVICE, "svg"); //$NON-NLS-1$
206
		// put(SHOW_EVAL_LOGS, false);
206 207
		
207
		Log.fine(TXMCoreMessages.bind("R stats engine preferences set with: {0} and {1}.", OSDir.getAbsolutePath(), execFile.getAbsolutePath())); //$NON-NLS-1$
208
		Log.fine(TXMCoreMessages.bind("R stats engine preferences set with: {0} and {1}.", rRootDir.getAbsolutePath(), execFile.getAbsolutePath())); //$NON-NLS-1$
208 209
	}
209 210
	
210 211
}
tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RStatsEngine.java (revision 2516)
3 3
import java.util.HashMap;
4 4

  
5 5
import org.eclipse.core.runtime.IConfigurationElement;
6
import org.eclipse.core.runtime.IExtensionPoint;
7 6
import org.eclipse.core.runtime.IProgressMonitor;
8 7
import org.eclipse.core.runtime.RegistryFactory;
9 8
import org.txm.core.messages.TXMCoreMessages;
......
22 21
 *
23 22
 */
24 23
public class RStatsEngine extends StatsEngine {
25

  
26 24
	
25
	
27 26
	/** The state of the stats engine. */
28 27
	private static boolean started = false;
29 28
	
30 29
	
31 30
	private static boolean mandatory = false;
32

  
33 31
	
32
	
34 33
	public RStatsEngine() {
35 34
		// no instantiation
36 35
	}
37

  
38 36
	
37
	
39 38
	/**
40 39
	 * Starts the stats engine if the engine is not remote then launch RServe.
41 40
	 *
42 41
	 * @return true, if successful
43 42
	 */
43
	@Override
44 44
	public boolean start(IProgressMonitor monitor) {
45 45
		try {
46
			if (monitor != null) monitor.subTask("Starting Statistics Engine...");
46
			if (monitor != null) {
47
				monitor.subTask("Starting Statistics Engine...");
48
			}
47 49
			
48 50
			if (RPreferences.getInstance().getBoolean(RPreferences.DISABLE)) {
49 51
				Log.severe("Warning, Statistics Engine is disabled.");
......
58 60
			boolean debug = RPreferences.getInstance().getBoolean(RPreferences.DEBUG);
59 61
			mandatory = RPreferences.getInstance().getBoolean(RPreferences.IS_MANDATORY);
60 62
			
61
			Log.fine(RCoreMessages.bind(RCoreMessages.info_startingStatsEngine, new Object[] {user, remote, port, debug}));
63
			Log.fine(RCoreMessages.bind(RCoreMessages.info_startingStatsEngine, new Object[] { user, remote, port, debug }));
62 64
			// System.out.println("test remote :" + R_PATH_TO_EXECUTABLE + ":" + properties.getProperty(R_PATH_TO_EXECUTABLE));
63 65
			if (!remote) {
64 66
				// start Rserve executable
65 67
				started = RWorkspace.startExec(
66
						RPreferences.getInstance().getString(RPreferences.PATH_TO_EXECUTABLE), 
67
						port, 
68
						debug, 
68
						RPreferences.getInstance().getString(RPreferences.PATH_TO_EXECUTABLE),
69
						port,
70
						debug,
69 71
						RPreferences.getInstance().getString(RPreferences.RARGS),
70 72
						RPreferences.getInstance().getString(RPreferences.RSERVEARGS));
71

  
73
				
72 74
				if (started) { // try connecting to R witout login
73 75
					started = RWorkspace.connect("127.0.0.1", port); //$NON-NLS-1$
74 76
				}
75
			} else { // try connecting to R, with login and password
77
			}
78
			else { // try connecting to R, with login and password
76 79
				started = RWorkspace.connect(RPreferences.getInstance().getString(RPreferences.SERVER_ADDRESS), port, user, password);
77 80
			}
78

  
81
			
79 82
			if (started) { // post configuration of R
80 83
				String rPackagesPath = RPreferences.getInstance().getString(RPreferences.PACKAGES_PATH);
81 84
				started = RWorkspace.getRWorkspaceInstance().postConfiguration(rPackagesPath);
82 85
			}
83

  
84
			//System.out.println("try to set R_FILE_TRANSFERT to " + RPreferences.getInstance().getBoolean(RPreferences.R_FILE_TRANSFERT));
86
			
87
			// System.out.println("try to set R_FILE_TRANSFERT to " + RPreferences.getInstance().getBoolean(RPreferences.R_FILE_TRANSFERT));
85 88
			RWorkspace.setUseFileCommunication(RPreferences.getInstance().getBoolean(RPreferences.FILE_TRANSFERT));
86
			//	System.out.println("success");
87
			//System.out.println("file transfert ? "+RWorkspace.isFileTranfert());
89
			// System.out.println("success");
90
			// System.out.println("file transfert ? "+RWorkspace.isFileTranfert());
88 91
			
89 92
			loadRTransformers();
90
		} catch (RWorkspaceException e) {
91
			Log.severe(RCoreMessages.error_connectionFailed); 
93
		}
94
		catch (RWorkspaceException e) {
95
			Log.severe(RCoreMessages.error_connectionFailed);
92 96
			started = false;
93 97
		}
94

  
98
		
95 99
		return started;
96 100
	}
97 101
	
98 102
	public HashMap<String, RTransformer<? extends TXMResult>> getTransformers() {
99 103
		return transformers;
100 104
	}
101

  
102
	HashMap<String, RTransformer<? extends TXMResult>> transformers = new HashMap<String, RTransformer<? extends TXMResult>>();
105
	
106
	HashMap<String, RTransformer<? extends TXMResult>> transformers = new HashMap<>();
107
	
103 108
	private void loadRTransformers() {
104 109
		
105 110
		transformers.clear();
106

  
111
		
107 112
		IConfigurationElement[] contributions = RegistryFactory.getRegistry().getConfigurationElementsFor(RTransformer.class.getName());
108

  
113
		
109 114
		Log.fine(TXMCoreMessages.bind("Looking for R transformers contributions with extension point id ''{0}''...", RTransformer.class.getName())); //$NON-NLS-1$
110 115
		Log.fine(TXMCoreMessages.bind("{0} transformers(s) found.", contributions.length)); //$NON-NLS-1$
111

  
116
		
112 117
		for (int i = 0; i < contributions.length; i++) {
113 118
			try {
114 119
				@SuppressWarnings("unchecked")
115 120
				RTransformer<? extends TXMResult> transformer = (RTransformer<? extends TXMResult>) contributions[i].createExecutableExtension("class"); //$NON-NLS-1$
116

  
121
				
117 122
				Log.finer(TXMCoreMessages.bind("Registering R transformer: {0}...", transformer));
118

  
123
				
119 124
				transformers.put(contributions[i].getAttribute("type"), transformer);
120
			} catch (Exception e) {
125
			}
126
			catch (Exception e) {
121 127
				Log.severe("Error: failed to instantiate " + contributions[i].getName() + ".");
122 128
				e.printStackTrace();
123 129
			}
124 130
		}
125 131
	}
126

  
132
	
127 133
	@Override
128 134
	public boolean stop() {
129 135
		try {
......
131 137
			RWorkspace.shutdown();
132 138
			RStatsEngine.kill();
133 139
			started = false;
134
		} catch (Exception e) {
140
		}
141
		catch (Exception e) {
135 142
			Log.severe("Error while closing R.");
136 143
			e.printStackTrace();
137 144
			return false;
138 145
		}
139 146
		return true;
140 147
	}
141

  
142

  
143 148
	
149
	
150
	
144 151
	/**
145 152
	 * kill Rserve process.
146 153
	 */
147 154
	public static void kill() {
148
		if (!RPreferences.getInstance().getBoolean(RPreferences.REMOTE))	{
155
		if (!RPreferences.getInstance().getBoolean(RPreferences.REMOTE)) {
149 156
			
150 157
			try {
151 158
				if (StartRserve.rProcess != null) {
152 159
					Log.finest("Quitting R process...");
153 160
					StartRserve.rProcess.destroy();
154 161
				}
155
			} catch (Exception e1) {
162
			}
163
			catch (Exception e1) {
156 164
				// TODO Auto-generated catch block
157 165
				e1.printStackTrace();
158 166
			}
159 167
			
160
			// FIXME: became useless.
161
//			// Windows OS
162
//			if (OSDetector.isFamilyWindows()) {
163
//				try {
164
//					String cmd = "taskkill /IM Rterm.exe /F"; //$NON-NLS-1$
165
//					//String cmd = "cmd /c FOR /F \"tokens=5 delims= \" %P IN ('netstat -ano ^| findstr :6330 ^| findstr LISTENING') DO taskkill /F /PID %P"; //$NON-NLS-1$ 
166
//					Log.finest("Executing command: " + cmd);
167
//
168
//					Process p = Runtime.getRuntime().exec(
169
//							//"taskkill /IM Rserve.exe /F"); //$NON-NLS-1$
170
//							cmd
171
//							);
172
//
173
//					// consumes streams
174
//		            new StreamConsumer(p.getErrorStream(), -1).start();;            
175
//		            new StreamConsumer(p.getInputStream(), 0).start();
176
//		            
177
//					p.waitFor();
178
//					started = false;
179
//				} catch (IOException e) {
180
//					Log.severe(RCoreMessages.error_failedToKillRServe + Log.toString(e));
181
//					try {
182
//						
183
//						String cmd = "cmd /c FOR /F \"tokens=5 delims= \" %P IN ('netstat -ano ^| findstr :6330 ^| findstr LISTENING') DO tskill %P"; //$NON-NLS-1$
184
//						Log.finest("Executing command: " + cmd);
185
//						
186
//						Process p = Runtime.getRuntime().exec(
187
//								//"tskill Rserve.exe"); //$NON-NLS-1$
188
//								cmd
189
//								);
190
//						p.waitFor();
191
//						started = false;
192
//					} catch (IOException e2) {
193
//						Log.severe(RCoreMessages.error_failedToKillRServe2+Log.toString(e2));
194
//						Log.printStackTrace(e2);
195
//					} catch (InterruptedException e3) {
196
//						Log.severe(Log.toString(e3));
197
//						Log.printStackTrace(e3);
198
//					}
199
//				}
200
//				catch (InterruptedException e) {
201
//					Log.severe("Error while closing R: " + e.getLocalizedMessage());
202
//					Log.printStackTrace(e);
203
//				}
204
//			}
205
//			// Mac, Linux
206
//			else {
207
//				try {
208
//					Process p = Runtime.getRuntime().exec(
209
//							"kill -9 `lsof -t -a -c Rserve-bin.so -i : " + RPreferences.getInstance().getInt(RPreferences.PORT) + "`"); //$NON-NLS-1$ //$NON-NLS-2$
210
//					p.waitFor();
211
//					started = false;
212
//				} catch (IOException e) {
213
//					Log.severe(RCoreMessages.error_failedToKillRServe3 + Log.toString(e));
214
//					org.txm.utils.logger.Log.printStackTrace(e);
215
//				} catch (InterruptedException e) {
216
//					Log.severe("Error while closing R: " + e.getLocalizedMessage());
217
//					org.txm.utils.logger.Log.printStackTrace(e);
218
//				}
219
//			}
168
			// FIXME: SJ: became useless ?
169
			// FIXME: SJ, later: actually it seems R and RTerm are not always terminated on Windows, need to check again before removing this code
170
			// // Windows OS
171
			// if (OSDetector.isFamilyWindows()) {
172
			// try {
173
			// String cmd = "taskkill /IM Rterm.exe /F"; //$NON-NLS-1$
174
			// //String cmd = "cmd /c FOR /F \"tokens=5 delims= \" %P IN ('netstat -ano ^| findstr :6330 ^| findstr LISTENING') DO taskkill /F /PID %P"; //$NON-NLS-1$
175
			// Log.finest("Executing command: " + cmd);
176
			//
177
			// Process p = Runtime.getRuntime().exec(
178
			// //"taskkill /IM Rserve.exe /F"); //$NON-NLS-1$
179
			// cmd
180
			// );
181
			//
182
			// // consumes streams
183
			// new StreamConsumer(p.getErrorStream(), -1).start();;
184
			// new StreamConsumer(p.getInputStream(), 0).start();
185
			//
186
			// p.waitFor();
187
			// started = false;
188
			// } catch (IOException e) {
189
			// Log.severe(RCoreMessages.error_failedToKillRServe + Log.toString(e));
190
			// try {
191
			//
192
			// String cmd = "cmd /c FOR /F \"tokens=5 delims= \" %P IN ('netstat -ano ^| findstr :6330 ^| findstr LISTENING') DO tskill %P"; //$NON-NLS-1$
193
			// Log.finest("Executing command: " + cmd);
194
			//
195
			// Process p = Runtime.getRuntime().exec(
196
			// //"tskill Rserve.exe"); //$NON-NLS-1$
197
			// cmd
198
			// );
199
			// p.waitFor();
200
			// started = false;
201
			// } catch (IOException e2) {
202
			// Log.severe(RCoreMessages.error_failedToKillRServe2+Log.toString(e2));
203
			// Log.printStackTrace(e2);
204
			// } catch (InterruptedException e3) {
205
			// Log.severe(Log.toString(e3));
206
			// Log.printStackTrace(e3);
207
			// }
208
			// }
209
			// catch (InterruptedException e) {
210
			// Log.severe("Error while closing R: " + e.getLocalizedMessage());
211
			// Log.printStackTrace(e);
212
			// }
213
			// }
214
			// // Mac, Linux
215
			// else {
216
			// try {
217
			// Process p = Runtime.getRuntime().exec(
218
			// "kill -9 `lsof -t -a -c Rserve-bin.so -i : " + RPreferences.getInstance().getInt(RPreferences.PORT) + "`"); //$NON-NLS-1$ //$NON-NLS-2$
219
			// p.waitFor();
220
			// started = false;
221
			// } catch (IOException e) {
222
			// Log.severe(RCoreMessages.error_failedToKillRServe3 + Log.toString(e));
223
			// org.txm.utils.logger.Log.printStackTrace(e);
224
			// } catch (InterruptedException e) {
225
			// Log.severe("Error while closing R: " + e.getLocalizedMessage());
226
			// org.txm.utils.logger.Log.printStackTrace(e);
227
			// }
228
			// }
220 229
		}
221 230
	}
222 231
	
......
225 234
	/**
226 235
	 * Returns the running state of the stats engine.
227 236
	 */
228
	public static boolean isStarted()	{
237
	public static boolean isStarted() {
229 238
		return started;
230 239
	}
231

  
232

  
240
	
241
	
233 242
	/**
234 243
	 * Checks if the engine is mandatory.
244
	 * 
235 245
	 * @return the mandatory
236 246
	 */
237 247
	public static boolean isMandatory() {
238 248
		return mandatory;
239 249
	}
240

  
241

  
250
	
251
	
242 252
	@Override
243 253
	public boolean isRunning() {
244 254
		return started;
245 255
	}
246

  
247

  
256
	
257
	
248 258
	@Override
249 259
	public boolean initialize() {
250 260
		return true;
251 261
	}
252

  
262
	
253 263
	@Override
254 264
	public String getName() {
255 265
		return "R";

Formats disponibles : Unified diff