Package org.eclipse.ecf.provider.filetransfer.browse

Examples of org.eclipse.ecf.provider.filetransfer.browse.URLRemoteFile


        throw new BrowseFileTransferException(Messages.HttpClientRetrieveFileTransfer_Proxy_Auth_Required, code);
      } else {
        throw new BrowseFileTransferException(NLS.bind(Messages.HttpClientRetrieveFileTransfer_ERROR_GENERAL_RESPONSE_CODE, new Integer(code)), code);
      }
      remoteFiles = new IRemoteFile[1];
      remoteFiles[0] = new URLRemoteFile(lastModified, fileLength, fileID);
    } catch (Exception e) {
      Trace.throwing(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_THROWING, this.getClass(), "runRequest", e); //$NON-NLS-1$
      BrowseFileTransferException ex = (BrowseFileTransferException) ((e instanceof BrowseFileTransferException) ? e : new BrowseFileTransferException(NLS.bind(Messages.HttpClientRetrieveFileTransfer_EXCEPTION_COULD_NOT_CONNECT, urlString), e, code));
      throw ex;
    }
View Full Code Here


    }
  }

  private IRemoteFile createRemoteFile(String string)
      throws URISyntaxException, FileCreateException, SecurityException {
    URLRemoteFile file = null;
    IFileID id = null;
    String[] parts = string.split("\\|");

    // Check to see if this string can be parsed
    if (parts.length < 4) {
      id = FileIDFactory.getDefault().createFileID(
          IDFactory.getDefault().getNamespaceByName(
              FileTransferNamespace.PROTOCOL), "scp://unknown");
      file = new URLRemoteFile(0, 0, id);
    } else {

      // Build the filename back up, since the filename may also contain
      // "|"
      // characters
      StringBuilder builder = new StringBuilder("scp://");
      for (int i = 3; i < parts.length; i++) {
        builder.append(parts[i]);

        // Put the | back into the name
        if (i > 3 && i < parts.length - 1) {
          builder.append("|");
        }
      }

      // If it's a directory, then make sure it ends with /
      if (parts[0].equals("directory")
          && !builder.toString().endsWith("/")) {
        builder.append("/");
      } else if (!parts[0].equals("directory")
          && builder.toString().endsWith("/")) {
        builder.deleteCharAt(builder.length() - 1);
      }

      String originalName = builder.toString();
      String formatedName = originalName.replace(" ", "%20");
      URI uri = new URI(formatedName);

      // Create the FileID
      id = FileIDFactory.getDefault().createFileID(
          IDFactory.getDefault().getNamespaceByName(
              FileTransferNamespace.PROTOCOL),
          new Object[] { uri });
      long size = Long.parseLong(parts[1]);
      long modification = Long.parseLong(parts[2]);
      file = new URLRemoteFile(modification, size, id);
    }
    return file;
  }
View Full Code Here

        throw new BrowseFileTransferException(Messages.HttpClientRetrieveFileTransfer_Proxy_Auth_Required, code);
      } else {
        throw new BrowseFileTransferException(NLS.bind(Messages.HttpClientRetrieveFileTransfer_ERROR_GENERAL_RESPONSE_CODE, new Integer(code)), code);
      }
      remoteFiles = new IRemoteFile[1];
      remoteFiles[0] = new URLRemoteFile(lastModified, fileLength, fileID);
    } catch (Exception e) {
      Trace.throwing(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_THROWING, this.getClass(), "runRequest", e); //$NON-NLS-1$
      BrowseFileTransferException ex = (BrowseFileTransferException) ((e instanceof BrowseFileTransferException) ? e : new BrowseFileTransferException(NLS.bind(Messages.HttpClientRetrieveFileTransfer_EXCEPTION_COULD_NOT_CONNECT, urlString), e, code));
      throw ex;
    } finally {
View Full Code Here

TOP

Related Classes of org.eclipse.ecf.provider.filetransfer.browse.URLRemoteFile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.