Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » DSDP - Target Management » How to create SubSystem Programatically?(make a connection and retrieve directory and files without UI)
How to create SubSystem Programatically? [message #639623] Wed, 17 November 2010 09:05 Go to next message
Mark Anderson is currently offline Mark AndersonFriend
Messages: 8
Registered: October 2010
Junior Member
Hi everybody?

I have a simple question.
My goal is to provide remote accessing functionality in my own resource browsing tree (kind of eclipse project).
We're using SSH to access remote server now.

First of all, I've created IHost instance

ISystemRegistry sr = SystemStartHere.getSystemRegistry();	
ISystemProfile profile = sr.getSystemProfileManager().createSystemProfile(profileName, true);		
IRSESystemType systemType = RSECorePlugin.getTheCoreRegistry().getSystemTypeById("org.eclipse.rse.systemtype.ssh");
IHost host = sr.createHost(profileName, systemType, connectionName, apInfo.getIp(), connectionDesc,  apInfo.getId(), IRSEUserIdConstants.USERID_LOCATION_HOST, configurators);


But SSH system type had three SubSystems (SSH.Files, SSH.Terminal, SSH.Shell)
And the last parameter of createHost() 'configurators' is a kind of constructor for each sub systems I think.
Actually SSH.Terminal and Shell is not fit for me but it's not a problem at now. Smile

I have a question at this point...
How can I create each configurator instances for thress sub systems?
Source file of org.eclipse.rse.ui.wizard looks tightly coupled with IWizard.
But I would like to make a connection and retrieve directory and files without UI.
Is there any simple instruction or sample source files for it?
I've searched this forum but I didn't find it.

I would appreciate any comments.
Have a nice day~

[Updated on: Wed, 17 November 2010 09:19]

Report message to a moderator

Re: How to create SubSystem Programatically? [message #639690 is a reply to message #639623] Wed, 17 November 2010 13:36 Go to previous messageGo to next message
Martin Oberhuber is currently offline Martin OberhuberFriend
Messages: 985
Registered: July 2009
Senior Member
Hi Mark,

I think that the EclipseCon 2007 Tutorial on RSE should answer most of
your questions:

http://www.eclipsecon.org/2007/index.php?page=sub/&id=36 51

Click the "Presentation File" link on top in order to download a ZIP
that includes the presentation as well as the sample code.

Regarding the subsystem configurators, these are not required for you.
You'd only use these when custom wizard pages should be added ... in
your (non-UI) case, the systemType will already automatically drag in
all the subsystems that are configured against it. If you need to change
properties, you can change subsystem configuration by iterating over the
IHost's subsystems and accessing the property sets. More details in the
mentioned presentation.

HTH,
Martin
Re: How to create SubSystem Programatically? [message #639848 is a reply to message #639690] Thu, 18 November 2010 05:51 Go to previous messageGo to next message
Mark Anderson is currently offline Mark AndersonFriend
Messages: 8
Registered: October 2010
Junior Member
First of all, Thank you for your comments..
It is great materials to me and also helpful.
However, I have another question now. Very Happy

I've also tested from Ex.1: Creating a Connection to Ex2. Event Logging and it was fully understandable and works great!
But there is no futher explanation about SystemRemoteFileDialog right after the Ex2 in the material you mentioned.

Although there was a explanation about subsystem and service layers, but I couldn't understand well. So I double checked source file of org.eclipse.rse.ui.SystemRemoteFileDialog. It was also coupled with eclipse ui like SystemView, SafeTreeViewer and etc in the long run.
And section Ex.3: Upload also used SystemRemoteFolderDialog.

According to the documents, should I use services in order to read remote directories and files instead of subsystem?
If right, how can I get SftpFileService instance from IHost?

Thanks and have a nice day~
Re: How to create SubSystem Programatically? [message #640556 is a reply to message #639848] Mon, 22 November 2010 13:46 Go to previous messageGo to next message
Martin Oberhuber is currently offline Martin OberhuberFriend
Messages: 985
Registered: July 2009
Senior Member
Hi Mark,

The Subsystem layer is meant to be hi-level and the one to be used by
your clients. I think David McKnight mentioned this on the newsgroup
before. RSE UI Widgets all operate on the Subsystem layer.

The Services layer is meant to make it easier for implementers to
provide new kinds of communication channel.

There are very few exceptions in which the services layer might provide
functionality better than subsystem, because it's slightly more modern
API and closer to the remote. But in general, you should stick with
using subsystem as a client and services as an implementer.

I hope that SystemRemoteFolderDialog explains itself if your read its
API Javadoc, Source and examples.

HTH,
Martin
Re: How to create SubSystem Programatically? [message #641327 is a reply to message #640556] Thu, 25 November 2010 02:26 Go to previous message
Mark Anderson is currently offline Mark AndersonFriend
Messages: 8
Registered: October 2010
Junior Member
Hi Martin,

I appreciate for your help
As you wished, it was helpful to me...
Thanks again.~
Previous Topic:using RSE in OSGi containers (Equinox)
Next Topic:IRemoteFile.exists() returns true but can't download file with following message
Goto Forum:
  


Current Time: Sat Dec 20 17:31:25 GMT 2014

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

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