View | Details | Raw Unified | Return to bug 187301 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/rse/internal/services/telnet/shell/TelnetHostShell.java (-5 / +150 lines)
Lines 19-30 Link Here
19
19
20
import java.io.BufferedReader;
20
import java.io.BufferedReader;
21
import java.io.IOException;
21
import java.io.IOException;
22
import java.io.InputStream;
22
import java.io.InputStreamReader;
23
import java.io.InputStreamReader;
23
import java.io.OutputStream;
24
import java.io.OutputStream;
25
import java.io.PrintStream;
24
import java.io.PrintWriter;
26
import java.io.PrintWriter;
27
import java.util.Random;
25
import java.util.regex.Pattern;
28
import java.util.regex.Pattern;
26
29
27
import org.apache.commons.net.telnet.TelnetClient;
30
import org.apache.commons.net.telnet.TelnetClient;
31
import org.eclipse.rse.core.model.IPropertySet;
32
33
import org.eclipse.rse.internal.services.telnet.Activator;
28
import org.eclipse.rse.internal.services.telnet.ITelnetSessionProvider;
34
import org.eclipse.rse.internal.services.telnet.ITelnetSessionProvider;
29
import org.eclipse.rse.services.clientserver.PathUtility;
35
import org.eclipse.rse.services.clientserver.PathUtility;
30
import org.eclipse.rse.services.shells.AbstractHostShell;
36
import org.eclipse.rse.services.shells.AbstractHostShell;
Lines 39-53 Link Here
39
	private TelnetShellOutputReader fStdoutHandler;
45
	private TelnetShellOutputReader fStdoutHandler;
40
	private TelnetShellOutputReader fStderrHandler;
46
	private TelnetShellOutputReader fStderrHandler;
41
	private TelnetShellWriterThread fShellWriter;
47
	private TelnetShellWriterThread fShellWriter;
48
	private TelnetClient thisShellsClient = null;
49
	private String host;
50
	private String password;
51
	private String shellId =  "Shell." + String.valueOf( new Random().nextInt() ); //$NON-NLS-1$
52
	private IPropertySet sessionProperties;	
53
	private InputStream in;
54
	private PrintStream out;
55
	
56
	public static final String PROPERTY_SET_NAME = "Telnet Settings"; //$NON-NLS-1$
57
	public static final String PROPERTY_LOGIN_REQUIRED = "Login.Required"; //$NON-NLS-1$
58
	public static final String PROPERTY_LOGIN_PROMPT = "Login.Prompt"; //$NON-NLS-1$
59
	public static final String PROPERTY_PASSWORD_PROMPT = "Password.Prompt"; //$NON-NLS-1$
60
	public static final String PROPERTY_COMMAND_PROMPT = "Command.Prompt"; //$NON-NLS-1$
61
	private static final int ERROR_CODE = 100; // filed error code
62
	private static final int SUCCESS_CODE = 150; // login pass code
63
	private static final int CONNECT_CLOSED = 200; // code for end of login attempts
42
	
64
	
