mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-07 17:15:25 +02:00
Add better boot script error reporting. Externalize strings.
Change-Id: If0193ffeaf9ea03f44eb87cde3e6dd4a3e24f7f5 Signed-off-by: Greg Watson <g.watson@computer.org>
This commit is contained in:
parent
ecd433f470
commit
4206d11f69
9 changed files with 149 additions and 65 deletions
|
@ -29,9 +29,13 @@ parent_is_not_orphan () {
|
||||||
|
|
||||||
do_check() {
|
do_check() {
|
||||||
java_vers=`java -version 2>&1`
|
java_vers=`java -version 2>&1`
|
||||||
vers=`expr "$java_vers" : "java version \"\([0-9]*\.[0-9]*\).*\""`
|
major=`expr "$java_vers" : "java version \"\([0-9]*\)\.[0-9]*.*\""`
|
||||||
if test "%$vers" != "%1.8"; then
|
minor=`expr "$java_vers" : "java version \"[0-9]*\.\([0-9]*\).*\""`
|
||||||
echo fail:invalid java version $vers
|
if test "$major" -ge 2 -o "$minor" -ge 8; then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
echo "fail:invalid java version $major.$minor; must be >= 1.8"
|
||||||
|
return
|
||||||
fi
|
fi
|
||||||
case "`uname`" in
|
case "`uname`" in
|
||||||
Linux)
|
Linux)
|
||||||
|
@ -45,7 +49,8 @@ do_check() {
|
||||||
proxydir=$installdir/Proxy.app;
|
proxydir=$installdir/Proxy.app;
|
||||||
plugins=$proxydir/Contents/Eclipse/plugins;;
|
plugins=$proxydir/Contents/Eclipse/plugins;;
|
||||||
*)
|
*)
|
||||||
echo fail:system not supported;;
|
echo fail:system not supported;
|
||||||
|
return;;
|
||||||
esac
|
esac
|
||||||
proxy=no
|
proxy=no
|
||||||
if test -d $proxydir; then
|
if test -d $proxydir; then
|
||||||
|
|
|
@ -36,6 +36,7 @@ import org.eclipse.remote.internal.proxy.core.commands.ExecCommand;
|
||||||
import org.eclipse.remote.internal.proxy.core.commands.GetCwdCommand;
|
import org.eclipse.remote.internal.proxy.core.commands.GetCwdCommand;
|
||||||
import org.eclipse.remote.internal.proxy.core.commands.GetEnvCommand;
|
import org.eclipse.remote.internal.proxy.core.commands.GetEnvCommand;
|
||||||
import org.eclipse.remote.internal.proxy.core.commands.GetPropertiesCommand;
|
import org.eclipse.remote.internal.proxy.core.commands.GetPropertiesCommand;
|
||||||
|
import org.eclipse.remote.internal.proxy.core.messages.Messages;
|
||||||
import org.eclipse.remote.proxy.protocol.core.StreamChannelManager;
|
import org.eclipse.remote.proxy.protocol.core.StreamChannelManager;
|
||||||
import org.eclipse.remote.proxy.protocol.core.StreamChannel;
|
import org.eclipse.remote.proxy.protocol.core.StreamChannel;
|
||||||
import org.eclipse.remote.proxy.protocol.core.exceptions.ProxyException;
|
import org.eclipse.remote.proxy.protocol.core.exceptions.ProxyException;
|
||||||
|
@ -171,11 +172,11 @@ public class ProxyConnection implements IRemoteConnectionControlService,
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void open(IProgressMonitor monitor) throws RemoteConnectionException {
|
public void open(IProgressMonitor monitor) throws RemoteConnectionException {
|
||||||
SubMonitor subMon = SubMonitor.convert(monitor, "Opening connection...", 20);
|
SubMonitor subMon = SubMonitor.convert(monitor, Messages.ProxyConnection_0, 20);
|
||||||
if (!isOpen) {
|
if (!isOpen) {
|
||||||
ProxyConnectionBootstrap bootstrap = new ProxyConnectionBootstrap();
|
ProxyConnectionBootstrap bootstrap = new ProxyConnectionBootstrap();
|
||||||
channelMux = bootstrap.run(getRemoteConnection(), subMon.newChild(10));
|
channelMux = bootstrap.run(getRemoteConnection(), subMon.newChild(10));
|
||||||
new Thread(channelMux, "multiplexer").start();
|
new Thread(channelMux, "multiplexer").start(); //$NON-NLS-1$
|
||||||
try {
|
try {
|
||||||
commandChannel = channelMux.openChannel();
|
commandChannel = channelMux.openChannel();
|
||||||
initialize(subMon.newChild(10));
|
initialize(subMon.newChild(10));
|
||||||
|
@ -198,15 +199,15 @@ public class ProxyConnection implements IRemoteConnectionControlService,
|
||||||
SubMonitor subMon = SubMonitor.convert(monitor, 30);
|
SubMonitor subMon = SubMonitor.convert(monitor, 30);
|
||||||
fWorkingDir = getCwd(subMon.newChild(10));
|
fWorkingDir = getCwd(subMon.newChild(10));
|
||||||
if (subMon.isCanceled()) {
|
if (subMon.isCanceled()) {
|
||||||
throw new RemoteConnectionException("User canceled opening connection");
|
throw new RemoteConnectionException(Messages.ProxyConnection_2);
|
||||||
}
|
}
|
||||||
fEnv.putAll(loadEnv(subMon.newChild(10)));
|
fEnv.putAll(loadEnv(subMon.newChild(10)));
|
||||||
if (subMon.isCanceled()) {
|
if (subMon.isCanceled()) {
|
||||||
throw new RemoteConnectionException("User canceled opening connection");
|
throw new RemoteConnectionException(Messages.ProxyConnection_2);
|
||||||
}
|
}
|
||||||
fProperties.putAll(loadProperties(subMon.newChild(10)));
|
fProperties.putAll(loadProperties(subMon.newChild(10)));
|
||||||
if (subMon.isCanceled()) {
|
if (subMon.isCanceled()) {
|
||||||
throw new RemoteConnectionException("User canceled opening connection");
|
throw new RemoteConnectionException(Messages.ProxyConnection_2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,6 +253,7 @@ public class ProxyConnection implements IRemoteConnectionControlService,
|
||||||
private StringBuffer stdout = new StringBuffer();
|
private StringBuffer stdout = new StringBuffer();
|
||||||
private StringBuffer stderr = new StringBuffer();
|
private StringBuffer stderr = new StringBuffer();
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private String executeSshCommand(ChannelShell shell, String command) throws RemoteConnectionException {
|
private String executeSshCommand(ChannelShell shell, String command) throws RemoteConnectionException {
|
||||||
try {
|
try {
|
||||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||||
|
@ -276,7 +278,7 @@ public class ProxyConnection implements IRemoteConnectionControlService,
|
||||||
final StreamChannel chanA = channelMux.openChannel();
|
final StreamChannel chanA = channelMux.openChannel();
|
||||||
final StreamChannel chanB = channelMux.openChannel();
|
final StreamChannel chanB = channelMux.openChannel();
|
||||||
final StreamChannel chanC = channelMux.openChannel();
|
final StreamChannel chanC = channelMux.openChannel();
|
||||||
new Thread("cmd stdin reader") {
|
new Thread("cmd stdin reader") { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
byte[] buf = new byte[1024];
|
byte[] buf = new byte[1024];
|
||||||
|
@ -290,7 +292,7 @@ public class ProxyConnection implements IRemoteConnectionControlService,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
new Thread("cmd stderr reader") {
|
new Thread("cmd stderr reader") { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
byte[] buf = new byte[1024];
|
byte[] buf = new byte[1024];
|
||||||
|
@ -346,10 +348,7 @@ public class ProxyConnection implements IRemoteConnectionControlService,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IRemoteProcess getCommandShell(int flags) throws IOException {
|
public IRemoteProcess getCommandShell(int flags) throws IOException {
|
||||||
if (!proxyRunning) {
|
throw new IOException("Not implemented yet");
|
||||||
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -25,12 +25,14 @@ import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.SubMonitor;
|
import org.eclipse.core.runtime.SubMonitor;
|
||||||
import org.eclipse.jsch.core.IJSchService;
|
import org.eclipse.jsch.core.IJSchService;
|
||||||
|
import org.eclipse.osgi.util.NLS;
|
||||||
import org.eclipse.remote.core.IRemoteConnection;
|
import org.eclipse.remote.core.IRemoteConnection;
|
||||||
import org.eclipse.remote.core.IRemoteConnectionHostService;
|
import org.eclipse.remote.core.IRemoteConnectionHostService;
|
||||||
import org.eclipse.remote.core.IRemoteConnectionWorkingCopy;
|
import org.eclipse.remote.core.IRemoteConnectionWorkingCopy;
|
||||||
import org.eclipse.remote.core.IUserAuthenticatorService;
|
import org.eclipse.remote.core.IUserAuthenticatorService;
|
||||||
import org.eclipse.remote.core.exception.RemoteConnectionException;
|
import org.eclipse.remote.core.exception.RemoteConnectionException;
|
||||||
import org.eclipse.remote.internal.jsch.core.JSchUserInfo;
|
import org.eclipse.remote.internal.jsch.core.JSchUserInfo;
|
||||||
|
import org.eclipse.remote.internal.proxy.core.messages.Messages;
|
||||||
import org.eclipse.remote.proxy.protocol.core.StreamChannelManager;
|
import org.eclipse.remote.proxy.protocol.core.StreamChannelManager;
|
||||||
import org.osgi.framework.Bundle;
|
import org.osgi.framework.Bundle;
|
||||||
|
|
||||||
|
@ -48,6 +50,7 @@ public class ProxyConnectionBootstrap {
|
||||||
private State state;
|
private State state;
|
||||||
private String osName;
|
private String osName;
|
||||||
private String osArch;
|
private String osArch;
|
||||||
|
private String errorMessage;
|
||||||
|
|
||||||
private final SubMonitor monitor;
|
private final SubMonitor monitor;
|
||||||
private final BufferedReader reader;
|
private final BufferedReader reader;
|
||||||
|
@ -87,6 +90,14 @@ public class ProxyConnectionBootstrap {
|
||||||
void setOSArch(String osArch) {
|
void setOSArch(String osArch) {
|
||||||
this.osArch = osArch;
|
this.osArch = osArch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setErrorMessage(String message) {
|
||||||
|
this.errorMessage = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getErrorMessage() {
|
||||||
|
return errorMessage;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private interface State {
|
private interface State {
|
||||||
|
@ -100,10 +111,10 @@ public class ProxyConnectionBootstrap {
|
||||||
INIT {
|
INIT {
|
||||||
@Override
|
@Override
|
||||||
public boolean process(Context context) throws IOException {
|
public boolean process(Context context) throws IOException {
|
||||||
context.getMonitor().subTask("Initializing");
|
context.getMonitor().subTask(Messages.ProxyConnectionBootstrap_0);
|
||||||
String line = context.reader.readLine();
|
String line = context.reader.readLine();
|
||||||
context.getMonitor().worked(1);
|
context.getMonitor().worked(1);
|
||||||
if (line.equals("running")) {
|
if (line.equals("running")) { //$NON-NLS-1$
|
||||||
context.setState(States.CHECK);
|
context.setState(States.CHECK);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -113,33 +124,34 @@ public class ProxyConnectionBootstrap {
|
||||||
CHECK {
|
CHECK {
|
||||||
@Override
|
@Override
|
||||||
public boolean process(Context context) throws IOException {
|
public boolean process(Context context) throws IOException {
|
||||||
context.getMonitor().subTask("Validating environment");
|
context.getMonitor().subTask(Messages.ProxyConnectionBootstrap_1);
|
||||||
String bundleName = "org.eclipse.remote.proxy.server.core";
|
String bundleName = "org.eclipse.remote.proxy.server.core"; //$NON-NLS-1$
|
||||||
Bundle serverBundle = Platform.getBundle(bundleName);
|
Bundle serverBundle = Platform.getBundle(bundleName);
|
||||||
if (serverBundle == null) {
|
if (serverBundle == null) {
|
||||||
throw new IOException("Unable to locate server bundle " + bundleName);
|
throw new IOException(NLS.bind(Messages.ProxyConnectionBootstrap_2, bundleName));
|
||||||
}
|
}
|
||||||
context.writer.write("check " + serverBundle.getVersion() + "\n");
|
context.writer.write("check " + serverBundle.getVersion() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
context.writer.flush();
|
context.writer.flush();
|
||||||
String line = context.reader.readLine();
|
String line = context.reader.readLine();
|
||||||
while (line != null) {
|
while (line != null) {
|
||||||
context.getMonitor().worked(2);
|
context.getMonitor().worked(2);
|
||||||
String[] parts = line.split(":");
|
String[] parts = line.split(":"); //$NON-NLS-1$
|
||||||
switch (parts[0]) {
|
switch (parts[0]) {
|
||||||
case "ok":
|
case "ok": //$NON-NLS-1$
|
||||||
String[] status = parts[1].split("/");
|
String[] status = parts[1].split("/"); //$NON-NLS-1$
|
||||||
context.setOSName(status[1]);
|
context.setOSName(status[1]);
|
||||||
context.setOSArch(status[2]);
|
context.setOSArch(status[2]);
|
||||||
context.setState(status[0].equals("proxy") ? States.START : States.DOWNLOAD);
|
context.setState(status[0].equals("proxy") ? States.START : States.DOWNLOAD); //$NON-NLS-1$
|
||||||
return true;
|
return true;
|
||||||
case "fail":
|
case "fail": //$NON-NLS-1$
|
||||||
System.out.println("fail:"+parts[1]);
|
context.setErrorMessage(parts[1]);
|
||||||
|
System.out.println("fail:"+parts[1]); //$NON-NLS-1$
|
||||||
return false;
|
return false;
|
||||||
case "debug":
|
case "debug": //$NON-NLS-1$
|
||||||
System.err.println(line);
|
System.err.println(line);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
System.err.println("Invalid response from bootstrap script: " + line);
|
System.err.println("Invalid response from bootstrap script: " + line); //$NON-NLS-1$
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
line = context.reader.readLine();
|
line = context.reader.readLine();
|
||||||
|
@ -150,37 +162,38 @@ public class ProxyConnectionBootstrap {
|
||||||
DOWNLOAD {
|
DOWNLOAD {
|
||||||
@Override
|
@Override
|
||||||
public boolean process(Context context) throws IOException {
|
public boolean process(Context context) throws IOException {
|
||||||
context.getMonitor().subTask("Updating server proxy");
|
context.getMonitor().subTask(Messages.ProxyConnectionBootstrap_3);
|
||||||
String bundleName = "org.eclipse.remote.proxy.server." + context.getOSName() + "." + context.getOSArch();
|
String bundleName = "org.eclipse.remote.proxy.server." + context.getOSName() + "." + context.getOSArch(); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
Bundle serverBundle = Platform.getBundle(bundleName);
|
Bundle serverBundle = Platform.getBundle(bundleName);
|
||||||
if (serverBundle == null) {
|
if (serverBundle == null) {
|
||||||
throw new IOException("Unable to locate server bundle " + bundleName);
|
throw new IOException(NLS.bind(Messages.ProxyConnectionBootstrap_2, bundleName));
|
||||||
}
|
}
|
||||||
URL fileURL = FileLocator.find(serverBundle, new Path("proxy.server.tar.gz"), null);
|
URL fileURL = FileLocator.find(serverBundle, new Path("proxy.server.tar.gz"), null); //$NON-NLS-1$
|
||||||
if (fileURL == null) {
|
if (fileURL == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
File file = new File(FileLocator.toFileURL(fileURL).getFile());
|
File file = new File(FileLocator.toFileURL(fileURL).getFile());
|
||||||
long count = file.length() / 510;
|
long count = file.length() / 510;
|
||||||
context.writer.write("download " + count + "\n");
|
context.writer.write("download " + count + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
context.writer.flush();
|
context.writer.flush();
|
||||||
context.getMonitor().worked(2);
|
context.getMonitor().worked(2);
|
||||||
if (downloadFile(file, context.writer, context.getMonitor().newChild(5))) {
|
if (downloadFile(file, context.writer, context.getMonitor().newChild(5))) {
|
||||||
String line = context.reader.readLine();
|
String line = context.reader.readLine();
|
||||||
while (line != null) {
|
while (line != null) {
|
||||||
String[] parts = line.split(":");
|
String[] parts = line.split(":"); //$NON-NLS-1$
|
||||||
switch (parts[0]) {
|
switch (parts[0]) {
|
||||||
case "ok":
|
case "ok": //$NON-NLS-1$
|
||||||
context.setState(States.START);
|
context.setState(States.START);
|
||||||
return true;
|
return true;
|
||||||
case "fail":
|
case "fail": //$NON-NLS-1$
|
||||||
System.out.println("fail:"+parts[1]);
|
context.setErrorMessage(parts[1]);
|
||||||
|
System.out.println("fail:"+parts[1]); //$NON-NLS-1$
|
||||||
return false;
|
return false;
|
||||||
case "debug":
|
case "debug": //$NON-NLS-1$
|
||||||
System.err.println(line);
|
System.err.println(line);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
System.err.println("Invalid response from bootstrap script: " + line);
|
System.err.println("Invalid response from bootstrap script: " + line); //$NON-NLS-1$
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
line = context.reader.readLine();
|
line = context.reader.readLine();
|
||||||
|
@ -215,8 +228,8 @@ public class ProxyConnectionBootstrap {
|
||||||
START {
|
START {
|
||||||
@Override
|
@Override
|
||||||
public boolean process(Context context) throws IOException {
|
public boolean process(Context context) throws IOException {
|
||||||
context.getMonitor().subTask("Starting server");
|
context.getMonitor().subTask(Messages.ProxyConnectionBootstrap_4);
|
||||||
context.writer.write("start\n");
|
context.writer.write("start\n"); //$NON-NLS-1$
|
||||||
context.writer.flush();
|
context.writer.flush();
|
||||||
return false; // Finished
|
return false; // Finished
|
||||||
}
|
}
|
||||||
|
@ -233,17 +246,17 @@ public class ProxyConnectionBootstrap {
|
||||||
final Channel chan = openChannel(connection, subMon.newChild(10));
|
final Channel chan = openChannel(connection, subMon.newChild(10));
|
||||||
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(chan.getOutputStream()));
|
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(chan.getOutputStream()));
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(chan.getInputStream()));
|
BufferedReader reader = new BufferedReader(new InputStreamReader(chan.getInputStream()));
|
||||||
subMon.beginTask("Checking server installation", 10);
|
subMon.beginTask(Messages.ProxyConnectionBootstrap_5, 10);
|
||||||
subMon.subTask("Loading bootstrap shell");
|
subMon.subTask(Messages.ProxyConnectionBootstrap_9);
|
||||||
URL fileURL = FileLocator.find(Activator.getDefault().getBundle(), new Path("bootstrap.sh"), null);
|
URL fileURL = FileLocator.find(Activator.getDefault().getBundle(), new Path("bootstrap.sh"), null); //$NON-NLS-1$
|
||||||
if (fileURL == null) {
|
if (fileURL == null) {
|
||||||
throw new RemoteConnectionException("Unable to locate bootstrap shell");
|
throw new RemoteConnectionException(Messages.ProxyConnectionBootstrap_6);
|
||||||
}
|
}
|
||||||
File file = new File(FileLocator.toFileURL(fileURL).getFile());
|
File file = new File(FileLocator.toFileURL(fileURL).getFile());
|
||||||
BufferedReader scriptReader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
|
BufferedReader scriptReader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
|
||||||
String line;
|
String line;
|
||||||
while ((line = scriptReader.readLine()) != null) {
|
while ((line = scriptReader.readLine()) != null) {
|
||||||
writer.write(line + "\n");
|
writer.write(line + "\n"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
scriptReader.close();
|
scriptReader.close();
|
||||||
writer.flush();
|
writer.flush();
|
||||||
|
@ -253,18 +266,18 @@ public class ProxyConnectionBootstrap {
|
||||||
// do state machine
|
// do state machine
|
||||||
}
|
}
|
||||||
if (context.getState() != States.START) {
|
if (context.getState() != States.START) {
|
||||||
context.writer.write("exit\n");
|
context.writer.write("exit\n"); //$NON-NLS-1$
|
||||||
context.writer.flush();
|
context.writer.flush();
|
||||||
throw new RemoteConnectionException("Unable to start server");
|
throw new RemoteConnectionException(NLS.bind(Messages.ProxyConnectionBootstrap_7, context.getErrorMessage()));
|
||||||
}
|
}
|
||||||
new Thread("server error stream") {
|
new Thread("server error stream") { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(chan.getExtInputStream()));
|
BufferedReader reader = new BufferedReader(new InputStreamReader(chan.getExtInputStream()));
|
||||||
String line;
|
String line;
|
||||||
while ((line = reader.readLine()) != null) {
|
while ((line = reader.readLine()) != null) {
|
||||||
System.err.println("server: "+ line);
|
System.err.println("server: "+ line); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// Ignore and terminate thread
|
// Ignore and terminate thread
|
||||||
|
@ -295,10 +308,10 @@ public class ProxyConnectionBootstrap {
|
||||||
}
|
}
|
||||||
jSchService.connect(session, hostService.getTimeout() * 1000, monitor);
|
jSchService.connect(session, hostService.getTimeout() * 1000, monitor);
|
||||||
if (monitor.isCanceled()) {
|
if (monitor.isCanceled()) {
|
||||||
throw new RemoteConnectionException("User canceled connection open");
|
throw new RemoteConnectionException(Messages.ProxyConnectionBootstrap_8);
|
||||||
}
|
}
|
||||||
exec = (ChannelExec) session.openChannel("exec"); //$NON-NLS-1$
|
exec = (ChannelExec) session.openChannel("exec"); //$NON-NLS-1$
|
||||||
exec.setCommand("/bin/sh -l");
|
exec.setCommand("/bin/sh -l"); //$NON-NLS-1$
|
||||||
exec.connect();
|
exec.connect();
|
||||||
return exec;
|
return exec;
|
||||||
} catch (JSchException e) {
|
} catch (JSchException e) {
|
||||||
|
|
|
@ -32,6 +32,7 @@ public class ProxyConnectionProviderService implements IRemoteConnectionProvider
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
|
// Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -36,6 +36,7 @@ import org.eclipse.remote.internal.proxy.core.commands.GetInputStreamCommand;
|
||||||
import org.eclipse.remote.internal.proxy.core.commands.GetOutputStreamCommand;
|
import org.eclipse.remote.internal.proxy.core.commands.GetOutputStreamCommand;
|
||||||
import org.eclipse.remote.internal.proxy.core.commands.MkdirCommand;
|
import org.eclipse.remote.internal.proxy.core.commands.MkdirCommand;
|
||||||
import org.eclipse.remote.internal.proxy.core.commands.PutInfoCommand;
|
import org.eclipse.remote.internal.proxy.core.commands.PutInfoCommand;
|
||||||
|
import org.eclipse.remote.internal.proxy.core.messages.Messages;
|
||||||
import org.eclipse.remote.proxy.protocol.core.exceptions.ProxyException;
|
import org.eclipse.remote.proxy.protocol.core.exceptions.ProxyException;
|
||||||
|
|
||||||
public class ProxyFileStore extends FileStore {
|
public class ProxyFileStore extends FileStore {
|
||||||
|
@ -71,18 +72,18 @@ public class ProxyFileStore extends FileStore {
|
||||||
IRemoteServicesManager manager = Activator.getService(IRemoteServicesManager.class);
|
IRemoteServicesManager manager = Activator.getService(IRemoteServicesManager.class);
|
||||||
IRemoteConnectionType connectionType = manager.getConnectionType(fURI);
|
IRemoteConnectionType connectionType = manager.getConnectionType(fURI);
|
||||||
if (connectionType == null) {
|
if (connectionType == null) {
|
||||||
throw new RemoteConnectionException(NLS.bind("No remote services found for URI {0}", fURI));
|
throw new RemoteConnectionException(NLS.bind(Messages.ProxyFileStore_0, fURI));
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
IRemoteConnection connection = connectionType.getConnection(fURI);
|
IRemoteConnection connection = connectionType.getConnection(fURI);
|
||||||
if (connection == null) {
|
if (connection == null) {
|
||||||
throw new RemoteConnectionException(NLS.bind("Invalid connection for URI {0}", fURI));
|
throw new RemoteConnectionException(NLS.bind(Messages.ProxyFileStore_1, fURI));
|
||||||
}
|
}
|
||||||
if (!connection.isOpen()) {
|
if (!connection.isOpen()) {
|
||||||
connection.open(monitor);
|
connection.open(monitor);
|
||||||
if (!connection.isOpen()) {
|
if (!connection.isOpen()) {
|
||||||
throw new RemoteConnectionException("Connection is not open");
|
throw new RemoteConnectionException(Messages.ProxyFileStore_2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return connection.getService(ProxyConnection.class);
|
return connection.getService(ProxyConnection.class);
|
||||||
|
@ -234,7 +235,7 @@ public class ProxyFileStore extends FileStore {
|
||||||
IFileStore parent = getParent();
|
IFileStore parent = getParent();
|
||||||
if (parent != null && !parent.fetchInfo(EFS.NONE, subMon.newChild(5)).exists()) {
|
if (parent != null && !parent.fetchInfo(EFS.NONE, subMon.newChild(5)).exists()) {
|
||||||
throw new CoreException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), EFS.ERROR_WRITE,
|
throw new CoreException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), EFS.ERROR_WRITE,
|
||||||
NLS.bind("The parent of directory {0} does not exist", fRemotePath.toString()), null));
|
NLS.bind(Messages.ProxyFileStore_3, fRemotePath.toString()), null));
|
||||||
}
|
}
|
||||||
if (subMon.isCanceled()) {
|
if (subMon.isCanceled()) {
|
||||||
return this;
|
return this;
|
||||||
|
@ -256,11 +257,11 @@ public class ProxyFileStore extends FileStore {
|
||||||
if (!subMon.isCanceled()) {
|
if (!subMon.isCanceled()) {
|
||||||
if (!info.exists()) {
|
if (!info.exists()) {
|
||||||
throw new CoreException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), EFS.ERROR_WRITE,
|
throw new CoreException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), EFS.ERROR_WRITE,
|
||||||
NLS.bind("The directory {0} could not be created", fRemotePath.toString()), null));
|
NLS.bind(Messages.ProxyFileStore_4, fRemotePath.toString()), null));
|
||||||
}
|
}
|
||||||
if (!info.isDirectory()) {
|
if (!info.isDirectory()) {
|
||||||
throw new CoreException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), EFS.ERROR_WRONG_TYPE,
|
throw new CoreException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), EFS.ERROR_WRONG_TYPE,
|
||||||
NLS.bind("A file of name {0} already exists", fRemotePath.toString()), null));
|
NLS.bind(Messages.ProxyFileStore_5, fRemotePath.toString()), null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -282,11 +283,11 @@ public class ProxyFileStore extends FileStore {
|
||||||
if (!subMon.isCanceled()) {
|
if (!subMon.isCanceled()) {
|
||||||
if (!info.exists()) {
|
if (!info.exists()) {
|
||||||
throw new CoreException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), EFS.ERROR_READ,
|
throw new CoreException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), EFS.ERROR_READ,
|
||||||
NLS.bind("File {0} does not exist", fRemotePath.toString()), null));
|
NLS.bind(Messages.ProxyFileStore_6, fRemotePath.toString()), null));
|
||||||
}
|
}
|
||||||
if (info.isDirectory()) {
|
if (info.isDirectory()) {
|
||||||
throw new CoreException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), EFS.ERROR_WRONG_TYPE,
|
throw new CoreException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), EFS.ERROR_WRONG_TYPE,
|
||||||
NLS.bind("{0} is a directory", fRemotePath.toString()), null));
|
NLS.bind(Messages.ProxyFileStore_7, fRemotePath.toString()), null));
|
||||||
}
|
}
|
||||||
GetInputStreamCommand command = new GetInputStreamCommand(connection, options, fRemotePath.toString());
|
GetInputStreamCommand command = new GetInputStreamCommand(connection, options, fRemotePath.toString());
|
||||||
try {
|
try {
|
||||||
|
@ -312,7 +313,7 @@ public class ProxyFileStore extends FileStore {
|
||||||
if (!subMon.isCanceled()) {
|
if (!subMon.isCanceled()) {
|
||||||
if (info.isDirectory()) {
|
if (info.isDirectory()) {
|
||||||
throw new CoreException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), EFS.ERROR_WRONG_TYPE,
|
throw new CoreException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), EFS.ERROR_WRONG_TYPE,
|
||||||
NLS.bind("{0} is a directory", fRemotePath.toString()), null));
|
NLS.bind(Messages.ProxyFileStore_7, fRemotePath.toString()), null));
|
||||||
}
|
}
|
||||||
GetOutputStreamCommand command = new GetOutputStreamCommand(connection, options, fRemotePath.toString());
|
GetOutputStreamCommand command = new GetOutputStreamCommand(connection, options, fRemotePath.toString());
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class ProxyProcess extends RemoteProcess implements IRemoteProcessControl
|
||||||
isCompleted = false;
|
isCompleted = false;
|
||||||
exitValue = 0;
|
exitValue = 0;
|
||||||
|
|
||||||
cmdThread = new Thread("process " + builder.command().get(0) + " result reader") {
|
cmdThread = new Thread("process " + builder.command().get(0) + " result reader") { //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
|
@ -203,5 +203,6 @@ public class ProxyProcess extends RemoteProcess implements IRemoteProcessControl
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTerminalSize(int cols, int rows, int pwidth, int pheight) {
|
public void setTerminalSize(int cols, int rows, int pwidth, int pheight) {
|
||||||
|
// Nothing?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import org.eclipse.remote.core.IRemoteFileService;
|
||||||
import org.eclipse.remote.core.IRemoteProcess;
|
import org.eclipse.remote.core.IRemoteProcess;
|
||||||
import org.eclipse.remote.core.IRemoteProcessBuilder;
|
import org.eclipse.remote.core.IRemoteProcessBuilder;
|
||||||
import org.eclipse.remote.internal.proxy.core.commands.ExecCommand;
|
import org.eclipse.remote.internal.proxy.core.commands.ExecCommand;
|
||||||
|
import org.eclipse.remote.internal.proxy.core.messages.Messages;
|
||||||
import org.eclipse.remote.proxy.protocol.core.StreamChannel;
|
import org.eclipse.remote.proxy.protocol.core.StreamChannel;
|
||||||
import org.eclipse.remote.proxy.protocol.core.exceptions.ProxyException;
|
import org.eclipse.remote.proxy.protocol.core.exceptions.ProxyException;
|
||||||
|
|
||||||
|
@ -90,14 +91,14 @@ public class ProxyProcessBuilder extends AbstractRemoteProcessBuilder {
|
||||||
|
|
||||||
final ProxyConnection conn = getRemoteConnection().getService(ProxyConnection.class);
|
final ProxyConnection conn = getRemoteConnection().getService(ProxyConnection.class);
|
||||||
if (conn == null) {
|
if (conn == null) {
|
||||||
throw new IOException("Unable to located connection for this process");
|
throw new IOException(Messages.ProxyProcessBuilder_0);
|
||||||
}
|
}
|
||||||
|
|
||||||
final StreamChannel chanStdIO = conn.openChannel();
|
final StreamChannel chanStdIO = conn.openChannel();
|
||||||
final StreamChannel chanStdErr = conn.openChannel();
|
final StreamChannel chanStdErr = conn.openChannel();
|
||||||
final StreamChannel chanControl = conn.openChannel();
|
final StreamChannel chanControl = conn.openChannel();
|
||||||
|
|
||||||
Job job = new Job("process executor") {
|
Job job = new Job("process executor") { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected IStatus run(IProgressMonitor monitor) {
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
ExecCommand cmd = new ExecCommand(conn, cmdArgs, env, directory().toURI().getPath(), redirectErrorStream(), append,
|
ExecCommand cmd = new ExecCommand(conn, cmdArgs, env, directory().toURI().getPath(), redirectErrorStream(), append,
|
||||||
|
|
|
@ -56,6 +56,48 @@ public class Messages extends NLS {
|
||||||
public static String JschFileStore_A_file_of_name_already_exists;
|
public static String JschFileStore_A_file_of_name_already_exists;
|
||||||
public static String JschFileStore_The_parent_of_directory_does_not_exist;
|
public static String JschFileStore_The_parent_of_directory_does_not_exist;
|
||||||
|
|
||||||
|
public static String ProxyConnection_0;
|
||||||
|
|
||||||
|
public static String ProxyConnection_2;
|
||||||
|
|
||||||
|
public static String ProxyConnectionBootstrap_0;
|
||||||
|
|
||||||
|
public static String ProxyConnectionBootstrap_1;
|
||||||
|
|
||||||
|
public static String ProxyConnectionBootstrap_2;
|
||||||
|
|
||||||
|
public static String ProxyConnectionBootstrap_3;
|
||||||
|
|
||||||
|
public static String ProxyConnectionBootstrap_4;
|
||||||
|
|
||||||
|
public static String ProxyConnectionBootstrap_5;
|
||||||
|
|
||||||
|
public static String ProxyConnectionBootstrap_6;
|
||||||
|
|
||||||
|
public static String ProxyConnectionBootstrap_7;
|
||||||
|
|
||||||
|
public static String ProxyConnectionBootstrap_8;
|
||||||
|
|
||||||
|
public static String ProxyConnectionBootstrap_9;
|
||||||
|
|
||||||
|
public static String ProxyFileStore_0;
|
||||||
|
|
||||||
|
public static String ProxyFileStore_1;
|
||||||
|
|
||||||
|
public static String ProxyFileStore_2;
|
||||||
|
|
||||||
|
public static String ProxyFileStore_3;
|
||||||
|
|
||||||
|
public static String ProxyFileStore_4;
|
||||||
|
|
||||||
|
public static String ProxyFileStore_5;
|
||||||
|
|
||||||
|
public static String ProxyFileStore_6;
|
||||||
|
|
||||||
|
public static String ProxyFileStore_7;
|
||||||
|
|
||||||
|
public static String ProxyProcessBuilder_0;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// load message values from bundle file
|
// load message values from bundle file
|
||||||
NLS.initializeMessages(BUNDLE_ID, Messages.class);
|
NLS.initializeMessages(BUNDLE_ID, Messages.class);
|
||||||
|
|
|
@ -43,3 +43,24 @@ JschFileStore_No_remote_services_found_for_URI=No remote services found for URI:
|
||||||
JschFileStore_The_directory_could_not_be_created=The directory {0} could not be created
|
JschFileStore_The_directory_could_not_be_created=The directory {0} could not be created
|
||||||
JschFileStore_A_file_of_name_already_exists=A file of name {0} already exists
|
JschFileStore_A_file_of_name_already_exists=A file of name {0} already exists
|
||||||
JschFileStore_The_parent_of_directory_does_not_exist=The parent of directory {0} does not exist
|
JschFileStore_The_parent_of_directory_does_not_exist=The parent of directory {0} does not exist
|
||||||
|
ProxyConnection_0=Opening connection...
|
||||||
|
ProxyConnection_2=User canceled opening connection
|
||||||
|
ProxyConnectionBootstrap_0=Initializing
|
||||||
|
ProxyConnectionBootstrap_1=Validating environment
|
||||||
|
ProxyConnectionBootstrap_2=Unable to locate server bundle {0}
|
||||||
|
ProxyConnectionBootstrap_3=Updating server proxy
|
||||||
|
ProxyConnectionBootstrap_4=Starting server
|
||||||
|
ProxyConnectionBootstrap_5=Checking server installation
|
||||||
|
ProxyConnectionBootstrap_6=Unable to locate bootstrap shell
|
||||||
|
ProxyConnectionBootstrap_7=Unable to start server: {0}
|
||||||
|
ProxyConnectionBootstrap_8=User canceled connection open
|
||||||
|
ProxyConnectionBootstrap_9=Loading bootstrap shell
|
||||||
|
ProxyFileStore_0=No remote services found for URI {0}
|
||||||
|
ProxyFileStore_1=Invalid connection for URI {0}
|
||||||
|
ProxyFileStore_2=Connection is not open
|
||||||
|
ProxyFileStore_3=The parent of directory {0} does not exist
|
||||||
|
ProxyFileStore_4=The directory {0} could not be created
|
||||||
|
ProxyFileStore_5=A file of name {0} already exists
|
||||||
|
ProxyFileStore_6=File {0} does not exist
|
||||||
|
ProxyFileStore_7={0} is a directory
|
||||||
|
ProxyProcessBuilder_0=Unable to located connection for this process
|
||||||
|
|
Loading…
Add table
Reference in a new issue