Lines 101-117
Link Here
|
101 |
*/ |
101 |
*/ |
102 |
protected IPropertySet getTelnetPropertySet() { |
102 |
protected IPropertySet getTelnetPropertySet() { |
103 |
IPropertySet telnetSet = getPropertySet(PROPERTY_SET_NAME); |
103 |
IPropertySet telnetSet = getPropertySet(PROPERTY_SET_NAME); |
|
|
104 |
|
104 |
if (telnetSet == null) { |
105 |
if (telnetSet == null) { |
105 |
telnetSet = createPropertySet(PROPERTY_SET_NAME, |
106 |
telnetSet = createPropertySet(PROPERTY_SET_NAME/*, |
106 |
TelnetConnectorResources.PropertySet_Description); |
107 |
TelnetConnectorResources.PropertySet_Description*/); |
107 |
telnetSet.addProperty(PROPERTY_LOGIN_REQUIRED, |
108 |
telnetSet.addProperty(PROPERTY_LOGIN_REQUIRED, |
108 |
"true", PropertyType.getEnumPropertyType(new String[] { "true", "false" })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
109 |
"false", PropertyType.getEnumPropertyType(new String[] { "true", "false" })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
109 |
telnetSet.addProperty(PROPERTY_LOGIN_PROMPT, |
110 |
telnetSet.addProperty(PROPERTY_LOGIN_PROMPT, |
110 |
"ogin: ", PropertyType.getStringPropertyType()); //$NON-NLS-1$ |
111 |
"ogin: ", PropertyType.getStringPropertyType()); //$NON-NLS-1$ |
111 |
telnetSet.addProperty(PROPERTY_PASSWORD_PROMPT, |
112 |
telnetSet.addProperty(PROPERTY_PASSWORD_PROMPT, |
112 |
"assword: ", PropertyType.getStringPropertyType()); //$NON-NLS-1$ |
113 |
"assword: ", PropertyType.getStringPropertyType()); //$NON-NLS-1$ |
113 |
telnetSet.addProperty(PROPERTY_COMMAND_PROMPT, |
114 |
telnetSet.addProperty(PROPERTY_COMMAND_PROMPT, |
114 |
"$", PropertyType.getStringPropertyType()); //$NON-NLS-1$ |
115 |
"#", PropertyType.getStringPropertyType()); //$NON-NLS-1$ |
115 |
} |
116 |
} |
116 |
return telnetSet; |
117 |
return telnetSet; |
117 |
} |
118 |
} |
Lines 258-268
Link Here
|
258 |
} |
259 |
} |
259 |
} |
260 |
} |
260 |
|
261 |
|
|
|
262 |
int read_withtime(InputStream in) { |
263 |
long millisToEnd = System.currentTimeMillis() + 1000; |
264 |
try { |
265 |
while (System.currentTimeMillis()<millisToEnd) |
266 |
{ |
267 |
if (in.available()>0) |
268 |
return in.read(); |
269 |
else |
270 |
Thread.sleep(100); |
271 |
} |
272 |
} catch (IOException e) { |
273 |
e.printStackTrace(); |
274 |
} catch (InterruptedException e) { |
275 |
e.printStackTrace(); |
276 |
} |
277 |
return -1; |
278 |
} |
279 |
|
261 |
public int readUntil(String pattern,InputStream in) { |
280 |
public int readUntil(String pattern,InputStream in) { |
|
|
281 |
|
262 |
try { |
282 |
try { |
263 |
char lastChar = pattern.charAt(pattern.length() - 1); |
283 |
char lastChar = pattern.charAt(pattern.length() - 1); |
264 |
StringBuffer sb = new StringBuffer(); |
284 |
StringBuffer sb = new StringBuffer(); |
265 |
int ch = in.read(); |
285 |
int ch = read_withtime(in); |
266 |
while (ch >= 0) { |
286 |
while (ch >= 0) { |
267 |
char tch = (char) ch; |
287 |
char tch = (char) ch; |
268 |
if (Activator.isTracingOn()) |
288 |
if (Activator.isTracingOn()) |
Lines 279-285
Link Here
|
279 |
return SUCCESS_CODE; |
299 |
return SUCCESS_CODE; |
280 |
} |
300 |
} |
281 |
} |
301 |
} |
282 |
ch = in.read(); |
302 |
ch = read_withtime(in); |
283 |
} |
303 |
} |
284 |
} catch (Exception e) { |
304 |
} catch (Exception e) { |
285 |
SystemBasePlugin.logError(e.getMessage() == null ? e.getClass().getName() : e.getMessage(), e); |
305 |
SystemBasePlugin.logError(e.getMessage() == null ? e.getClass().getName() : e.getMessage(), e); |