43
	public TelnetHostShell(ITelnetSessionProvider sessionProvider, String initialWorkingDirectory, String commandToRun, String encoding, String[] environment) {
65
	public TelnetHostShell(ITelnetSessionProvider sessionProvider, String initialWorkingDirectory, String commandToRun, String encoding, String[] environment) {
44
		try {
66
		try {
45
			fSessionProvider = sessionProvider;
67
			fSessionProvider = sessionProvider;
68
			host = fSessionProvider.getSessionHostName();
69
			password = fSessionProvider.getSessionPassword();
70
			sessionProperties = fSessionProvider.getSessionPropertySet();
46
			
71
			
47
72
			TelnetClient perShellClient = new TelnetClient();
48
			fStdoutHandler = new TelnetShellOutputReader(this, new BufferedReader(new InputStreamReader(sessionProvider.getTelnetClient().getInputStream())), false);
73
			perShellClient.connect(host);
74
			setThisShellsClient(perShellClient);
75
			
76
			
77
			fSessionProvider.addShellsTelnetClient(perShellClient, getShellId() );
78
			
79
			in = perShellClient.getInputStream();
80
			out = new PrintStream(perShellClient.getOutputStream());
81
			
82
			LoginThread checkLogin = new LoginThread( fSessionProvider.getSessionUsername(), password);
83
			checkLogin.start();
84
			checkLogin.join();
85
			int status = checkLogin.getLoginStatus();
86
			
87
			fStdoutHandler = new TelnetShellOutputReader(this, new BufferedReader(new InputStreamReader(perShellClient.getInputStream())), false);
49
			fStderrHandler = new TelnetShellOutputReader(this, null,true);
88
			fStderrHandler = new TelnetShellOutputReader(this, null,true);
50
			OutputStream outputStream = sessionProvider.getTelnetClient().getOutputStream();
89
			OutputStream outputStream = perShellClient.getOutputStream();
51
			//TODO check if encoding or command to execute needs to be considered
90
			//TODO check if encoding or command to execute needs to be considered
52
			//If a command is given, it might be possible to do without a Thread
91
			//If a command is given, it might be possible to do without a Thread
53
			//Charset cs = Charset.forName(encoding);
92
			//Charset cs = Charset.forName(encoding);
Lines 76-97 Link Here
76
		}
115
		}
77
	}
116
	}
78
	
117
	
118
	public String getShellId() {
119
		return this.shellId;
120
	}
121
	
79
	public String getPromptCommand() {
122
	public String getPromptCommand() {
80
		return "echo $PWD'>'"; //$NON-NLS-1$
123
		return "echo $PWD'>'"; //$NON-NLS-1$
81
	}
124
	}
82
	
125
	
126
	private void setThisShellsClient( TelnetClient client) {
127
		this.thisShellsClient = client;
128
	}
129
	
130
	private TelnetClient getThisShellsClient( ) {
131
		return this.thisShellsClient;
132
	}
133
	
83
	public void exit() {
134
	public void exit() {
84
		fShellWriter.stopThread();
135
		fShellWriter.stopThread();
85
		try {
136
		try {
86
			//TODO disconnect should better be done via the ConnectorService!!
137
			//TODO disconnect should better be done via the ConnectorService!!
87
			//Because like we do it here, the connector service is not notified!
138
			//Because like we do it here, the connector service is not notified!
88
			TelnetClient client = fSessionProvider.getTelnetClient();
139
			TelnetClient client = getThisShellsClient();//fSessionProvider.getTelnetClient();
89
			if (client!=null) {
140
			if (client!=null) {
90
				synchronized(client) {
141
				synchronized(client) {
91
					if (client.isConnected())
142
					if (client.isConnected())
92
						client.disconnect();
143
						client.disconnect();
93
				}
144
				}
94
			}
145
			}
146
			fSessionProvider.removeShellsTelnetClient( getShellId() );
95
		} catch (IOException e) {
147
		} catch (IOException e) {
96
		}
148
		}
97
149
Lines 106-112 Link Here
106
	}
158
	}
107
159
108
	public boolean isActive() {
160
	public boolean isActive() {
109
		TelnetClient client = fSessionProvider.getTelnetClient();
161
		TelnetClient client = getThisShellsClient();//fSessionProvider.getTelnetClient();
110
		if (client!=null ) {
162
		if (client!=null ) {
111
			return true;
163
			return true;
112
		}
164
		}
Lines 136-140 Link Here
136
		}
188
		}
137
189
138
	}
190
	}
191
	
192
	/*
193
	 * A Login Thread to catch errors during login into telnet session
194
	 */
