Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » DSDP - Target Management » Set daemon port programmatically
Set daemon port programmatically [message #20625] Thu, 17 April 2008 19:50 Go to next message
Denise Schmidt is currently offline Denise Schmidt
Messages: 66
Registered: July 2009
Member
I am using RSE 2.0.3. I have written some plug in code to add a button to
create a connection to a specific Unix machine. The code I have appears
to take all the default values when creating the connection. What I'd
like to know is how do I change the default port used to connect to the
server daemon in my code? Here's what I have to create the connection:

ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();

ISystemProfile profile =
registry.getSystemProfileManager().getDefaultPrivateSystemPr ofile();

String hostName = "eddea03.rck.atm.lmco.com";

IHost host = registry.getHost(profile, hostName);
if (host == null) {
IRSESystemType sysType = RSECorePlugin.getTheCoreRegistry()
.getSystemTypeById("org.eclipse.rse.systemtype.unix");
host = registry.createHost(sysType,
hostName,
hostName,
"Connection to Unix machine");
}

I've been searching the web and looking through RSE code but haven't found
how to set the daemon port to something other than 4075.

While I'm at it, my code doesn't actually connect all the way to the
server as I don't get prompted for a user ID and password until I try to
expand my home directory. I must be missing an additional call to
complete the connection but I'm not sure what it is.

Thanks for any help.
Re: Set daemon port programmatically [message #20636 is a reply to message #20625] Mon, 21 April 2008 15:12 Go to previous messageGo to next message
David McKnight is currently offline David McKnight
Messages: 244
Registered: July 2009
Senior Member
Hi Denise,

In order to set the daemon port for a dstore connection, you'll need to
first get at the appropriate connector service. In some cases there may be
more than one connector service (for example, if you use a combination of
services like ftp files, with dstore shells). To get at the connector
services, you can call IHost.getConnectorServices(). For DStore, you'll
need to get the DStoreConnectorService. Once you have that, you can call
DStoreConnectorService.getRemoteServerLauncherProperties(). That should
return a RemoteServerLauncher (you'll have to cast to that). From there,
there is a setDaemonPort(int) method.

hope that helps,
Dave

"Denise Schmidt" <denise.schmidt@lmco.com> wrote in message
news:14493445faab485fba72818ff9067fee$1@www.eclipse.org...
>I am using RSE 2.0.3. I have written some plug in code to add a button to
>create a connection to a specific Unix machine. The code I have appears to
>take all the default values when creating the connection. What I'd like to
>know is how do I change the default port used to connect to the server
>daemon in my code? Here's what I have to create the connection:
>
> ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
>
> ISystemProfile profile =
> registry.getSystemProfileManager().getDefaultPrivateSystemPr ofile();
>
> String hostName = "eddea03.rck.atm.lmco.com";
>
> IHost host = registry.getHost(profile, hostName);
> if (host == null) {
> IRSESystemType sysType = RSECorePlugin.getTheCoreRegistry()
> .getSystemTypeById("org.eclipse.rse.systemtype.unix");
> host = registry.createHost(sysType,
> hostName,
> hostName,
> "Connection to Unix machine");
> }
>
> I've been searching the web and looking through RSE code but haven't found
> how to set the daemon port to something other than 4075.
> While I'm at it, my code doesn't actually connect all the way to the
> server as I don't get prompted for a user ID and password until I try to
> expand my home directory. I must be missing an additional call to
> complete the connection but I'm not sure what it is.
>
> Thanks for any help.
>
>
Re: Set daemon port programmatically [message #21700 is a reply to message #20636] Mon, 21 April 2008 18:39 Go to previous messageGo to next message
Denise Schmidt is currently offline Denise Schmidt
Messages: 66
Registered: July 2009
Member
Thanks David, that worked great to change the daemon port. Is there a way
to finish off the connection (having it prompt for my user ID and
password)? Basically I'm trying to find out to invoke the popup Connect
code from my code. Thanks!
Re: Set daemon port programmatically [message #21879 is a reply to message #21700] Tue, 22 April 2008 14:32 Go to previous messageGo to next message
David McKnight is currently offline David McKnight
Messages: 244
Registered: July 2009
Senior Member
Hi Denise,

To connect, you could look at SystemConnectAction as an example. The
easiest way to connect is probably to take a subsystem and call
connect(monitor, true). Note that passing in true for force the
uid/password prompt.


"Denise Schmidt" <denise.schmidt@lmco.com> wrote in message
news:e8efbfb4b0863e53a7e1b557a2027ab0$1@www.eclipse.org...
> Thanks David, that worked great to change the daemon port. Is there a way
> to finish off the connection (having it prompt for my user ID and
> password)? Basically I'm trying to find out to invoke the popup Connect
> code from my code. Thanks!
>
Re: Set daemon port programmatically [message #21966 is a reply to message #20625] Tue, 22 April 2008 15:36 Go to previous message
Martin Oberhuber is currently offline Martin Oberhuber
Messages: 984
Registered: July 2009
Senior Member
Hi Denise,

You can look at our Unit Tests how to programmatically create a connection:

org.eclipse.rse.tests / RSEBaseConnectionTestCase.getLinuxHost()

does the DStore thing. That also shows you how to avoid the UI
prompt. For the Daemon Port specifically, see RSEConnectionManager
line 256ff:

IConnectorService cs = connection.getConnectorServices()[0];
IServerLauncherProperties p = cs.getRemoteServerLauncherProperties();
if (p instanceof IRemoteServerLauncher) {
IRemoteServerLauncher launcher = (IRemoteServerLauncher) p;
launcher.setDaemonPort(daemonPortNum);
}

Xuan or DaveM might know more, if you ask on the Mailing List.

Cheers,
--
Martin Oberhuber, Senior Member of Technical Staff, Wind River
Target Management Project Lead, DSDP PMC Member
http://www.eclipse.org/dsdp/tm




Denise Schmidt wrote:
> I am using RSE 2.0.3. I have written some plug in code to add a button
> to create a connection to a specific Unix machine. The code I have
> appears to take all the default values when creating the connection.
> What I'd like to know is how do I change the default port used to
> connect to the server daemon in my code? Here's what I have to create
> the connection:
>
> ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
>
> ISystemProfile profile =
> registry.getSystemProfileManager().getDefaultPrivateSystemPr ofile();
>
> String hostName = "eddea03.rck.atm.lmco.com";
>
> IHost host = registry.getHost(profile, hostName);
> if (host == null) {
> IRSESystemType sysType = RSECorePlugin.getTheCoreRegistry()
> .getSystemTypeById("org.eclipse.rse.systemtype.unix");
> host = registry.createHost(sysType,
> hostName,
> hostName,
> "Connection to Unix machine");
> }
>
> I've been searching the web and looking through RSE code but haven't
> found how to set the daemon port to something other than 4075.
> While I'm at it, my code doesn't actually connect all the way to the
> server as I don't get prompted for a user ID and password until I try to
> expand my home directory. I must be missing an additional call to
> complete the connection but I'm not sure what it is.
>
> Thanks for any help.
>
>
Re: Set daemon port programmatically [message #573823 is a reply to message #20625] Mon, 21 April 2008 15:12 Go to previous message
David McKnight is currently offline David McKnight
Messages: 244
Registered: July 2009
Senior Member
Hi Denise,

In order to set the daemon port for a dstore connection, you'll need to
first get at the appropriate connector service. In some cases there may be
more than one connector service (for example, if you use a combination of
services like ftp files, with dstore shells). To get at the connector
services, you can call IHost.getConnectorServices(). For DStore, you'll
need to get the DStoreConnectorService. Once you have that, you can call
DStoreConnectorService.getRemoteServerLauncherProperties(). That should
return a RemoteServerLauncher (you'll have to cast to that). From there,
there is a setDaemonPort(int) method.

hope that helps,
Dave

"Denise Schmidt" <denise.schmidt@lmco.com> wrote in message
news:14493445faab485fba72818ff9067fee$1@www.eclipse.org...
>I am using RSE 2.0.3. I have written some plug in code to add a button to
>create a connection to a specific Unix machine. The code I have appears to
>take all the default values when creating the connection. What I'd like to
>know is how do I change the default port used to connect to the server
>daemon in my code? Here's what I have to create the connection:
>
> ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
>
> ISystemProfile profile =
> registry.getSystemProfileManager().getDefaultPrivateSystemPr ofile();
>
> String hostName = "eddea03.rck.atm.lmco.com";
>
> IHost host = registry.getHost(profile, hostName);
> if (host == null) {
> IRSESystemType sysType = RSECorePlugin.getTheCoreRegistry()
> .getSystemTypeById("org.eclipse.rse.systemtype.unix");
> host = registry.createHost(sysType,
> hostName,
> hostName,
> "Connection to Unix machine");
> }
>
> I've been searching the web and looking through RSE code but haven't found
> how to set the daemon port to something other than 4075.
> While I'm at it, my code doesn't actually connect all the way to the
> server as I don't get prompted for a user ID and password until I try to
> expand my home directory. I must be missing an additional call to
> complete the connection but I'm not sure what it is.
>
> Thanks for any help.
>
>
Re: Set daemon port programmatically [message #573935 is a reply to message #20636] Mon, 21 April 2008 18:39 Go to previous message
Denise Schmidt is currently offline Denise Schmidt
Messages: 66
Registered: July 2009
Member
Thanks David, that worked great to change the daemon port. Is there a way
to finish off the connection (having it prompt for my user ID and
password)? Basically I'm trying to find out to invoke the popup Connect
code from my code. Thanks!
Re: Set daemon port programmatically [message #574044 is a reply to message #21700] Tue, 22 April 2008 14:32 Go to previous message
David McKnight is currently offline David McKnight
Messages: 244
Registered: July 2009
Senior Member
Hi Denise,

To connect, you could look at SystemConnectAction as an example. The
easiest way to connect is probably to take a subsystem and call
connect(monitor, true). Note that passing in true for force the
uid/password prompt.


"Denise Schmidt" <denise.schmidt@lmco.com> wrote in message
news:e8efbfb4b0863e53a7e1b557a2027ab0$1@www.eclipse.org...
> Thanks David, that worked great to change the daemon port. Is there a way
> to finish off the connection (having it prompt for my user ID and
> password)? Basically I'm trying to find out to invoke the popup Connect
> code from my code. Thanks!
>
Re: Set daemon port programmatically [message #574107 is a reply to message #20625] Tue, 22 April 2008 15:36 Go to previous message
Martin Oberhuber is currently offline Martin Oberhuber
Messages: 984
Registered: July 2009
Senior Member
Hi Denise,

You can look at our Unit Tests how to programmatically create a connection:

org.eclipse.rse.tests / RSEBaseConnectionTestCase.getLinuxHost()

does the DStore thing. That also shows you how to avoid the UI
prompt. For the Daemon Port specifically, see RSEConnectionManager
line 256ff:

IConnectorService cs = connection.getConnectorServices()[0];
IServerLauncherProperties p = cs.getRemoteServerLauncherProperties();
if (p instanceof IRemoteServerLauncher) {
IRemoteServerLauncher launcher = (IRemoteServerLauncher) p;
launcher.setDaemonPort(daemonPortNum);
}

Xuan or DaveM might know more, if you ask on the Mailing List.

Cheers,
--
Martin Oberhuber, Senior Member of Technical Staff, Wind River
Target Management Project Lead, DSDP PMC Member
http://www.eclipse.org/dsdp/tm




Denise Schmidt wrote:
> I am using RSE 2.0.3. I have written some plug in code to add a button
> to create a connection to a specific Unix machine. The code I have
> appears to take all the default values when creating the connection.
> What I'd like to know is how do I change the default port used to
> connect to the server daemon in my code? Here's what I have to create
> the connection:
>
> ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
>
> ISystemProfile profile =
> registry.getSystemProfileManager().getDefaultPrivateSystemPr ofile();
>
> String hostName = "eddea03.rck.atm.lmco.com";
>
> IHost host = registry.getHost(profile, hostName);
> if (host == null) {
> IRSESystemType sysType = RSECorePlugin.getTheCoreRegistry()
> .getSystemTypeById("org.eclipse.rse.systemtype.unix");
> host = registry.createHost(sysType,
> hostName,
> hostName,
> "Connection to Unix machine");
> }
>
> I've been searching the web and looking through RSE code but haven't
> found how to set the daemon port to something other than 4075.
> While I'm at it, my code doesn't actually connect all the way to the
> server as I don't get prompted for a user ID and password until I try to
> expand my home directory. I must be missing an additional call to
> complete the connection but I'm not sure what it is.
>
> Thanks for any help.
>
>
Previous Topic:Hanging while connecting to daemon
Next Topic:Missing RemoteSystemsTempFiles (Remote Systems Explorer)
Goto Forum:
  


Current Time: Sat Oct 25 22:55:50 GMT 2014

Powered by FUDForum. Page generated in 0.03546 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software