|
Re: Using RSE for creating own builder [message #1164437 is a reply to message #1159553] |
Thu, 31 October 2013 17:32  |
Martin Tauber Messages: 122 Registered: July 2009 |
Senior Member |
|
|
Am 28.10.13 17:15, schrieb Dmitry Dmitry:
> Hi everyone!
> I'm currently developing an eclipse plug-in that enables a one-click
> setup and further remote building of my project.
> At the project nature configuration time, I request a user to enter
> server name, server username and password. I can be sure that connection
> is an SSH one.
> Can anyone please help me in understanding the steps to connect to a
> server, cd to a src location (predefined) and execute a "make" command
> with predefined parameters (plus - capture the output)?
> As far as I understood by now:
> Step 1. SshShellSubSystemConfiguration config = new
> SshShellSubSystemConfiguration();
> ???
> Step N. IServiceCommandShell shell =
> config.createRemoteCommandShell(null, null);
> shell.getCommandSubSystem().runCommand("cd /home/proj/src &&
> make clean all install && cd /home/proj/bin && ./startup_proj.sh", ???,
> ???);
>
> What are the steps 2-(N-1)?
> Is it basically possible to do that with RSE? It is preferrable that any
> system is not explicitly created in RSE UI.
> Thanks in advance?
Hi Dimitry,
you can create a connection to the remote system like this:
IHost host = registry.getHost(profile, hostFieldValue);
if (host == null) {
try {
host =
registry.createHost(RSECorePlugin.getTheCoreRegistry().getSystemTypeById(IRSESystemType.SYSTEMTYPE_SSH_ONLY_ID),
hostFieldValue, hostFieldValue, "Connection to
" + hostFieldValue);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
or use the gui elements from rse liek the remote explorer
then you can run a commamd on the remote host
IRemoteCmdSubSystem cmdSS = this.getCmdSubSystem();
SimpleCommandOperation op = new SimpleCommandOperation(cmdSS,
workingDir, true);
try {
op.runCommand(command, true);
} catch (Exception e) {
e.printStackTrace();
}
String line = op.readLine(true);
while (line != null) {
this.WriteToConsole(line);
lines.add(line);
line = op.readLine(true);
}
private IRemoteCmdSubSystem getCmdSubSystem() {
ISubSystem[] subSystems;
IHost host = this.getHost();
subSystems = host.getSubSystems();
for (int i=0; i<subSystems.length;i++) {
if (subSystems[i] instanceof IRemoteCmdSubSystem) {
return (IRemoteCmdSubSystem)subSystems[i];
}
}
return null;
}
Regards
Martin
|
|
|
Powered by
FUDForum. Page generated in 0.01749 seconds