195
196
	private class LoginThread extends Thread {
197
198
		private String user;
199
		private String passwd;
200
		private int status = SUCCESS_CODE;
201
202
		public LoginThread(String username, String password) {
203
			this.user = username;
204
			this.passwd = password;
205
		}
206
207
		public void run() {
208
209
			String login_required = sessionProperties
210
					.getPropertyValue(PROPERTY_LOGIN_REQUIRED);
211
			String login_prompt = sessionProperties
212
					.getPropertyValue(PROPERTY_LOGIN_PROMPT);
213
			String password_prompt = sessionProperties
214
					.getPropertyValue(PROPERTY_PASSWORD_PROMPT);
215
			String command_prompt = sessionProperties
216
					.getPropertyValue(PROPERTY_COMMAND_PROMPT);
217
218
			if (Boolean.valueOf(login_required).booleanValue()) {
219
				status = SUCCESS_CODE;
220
				if (login_prompt != null && login_prompt.length() > 0) {
221
					status = readUntil(login_prompt);
222
					write(user);
223
				}
224
				if (status == SUCCESS_CODE && password_prompt != null && password_prompt.length() > 0) {
225
					status = readUntil(password_prompt);
226
					write(passwd);
227
				}
228
				if (status == SUCCESS_CODE && command_prompt != null && command_prompt.length() > 0) {
229
					status = readUntil(command_prompt);
230
				}
231
			} else {
232
				if (command_prompt != null && command_prompt.length() > 0) {
233
					status = readUntil(command_prompt);
234
				}
235
			}
236
		}
237
238
		public int getLoginStatus() {
239
			return this.status;
240
		}
241
	}
139
242
243
	public int readUntil(String pattern) {
244
		try {
245
			char lastChar = pattern.charAt(pattern.length() - 1);
246
			StringBuffer sb = new StringBuffer();
247
			int ch = in.read();
248
			while (ch >= 0) {
249
				char tch = (char) ch;
250
				if (Activator.isTracingOn())
251
					System.out.print(tch);
252
				sb.append(tch);
253
				if (tch=='t' && sb.indexOf("incorrect") >= 0) { //$NON-NLS-1$
254
					return ERROR_CODE;
255
				}
256
				if (tch=='d' && sb.indexOf("closed") >= 0) { //$NON-NLS-1$
257
					return CONNECT_CLOSED;
258
				}
259
				if (tch == lastChar) {
260
					if (sb.toString().endsWith(pattern)) {
261
						return SUCCESS_CODE;
262
					}
263
				}
264
				ch = in.read();
265
			}
266
		} catch (Exception e) {
267
		}
268
		return CONNECT_CLOSED;
269
	}
270
	
271
	public void write(String value) {
272
		try {
273
			out.println(value);
274
			out.flush();
275
			if (Activator.isTracingOn()) {
276
				// Avoid printing password to stdout
277
				// Activator.trace("write: "+value ); //$NON-NLS-1$
278
				int len = value.length() + 6;
279
				Activator.trace("write: ******************".substring(0, len <= 24 ? len : 24)); //$NON-NLS-1$
280
			}
281
		} catch (Exception e) {
282
			e.printStackTrace();
283
		}
284
	}
140
}
285
}
(-)src/org/eclipse/rse/internal/services/telnet/ITelnetSessionProvider.java (+14 lines)
Lines 16-27 Link Here
16
 *******************************************************************************/
16
 *******************************************************************************/
