The Xdrive implementation can be used either via the Eclipse File System (EFS) which is the most convenient way when running in an Eclipse Runtime environment. But the xdrive bundle can also be used in other environments. This article describes how.
In order to understand how to use the xdrive bundle, it is worth looking at how it is integrated into spaces itself.
The filesystem.xdrive bundle
The filesystem bundle for xdrive is called "org.eclipse.spaces.filesystem.xdrive" and it contains the implementation of IFileStore and IFileSystem required by EFS. It also has the necessary wrapping of Eclipse Runtime classes to interfaces supplied by the xdrive bundle. You can look at these as example use of the xdrive bundle.
Specifically, it maps IProgressMonitor to IXdriveProgressMonitor, and wraps Xdrive exceptions to CoreExceptions.
The provider.xdrive bundle
The spaces space provider bundle for xdrive is called "org.eclipse.spaces.provider.xdrive" and in addition to being the spaces implementation that makes use of the xdrive filesystem, it also has an implementation of the xdrive passwordProvider.
You can look into the plugin class for this bundle to see how it sets the xdrive password provider.
The xdrive bundle
The xdrive bundle is called "org.eclipse.spaces.xdrive", and this bundle has no dependencies on the Eclipse runtime. This means that it can not use the nice Eclipse extension points, nor IProgressMonitor, CoreExceptions, etc. Instead it has its own implementation called IXdriveProgressMonitor, and a concrete implementation of a null progress monitor called XdriveNullProgressMonitor. It has ecplicit exceptions that are not derived from CoreException.
Further, instead of having passwordProvider be an extension point, an external provider is explicitly set using "XdriveController.setPasswordProvider(IXdrivePasswordProvider provider)".
If no password provider is set, the xdrive will only be able to access xdrives where login/password combinations have been explicitly provided via calls to "public static void XdriveController.setPassword(String user, String host, String password, boolean storeInKeyring)"
The boolean storeInKeyring will probably be refactored out (it is not used). The user is the aol email account used as the "login", the host is the xdrive host ("eclipse.xdrive.com"), and password is what you expect it to be.
The XdriveController.setPassword() stores the password in memory only.
The alternatives when using the xdrive bundle are:
- set the passwords explicitly using XdriveController.setPassword(), or
- implement the IXdrivePasswordProvider interface and set that with XdriveController.setPasswordProvider()
The IXdrivePasswordProvider implementation can ask the user for the password using device specific code, it can also store that password if it wants to and silently pick it up if available. (This is how the spaces implementation of the password provider does it (by using the eclipse keyring).
Where to find the bundles?
The bundles are located in the Eclipse technology projects SVN. See Spaces/Building from source for more details.