mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 11:55:40 +02:00
[178201] Telnet subsystem contribution initial checkin
This commit is contained in:
parent
9529b426c3
commit
22ae382e1c
32 changed files with 1431 additions and 0 deletions
7
rse/plugins/org.eclipse.rse.services.telnet/.classpath
Normal file
7
rse/plugins/org.eclipse.rse.services.telnet/.classpath
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
|
<classpathentry kind="output" path="bin"/>
|
||||||
|
</classpath>
|
1
rse/plugins/org.eclipse.rse.services.telnet/.cvsignore
Normal file
1
rse/plugins/org.eclipse.rse.services.telnet/.cvsignore
Normal file
|
@ -0,0 +1 @@
|
||||||
|
bin
|
28
rse/plugins/org.eclipse.rse.services.telnet/.project
Normal file
28
rse/plugins/org.eclipse.rse.services.telnet/.project
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>org.eclipse.rse.services.telnet</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.pde.PluginNature</nature>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
|
@ -0,0 +1,70 @@
|
||||||
|
#Tue Jan 30 22:33:44 CET 2007
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.4
|
||||||
|
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.autoboxing=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.deprecation=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected
|
||||||
|
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.nullReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.3
|
|
@ -0,0 +1,17 @@
|
||||||
|
Manifest-Version: 1.0
|
||||||
|
Bundle-ManifestVersion: 2
|
||||||
|
Bundle-Name: %pluginName
|
||||||
|
Bundle-SymbolicName: org.eclipse.rse.services.telnet
|
||||||
|
Bundle-Version: 1.0.0.qualifier
|
||||||
|
Bundle-Activator: org.eclipse.rse.internal.services.telnet.Activator
|
||||||
|
Bundle-Localization: plugin
|
||||||
|
Require-Bundle: org.eclipse.ui,
|
||||||
|
org.eclipse.core.runtime,
|
||||||
|
org.eclipse.rse.services,
|
||||||
|
org.apache.commons.net,
|
||||||
|
org.eclipse.rse.services.files.ftp
|
||||||
|
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",
|
||||||
|
org.eclipse.rse.internal.services.telnet.shell;x-friends:="org.eclipse.rse.connectorservice.telnet,org.eclipse.rse.subsystems.shells.telnet"
|
||||||
|
Eclipse-LazyStart: true
|
||||||
|
Bundle-Vendor: %providerName
|
||||||
|
Bundle-RequiredExecutionEnvironment: J2SE-1.4
|
28
rse/plugins/org.eclipse.rse.services.telnet/about.html
Normal file
28
rse/plugins/org.eclipse.rse.services.telnet/about.html
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
|
||||||
|
<title>About</title>
|
||||||
|
</head>
|
||||||
|
<body lang="EN-US">
|
||||||
|
<h2>About This Content</h2>
|
||||||
|
|
||||||
|
<p>June 2, 2006</p>
|
||||||
|
<h3>License</h3>
|
||||||
|
|
||||||
|
<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
|
||||||
|
indicated below, the Content is provided to you under the terms and conditions of the
|
||||||
|
Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
|
||||||
|
at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
|
||||||
|
For purposes of the EPL, "Program" will mean the Content.</p>
|
||||||
|
|
||||||
|
<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
|
||||||
|
being redistributed by another party ("Redistributor") and different terms and conditions may
|
||||||
|
apply to your use of any object code in the Content. Check the Redistributor's license that was
|
||||||
|
provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
|
||||||
|
indicated below, the terms and conditions of the EPL still apply to any source code in the Content
|
||||||
|
and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
16
rse/plugins/org.eclipse.rse.services.telnet/build.properties
Normal file
16
rse/plugins/org.eclipse.rse.services.telnet/build.properties
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
###############################################################################
|
||||||
|
# Copyright (c) 2005, 2007 IBM Corporation and others.
|
||||||
|
# All rights reserved. This program and the accompanying materials
|
||||||
|
# are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
# which accompanies this distribution, and is available at
|
||||||
|
# http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
#
|
||||||
|
# Contributors:
|
||||||
|
# IBM Corporation - initial API and implementation
|
||||||
|
###############################################################################
|
||||||
|
bin.includes = .,\
|
||||||
|
META-INF/,\
|
||||||
|
about.html,\
|
||||||
|
plugin.properties
|
||||||
|
source.. = src/
|
||||||
|
output.. = bin/
|
|
@ -0,0 +1,16 @@
|
||||||
|
###############################################################################
|
||||||
|
# Copyright (c) 2000, 2007 IBM Corporation and others.
|
||||||
|
# All rights reserved. This program and the accompanying materials
|
||||||
|
# are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
# which accompanies this distribution, and is available at
|
||||||
|
# http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
#
|
||||||
|
# Contributors:
|
||||||
|
# Sheldon D'souza (Celunite) - created
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
# NLS_MESSAGEFORMAT_NONE
|
||||||
|
# NLS_ENCODING=UTF-8
|
||||||
|
|
||||||
|
pluginName = RSE Telnet Service
|
||||||
|
providerName = Eclipse.org
|
|
@ -0,0 +1,76 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006, 2007 Celunite, Inc. and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Sheldon D'souza (Celunite) - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.rse.internal.services.telnet;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.ILog;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.Status;
|
||||||
|
import org.eclipse.osgi.util.NLS;
|
||||||
|
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||||
|
import org.osgi.framework.BundleContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The activator class controls the plug-in life cycle
|
||||||
|
*/
|
||||||
|
public class Activator extends AbstractUIPlugin {
|
||||||
|
|
||||||
|
// The plug-in ID
|
||||||
|
public static final String PLUGIN_ID = "org.eclipse.rse.services.telnet"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
// The shared instance
|
||||||
|
private static Activator plugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The constructor
|
||||||
|
*/
|
||||||
|
public Activator() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
|
||||||
|
*/
|
||||||
|
public void start(BundleContext context) throws Exception {
|
||||||
|
super.start(context);
|
||||||
|
plugin = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
|
||||||
|
*/
|
||||||
|
public void stop(BundleContext context) throws Exception {
|
||||||
|
plugin = null;
|
||||||
|
super.stop(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the shared instance
|
||||||
|
*
|
||||||
|
* @return the shared instance
|
||||||
|
*/
|
||||||
|
public static Activator getDefault() {
|
||||||
|
return plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs an throwable to the log for this plugin.
|
||||||
|
* @param t the Throwable to be logged.
|
||||||
|
*/
|
||||||
|
public void logException(Throwable t) {
|
||||||
|
ILog log = getLog();
|
||||||
|
String id = getBundle().getSymbolicName();
|
||||||
|
String message = NLS.bind(TelnetServiceResources.TelnetPlugin_Unexpected_Exception, t.getClass().getName(), t.getLocalizedMessage());
|
||||||
|
IStatus status = new Status(IStatus.ERROR, id, 0, message, t);
|
||||||
|
log.log(status);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006, 2007 Celunite, Inc.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Sheldon D'souza (Celunite) - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.rse.internal.services.telnet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Markup Interface for services using the TelnetConnectorService.
|
||||||
|
*
|
||||||
|
* By implementing this interface, services can be recognized
|
||||||
|
* as operating against an TelnetConnectorService. The interface
|
||||||
|
* is used as the key in a table for looking up the connector
|
||||||
|
* service when needed.
|
||||||
|
*/
|
||||||
|
public interface ITelnetService {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006, 2007 IBM Corporation and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Initial Contributors:
|
||||||
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Sheldon D'souza (Celunite) - adapted from ISshSessionProvider
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.rse.internal.services.telnet;
|
||||||
|
|
||||||
|
import org.apache.commons.net.telnet.TelnetClient;
|
||||||
|
|
||||||
|
public interface ITelnetSessionProvider {
|
||||||
|
|
||||||
|
public TelnetClient getTelnetClient();
|
||||||
|
|
||||||
|
/* Inform the connectorService that a session has been lost. */
|
||||||
|
public void handleSessionLost();
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006, 2007 Wind River Systems, Inc. and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Martin Oberhuber (Wind River) - initial API and implementation
|
||||||
|
* Sheldon D'souza (Celunite) - adapted form SshServiceResources
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.rse.internal.services.telnet;
|
||||||
|
|
||||||
|
import org.eclipse.osgi.util.NLS;
|
||||||
|
|
||||||
|
public class TelnetServiceResources extends NLS {
|
||||||
|
|
||||||
|
private static final String BUNDLE_NAME = "org.eclipse.rse.internal.services.telnet.TelnetServiceResources"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
public static String TelnetPlugin_Unexpected_Exception;
|
||||||
|
|
||||||
|
public static String TelnetShellService_Description;
|
||||||
|
|
||||||
|
public static String TelnetShellService_Name;
|
||||||
|
|
||||||
|
static {
|
||||||
|
// initialize resource bundle
|
||||||
|
NLS.initializeMessages(BUNDLE_NAME, TelnetServiceResources.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
private TelnetServiceResources(){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
################################################################################
|
||||||
|
# Copyright (c) 2006, 2007 Wind River Systems, Inc. and others
|
||||||
|
# All rights reserved. This program and the accompanying materials
|
||||||
|
# are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
# which accompanies this distribution, and is available at
|
||||||
|
# http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
#
|
||||||
|
# Contributors:
|
||||||
|
# Martin Oberhuber (Wind River) - initial API and implementation
|
||||||
|
# Sheldon D'souza (Celunite) - adapted from SshServiceResources
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
# NLS_MESSAGEFORMAT_VAR
|
||||||
|
# NLS_ENCODING=UTF-8
|
||||||
|
|
||||||
|
TelnetPlugin_Unexpected_Exception=Unexpected {0}: {1}
|
||||||
|
TelnetShellService_Name=Telnet Shell Service
|
||||||
|
TelnetShellService_Description=Telnet Shell Service Description
|
|
@ -0,0 +1,132 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006, 2007 IBM Corporation and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Initial Contributors:
|
||||||
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Martin Oberhuber (Wind River) - Adapted from LocalHostShell.
|
||||||
|
* Sheldon D'souza (Celunite) - Adapted from SshHostShell
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.rse.internal.services.telnet.shell;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import org.apache.commons.net.telnet.TelnetClient;
|
||||||
|
import org.eclipse.rse.internal.services.telnet.ITelnetSessionProvider;
|
||||||
|
import org.eclipse.rse.services.clientserver.PathUtility;
|
||||||
|
import org.eclipse.rse.services.shells.AbstractHostShell;
|
||||||
|
import org.eclipse.rse.services.shells.IHostShell;
|
||||||
|
import org.eclipse.rse.services.shells.IHostShellOutputReader;
|
||||||
|
|
||||||
|
public class TelnetHostShell extends AbstractHostShell implements IHostShell {
|
||||||
|
|
||||||
|
public static final String SHELL_INVOCATION = ">"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private ITelnetSessionProvider fSessionProvider;
|
||||||
|
private TelnetShellOutputReader fStdoutHandler;
|
||||||
|
private TelnetShellOutputReader fStderrHandler;
|
||||||
|
private TelnetShellWriterThread fShellWriter;
|
||||||
|
|
||||||
|
public TelnetHostShell(ITelnetSessionProvider sessionProvider, String initialWorkingDirectory, String commandToRun, String encoding, String[] environment) {
|
||||||
|
try {
|
||||||
|
fSessionProvider = sessionProvider;
|
||||||
|
|
||||||
|
|
||||||
|
fStdoutHandler = new TelnetShellOutputReader(this, new BufferedReader(new InputStreamReader(sessionProvider.getTelnetClient().getInputStream())), false);
|
||||||
|
fStderrHandler = new TelnetShellOutputReader(this, null,true);
|
||||||
|
OutputStream outputStream = sessionProvider.getTelnetClient().getOutputStream();
|
||||||
|
//TODO check if encoding or command to execute needs to be considered
|
||||||
|
//If a command is given, it might be possible to do without a Thread
|
||||||
|
//Charset cs = Charset.forName(encoding);
|
||||||
|
//PrintWriter outputWriter = new PrintWriter(
|
||||||
|
// new BufferedWriter(new OutputStreamWriter(outputStream,cs)));
|
||||||
|
PrintWriter outputWriter = new PrintWriter(outputStream);
|
||||||
|
fShellWriter = new TelnetShellWriterThread(outputWriter);
|
||||||
|
|
||||||
|
if (initialWorkingDirectory!=null && initialWorkingDirectory.length()>0
|
||||||
|
&& !initialWorkingDirectory.equals(".") //$NON-NLS-1$
|
||||||
|
&& !initialWorkingDirectory.equals("Command Shell") //$NON-NLS-1$ //FIXME workaround for bug 153047
|
||||||
|
) {
|
||||||
|
writeToShell("cd "+PathUtility.enQuoteUnix(initialWorkingDirectory)); //$NON-NLS-1$
|
||||||
|
} else if (SHELL_INVOCATION.equals(commandToRun)) {
|
||||||
|
writeToShell(getPromptCommand());
|
||||||
|
} else if(commandToRun!=null && commandToRun.length()>0) {
|
||||||
|
writeToShell(commandToRun);
|
||||||
|
}
|
||||||
|
} catch(Exception e) {
|
||||||
|
//TODO Forward exception to RSE properly
|
||||||
|
e.printStackTrace();
|
||||||
|
if (fShellWriter!=null) {
|
||||||
|
fShellWriter.stopThread();
|
||||||
|
fShellWriter = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPromptCommand() {
|
||||||
|
return "echo $PWD'>'"; //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
public void exit() {
|
||||||
|
fShellWriter.stopThread();
|
||||||
|
try {
|
||||||
|
fSessionProvider.getTelnetClient().disconnect();
|
||||||
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public IHostShellOutputReader getStandardOutputReader() {
|
||||||
|
return fStdoutHandler;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IHostShellOutputReader getStandardErrorReader() {
|
||||||
|
return fStderrHandler;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isActive() {
|
||||||
|
TelnetClient client = fSessionProvider.getTelnetClient();
|
||||||
|
if (client!=null ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// shell is not active: check for session lost
|
||||||
|
exit();
|
||||||
|
|
||||||
|
if (client!=null && !client.isConnected()) {
|
||||||
|
fSessionProvider.handleSessionLost();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Pattern cdCommands = Pattern.compile("\\A\\s*(cd|chdir|ls)\\b"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
public void writeToShell(String command) {
|
||||||
|
if (isActive()) {
|
||||||
|
if ("#break".equals(command)) { //$NON-NLS-1$
|
||||||
|
command = "\u0003"; //Unicode 3 == Ctrl+C //$NON-NLS-1$
|
||||||
|
} else if (cdCommands.matcher(command).find()) {
|
||||||
|
command += "\r\n" + getPromptCommand(); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
if (!fShellWriter.sendCommand(command)) {
|
||||||
|
//exception occurred: terminate writer thread, cancel connection
|
||||||
|
exit();
|
||||||
|
isActive();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,146 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006, 2007 IBM Corporation and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Initial Contributors:
|
||||||
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Martin Oberhuber (Wind River) - Adapted from LocalShellOutputReader.
|
||||||
|
* Martin Oberhuber (Wind River) - Added vt100 escape sequence ignoring.
|
||||||
|
* Sheldon D'souza (Celunite) - Adapted from SshShellOutputReader
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.rse.internal.services.telnet.shell;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import org.eclipse.rse.internal.services.telnet.Activator;
|
||||||
|
import org.eclipse.rse.services.shells.AbstractHostShellOutputReader;
|
||||||
|
import org.eclipse.rse.services.shells.IHostOutput;
|
||||||
|
import org.eclipse.rse.services.shells.IHostShell;
|
||||||
|
import org.eclipse.rse.services.shells.SimpleHostOutput;
|
||||||
|
|
||||||
|
public class TelnetShellOutputReader extends AbstractHostShellOutputReader {
|
||||||
|
|
||||||
|
|
||||||
|
protected BufferedReader fReader;
|
||||||
|
private String fPromptChars = ">$%#]"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
public TelnetShellOutputReader(IHostShell hostShell, BufferedReader reader,boolean isErrorReader) {
|
||||||
|
super(hostShell, isErrorReader);
|
||||||
|
setName("Telnet ShellOutputReader"+getName()); //$NON-NLS-1$
|
||||||
|
fReader = reader;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IHostOutput internalReadLine() {
|
||||||
|
if (fReader == null) {
|
||||||
|
//Our workaround sets the stderr reader to null, so we never give any stderr output.
|
||||||
|
//TODO Check if ssh supports some method of having separate stdout and stderr streams
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
StringBuffer theLine = new StringBuffer();
|
||||||
|
StringBuffer theDebugLine = null;
|
||||||
|
theDebugLine = new StringBuffer();
|
||||||
|
int ch;
|
||||||
|
boolean done = false;
|
||||||
|
while (!done && !isFinished()) {
|
||||||
|
try {
|
||||||
|
ch = fReader.read();
|
||||||
|
switch (ch) {
|
||||||
|
case -1:
|
||||||
|
case 65535:
|
||||||
|
if (theLine.length() == 0) // End of Reader
|
||||||
|
return null;
|
||||||
|
done = true;
|
||||||
|
break;
|
||||||
|
case '\b': //backspace
|
||||||
|
if(theDebugLine!=null) theDebugLine.append((char)ch);
|
||||||
|
int len = theLine.length()-1;
|
||||||
|
if (len>=0) theLine.deleteCharAt(len);
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
if(theDebugLine!=null) theDebugLine.append((char)ch);
|
||||||
|
break; // Carriage Return: dont append to the buffer
|
||||||
|
case 10:
|
||||||
|
if(theDebugLine!=null) theDebugLine.append((char)ch);
|
||||||
|
done = true; // Newline
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
//Tab: we count tabs at column 8
|
||||||
|
//TODO Check: SystemViewRemoteOutputAdapter.translateTabs() also translates
|
||||||
|
//Therefore this special handling here might be unnecessary
|
||||||
|
if(theDebugLine!=null) theDebugLine.append((char)ch);
|
||||||
|
int tabIndex = theLine.length() % 8;
|
||||||
|
while (tabIndex < 8) {
|
||||||
|
theLine.append(' ');
|
||||||
|
tabIndex++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
char tch = (char) ch;
|
||||||
|
if(theDebugLine!=null) theDebugLine.append(tch);
|
||||||
|
if (!Character.isISOControl(tch)) {
|
||||||
|
theLine.append(tch); // Any other character
|
||||||
|
} else if (ch == 27) {
|
||||||
|
// Escape: ignore next char too
|
||||||
|
int nch = fReader.read();
|
||||||
|
if (theDebugLine!=null) theDebugLine.append((char)nch);
|
||||||
|
if (nch == 91) {
|
||||||
|
//vt100 escape sequence: read until end-of-command (skip digits and semicolon)
|
||||||
|
//e.g. \x1b;13;m --> ignore the entire command, including the trailing m
|
||||||
|
do {
|
||||||
|
nch = fReader.read();
|
||||||
|
if (theDebugLine!=null) theDebugLine.append((char)nch);
|
||||||
|
} while (Character.isDigit((char)nch) || nch == ';');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check to see if the BufferedReader is still ready which means
|
||||||
|
// there are more characters
|
||||||
|
// in the Buffer...If not, then we assume it is waiting for
|
||||||
|
// input.
|
||||||
|
if (!done && !fReader.ready()) {
|
||||||
|
// wait to make sure -- max. 500 msec to wait for new chars
|
||||||
|
// if we are not at a CRLF seems to be appropriate for the
|
||||||
|
// Pipes and Threads in ssh.
|
||||||
|
long waitIncrement = 500;
|
||||||
|
// Check if we think we are at a prompt
|
||||||
|
int len = theLine.length()-1;
|
||||||
|
while (len>0 && Character.isSpaceChar(theLine.charAt(len))) {
|
||||||
|
len--;
|
||||||
|
}
|
||||||
|
if (len>=0 && fPromptChars.indexOf(theLine.charAt(len))>=0) {
|
||||||
|
waitIncrement = 5; //wait only 5 msec if we think it's a prompt
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Thread.sleep(waitIncrement);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
}
|
||||||
|
if (!fReader.ready()) {
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
//FIXME it's dangerous to return null here since this will end
|
||||||
|
//our reader thread completely... the exception could just be
|
||||||
|
//temporary, and we should keep running!
|
||||||
|
Activator.getDefault().logException(e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (theDebugLine!=null) {
|
||||||
|
String debugLine = theDebugLine.toString();
|
||||||
|
debugLine.compareTo(""); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
return new SimpleHostOutput(theLine.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,90 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006, 2007 IBM Corporation and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Initial Contributors:
|
||||||
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Martin Oberhuber (Wind River) - Adapted from LocalShellService.
|
||||||
|
* Sheldon D'souza (Celunite) - Adapted from SshShellService.
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.rse.internal.services.telnet.shell;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.rse.internal.services.telnet.ITelnetService;
|
||||||
|
import org.eclipse.rse.internal.services.telnet.ITelnetSessionProvider;
|
||||||
|
import org.eclipse.rse.internal.services.telnet.TelnetServiceResources;
|
||||||
|
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||||
|
import org.eclipse.rse.services.shells.IHostShell;
|
||||||
|
import org.eclipse.rse.services.shells.IShellService;
|
||||||
|
|
||||||
|
public class TelnetShellService implements ITelnetService, IShellService {
|
||||||
|
|
||||||
|
|
||||||
|
private ITelnetSessionProvider fTelnetSessionProvider;
|
||||||
|
|
||||||
|
public TelnetShellService( ITelnetSessionProvider sessionProvider) {
|
||||||
|
this.fTelnetSessionProvider = sessionProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getHostEnvironment() {
|
||||||
|
return new String[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
public IHostShell launchShell(String initialWorkingDirectory,
|
||||||
|
String[] environment, IProgressMonitor monitor) {
|
||||||
|
String defaultEncoding = System.getProperty("file.encoding"); //$NON-NLS-1$
|
||||||
|
return launchShell(initialWorkingDirectory, defaultEncoding, environment, monitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IHostShell launchShell(String initialWorkingDirectory,
|
||||||
|
String encoding, String[] environment,
|
||||||
|
IProgressMonitor monitor) {
|
||||||
|
TelnetHostShell hostShell = new TelnetHostShell(fTelnetSessionProvider, initialWorkingDirectory, TelnetHostShell.SHELL_INVOCATION, encoding, environment);
|
||||||
|
return hostShell;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IHostShell runCommand(String initialWorkingDirectory,
|
||||||
|
String command, String[] environment, IProgressMonitor monitor) {
|
||||||
|
String defaultEncoding = System.getProperty("file.encoding"); //$NON-NLS-1$
|
||||||
|
return runCommand(initialWorkingDirectory, command, defaultEncoding, environment, monitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IHostShell runCommand(String initialWorkingDirectory,
|
||||||
|
String command, String encoding, String[] environment,
|
||||||
|
IProgressMonitor monitor) {
|
||||||
|
TelnetHostShell hostShell = new TelnetHostShell(fTelnetSessionProvider, initialWorkingDirectory, TelnetHostShell.SHELL_INVOCATION, encoding, environment);
|
||||||
|
return hostShell;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return TelnetServiceResources.TelnetShellService_Description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SystemMessage getMessage(String messageID) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return TelnetServiceResources.TelnetShellService_Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initService(IProgressMonitor monitor) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void uninitService(IProgressMonitor monitor) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,101 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006, 2007 Wind River Systems, Inc. and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Martin Oberhuber (Wind River) - initial API and implementation
|
||||||
|
* Sheldon D'souza (Celunite) - Adapted from SshShellWriterThread
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.rse.internal.services.telnet.shell;
|
||||||
|
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
|
||||||
|
public class TelnetShellWriterThread extends Thread {
|
||||||
|
|
||||||
|
private PrintWriter fOutputWriter;
|
||||||
|
private String fNextCommand;
|
||||||
|
private boolean fIsCancelled;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* constructor for ssh shell writer thread
|
||||||
|
* @param outputWriter PrintWriter to write to in separate Thread
|
||||||
|
*/
|
||||||
|
public TelnetShellWriterThread(PrintWriter outputWriter)
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
fOutputWriter = outputWriter;
|
||||||
|
setName("Telnet ShellWriter"+getName()); //$NON-NLS-1$
|
||||||
|
start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized boolean isDone()
|
||||||
|
{
|
||||||
|
return fIsCancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void stopThread()
|
||||||
|
{
|
||||||
|
fIsCancelled = true;
|
||||||
|
notifyAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write command to remote side. Wait until the
|
||||||
|
* thread takes the command (no queueing).
|
||||||
|
* @param command to send
|
||||||
|
* @return boolean true if command was sent ok
|
||||||
|
*/
|
||||||
|
public synchronized boolean sendCommand(String command)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
//In case multiple commands try to send:
|
||||||
|
//wait until it's our turn
|
||||||
|
while (!fIsCancelled && fNextCommand!=null) {
|
||||||
|
wait();
|
||||||
|
}
|
||||||
|
if (!fIsCancelled) {
|
||||||
|
//Now it's our turn
|
||||||
|
fNextCommand = command;
|
||||||
|
notifyAll();
|
||||||
|
//Wait until our command is processed
|
||||||
|
while (!fIsCancelled && fNextCommand!=null) {
|
||||||
|
wait();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch(InterruptedException e) {
|
||||||
|
stopThread();
|
||||||
|
}
|
||||||
|
return !fIsCancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void run()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
while (!fIsCancelled) {
|
||||||
|
while (fNextCommand==null && !fIsCancelled) {
|
||||||
|
wait();
|
||||||
|
}
|
||||||
|
if (!fIsCancelled) {
|
||||||
|
fOutputWriter.println(fNextCommand);
|
||||||
|
fNextCommand=null;
|
||||||
|
notifyAll();
|
||||||
|
if (fOutputWriter.checkError()) { //flush AND get error
|
||||||
|
stopThread();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch(InterruptedException e) {
|
||||||
|
/* no special handling -> close stream */
|
||||||
|
} finally {
|
||||||
|
stopThread();
|
||||||
|
// if( fOutputWriter != null )
|
||||||
|
// fOutputWriter.close();
|
||||||
|
fOutputWriter = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
|
<classpathentry kind="output" path="bin"/>
|
||||||
|
</classpath>
|
|
@ -0,0 +1 @@
|
||||||
|
bin
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>org.eclipse.rse.subsystems.shells.telnet</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.pde.PluginNature</nature>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
|
@ -0,0 +1,70 @@
|
||||||
|
#Tue Jan 30 22:33:44 CET 2007
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.4
|
||||||
|
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.autoboxing=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.deprecation=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected
|
||||||
|
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.nullReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.3
|
|
@ -0,0 +1,22 @@
|
||||||
|
Manifest-Version: 1.0
|
||||||
|
Bundle-ManifestVersion: 2
|
||||||
|
Bundle-Name: %pluginName
|
||||||
|
Bundle-SymbolicName: org.eclipse.rse.subsystems.shells.telnet;singleton:=true
|
||||||
|
Bundle-Version: 1.0.0.qualifier
|
||||||
|
Bundle-Activator: org.eclipse.rse.internal.subsystems.shells.telnet.Activator
|
||||||
|
Bundle-Localization: plugin
|
||||||
|
Require-Bundle: org.eclipse.ui,
|
||||||
|
org.eclipse.core.runtime,
|
||||||
|
org.eclipse.rse.services,
|
||||||
|
org.eclipse.rse.connectorservice.telnet,
|
||||||
|
org.eclipse.rse.services.telnet,
|
||||||
|
org.eclipse.rse.subsystems.shells.core,
|
||||||
|
org.eclipse.rse.subsystems.files.core,
|
||||||
|
org.eclipse.rse.shells.ui,
|
||||||
|
org.eclipse.rse.core,
|
||||||
|
org.eclipse.rse.ui
|
||||||
|
Export-Package: org.eclipse.rse.internal.subsystems.shells.telnet;x-internal:=true,
|
||||||
|
org.eclipse.rse.subsystems.shells.telnet
|
||||||
|
Eclipse-LazyStart: true
|
||||||
|
Bundle-Vendor: %providerName
|
||||||
|
Bundle-RequiredExecutionEnvironment: J2SE-1.4
|
|
@ -0,0 +1,28 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
|
||||||
|
<title>About</title>
|
||||||
|
</head>
|
||||||
|
<body lang="EN-US">
|
||||||
|
<h2>About This Content</h2>
|
||||||
|
|
||||||
|
<p>June 2, 2006</p>
|
||||||
|
<h3>License</h3>
|
||||||
|
|
||||||
|
<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
|
||||||
|
indicated below, the Content is provided to you under the terms and conditions of the
|
||||||
|
Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
|
||||||
|
at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
|
||||||
|
For purposes of the EPL, "Program" will mean the Content.</p>
|
||||||
|
|
||||||
|
<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
|
||||||
|
being redistributed by another party ("Redistributor") and different terms and conditions may
|
||||||
|
apply to your use of any object code in the Content. Check the Redistributor's license that was
|
||||||
|
provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
|
||||||
|
indicated below, the terms and conditions of the EPL still apply to any source code in the Content
|
||||||
|
and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,19 @@
|
||||||
|
###############################################################################
|
||||||
|
# Copyright (c) 2005, 2006 IBM Corporation and others.
|
||||||
|
# All rights reserved. This program and the accompanying materials
|
||||||
|
# are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
# which accompanies this distribution, and is available at
|
||||||
|
# http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
#
|
||||||
|
# Contributors:
|
||||||
|
# IBM Corporation - initial API and implementation
|
||||||
|
###############################################################################
|
||||||
|
bin.includes = .,\
|
||||||
|
META-INF/,\
|
||||||
|
about.html,\
|
||||||
|
plugin.properties,\
|
||||||
|
icons/,\
|
||||||
|
plugin.xml
|
||||||
|
source.. = src/
|
||||||
|
output.. = bin/
|
||||||
|
src.includes = about.html
|
Binary file not shown.
After Width: | Height: | Size: 230 B |
Binary file not shown.
After Width: | Height: | Size: 246 B |
|
@ -0,0 +1,20 @@
|
||||||
|
################################################################################
|
||||||
|
# Copyright (c) 2006 Wind River Systems, Inc.
|
||||||
|
# All rights reserved. This program and the accompanying materials
|
||||||
|
# are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
# which accompanies this distribution, and is available at
|
||||||
|
# http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
#
|
||||||
|
# Contributors:
|
||||||
|
# Martin Oberhuber - initial API and implementation
|
||||||
|
# Sheldon D'souza - Changes to strings
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
# NLS_MESSAGEFORMAT_NONE
|
||||||
|
# NLS_ENCODING=UTF-8
|
||||||
|
|
||||||
|
pluginName = RSE Telnet Shells
|
||||||
|
providerName = Eclipse.org
|
||||||
|
|
||||||
|
TelnetShellSubsystemName=Telnet Shells
|
||||||
|
TelnetShellSubsystemDescription=Work with shells and commands on remote systems using the Telnet protocol.
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (c) 2006, 2007 Wind River Systems, Inc.
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
which accompanies this distribution, and is available at
|
||||||
|
http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
|
||||||
|
Contributors:
|
||||||
|
Martin Oberhuber - initial API and implementation
|
||||||
|
-->
|
||||||
|
<?eclipse version="3.1"?>
|
||||||
|
<plugin>
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.rse.ui.subsystemConfigurations">
|
||||||
|
<configuration
|
||||||
|
systemTypeIds="org.eclipse.rse.systemtype.linux;org.eclipse.rse.systemtype.unix;org.eclipse.rse.systemtype.aix"
|
||||||
|
name="%TelnetShellSubsystemName"
|
||||||
|
description="%TelnetShellSubsystemDescription"
|
||||||
|
iconlive="icons/full/obj16/systemcommandslive_obj.gif"
|
||||||
|
icon="icons/full/obj16/systemcommands_obj.gif"
|
||||||
|
category="shells"
|
||||||
|
class="org.eclipse.rse.subsystems.shells.telnet.TelnetShellSubSystemConfiguration"
|
||||||
|
vendor="%providerName"
|
||||||
|
priority="300"
|
||||||
|
id="telnet.shells">
|
||||||
|
</configuration>
|
||||||
|
</extension>
|
||||||
|
|
||||||
|
</plugin>
|
|
@ -0,0 +1,60 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006, 2007 Celunite, Inc. and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Sheldon D'souza (Celunite)
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.rse.internal.subsystems.shells.telnet;
|
||||||
|
|
||||||
|
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||||
|
import org.osgi.framework.BundleContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The activator class controls the plug-in life cycle
|
||||||
|
*/
|
||||||
|
public class Activator extends AbstractUIPlugin {
|
||||||
|
|
||||||
|
// The plug-in ID
|
||||||
|
public static final String PLUGIN_ID = "org.eclipse.rse.subsystems.shells.telnet"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
// The shared instance
|
||||||
|
private static Activator plugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The constructor
|
||||||
|
*/
|
||||||
|
public Activator() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
|
||||||
|
*/
|
||||||
|
public void start(BundleContext context) throws Exception {
|
||||||
|
super.start(context);
|
||||||
|
plugin = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
|
||||||
|
*/
|
||||||
|
public void stop(BundleContext context) throws Exception {
|
||||||
|
plugin = null;
|
||||||
|
super.stop(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the shared instance
|
||||||
|
*
|
||||||
|
* @return the shared instance
|
||||||
|
*/
|
||||||
|
public static Activator getDefault() {
|
||||||
|
return plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,204 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006, 2007 IBM Corporation and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Initial Contributors:
|
||||||
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Martin Oberhuber (Wind River) - Adapted from LocalServiceCommandShell
|
||||||
|
* Sheldon D'souza (Celunite) - Adapted from SshServiceCommandShell
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.rse.internal.subsystems.shells.telnet;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.Path;
|
||||||
|
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||||
|
import org.eclipse.rse.internal.services.telnet.shell.TelnetHostShell;
|
||||||
|
import org.eclipse.rse.internal.subsystems.shells.servicesubsystem.OutputRefreshJob;
|
||||||
|
import org.eclipse.rse.services.shells.IHostOutput;
|
||||||
|
import org.eclipse.rse.services.shells.IHostShell;
|
||||||
|
import org.eclipse.rse.services.shells.IHostShellChangeEvent;
|
||||||
|
import org.eclipse.rse.services.shells.ParsedOutput;
|
||||||
|
import org.eclipse.rse.services.shells.Patterns;
|
||||||
|
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
|
||||||
|
import org.eclipse.rse.subsystems.shells.core.model.ISystemOutputRemoteTypes;
|
||||||
|
import org.eclipse.rse.subsystems.shells.core.model.RemoteError;
|
||||||
|
import org.eclipse.rse.subsystems.shells.core.model.RemoteOutput;
|
||||||
|
import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem;
|
||||||
|
import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteOutput;
|
||||||
|
import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.ServiceCommandShell;
|
||||||
|
|
||||||
|
public class TelnetServiceCommandShell extends ServiceCommandShell {
|
||||||
|
|
||||||
|
private Patterns _patterns;
|
||||||
|
private String _curCommand;
|
||||||
|
private String _workingDir;
|
||||||
|
private IRemoteFileSubSystem _fs;
|
||||||
|
|
||||||
|
public TelnetServiceCommandShell(IRemoteCmdSubSystem cmdSS, IHostShell hostShell) {
|
||||||
|
super(cmdSS, hostShell);
|
||||||
|
_patterns = new Patterns();
|
||||||
|
_patterns.update("cmd"); //$NON-NLS-1$
|
||||||
|
ISubSystem[] sses = cmdSS.getHost().getSubSystems();
|
||||||
|
for (int i = 0; i < sses.length; i++)
|
||||||
|
{
|
||||||
|
if (sses[i] instanceof IRemoteFileSubSystem)
|
||||||
|
{
|
||||||
|
_fs = (IRemoteFileSubSystem)sses[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getContext()
|
||||||
|
{
|
||||||
|
String workingDir = _workingDir;
|
||||||
|
if (workingDir != null && workingDir.length() > 0)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return _fs.getRemoteFileObject(workingDir, new NullProgressMonitor());
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void shellOutputChanged(IHostShellChangeEvent event)
|
||||||
|
{
|
||||||
|
IHostOutput[] lines = event.getLines();
|
||||||
|
boolean gotCommand = false;
|
||||||
|
ArrayList outputs = new ArrayList(lines.length);
|
||||||
|
for (int i = 0; i < lines.length; i++)
|
||||||
|
{
|
||||||
|
String line = lines[i].getString();
|
||||||
|
if (line.endsWith(getPromptCommand())) {
|
||||||
|
continue; //ignore our synthetic prompt command
|
||||||
|
}
|
||||||
|
|
||||||
|
ParsedOutput parsedMsg = null;
|
||||||
|
if (!gotCommand && line.equals(_curCommand)) {
|
||||||
|
gotCommand = true;
|
||||||
|
continue; //ignore remote command echo
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
|
||||||
|
// Bug 160202: Remote shell dies.
|
||||||
|
if ((_curCommand == null) || (!_curCommand.trim().equals("ls"))) { //$NON-NLS-1$
|
||||||
|
parsedMsg = _patterns.matchLine(line);
|
||||||
|
|
||||||
|
// Bug 160202: Remote shell dies.
|
||||||
|
if (_curCommand != null) {
|
||||||
|
String temp = _curCommand.trim();
|
||||||
|
StringTokenizer tokenizer = new StringTokenizer(temp);
|
||||||
|
|
||||||
|
if (tokenizer.countTokens() == 2) {
|
||||||
|
String token1 = tokenizer.nextToken();
|
||||||
|
String token2 = tokenizer.nextToken();
|
||||||
|
|
||||||
|
if ((token1.equals("ls")) && (token2.indexOf('-') == 0) && (token2.indexOf('l') > 0)) { //$NON-NLS-1$
|
||||||
|
if (line.startsWith("total")) { //$NON-NLS-1$
|
||||||
|
parsedMsg = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RemoteOutput output = null;
|
||||||
|
|
||||||
|
String type = "stdout"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
if (parsedMsg != null) {
|
||||||
|
type = parsedMsg.type;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.isError()) {
|
||||||
|
output = new RemoteError(this, type);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
output = new RemoteOutput(this, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
output.setText(line);
|
||||||
|
if (parsedMsg != null)
|
||||||
|
{
|
||||||
|
String file = parsedMsg.file;
|
||||||
|
if (type.equals(ISystemOutputRemoteTypes.TYPE_PROMPT))
|
||||||
|
{
|
||||||
|
_workingDir = file;
|
||||||
|
output.setAbsolutePath(_workingDir);
|
||||||
|
}
|
||||||
|
else if(_workingDir!=null)
|
||||||
|
{
|
||||||
|
IPath p = new Path(_workingDir).append(file);
|
||||||
|
output.setAbsolutePath(p.toString());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
output.setAbsolutePath(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
addOutput(output);
|
||||||
|
outputs.add(output);
|
||||||
|
}
|
||||||
|
IRemoteOutput[] remoteOutputs = (IRemoteOutput[])outputs.toArray(new IRemoteOutput[outputs.size()]);
|
||||||
|
//if (_lastRefreshJob == null || _lastRefreshJob.isComplete())
|
||||||
|
{
|
||||||
|
_lastRefreshJob = new OutputRefreshJob(this, remoteOutputs, false);
|
||||||
|
_lastRefreshJob.schedule();
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_lastRefreshJob.addOutputs(remoteOutputs);
|
||||||
|
_lastRefreshJob.schedule();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the prompt command, such that lines ending with the
|
||||||
|
* prompt command can be removed from output.
|
||||||
|
* Should be overridden in case the IHostShell used for this
|
||||||
|
* service is not an TelnetHostShell.
|
||||||
|
* @return String promptCommand
|
||||||
|
*/
|
||||||
|
protected String getPromptCommand() {
|
||||||
|
IHostShell shell = getHostShell();
|
||||||
|
//assert shell instanceof TelnetHostShell;
|
||||||
|
if (shell instanceof TelnetHostShell) {
|
||||||
|
return ((TelnetHostShell)shell).getPromptCommand();
|
||||||
|
}
|
||||||
|
//return something impossible such that nothing is ever matched
|
||||||
|
return "\uffff"; //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeToShell(String cmd)
|
||||||
|
{
|
||||||
|
_curCommand = cmd;
|
||||||
|
_patterns.update(cmd);
|
||||||
|
super.writeToShell(cmd);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,84 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006, 2007 IBM Corporation and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Initial Contributors:
|
||||||
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Martin Oberhuber (Wind River) - Adapted template for ssh service.
|
||||||
|
* Sheldon D'souza (Celunite) - Adapted template for telnet service
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.rse.subsystems.shells.telnet;
|
||||||
|
|
||||||
|
import org.eclipse.rse.core.model.IHost;
|
||||||
|
import org.eclipse.rse.core.subsystems.IConnectorService;
|
||||||
|
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||||
|
import org.eclipse.rse.internal.connectorservice.telnet.TelnetConnectorService;
|
||||||
|
import org.eclipse.rse.internal.connectorservice.telnet.TelnetConnectorServiceManager;
|
||||||
|
import org.eclipse.rse.internal.services.telnet.ITelnetService;
|
||||||
|
import org.eclipse.rse.internal.services.telnet.shell.TelnetShellService;
|
||||||
|
import org.eclipse.rse.internal.subsystems.shells.telnet.TelnetServiceCommandShell;
|
||||||
|
import org.eclipse.rse.services.shells.IHostShell;
|
||||||
|
import org.eclipse.rse.services.shells.IShellService;
|
||||||
|
import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem;
|
||||||
|
import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.IServiceCommandShell;
|
||||||
|
import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.ShellServiceSubSystem;
|
||||||
|
import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.ShellServiceSubSystemConfiguration;
|
||||||
|
|
||||||
|
public class TelnetShellSubSystemConfiguration extends
|
||||||
|
ShellServiceSubSystemConfiguration {
|
||||||
|
|
||||||
|
public TelnetShellSubSystemConfiguration() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#isFactoryFor(java.lang.Class)
|
||||||
|
*/
|
||||||
|
public boolean isFactoryFor(Class subSystemType) {
|
||||||
|
boolean isFor = ShellServiceSubSystem.class.equals(subSystemType);
|
||||||
|
return isFor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiate and return an instance of OUR subystem.
|
||||||
|
* Do not populate it yet though!
|
||||||
|
* @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#createSubSystemInternal(IHost)
|
||||||
|
*/
|
||||||
|
public ISubSystem createSubSystemInternal(IHost host)
|
||||||
|
{
|
||||||
|
TelnetConnectorService connectorService = (TelnetConnectorService)getConnectorService(host);
|
||||||
|
ISubSystem subsys = new ShellServiceSubSystem(host, connectorService, createShellService(host));
|
||||||
|
return subsys;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IShellService createShellService(IHost host) {
|
||||||
|
TelnetConnectorService cserv = (TelnetConnectorService)getConnectorService(host);
|
||||||
|
return new TelnetShellService(cserv);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IConnectorService getConnectorService(IHost host) {
|
||||||
|
return TelnetConnectorServiceManager.getInstance().getConnectorService(host, ITelnetService.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConnectorService(IHost host,
|
||||||
|
IConnectorService connectorService) {
|
||||||
|
TelnetConnectorServiceManager.getInstance().setConnectorService(host, ITelnetService.class, connectorService);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Class getServiceImplType() {
|
||||||
|
return ITelnetService.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IServiceCommandShell createRemoteCommandShell(IRemoteCmdSubSystem cmdSS, IHostShell hostShell) {
|
||||||
|
return new TelnetServiceCommandShell(cmdSS, hostShell);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||||
|
<meta name="Author" content="Martin Oberhuber (Wind River)">
|
||||||
|
<title>Package-level Javadoc</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
Application programming interface for creating customized telnet shell subsystems.
|
||||||
|
<h2>
|
||||||
|
Package Specification</h2>
|
||||||
|
The package provides support classes for creating customized telnet shell
|
||||||
|
subsystems.
|
||||||
|
<p>The class <b>TelnetSubSystemConfiguration</b> is the main factory
|
||||||
|
for creating a telnet shell subsystem. By deriving from it, extenders
|
||||||
|
can create their customized telnet shell subsystem configuration which can
|
||||||
|
then be registered against their system types. A custom
|
||||||
|
<b>SubSystemConfigurationAdapter</b> can be registered for UI-specific
|
||||||
|
customizations. Possible customizations include:
|
||||||
|
<ul>
|
||||||
|
<li>Changing the isCaseSensitive() method for system types that
|
||||||
|
are not of UNIX style.</li>
|
||||||
|
<li>Wrapping the created ShellServiceSubSystem or IShellService
|
||||||
|
in a delegate for modifying operation of the Subsystem.</li>
|
||||||
|
</ul>
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Add table
Reference in a new issue