17
package org.eclipse.rse.internal.services.telnet;
17
package org.eclipse.rse.internal.services.telnet;
18
18
19
19
import org.apache.commons.net.telnet.TelnetClient;
20
import org.apache.commons.net.telnet.TelnetClient;
21
import org.eclipse.rse.core.model.IPropertySet;
20
22
21
public interface ITelnetSessionProvider {
23
public interface ITelnetSessionProvider {
22
	
24
	
23
	public TelnetClient getTelnetClient();
25
	public TelnetClient getTelnetClient();
24
	
26
	
27
	public void addShellsTelnetClient( TelnetClient client, String shellId );
28
	
29
	public void removeShellsTelnetClient( String shellId );
30
	
31
	public String  getSessionHostName();
32
	
33
	public String getSessionPassword();
34
	
35
	public String getSessionUsername();
36
	
37
	public IPropertySet getSessionPropertySet() ;
38
	
25
	/* Inform the connectorService that a session has been lost. */
39
	/* Inform the connectorService that a session has been lost. */
26
	public void handleSessionLost();
40
	public void handleSessionLost();
27
}
41
}
(-)src/org/eclipse/rse/internal/services/telnet/Activator.java (+37 lines)
Lines 10-17 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.rse.internal.services.telnet;
11
package org.eclipse.rse.internal.services.telnet;
12
12
13
import java.text.DateFormat;
14
import java.text.SimpleDateFormat;
15
import java.util.Date;
16
13
import org.eclipse.core.runtime.ILog;
17
import org.eclipse.core.runtime.ILog;
14
import org.eclipse.core.runtime.IStatus;
18
import org.eclipse.core.runtime.IStatus;
19
import org.eclipse.core.runtime.Platform;
15
import org.eclipse.core.runtime.Status;
20
import org.eclipse.core.runtime.Status;
16
import org.eclipse.osgi.util.NLS;
21
import org.eclipse.osgi.util.NLS;
17
import org.eclipse.ui.plugin.AbstractUIPlugin;
22
import org.eclipse.ui.plugin.AbstractUIPlugin;
Lines 52-57 Link Here
52
		super.stop(context);
57
		super.stop(context);
53
	}
58
	}
54
59
60
	private static Boolean fTracingOn = null;
61
	public static boolean isTracingOn() {
62
		if (fTracingOn==null) {
63
			String id = plugin.getBundle().getSymbolicName();
64
			String val = Platform.getDebugOption(id + "/debug"); //$NON-NLS-1$
65
			if ("true".equals(val)) { //$NON-NLS-1$
66
				fTracingOn = Boolean.TRUE;
67
			} else {
68
				fTracingOn = Boolean.FALSE;
69
			}
70
		}
71
		return fTracingOn.booleanValue();
72
	}
73
	public static String getTimestamp() {
74
		try {
75
			DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); //$NON-NLS-1$
76
			return formatter.format(new Date());
77
		} catch (Exception e) {
78
			// If there were problems writing out the date, ignore and
79
			// continue since that shouldn't stop us from logging the rest
80
			// of the information
81
		}
82
		return Long.toString(System.currentTimeMillis());
83
	}
84
	public static void trace(String msg) {
85
		if (isTracingOn()) {Date
86
			String fullMsg = getTimestamp() + " | " + Thread.currentThread().getName() + " | " + msg; //$NON-NLS-1$ //$NON-NLS-2$
87
			System.out.println(fullMsg);
88
			System.out.flush();
89
		}
90
	}
91
	
