Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Target Management » programmatically use RSE(How to open a remote file from within an RCP application?)
programmatically use RSE [message #756714] Mon, 14 November 2011 19:04 Go to next message
Julia Kurde is currently offline Julia KurdeFriend
Messages: 66
Registered: November 2011
Location: Berlin, Germany
Member
Hi,

I'm not quite sure if I'm submitting this question in the right forum, but what I would like to do and don't know how is the following:

From within the RCP application I am develloping I want to access a remote file and use the default system editor to open it. The code may look like this:

IFileStore fileStore = EFS.getFileSystem(scheme).getStore(fileNameURI);
IEditorInput editorInput = new FileStoreEditorInput(fileStore);
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(editorInput, IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);


The scheme is either 'file' if the file is local (which works), or it is ftp if the file is remote, which does not work because there is no scheme defined for ftp.

I would need to implement a filesystem extension for the ftp scheme, but I guess there is already some implementation in the RSE/TM for that. Is it possible to use it like this?

Thanx!
Julia

[Updated on: Mon, 14 November 2011 19:05]

Report message to a moderator

Re: programmatically use RSE [message #757773 is a reply to message #756714] Mon, 21 November 2011 15:32 Go to previous messageGo to next message
Mat41 is currently offline Mat41Friend
Messages: 1
Registered: November 2011
Junior Member
Hi,

I have pretty much the same problem. I want to add EFS implementations for schemes other than the Eclipse-built-in scheme for the local filesystem 'file' (e.g. 'ftp' or 'ssh') to my RCP application in order to reuse code I already wrote to access the local filesystem. Information to that topic is quite sparse or at least I wasn't able to find it. This link is referenced quite often:
wiki.eclipse.org/EFS
But the EFS implementation for FTP and SSH (2. item under 'known implementations') seems not to be accessible. Maybe the link is outdated?

So I have two questions:
1. Are the EFS implementations of RSE intended to be used that way?
2. What is the general mechanism to hook up additional EFS implementations to RCP applications?

Thanks in advance,
Mat41
Re: programmatically use RSE [message #758026 is a reply to message #756714] Wed, 16 November 2011 14:55 Go to previous messageGo to next message
David McKnight is currently offline David McKnightFriend
Messages: 244
Registered: July 2009
Senior Member
Hi Julia,

The "rse" scheme serves files in a protocol-agnostic way. If you want to
use RSE as the FTP EFS provider, one thing you could do is create an FTP
Only connection in RSE and then write some code like the following:

URI fileNameURI = new URI("rse", host, path, null);


IFileStore fileStore = EFS.getFileSystem(scheme).getStore(fileNameURI);

IEditorInput editorInput = new FileStoreEditorInput(fileStore);

IEditorDescriptor descriptor = IDE.getEditorDescriptor(name);

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(editorInput,
descriptor.getId());


Dave


"julia.kurde" <forums-noreply@eclipse.org> wrote in message
news:j9rnvo$s5n$1@news.eclipse.org...
> Hi,
>
> I'm not quite sure if I'm submitting this question in the right forum, but
> what I would like to do and don't know how is the following:
>
> From within the RCP application I am develloping I want to access a remote
> file and use the default system editor to open it. The code may look like
> this:
>
>
> IFileStore fileStore = EFS.getFileSystem(scheme).getStore(fileNameURI);
> IEditorInput editorInput = new FileStoreEditorInput(fileStore);
> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(editorInput,
> IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);
>
>
> The scheme is either 'file' if the file is local (which works), or it is
> ftp if the file is remote, which does not work because there is no scheme
> defined for ftp.
> I would need to implement a filesystem extension for the ftp scheme, but I
> guess there is already some implementation in the RSE/TM for that. Is it
> possible to use it like this?
>
> Thanx!
> Julia
Re: programmatically use RSE [message #758063 is a reply to message #758026] Mon, 21 November 2011 20:28 Go to previous messageGo to next message
Julia Kurde is currently offline Julia KurdeFriend
Messages: 66
Registered: November 2011
Location: Berlin, Germany
Member
Hi Dave,

When trying

'URI fileNameURI = new URI(scheme, host, path, null)'

with

scheme: rse
host: 172.31.10.10
path: /EDS/bref_gebaeude.jpg

Unfortunatelly I'm getting

org.eclipse.ui.PartInitException: System editor can only open file base resources.

What can be the problem?

Thanx,
Julia
Re: programmatically use RSE [message #758260 is a reply to message #758063] Tue, 22 November 2011 13:29 Go to previous messageGo to next message
Julia Kurde is currently offline Julia KurdeFriend
Messages: 66
Registered: November 2011
Location: Berlin, Germany
Member
Hi Dave,

I had a closer look to it and it seems the problem is that
FileStoreEditorInput does not implement org.eclipse.ui.IPathEditorInput
as it is required for an external editor (see the javadoc of IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID).

On the other hand for the local file system there is no problem. In the class IURIEditorInputAdapterFactory an Adapter is created: PathEditorInputAdapter.

But if the file system is different from EFS.getLocalFileSystem(), no adapter is created and the editor will not open.

How can I deal with this?

Thanx again!
Julia

[Updated on: Tue, 22 November 2011 14:21]

Report message to a moderator

Re: programmatically use RSE [message #758295 is a reply to message #758260] Tue, 22 November 2011 15:31 Go to previous messageGo to next message
David McKnight is currently offline David McKnightFriend
Messages: 244
Registered: July 2009
Senior Member
Hi Julia,

I'm not sure whether this helps your scenario but one alternative to using
EFS is to use RSE directly like this:

ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
IHost rseHost = sr.getHost(sr.getActiveSystemProfiles()[0], host);

IRemoteFileSubSystem ss = RemoteFileUtility.getFileSubSystem(rseHost);

IRemoteFile remoteFile = ss.getRemoteFileObject(path, monitor);

IFile file =
(IFile)UniversalFileTransferUtility.downloadResourceToWorkspace(remoteFile,
monitor);

IEditorInput editorInput = new FileEditorInput(file);

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(editorInput,
EditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);


"jule" <forums-noreply@eclipse.org> wrote in message
news:jag83k$v4v$1@news.eclipse.org...
> Hi Dave,
>
> I had a closer look to it and it seems the problem is that
> FileStoreEditorInput does not implement org.eclipse.ui.IPathEditorInput as
> it is required for an external editor (see the javadoc of
> IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID).
> There are some implementations of IPathEditorInput, e.g.
> org.eclipse.ui.part.FileEditorInput. But this one needs an IFile Object,
> which I dont't know how to get from the IFileStore object.
> Another one is
> org.eclipse.ui.internal.ide.IURIEditorInputAdapterFactory.PathEditorInputAdapter,
> which wants an IFileStore object, but is internal.
>
> Thanx again!
> Julia
>
Re: programmatically use RSE [message #758472 is a reply to message #758295] Wed, 23 November 2011 12:01 Go to previous messageGo to next message
Julia Kurde is currently offline Julia KurdeFriend
Messages: 66
Registered: November 2011
Location: Berlin, Germany
Member
Hi Dave,

The method
sr.getActiveSystemProfiles()
returns an array of length zero in my case.
Seems I don't have any active system profile. How can I get one? (What is that actually?)

Julia

Re: programmatically use RSE [message #758512 is a reply to message #758472] Wed, 23 November 2011 14:13 Go to previous messageGo to next message
David McKnight is currently offline David McKnightFriend
Messages: 244
Registered: July 2009
Senior Member
Hi Julia,

It may be that there are no profiles at the time you make this call because
RSE has not get completed it's initialization. To ensure the initialization
is complete, make this call first:
RSECorePlugin.waitForInitCompletion()

Hope that helps,
Dave

"jule" <forums-noreply@eclipse.org> wrote in message
news:jainbm$ue9$1@news.eclipse.org...
> Hi Dave,
>
> The method
> sr.getActiveSystemProfiles()
> returns an array of length zero in my case. Seems I don't have any active
> system profile. How can I get one? (What is that actually?)
>
> Julia
>
>
Re: programmatically use RSE [message #758569 is a reply to message #758512] Wed, 23 November 2011 17:46 Go to previous messageGo to next message
Julia Kurde is currently offline Julia KurdeFriend
Messages: 66
Registered: November 2011
Location: Berlin, Germany
Member
OK... we are one step further!

Now, I'm getting my profile, which looks like this:
SystemProfile:
	_isDirty	true	
	_isTainted	true	
	_propertySets	LinkedHashMap<K,V> /* empty */
	_wasRestored	false	
	defaultPrivate	true	
	isActive	true	
	mgr		SystemProfileManager
	name		"juliasrechner"
	provider	null	
	suspended	false	

But then I don't get the rseHost. The method
sr.getHost(profiles[0], host);
returns null. The host is a valid IP address, profiles are the ones I got from
sr.getActiveSystemProfiles().

I don't have the source of the SystemRegistry class so I can't follow this problem in more detail, sorry! Maybe it is related to the provider of the profile, which is null.

Thanx for your patience!
Julia
Re: programmatically use RSE [message #758587 is a reply to message #758569] Wed, 23 November 2011 19:26 Go to previous messageGo to next message
David McKnight is currently offline David McKnightFriend
Messages: 244
Registered: July 2009
Senior Member
Hmm, maybe I need to step back for a moment. I was assuming that you had
already defined an RSE IHost but that might not be the case. If not, you'll
need to do that (either via the Remote Systems view or programmatically)
first. If you already have a connection defined, then I suppose you could
use this alternative to get at all the hosts and then find the one that's
applicable to you:

IHost[] hosts = sr.getHosts();


"jule" <forums-noreply@eclipse.org> wrote in message
news:jajbi0$8pp$1@news.eclipse.org...
> OK... we are one step further!
>
> Now, I'm getting my profile, which looks like this:
>
> SystemProfile:
> _isDirty true _isTainted true _propertySets LinkedHashMap<K,V> /* empty */
> _wasRestored false defaultPrivate true isActive true mgr
> SystemProfileManager
> name "juliasrechner"
> provider null suspended false
> But then I don't get the rseHost. The method
> sr.getHost(profiles[0], host);
> returns null. The host is a valid IP address, profiles are the ones I got
> from
> sr.getActiveSystemProfiles().
>
> I don't have the source of the SystemRegistry class so I can't follow this
> problem in more detail, sorry! Maybe it is related to the provider of the
> profile, which is null.
>
> Thanx for your patience!
> Julia
Re: programmatically use RSE [message #758597 is a reply to message #758587] Wed, 23 November 2011 20:08 Go to previous messageGo to next message
Julia Kurde is currently offline Julia KurdeFriend
Messages: 66
Registered: November 2011
Location: Berlin, Germany
Member
You're right, I did not define any RSE IHost yet (sr.getHosts() returns an empty array). I have to do it programmatically, because the RCP application I'm working on runs independently from the Remote Systems view.

Maybe I shortly explain the scenario how I want to use the RSE.
The user has this RCP application on his computer. There he opens a DB table which is displayed in an eclipse editor. The table contains file names. Via a context menu the user can select an action that opens the file in an external editor. The URL where to look for the file is set in the user preferences, which I'm reading in the run() method of that action.

So, I guess in this run() method I have to check whether there is already an IHost defined, and if not, define one.

Or, maybe we have to go back to the solution with an adapter for an IPathEditorInput for FileStoreEditorInput?

I'm a little bit lost in the moment, sorry!

Julia
Re: programmatically use RSE [message #758606 is a reply to message #758597] Wed, 23 November 2011 20:38 Go to previous messageGo to next message
David McKnight is currently offline David McKnightFriend
Messages: 244
Registered: July 2009
Senior Member
You could try something like this to create your host:

ISystemRegistry systemRegistry = RSECorePlugin.getTheSystemRegistry();
ISystemProfile profile =
systemRegistry.getSystemProfileManager().getDefaultPrivateSystemProfile();
String profileName = profile.getName();
String hostAlias = "myhost";
String hostname = "myhost";
String userId = "myid";

IRSESystemType systemType =
RSECorePlugin.getTheCoreRegistry().getSystemTypeById("org.eclipse.rse.systemtype.ftp");
IHost host = systemRegistry.createHost(profileName, systemType, hostAlias,
hostname, null, userId, IRSEUserIdConstants.USERID_LOCATION_HOST, null);



"jule" <forums-noreply@eclipse.org> wrote in message
news:jajjru$p68$1@news.eclipse.org...
> You're right, I did not define any RSE IHost yet (sr.getHosts() returns an
> empty array). I have to do it programmatically, because the RCP
> application I'm working on runs independently from the Remote Systems
> view.
> Maybe I shortly explain the scenario how I want to use the RSE.
> The user has this RCP application on his computer. There he opens a DB
> table which is displayed in an eclipse editor. The table contains file
> names. Via a context menu the user can select an action that opens the
> file in an external editor. The URL where to look for the file is set in
> the user preferences, which I'm reading in the run() method of that
> action.
> So, I guess in this run() method I have to check whether there is already
> an IHost defined, and if not, define one.
>
> Or, maybe we have to go back to the solution with an adapter for an
> IPathEditorInput for FileStoreEditorInput?
>
> I'm a little bit lost in the moment, sorry!
>
> Julia
Re: programmatically use RSE [message #758725 is a reply to message #758606] Thu, 24 November 2011 12:07 Go to previous messageGo to next message
Julia Kurde is currently offline Julia KurdeFriend
Messages: 66
Registered: November 2011
Location: Berlin, Germany
Member
Again one more step further... the IHost is created!
But still something is missing unfortunatelly.

And that something is the configuration of the file subsystem for ftp:

IRSESystemType systemType = RSECorePlugin.getTheCoreRegistry().getSystemTypeById("org.eclipse.rse.systemtype.ftp");
IRemoteFileSubSystemConfiguration fssConfig = RemoteFileUtility.getFileSubSystemConfiguration(systemType);

fssConfig is null.

Asking for
RemoteFileUtility.getFileSubSystem(rseHost);
also returns null.

For a cross check I tried to configure a connection to this host via the Remote Systems view. When trying to see the files I get the error message
Message reported from file system: 530 This FTP server is anonymous only.

So I can establish the connection but somehow I cannot access any files.

Is there anything special about anonymous servers?

Thanx again!
Julia
Re: programmatically use RSE [message #758812 is a reply to message #758725] Thu, 24 November 2011 15:51 Go to previous messageGo to next message
David McKnight is currently offline David McKnightFriend
Messages: 244
Registered: July 2009
Senior Member
Hi Julia,

I'm not sure why you'd get null there although I haven't tried this with
FTP. It's possible that you're missing a dependency for that. Could you
instead try with SSH?

When you create an SSH only connection from the Remote Systems view, are you
able to navigate the file system?

Instead of using the hardcoded ftp system type id, try using this:
IRSESystemType.SYSTEMTYPE_SSH_ONLY_ID


Dave
"jule" <forums-noreply@eclipse.org> wrote in message
news:jalc1j$6j6$1@news.eclipse.org...
> Again one more step further... the IHost is created!
> But still something is missing unfortunatelly.
>
> And that something is the configuration of the file subsystem for ftp:
>
> IRSESystemType systemType =
> RSECorePlugin.getTheCoreRegistry().getSystemTypeById("org.eclipse.rse.systemtype.ftp");
> IRemoteFileSubSystemConfiguration fssConfig =
> RemoteFileUtility.getFileSubSystemConfiguration(systemType);
>
> fssConfig is null.
>
> Asking for RemoteFileUtility.getFileSubSystem(rseHost);
> also returns null.
>
> For a cross check I tried to configure a connection to this host via the
> Remote Systems view. When trying to see the files I get the error message
> Message reported from file system: 530 This FTP server is anonymous only.
>
> So I can establish the connection but somehow I cannot access any files.
> Is there anything special about anonymous servers?
>
> Thanx again!
> Julia
>
Re: programmatically use RSE [message #758842 is a reply to message #758812] Thu, 24 November 2011 17:08 Go to previous messageGo to next message
Julia Kurde is currently offline Julia KurdeFriend
Messages: 66
Registered: November 2011
Location: Berlin, Germany
Member
Hi Dave,

In the Remote System view I can create an SSH-only connection and browse the files, no problem! But trying this programmatically, I get again null for both, the configuration

IRSESystemType systemType = RSECorePlugin.getTheCoreRegistry().getSystemTypeById(IRSESystemType.SYSTEMTYPE_SSH_ONLY_ID);
RemoteFileUtility.getFileSubSystemConfiguration(systemType);

as well as the file subsystem
RemoteFileUtility.getFileSubSystem(rseHost);

In the RCP Application I have to add every required plugin manually. So far I have
   <requires>
      <import plugin="org.eclipse.ui"/>
      <import plugin="org.eclipse.core.filesystem"/>
      <import plugin="org.eclipse.core.runtime"/>
      <import plugin="org.eclipse.ui.ide"/>
      <import plugin="org.eclipse.core.resources" version="3.7.100"/>
      <import plugin="org.eclipse.rse.core" version="3.2.1"/>
      <import plugin="org.eclipse.rse.subsystems.files.core" version="3.2.101"/>
      <import plugin="org.eclipse.rse.services" version="3.2.101"/>
      <import plugin="org.eclipse.rse.files.ui" version="3.2.1"/>
   </requires>

Maybe that's not enough...

Julia
Re: programmatically use RSE [message #758865 is a reply to message #758842] Thu, 24 November 2011 20:06 Go to previous messageGo to next message
David McKnight is currently offline David McKnightFriend
Messages: 244
Registered: July 2009
Senior Member
Julia,

In your case do you still have the waitForInitCompletion() call? Perhaps
that's what's preventing things from working. The following code did work
for me after RSE is loaded (after waitForInitCompletion()).

ISystemRegistry systemRegistry = RSECorePlugin.getTheSystemRegistry();

ISystemProfile profile =

systemRegistry.getSystemProfileManager().getDefaultPrivateSystemProfile();

String profileName = profile.getName();


IRSESystemType systemType =
RSECorePlugin.getTheCoreRegistry().getSystemTypeById(IRSESystemType.SYSTEMTYPE_SSH_ONLY_ID);

IHost newHost = systemRegistry.createHost(profileName, systemType,
hostAlias, hostname, null, userId, IRSEUserIdConstants.USERID_LOCATION_HOST,
null);

IRemoteFileSubSystem ss = RemoteFileUtility.getFileSubSystem(newHost);

IRemoteFile remoteFile = ss.getRemoteFileObject(path, monitor);

IFile file =
(IFile)UniversalFileTransferUtility.downloadResourceToWorkspace(remoteFile,
monitor);

IEditorInput editorInput = new FileEditorInput(file);

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(editorInput,
EditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);


Dave

"jule" <forums-noreply@eclipse.org> wrote in message
news:jaltm7$bdo$1@news.eclipse.org...
> Hi Dave,
>
> In the Remote System view I can create an SSH-only connection and browse
> the files, no problem! But trying this programmatically, I get again null
> for both, the configuration
>
> IRSESystemType systemType =
> RSECorePlugin.getTheCoreRegistry().getSystemTypeById(IRSESystemType.SYSTEMTYPE_SSH_ONLY_ID);
> RemoteFileUtility.getFileSubSystemConfiguration(systemType);
>
> as well as the file subsystem
> RemoteFileUtility.getFileSubSystem(rseHost);
>
> In the RCP Application I have to add every required plugin manually. So
> far I have
>
> <requires>
> <import plugin="org.eclipse.ui"/>
> <import plugin="org.eclipse.core.filesystem"/>
> <import plugin="org.eclipse.core.runtime"/>
> <import plugin="org.eclipse.ui.ide"/>
> <import plugin="org.eclipse.core.resources" version="3.7.100"/>
> <import plugin="org.eclipse.rse.core" version="3.2.1"/>
> <import plugin="org.eclipse.rse.subsystems.files.core"
> version="3.2.101"/>
> <import plugin="org.eclipse.rse.services" version="3.2.101"/>
> <import plugin="org.eclipse.rse.files.ui" version="3.2.1"/>
> </requires>
>
> Maybe that's not enough...
>
> Julia
Re: programmatically use RSE [message #758934 is a reply to message #758865] Fri, 25 November 2011 10:46 Go to previous messageGo to next message
Julia Kurde is currently offline Julia KurdeFriend
Messages: 66
Registered: November 2011
Location: Berlin, Germany
Member
Hi Dave,

I'm doing exactly this, and I'm running into a NullPointerException in createHost.
Maybe the stack trace is helpful.
java.lang.NullPointerException
	at org.eclipse.rse.internal.persistence.dom.RSEDOMExporter.createNode(RSEDOMExporter.java:332)
	at org.eclipse.rse.internal.persistence.dom.RSEDOMExporter.populateRSEDOM(RSEDOMExporter.java:142)
	at org.eclipse.rse.internal.persistence.dom.RSEDOMExporter.createRSEDOM(RSEDOMExporter.java:92)
	at org.eclipse.rse.internal.persistence.RSEPersistenceManager.save(RSEPersistenceManager.java:555)
	at org.eclipse.rse.internal.persistence.RSEPersistenceManager.commitProfile(RSEPersistenceManager.java:257)
	at org.eclipse.rse.internal.core.model.SystemProfileManager.commitSystemProfile(SystemProfileManager.java:117)
	at org.eclipse.rse.internal.core.model.SystemProfile.commit(SystemProfile.java:272)
	at org.eclipse.rse.internal.core.model.SystemProfileManager.commitProfiles(SystemProfileManager.java:108)
	at org.eclipse.rse.internal.core.model.SystemProfileManager.runOperation(SystemProfileManager.java:99)
	at org.eclipse.rse.internal.core.model.SystemProfileManager.run(SystemProfileManager.java:86)
	at org.eclipse.rse.internal.core.model.SystemRegistry.createHost(SystemRegistry.java:1629)
	at org.eclipse.rse.internal.core.model.SystemRegistry.createHost(SystemRegistry.java:1529)
	at eub.lzhview.actions.OpenDocumentAction.internalRun(OpenDocumentAction.java:232)
	at eub.lzhview.actions.OpenDocumentAction.access$0(OpenDocumentAction.java:96)
	at eub.lzhview.actions.OpenDocumentAction$1.runInUIThread(OpenDocumentAction.java:89)
	at org.eclipse.ui.progress.UIJob$1.run(UIJob.java:95)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4140)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at eub.rcplzhview.Application.start(Application.java:22)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
!SESSION 2011-11-25 11:32:47.347 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.6.0_29
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_DE
Framework arguments:  -product eub.rcplzhview.JLZHView
Command-line arguments:  -product eub.rcplzhview.JLZHView -data C:\JAVA\Workspace_jLZHview/../runtime-eub.rcplzhview.JLZHView -dev file:C:/JAVA/Workspace_jLZHview/.metadata/.plugins/org.eclipse.pde.core/eub.rcplzhview.JLZHView/dev.properties -os win32 -ws win32 -arch x86 -consoleLog

!ENTRY org.eclipse.ui 4 4 2011-11-25 11:33:08.378
!MESSAGE An internal error has occurred.

Unfortunatelly I can not look into the internal rse classes. The host still will be created though. The second time, because I check whether rseHost == null, createHost() is not called again, but the file system can not be loaded.
RemoteFileUtility.getFileSubSystem(rseHost);
returns null.
With the same parameters as I call createHost() in the code, I can create a connection in the Remote Systems view without any problem (SSH only, FTP does not work there either because of anonymous server).

My workaround for windows in the moment is to execute a command that uses the windows explorer:
String cmd = "explorer " + fileURL.toExternalForm();
Process process = Runtime.getRuntime().exec(cmd);

Very simple... But our application is supposed to run on Linux, too. So I need something platform independent. The RSE seemed a solution to me...
Do you think it's possible??

Julia
Re: programmatically use RSE [message #759004 is a reply to message #758934] Fri, 25 November 2011 14:47 Go to previous messageGo to next message
David McKnight is currently offline David McKnightFriend
Messages: 244
Registered: July 2009
Senior Member
Julia, have you had a chance to debug this? For the stack it would appear
that either the host or it's system type are null. Can you check that?


"jule" <forums-noreply@eclipse.org> wrote in message
news:janrmb$302$1@news.eclipse.org...
> Hi Dave,
>
> I'm doing exactly this, and I'm running into a NullPointerException in
> createHost.
> Maybe the stack trace is helpful.
> java.lang.NullPointerException
> at
> org.eclipse.rse.internal.persistence.dom.RSEDOMExporter.createNode(RSEDOMExporter.java:332)
> at
> org.eclipse.rse.internal.persistence.dom.RSEDOMExporter.populateRSEDOM(RSEDOMExporter.java:142)
> at
> org.eclipse.rse.internal.persistence.dom.RSEDOMExporter.createRSEDOM(RSEDOMExporter.java:92)
> at
> org.eclipse.rse.internal.persistence.RSEPersistenceManager.save(RSEPersistenceManager.java:555)
> at
> org.eclipse.rse.internal.persistence.RSEPersistenceManager.commitProfile(RSEPersistenceManager.java:257)
> at
> org.eclipse.rse.internal.core.model.SystemProfileManager.commitSystemProfile(SystemProfileManager.java:117)
> at
> org.eclipse.rse.internal.core.model.SystemProfile.commit(SystemProfile.java:272)
> at
> org.eclipse.rse.internal.core.model.SystemProfileManager.commitProfiles(SystemProfileManager.java:108)
> at
> org.eclipse.rse.internal.core.model.SystemProfileManager.runOperation(SystemProfileManager.java:99)
> at
> org.eclipse.rse.internal.core.model.SystemProfileManager.run(SystemProfileManager.java:86)
> at
> org.eclipse.rse.internal.core.model.SystemRegistry.createHost(SystemRegistry.java:1629)
> at
> org.eclipse.rse.internal.core.model.SystemRegistry.createHost(SystemRegistry.java:1529)
> at
> eub.lzhview.actions.OpenDocumentAction.internalRun(OpenDocumentAction.java:232)
> at
> eub.lzhview.actions.OpenDocumentAction.access$0(OpenDocumentAction.java:96)
> at
> eub.lzhview.actions.OpenDocumentAction$1.runInUIThread(OpenDocumentAction.java:89)
> at org.eclipse.ui.progress.UIJob$1.run(UIJob.java:95)
> at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
> at
> org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
> at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4140)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
> at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
> at eub.rcplzhview.Application.start(Application.java:22)
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
> !SESSION 2011-11-25
> 11:32:47.347 -----------------------------------------------
> eclipse.buildId=unknown
> java.version=1.6.0_29
> java.vendor=Sun Microsystems Inc.
> BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_DE
> Framework arguments: -product eub.rcplzhview.JLZHView
> Command-line arguments: -product eub.rcplzhview.JLZHView -data
> C:\JAVA\Workspace_jLZHview/../runtime-eub.rcplzhview.JLZHView -dev
> file:C:/JAVA/Workspace_jLZHview/.metadata/.plugins/org.eclipse.pde.core/eub.rcplzhview.JLZHView/dev.properties -
> os win32 -ws win32 -arch x86 -consoleLog
>
> !ENTRY org.eclipse.ui 4 4 2011-11-25 11:33:08.378
> !MESSAGE An internal error has occurred.
>
> Unfortunatelly I can not look into the internal rse classes. The host
> still will be created though. The second time, because I check whether
> rseHost == null, createHost() is not called again, but the file system can
> not be loaded. RemoteFileUtility.getFileSubSystem(rseHost);
> returns null.
> With the same parameters as I call createHost() in the code, I can create
> a connection in the Remote Systems view without any problem (SSH only, FTP
> does not work there either because of anonymous server).
>
> My workaround for windows in the moment is to execute a command that uses
> the windows explorer:
>
> String cmd = "explorer " + fileURL.toExternalForm();
> Process process = Runtime.getRuntime().exec(cmd);
>
> Very simple... But our application is supposed to run on Linux, too. So I
> need something platform independent. The RSE seemed a solution to me... Do
> you think it's possible??
>
> Julia
Re: programmatically use RSE [message #759031 is a reply to message #759004] Fri, 25 November 2011 17:18 Go to previous messageGo to next message
Julia Kurde is currently offline Julia KurdeFriend
Messages: 66
Registered: November 2011
Location: Berlin, Germany
Member
Your right! I don't get any system type.
RSECorePlugin.getTheCoreRegistry().getSystemTypeById(id);
returns null for
id = IRSESystemType.SYSTEMTYPE_FTP_ONLY_ID as well as for
id = IRSESystemType.SYSTEMTYPE_SSH_ONLY_ID.

I just checked this also on another pc and it is the same.

The system types I get from
RSECorePlugin.getTheCoreRegistry().getSystemTypes();
are
Windows (org.eclipse.rse.systemtype.windows)
Linux (org.eclipse.rse.systemtype.linux)
Unix (org.eclipse.rse.systemtype.unix)
Local (org.eclipse.rse.systemtype.local)

Seems indeed some dependencies are missing.

[Updated on: Fri, 25 November 2011 17:36]

Report message to a moderator

Re: programmatically use RSE [message #759033 is a reply to message #759031] Fri, 25 November 2011 17:44 Go to previous messageGo to next message
David McKnight is currently offline David McKnightFriend
Messages: 244
Registered: July 2009
Senior Member
Hey Jule, I just looked again at your plugin dependencies and noticed that
org.eclipse.rse.ui isn't there. You will want to include that.

"jule" <forums-noreply@eclipse.org> wrote in message
news:jaoikg$i2t$1@news.eclipse.org...
> Your right! I don't get any system type.
> RSECorePlugin.getTheCoreRegistry().getSystemTypeById(id);
> returns null for id = IRSESystemType.SYSTEMTYPE_FTP_ONLY_ID as well as for
> id = IRSESystemType.SYSTEMTYPE_SSH_ONLY_ID.
>
> I just checked this also on another pc and it is the same.
>
Re: programmatically use RSE [message #759036 is a reply to message #759033] Fri, 25 November 2011 18:21 Go to previous messageGo to next message
Julia Kurde is currently offline Julia KurdeFriend
Messages: 66
Registered: November 2011
Location: Berlin, Germany
Member
The 4 system types I have are defined in org.eclipse.rse.core as extension to the point org.eclipse.rse.core.systemTypes.
org.eclipse.rse.ui does not provide any extensions to this point. I would need the plugin(s) where the extensions for all the other system types are defined. In the interface IRSESystemType there are
SYSTEMTYPE_AIX_ID : String
SYSTEMTYPE_DISCOVERY_ID : String
SYSTEMTYPE_FTP_ONLY_ID : String
SYSTEMTYPE_ISERIES_ID : String
SYSTEMTYPE_LINUX_ID : String
SYSTEMTYPE_LOCAL_ID : String
SYSTEMTYPE_PASE_ID : String
SYSTEMTYPE_POWER_LINUX_ID : String
SYSTEMTYPE_SSH_ONLY_ID : String
SYSTEMTYPE_TELNET_ONLY_ID : String
SYSTEMTYPE_UNIX_ID : String
SYSTEMTYPE_WINDOWS_ID : String
SYSTEMTYPE_ZSERIES_ID : String
SYSTEMTYPE_ZSERIES_LINUX_ID : String

I just wounder where I can find them!
Re: programmatically use RSE [message #759037 is a reply to message #759036] Fri, 25 November 2011 18:36 Go to previous messageGo to next message
David McKnight is currently offline David McKnightFriend
Messages: 244
Registered: July 2009
Senior Member
The reason I think you need org.eclipse.rse.core is that's where the
Subsystem base class is defined. I doubt the issue is with the system type
ids.


"jule" <forums-noreply@eclipse.org> wrote in message
news:jaomau$p8i$1@news.eclipse.org...
> The 4 system types I have are defined in org.eclipse.rse.core as extension
> to the point org.eclipse.rse.core.systemTypes.
> org.eclipse.rse.ui does not provide any extensions to this point. I would
> need the plugin(s) where the extensions for all the other system types are
> defined. In the interface IRSESystemType there are
>
> SYSTEMTYPE_AIX_ID : String
> SYSTEMTYPE_DISCOVERY_ID : String
> SYSTEMTYPE_FTP_ONLY_ID : String
> SYSTEMTYPE_ISERIES_ID : String
> SYSTEMTYPE_LINUX_ID : String
> SYSTEMTYPE_LOCAL_ID : String
> SYSTEMTYPE_PASE_ID : String
> SYSTEMTYPE_POWER_LINUX_ID : String
> SYSTEMTYPE_SSH_ONLY_ID : String
> SYSTEMTYPE_TELNET_ONLY_ID : String
> SYSTEMTYPE_UNIX_ID : String
> SYSTEMTYPE_WINDOWS_ID : String
> SYSTEMTYPE_ZSERIES_ID : String
> SYSTEMTYPE_ZSERIES_LINUX_ID : String
>
> I just wounder where I can find them!
Re: programmatically use RSE [message #759039 is a reply to message #759037] Fri, 25 November 2011 18:48 Go to previous messageGo to next message
David McKnight is currently offline David McKnightFriend
Messages: 244
Registered: July 2009
Senior Member
err.... I mean org.eclipse.rse.ui.

"David McKnight" <dmcknigh@ca.ibm.com> wrote in message
news:jaon6l$qtg$1@news.eclipse.org...
> The reason I think you need org.eclipse.rse.core is that's where the
> Subsystem base class is defined. I doubt the issue is with the system
> type ids.
>
>
> "jule" <forums-noreply@eclipse.org> wrote in message
> news:jaomau$p8i$1@news.eclipse.org...
>> The 4 system types I have are defined in org.eclipse.rse.core as
>> extension to the point org.eclipse.rse.core.systemTypes.
>> org.eclipse.rse.ui does not provide any extensions to this point. I would
>> need the plugin(s) where the extensions for all the other system types
>> are defined. In the interface IRSESystemType there are
>>
>> SYSTEMTYPE_AIX_ID : String
>> SYSTEMTYPE_DISCOVERY_ID : String
>> SYSTEMTYPE_FTP_ONLY_ID : String
>> SYSTEMTYPE_ISERIES_ID : String
>> SYSTEMTYPE_LINUX_ID : String
>> SYSTEMTYPE_LOCAL_ID : String
>> SYSTEMTYPE_PASE_ID : String
>> SYSTEMTYPE_POWER_LINUX_ID : String
>> SYSTEMTYPE_SSH_ONLY_ID : String
>> SYSTEMTYPE_TELNET_ONLY_ID : String
>> SYSTEMTYPE_UNIX_ID : String
>> SYSTEMTYPE_WINDOWS_ID : String
>> SYSTEMTYPE_ZSERIES_ID : String
>> SYSTEMTYPE_ZSERIES_LINUX_ID : String
>>
>> I just wounder where I can find them!
>
>
Re: programmatically use RSE [message #759044 is a reply to message #759039] Fri, 25 November 2011 19:25 Go to previous messageGo to next message
Julia Kurde is currently offline Julia KurdeFriend
Messages: 66
Registered: November 2011
Location: Berlin, Germany
Member
But when these extension points are not defined, I will always get null from
RSECorePlugin.getTheCoreRegistry().getSystemTypeById(id);
except for the four I mentioned. Then the I will create an IHost with a null systemType.

By the way, I found the extension for the SSH Only (org.eclipse.rse.systemtype.ssh) system type in org.eclipse.rse.connectorservice.ssh. Just to check I included this plugin to my dependencies and I got the respective system type from the core registry. I was already quite happy (although I actually need ftp), but even then the two methods
RemoteFileUtility.getFileSubSystemConfiguration(systemType) and
RemoteFileUtility.getFileSubSystem(rseHost)
still return null.
By the way no matter if I include org.eclipse.rse.ui or not.

I don't know what's wrong here!
Re: programmatically use RSE [message #759064 is a reply to message #759044] Fri, 25 November 2011 21:25 Go to previous messageGo to next message
David McKnight is currently offline David McKnightFriend
Messages: 244
Registered: July 2009
Senior Member
If you call the following:

ISubSystem[] sses = host.getSubSystems();

What do you get as sses?


"jule" <forums-noreply@eclipse.org> wrote in message
news:jaoq47$tv$1@news.eclipse.org...
> But when these extension points are not defined, I will always get null
> from
> RSECorePlugin.getTheCoreRegistry().getSystemTypeById(id);
> except for the four I mentioned. Then the I will create an IHost with a
> null systemType.
>
> By the way, I found the extension for the SSH Only
> (org.eclipse.rse.systemtype.ssh) system type in
> org.eclipse.rse.connectorservice.ssh. Just to check I included this plugin
> to my dependencies and I got the respective system type from the core
> registry. I was already quite happy (although I actually need ftp), but
> even then the two methods
> RemoteFileUtility.getFileSubSystemConfiguration(systemType) and
> RemoteFileUtility.getFileSubSystem(rseHost)
> still return null. By the way no matter if I include org.eclipse.rse.ui or
> not.
>
> I don't know what's wrong here!
>
Re: programmatically use RSE [message #759121 is a reply to message #759064] Sat, 26 November 2011 14:57 Go to previous messageGo to next message
Julia Kurde is currently offline Julia KurdeFriend
Messages: 66
Registered: November 2011
Location: Berlin, Germany
Member
rseHost.getSubSystems();
RemoteFileUtility.getFileSubSystems(rseHost);

both return an empty array. The rseHost looks like this:
rseHost	Host  (id=4401)	
	_isDirty	false	
	_isTainted	false	
	_profile	SystemProfile  (id=4400)	
	_propertySets	LinkedHashMap<K,V>  (id=4408)	
	_wasRestored	true	
	aliasName	"172.31.10.10" (id=4407)	
	defaultUserId	null	
	description	null	
	hostName	"172.31.10.10" (id=4409)	
	offline	false	
	pool	SystemHostPool  (id=4410)	
	previousUserIdKey	"juliasrechner.172.31.10.10" (id=4411)	
	promptable	false	
	systemType	RSESystemType  (id=4397)	
	ucId	false	
	userIdCaseSensitive	false	

The defaultUserId is null although I create the rseHost with a non-null string for the defaultUserId. I don't know why this is not kept. The systemType is SSH only.
Re: programmatically use RSE [message #759690 is a reply to message #759121] Tue, 29 November 2011 16:10 Go to previous messageGo to next message
David McKnight is currently offline David McKnightFriend
Messages: 244
Registered: July 2009
Senior Member
Hi Julia,

I'm not sure what's going on here in your scenario. Some things to
consisder are:
1) Try the scenario with a clean workspace.

2) For FTP, makes sure you have the following dependency:

org.apache.commons.net

3) After creating a connection, you may want to add credentials like this:

SystemSignonInformation info = new SystemSignonInformation(address, userId,
password, systemType);

PasswordPersistenceManager.getInstance().add(info, true, false);

4) Make sure your plugin(s) and launch configurations don't have any errors
before launching.

Dave

"jule" <forums-noreply@eclipse.org> wrote in message
news:jaquok$v2u$1@news.eclipse.org...
> rseHost.getSubSystems(); RemoteFileUtility.getFileSubSystems(rseHost);
> both return an empty array. The rseHost looks like this:
>
> rseHost Host (id=4401) _isDirty false _isTainted false _profile
> SystemProfile (id=4400) _propertySets LinkedHashMap<K,V> (id=4408)
> _wasRestored true aliasName "172.31.10.10" (id=4407) defaultUserId null
> description null hostName "172.31.10.10" (id=4409) offline false pool
> SystemHostPool (id=4410) previousUserIdKey "juliasrechner.172.31.10.10"
> (id=4411) promptable false systemType RSESystemType (id=4397) ucId false
> userIdCaseSensitive false
> The defaultUserId is null although I create the rseHost with a non-null
> string for the defaultUserId. I don't know why this is not kept. The
> systemType is SSH only.
Re: programmatically use RSE [message #760545 is a reply to message #759690] Fri, 02 December 2011 19:04 Go to previous messageGo to next message
Julia Kurde is currently offline Julia KurdeFriend
Messages: 66
Registered: November 2011
Location: Berlin, Germany
Member
Hi Dave,

I could achieve
(a) to get the FTP only system type by including org.eclipse.rse.subsystems.files.ftp in my dependencies and
(b) to get the respective file sub system by including org.eclipse.rse.connectorservice.dstore.

So in my application the Enter Password dialog pops up with the Host name and User ID as specified in the code. So far everything is fine.

But the ftp server I want to connect is anonymous, so no matter what user ID and Password I enter in this dialog, the Console view opens with the same message as I also get when connecting via the Remote Systems view:
220 "LZH-Schemata-FTP-Server."

USER lzh
530 This FTP server is anonymous only.

QUIT
221 Goodbye.

and I run into an org.eclipse.rse.services.files.RemoteFileSecurityException: Operation failed. Security violation

Is it possible to connect to an anonymous server with the RSE?
Re: programmatically use RSE [message #760822 is a reply to message #760545] Mon, 05 December 2011 11:40 Go to previous messageGo to next message
Julia Kurde is currently offline Julia KurdeFriend
Messages: 66
Registered: November 2011
Location: Berlin, Germany
Member
The thing is solved!!
I'm pasting here the complete code. Maybe it is helpful for somebody...
				URL fileURL = new URL(EDSPathURL , fileNames[i]); /* create URL from path set in user preferences */
				URI fileNameURI = fileURL.toURI(); /* convert to URI */
				String scheme = fileNameURI.getScheme();
				String host = fileURL.getHost();
				String path = fileURL.getPath();
				IEditorInput editorInput;
				
				if (scheme.equalsIgnoreCase("file")) { /* open local file */
					IFileStore fileStore = EFS.getFileSystem(scheme).getStore(fileNameURI);
					editorInput = new FileStoreEditorInput(fileStore);
				} else if (scheme.equalsIgnoreCase("ftp")) { /* open file via ftp */
					ISystemRegistry systemRegistry = RSECorePlugin.getTheSystemRegistry();
					RSECorePlugin.waitForInitCompletion();

					ISystemProfile profile = systemRegistry.getSystemProfileManager().getDefaultPrivateSystemProfile();
					IHost rseHost = systemRegistry.getHost(profile, host);
					if (rseHost == null) {
						System.out.println("Create IHost... ");
						String profileName = profile.getName();
			 			IRSESystemType systemType = RSECorePlugin.getTheCoreRegistry().getSystemTypeById(IRSESystemType.SYSTEMTYPE_FTP_ONLY_ID);
						int defaultUserIdLocation = IRSEUserIdConstants.USERID_LOCATION_HOST;
						rseHost = systemRegistry.createHost(
								profileName,           /* Name of the system profile the connection is to be added to */
								systemType,            /* system type matching one of the system types defined via the systemTypes extension point */
								host,                  /* unique connection name */
								host,                  /* ip name of host */
								null,                  /* optional description of the connection. Can be null */
								null,                  /* userId to use as the default for the subsystems */ 
								defaultUserIdLocation, /* one of the constants in IRSEUserIdConstants that tells us where to store the user Id */
								null                   /* these are the configurators supplied by the subsystem configurations that pertain to the specified system type. Else null */
						);
					}
					rseHost.setDefaultUserId("ftp");
					rseHost.getConnectorServices()[0].setPassword("ftp", "", true, true); /* userID must be either 'ftp' or 'anonymous' for an anonymous connection. Otherwise comment this line out and a dialog will pop up for the user to enter a passwort */
					rseHost.getConnectorServices()[0].connect(monitor);
					IRemoteFileSubSystem ss = RemoteFileUtility.getFileSubSystem(rseHost);
					IRemoteFile remoteFile = ss.getRemoteFileObject(path, monitor);
					IFile file = (IFile) UniversalFileTransferUtility.downloadResourceToWorkspace(remoteFile, monitor);
					editorInput = new FileEditorInput(file);
					rseHost.getConnectorServices()[0].disconnect(monitor);
				} else { /* scheme is neither local nor FTP only... do something else... */
				}
				String id = IDE.getEditorDescriptor(fileNames[i]).getId();
				PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(editorInput, id);

When executing this code the server replies the following
220 "LZH-Schemata-FTP-Server."

USER anonymous
331 Please specify the password.

PASS ******
230 Login successful.

SYST
215 UNIX Type: L8

TYPE I
200 Switching to Binary mode.

PWD
257 "/"

NOOP
200 NOOP ok.

CWD /EDS
250 Directory successfully changed.

PORT 172,31,10,216,10,240
200 PORT command successful. Consider using PASV.

LIST -a
150 Here comes the directory listing.

226 Directory send OK.

QUIT
221 Goodbye.

By the way this works for passive as well for an active connection.
Finally, the required plugins in the dependencies are:
      <import plugin="org.eclipse.rse.core" version="3.2.1"/>
      <import plugin="org.eclipse.rse.subsystems.files.core" version="3.2.101"/>
      <import plugin="org.eclipse.rse.subsystems.files.ftp" version="2.1.301"/>
      <import plugin="org.eclipse.rse.services" version="3.2.101"/>
      <import plugin="org.eclipse.rse.files.ui" version="3.2.1"/>
      <import plugin="org.eclipse.rse.ui" version="3.2.1"/>
      <import plugin="org.eclipse.rse.connectorservice.dstore" version="3.1.200"/>

Thanks, Dave, for discussions!
Regards, Julia
Re: programmatically use RSE [message #761063 is a reply to message #760822] Mon, 05 December 2011 20:48 Go to previous message
David McKnight is currently offline David McKnightFriend
Messages: 244
Registered: July 2009
Senior Member
Hi Julie,

Sorry I missed your last message. I'm glad you got everything working!

Dave

"jule" <forums-noreply@eclipse.org> wrote in message
news:jbiain$q69$1@news.eclipse.org...
> The thing is solved!!
> I'm pasting here the complete code. Maybe it is helpful for somebody...
>
> URL fileURL = new URL(EDSPathURL , fileNames[i]); /* create URL from path
> set in user preferences */
> URI fileNameURI = fileURL.toURI(); /* convert to URI */
> String scheme = fileNameURI.getScheme();
> String host = fileURL.getHost();
> String path = fileURL.getPath();
> IEditorInput editorInput;
>
> if (scheme.equalsIgnoreCase("file")) { /* open local file */
> IFileStore fileStore = EFS.getFileSystem(scheme).getStore(fileNameURI);
> editorInput = new FileStoreEditorInput(fileStore);
> } else if (scheme.equalsIgnoreCase("ftp")) { /* open file via ftp */
> ISystemRegistry systemRegistry = RSECorePlugin.getTheSystemRegistry();
> RSECorePlugin.waitForInitCompletion();
>
> ISystemProfile profile =
> systemRegistry.getSystemProfileManager().getDefaultPrivateSystemProfile();
> IHost rseHost = systemRegistry.getHost(profile, host);
> if (rseHost == null) {
> System.out.println("Create IHost... ");
> String profileName = profile.getName();
> IRSESystemType systemType =
> RSECorePlugin.getTheCoreRegistry().getSystemTypeById(IRSESystemType.SYSTEMTYPE_FTP_ONLY_ID);
> int defaultUserIdLocation = IRSEUserIdConstants.USERID_LOCATION_HOST;
> rseHost = systemRegistry.createHost(
> profileName, /* Name of the system profile the connection is to
> be added to */
> systemType, /* system type matching one of the system types
> defined via the systemTypes extension point */
> host, /* unique connection name */
> host, /* ip name of host */
> null, /* optional description of the connection. Can be
> null */
> null, /* userId to use as the default for the subsystems
> */ defaultUserIdLocation, /* one of the constants in IRSEUserIdConstants
> that tells us where to store the user Id */
> null /* these are the configurators supplied by the
> subsystem configurations that pertain to the specified system type. Else
> null */
> );
> }
> rseHost.setDefaultUserId("ftp");
> rseHost.getConnectorServices()[0].setPassword("ftp", "", true, true); /*
> userID must be either 'ftp' or 'anonymous' for an anonymous connection.
> Otherwise comment this line out and a dialog will pop up for the user to
> enter a passwort */
> rseHost.getConnectorServices()[0].connect(monitor);
> IRemoteFileSubSystem ss = RemoteFileUtility.getFileSubSystem(rseHost);
> IRemoteFile remoteFile = ss.getRemoteFileObject(path, monitor);
> IFile file = (IFile)
> UniversalFileTransferUtility.downloadResourceToWorkspace(remoteFile,
> monitor);
> editorInput = new FileEditorInput(file);
> rseHost.getConnectorServices()[0].disconnect(monitor);
> } else { /* scheme is neither local nor FTP only... do something else...
> */
> }
> String id = IDE.getEditorDescriptor(fileNames[i]).getId();
> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(editorInput,
> id);
>
> When executing this code the server replies the following
>
> 220 "LZH-Schemata-FTP-Server."
>
> USER anonymous
> 331 Please specify the password.
>
> PASS ******
> 230 Login successful.
>
> SYST
> 215 UNIX Type: L8
>
> TYPE I
> 200 Switching to Binary mode.
>
> PWD
> 257 "/"
>
> NOOP
> 200 NOOP ok.
>
> CWD /EDS
> 250 Directory successfully changed.
>
> PORT 172,31,10,216,10,240
> 200 PORT command successful. Consider using PASV.
>
> LIST -a
> 150 Here comes the directory listing.
>
> 226 Directory send OK.
>
> QUIT
> 221 Goodbye.
>
> By the way this works for passive as well for an active connection.
> Finally, the required plugins in the dependencies are:
>
> <import plugin="org.eclipse.rse.core" version="3.2.1"/>
> <import plugin="org.eclipse.rse.subsystems.files.core"
> version="3.2.101"/>
> <import plugin="org.eclipse.rse.subsystems.files.ftp"
> version="2.1.301"/>
> <import plugin="org.eclipse.rse.services" version="3.2.101"/>
> <import plugin="org.eclipse.rse.files.ui" version="3.2.1"/>
> <import plugin="org.eclipse.rse.ui" version="3.2.1"/>
> <import plugin="org.eclipse.rse.connectorservice.dstore"
> version="3.1.200"/>
>
> Thanks, Dave, for discussions!
> Regards, Julia
Previous Topic:RSE SubSystem - Copy/Paste support
Next Topic:ftp set defualt to passive
Goto Forum:
  


Current Time: Sat Nov 29 10:16:17 GMT 2014

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

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