|
Re: how to ask ECF is scheme is supported for file transfer [message #624778 is a reply to message #624773] |
Thu, 16 April 2009 03:33 |
Scott Lewis Messages: 1038 Registered: July 2009 |
Senior Member |
|
|
Hi Henrik,
I know this isn't very satisfactory, but one way would be to create an
URL and see if it throws a MalformedURLException. If it does, then the
scheme is not supported.
Another way to examine what schemes are supported is to consult the
service registry for all services that implement this interface:
org.osgi.service.url.URLStreamHandlerService
In the service property with name:
org.osgi.service.url.URLConstants.URL_HANDLER_PROTOCOL
The value of this service property is a String[] with the protocols
supported by this URLStreamHandlerService. As ECF file transfer
providers are added, if they are not already registered as an
URLStreamHandlerService, then ECF registers the new scheme on startup
with this code (in org.eclipse.ecf.provider.filetransfer bundle
Activator class line 650:
final Hashtable properties = new Hashtable();
properties.put(URLConstants.URL_HANDLER_PROTOCOL, new String[] {protocol});
We would like to eventually add an interface for such introspection
(e.g. on IRetrieveFileTransferContainerAdapter,
IBrowseFileTransferContainerAdapter, and
ISendFileTransferContainerAdapter) but have not had the opportunity to
do so. So an enhancement request to this end would be most appreciated.
Thanks,
Scott
Henrik Lindberg wrote:
> Hi,
> I have a URI (as entered by a user in a UI), and I want to know if the
> current configuration of ECF has support for filetransfer using the scheme.
>
> How should I perform the check?
>
> Regards
> - henrik
|
|
|
Powered by
FUDForum. Page generated in 0.02777 seconds