55
	/**
92
	/**
56
	 * Returns the shared instance
93
	 * Returns the shared instance
57
	 *
94
	 *
(-)META-INF/MANIFEST.MF (-1 / +2 lines)
Lines 9-15 Link Here
9
 org.eclipse.core.runtime,
9
 org.eclipse.core.runtime,
10
 org.eclipse.rse.services,
10
 org.eclipse.rse.services,
11
 org.apache.commons.net,
11
 org.apache.commons.net,
12
 org.eclipse.rse.services.files.ftp
12
 org.eclipse.rse.services.files.ftp,
13
 org.eclipse.rse.core
13
Export-Package: org.eclipse.rse.internal.services.telnet;x-friends:="org.eclipse.rse.connectorservice.telnet,org.eclipse.rse.subsystems.files.telnet,org.eclipse.rse.subsystems.shells.telnet",
14
Export-Package: org.eclipse.rse.internal.services.telnet;x-friends:="org.eclipse.rse.connectorservice.telnet,org.eclipse.rse.subsystems.files.telnet,org.eclipse.rse.subsystems.shells.telnet",
14
 org.eclipse.rse.internal.services.telnet.shell;x-friends:="org.eclipse.rse.connectorservice.telnet,org.eclipse.rse.subsystems.shells.telnet"
15
 org.eclipse.rse.internal.services.telnet.shell;x-friends:="org.eclipse.rse.connectorservice.telnet,org.eclipse.rse.subsystems.shells.telnet"
15
Eclipse-LazyStart: true
16
Eclipse-LazyStart: true
(-)src/org/eclipse/rse/internal/connectorservice/telnet/TelnetConnectorService.java (-6 / +66 lines)
Lines 13-25 Link Here
13
 * Martin Oberhuber (Wind River) - [178606] fix endless loop in readUntil()
13
 * Martin Oberhuber (Wind River) - [178606] fix endless loop in readUntil()
14
 * Sheldon D'souza (Celunite) - [186536] login and password should be configurable
14
 * Sheldon D'souza (Celunite) - [186536] login and password should be configurable
15
 * Sheldon D'souza (Celunite) - [186570] handle invalid user id and password more gracefully
15
 * Sheldon D'souza (Celunite) - [186570] handle invalid user id and password more gracefully
16
 * Martin Oberhuber (Wind River) - [187218] Fix error reporting for connect() 
17
 *******************************************************************************/
16
 *******************************************************************************/
18
package org.eclipse.rse.internal.connectorservice.telnet;
17
package org.eclipse.rse.internal.connectorservice.telnet;
19
18
19
import java.io.IOException;
20
import java.io.InputStream;
20
import java.io.InputStream;
21
import java.io.PrintStream;
21
import java.io.PrintStream;
22
import java.lang.reflect.Array;
22
import java.lang.reflect.InvocationTargetException;
23
import java.lang.reflect.InvocationTargetException;
24
import java.net.SocketException;
25
import java.util.ArrayList;
26
import java.util.HashMap;
27
import java.util.List;
28
import java.util.Map;
29
import java.util.Vector;
23
30
24
import org.apache.commons.net.telnet.TelnetClient;
31
import org.apache.commons.net.telnet.TelnetClient;
25
import org.eclipse.core.runtime.IProgressMonitor;
32
import org.eclipse.core.runtime.IProgressMonitor;
Lines 28-33 Link Here
28
import org.eclipse.jface.operation.IRunnableContext;
35
import org.eclipse.jface.operation.IRunnableContext;
29
import org.eclipse.jface.operation.IRunnableWithProgress;
36
import org.eclipse.jface.operation.IRunnableWithProgress;
30
import org.eclipse.rse.core.RSECorePlugin;
37
import org.eclipse.rse.core.RSECorePlugin;
38
import org.eclipse.rse.core.SystemBasePlugin;
31
import org.eclipse.rse.core.model.IHost;
39
import org.eclipse.rse.core.model.IHost;
32
import org.eclipse.rse.core.model.IPropertySet;
40
import org.eclipse.rse.core.model.IPropertySet;
33
import org.eclipse.rse.core.model.ISystemRegistry;
41
import org.eclipse.rse.core.model.ISystemRegistry;
Lines 41-47 Link Here
41
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
49
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
42
import org.eclipse.rse.ui.ISystemMessages;
50
import org.eclipse.rse.ui.ISystemMessages;
43
import org.eclipse.rse.ui.RSEUIPlugin;
51
import org.eclipse.rse.ui.RSEUIPlugin;
44
import org.eclipse.rse.ui.SystemBasePlugin;
45
import org.eclipse.rse.ui.messages.SystemMessageDialog;
52
import org.eclipse.rse.ui.messages.SystemMessageDialog;
46
import org.eclipse.rse.ui.subsystems.StandardConnectorService;
53
import org.eclipse.rse.ui.subsystems.StandardConnectorService;
47
import org.eclipse.swt.widgets.Display;
54
import org.eclipse.swt.widgets.Display;
Lines 57-69 Link Here
57
	public static final String PROPERTY_LOGIN_PROMPT = "Login.Prompt"; //$NON-NLS-1$
