Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [dsdp-tm-dev] Programmatically making new connection in RSE view

Thanks Hari...it Worked!!!
need some more help in creating filters programmatically when you have filter string with you by extending RSE APIs.
is there any way?
have been struggling since long but no luck....help would be really appreciated..
 
Thanks,
Vrushali


--- On Sat, 11/29/08, hari babu <haribabu2006@xxxxxxxxx> wrote:
From: hari babu <haribabu2006@xxxxxxxxx>
Subject: Re: [dsdp-tm-dev] Programmatically making new connection in RSE view
To: vrush_com@xxxxxxxxx, "Target Management developer discussions" <dsdp-tm-dev@xxxxxxxxxxx>
Date: Saturday, November 29, 2008, 10:09 AM

Hi vrushali,
 
try the below chunk, this will create a new connection for you.
 
 
ISystemRegistry sysReg = RSECorePlugin.getDefault()
.getSystemRegistry();
if (sysReg != null) {
IRSECoreRegistry coreReg = RSECorePlugin.getDefault()
.getCoreRegistry();
if (coreReg != null) {
IRSESystemType telnetType = coreReg
.getSystemTypeById("org.eclipse.rse.systemtype.telnet");
if (telnetType != null) {
String userId = "newUser";
String connectionName = "112.134.700.7";
try {
IHost host = null;
host = sysReg.createHost(telnetType, userId,
connectionName, "new host");
ISubSystem[] subSystems = host.getSubSystems();
int i;
for (i = 0; subSystems != null && i < subSystems.length; i++) {
if (subSystems[i] instanceof IShellServiceSubSystem)
break;
}
final ISubSystem subSystem = subSystems[i];
subSystem.getConnectorService().setUserId(userId);
subSystem.getConnectorService().setPassword(userId, userId, false,
false);
IPropertySet propSet = subSystem.getConnectorService()
.getPropertySet("Telnet Settings");
IProperty commandPrompt = propSet.getProperty("Command.Prompt");
commandPrompt.setValue("#");
Map properties = new HashMap();
IConnectorService service = subSystem.getConnectorService();
properties.put("Command.Prompt", commandPrompt);
service.getPropertySet("Telnet Settings").setProperties(properties);
try {
subSystem.getConnectorService().connect(
new NullProgressMonitor());
} catch (Exception e1) {
e1.printStackTrace();
}
IHostShell hostShell = null;
IShellService shellService = ((IShellServiceSubSystem) subSystem)
.getShellService();
String env[] = new String[0];
if (shellService != null) {
try {
hostShell = shellService.launchShell("", env,
new NullProgressMonitor());
} catch (Exception e) {
e.printStackTrace();
}
}
if (hostShell != null) {
hostShell.writeToShell("eclipse-native-editor -p 3000");
}
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
}
 
} catch (Exception e1) {
e1.printStackTrace();
}
}


On Fri, Nov 28, 2008 at 11:00 PM, vrushali babar <vrush_com@xxxxxxxxx> wrote:
Hi,
 
I'm extending RSE APIs to develope an Eclipse plugin. is it possible to make new connections programmatically using this API's and have display of it in RSE view?
The option, New Connection, is available on the RSE's context menu; but here i want to provide a new connection just over a click without user having any knowledge of IP address. I'll be fetching the appropriate IP, making the connection and displaying it in RSE view.
 
So is there any way to connect to remote server's programmatically using RSE APIs?
 
Thanks in advance.
 
-Vrushali


_______________________________________________
dsdp-tm-dev mailing list
dsdp-tm-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dsdp-tm-dev




Back to the top