64
	public static final String PROPERTY_LOGIN_PROMPT = "Login.Prompt"; //$NON-NLS-1$
58
	public static final String PROPERTY_PASSWORD_PROMPT = "Password.Prompt"; //$NON-NLS-1$
65
	public static final String PROPERTY_PASSWORD_PROMPT = "Password.Prompt"; //$NON-NLS-1$
59
	public static final String PROPERTY_COMMAND_PROMPT = "Command.Prompt"; //$NON-NLS-1$
66
	public static final String PROPERTY_COMMAND_PROMPT = "Command.Prompt"; //$NON-NLS-1$
60
67
	public static final String PROPERTY_TELNET_CONNECT_TIMEOUT = "Telnet.timeout"; //$NON-NLS-1$
61
	private static final int TELNET_DEFAULT_PORT = 23; // TODO Make configurable
62
	private static final int TELNET_CONNECT_TIMEOUT = 60; //seconds - TODO: Make configurable
68
	private static final int TELNET_CONNECT_TIMEOUT = 60; //seconds - TODO: Make configurable
69
	
70
	private static final int TELNET_DEFAULT_PORT = 23;
63
	private TelnetClient fTelnetClient = new TelnetClient();
71
	private TelnetClient fTelnetClient = new TelnetClient();
72
	private Map fTelnetShellClients = new HashMap();
73
	private Vector shellSessionId = new Vector();
64
	private SessionLostHandler fSessionLostHandler;
74
	private SessionLostHandler fSessionLostHandler;
65
	private InputStream in;
75
	private InputStream in;
66
	private PrintStream out;
76
	private PrintStream out;
77
	private String sessionHostName ;
78
	private String sessionPassword;
67
	private IPropertySet telnetPropertySet = null;
79
	private IPropertySet telnetPropertySet = null;
68
	private static final int ERROR_CODE = 100; // filed error code
80
	private static final int ERROR_CODE = 100; // filed error code
69
	private static final int SUCCESS_CODE = 150; // login pass code
81
	private static final int SUCCESS_CODE = 150; // login pass code
Lines 99-104 Link Here
99
					"assword: ", PropertyType.getStringPropertyType()); //$NON-NLS-1$ 
111
					"assword: ", PropertyType.getStringPropertyType()); //$NON-NLS-1$ 
100
			telnetSet.addProperty(PROPERTY_COMMAND_PROMPT,
112
			telnetSet.addProperty(PROPERTY_COMMAND_PROMPT,
101
					"$", PropertyType.getStringPropertyType()); //$NON-NLS-1$
113
					"$", PropertyType.getStringPropertyType()); //$NON-NLS-1$
114
			telnetSet.addProperty(PROPERTY_TELNET_CONNECT_TIMEOUT,
115
					"60", PropertyType.getStringPropertyType()); //$NON-NLS-1$
116
			
102
		}
117
		}
103
		return telnetSet;
118
		return telnetSet;
104
	}
119
	}
Lines 112-117 Link Here
112
		String host = getHostName();
127
		String host = getHostName();
113
		String user = getUserId();
128
		String user = getUserId();
114
		String password = ""; //$NON-NLS-1$
129
		String password = ""; //$NON-NLS-1$
130
115
		int status = ERROR_CODE;
131
		int status = ERROR_CODE;
116
		Exception nestedException = null;
132
		Exception nestedException = null;
117
		try {
133
		try {
Lines 122-131 Link Here
122
				password = ssi.getPassword();
138
				password = ssi.getPassword();
123
			}
139
			}
124
140
141
			telnetPropertySet = getTelnetPropertySet();
142
			
143
			String time_out = telnetPropertySet.getPropertyValue(PROPERTY_TELNET_CONNECT_TIMEOUT); 
144
			this.sessionHostName = host;
145
			this.sessionPassword = password;
125
			in = fTelnetClient.getInputStream();
146
			in = fTelnetClient.getInputStream();
126
			out = new PrintStream(fTelnetClient.getOutputStream());
147
			out = new PrintStream(fTelnetClient.getOutputStream());
127
148
128
			long millisToEnd = System.currentTimeMillis() + TELNET_CONNECT_TIMEOUT*1000;
149
			long millisToEnd = System.currentTimeMillis() + Integer.valueOf( time_out ).intValue()*1000;
129
			LoginThread checkLogin = new LoginThread(user, password);
150
			LoginThread checkLogin = new LoginThread(user, password);
130
			checkLogin.start();
151
			checkLogin.start();
131
			while (checkLogin.isAlive() && System.currentTimeMillis()<millisToEnd) {
152
			while (checkLogin.isAlive() && System.currentTimeMillis()<millisToEnd) {
Lines 188-195 Link Here
188
		try {
209
		try {
189
			if (fTelnetClient != null) {
210
			if (fTelnetClient != null) {
190
				synchronized (fTelnetClient) {
211
				synchronized (fTelnetClient) {
212
					
191
					if (fTelnetClient.isConnected())
213
					if (fTelnetClient.isConnected())
192
						fTelnetClient.disconnect();
214
						fTelnetClient.disconnect();
215
					
216
					for( int i=0;i<shellSessionId.size();i++) {
217
						
218
						Object client = fTelnetShellClients.get( shellSessionId.get( i ));
219
						if( client != null  ) {
220
							if( client instanceof TelnetClient) {
221
								if(((TelnetClient) client).isConnected()) {
222
									((TelnetClient)client).disconnect();
223
								}
224
							}
225
						}
226
					}
193
				}
227
				}
194
			}
228
			}
195
		} catch (Exception e) {
229
		} catch (Exception e) {
Lines 250-256 Link Here
250
		Activator.trace("Telnet Service: Disconnecting ....."); //$NON-NLS-1$
284
		Activator.trace("Telnet Service: Disconnecting ....."); //$NON-NLS-1$
251
285
252
		boolean sessionLost = (fSessionLostHandler != null && fSessionLostHandler.isSessionLost());
286
		boolean sessionLost = (fSessionLostHandler != null && fSessionLostHandler.isSessionLost());
253
		// no more interested in handling session-lost, since we are
287
		// no more interested in handling session-lost, sinkeyce we are
254
		// disconnecting anyway
288
		// disconnecting anyway
255
		fSessionLostHandler = null;
289
		fSessionLostHandler = null;
256
		// handle events
290
		// handle events
Lines 268-276 Link Here
268
	}
302
	}
269
303
270
	public TelnetClient getTelnetClient() {
304
	public TelnetClient getTelnetClient() {
305
		
271
		return fTelnetClient;
306
		return fTelnetClient;
272
	}
307
	}
273
308
309
	public IPropertySet getSessionPropertySet() {
310
		return this.telnetPropertySet;
311
	}
312
	
313
	public String  getSessionHostName() {
314
		return this.sessionHostName;
315
	}
316
	
317
	public String getSessionUsername() {
318
		return getUserId();
319
	}
320
	
321
	public String getSessionPassword() {
322
		return this.sessionPassword;
323
	}
324
	
325
	public void addShellsTelnetClient( TelnetClient client , String shellId) {
326
		this.shellSessionId.add( shellId );
327
		this.fTelnetShellClients.put(shellId, client);
328
	}
329
	
330
	public void removeShellsTelnetClient( String shellId ) {
331
		this.fTelnetShellClients.remove(shellId);
332
	}
333
	
274
	/**
334
	/**
275
	 * Handle session-lost events. This is generic for any sort of connector
335
	 * Handle session-lost events. This is generic for any sort of connector
276
	 * service. Most of this is extracted from dstore's
336
	 * service. Most of this is extracted from dstore's

Return to bug 187301