Package org.eclipse.ecf.filetransfer

Examples of org.eclipse.ecf.filetransfer.SendFileTransferException


      setInputStream(new BufferedInputStream(new FileInputStream(getFileTransferInfo().getFile())));
      // Open target
      final IFileStore fileStore = EFS.getStore(new URI(getRemoteFileURL().getPath()));
      setOutputStream(fileStore.openOutputStream(0, null));
    } catch (final Exception e) {
      throw new SendFileTransferException(e);
    }
  }
View Full Code Here


  }

  public void sendOutgoingRequest(IFileID targetReceiver, IFileTransferInfo localFileToSend, IFileTransferListener progressListener, Map options) throws SendFileTransferException {

    if (manager == null)
      throw new SendFileTransferException("not connected");

    if (!(targetReceiver instanceof XMPPFileID))
      throw new SendFileTransferException("target receiver not XMPPFileID type.");

    final XMPPFileID fileID = (XMPPFileID) targetReceiver;

    int requestTimeout = -1;
    if (options != null) {
      final Object option = options.get(OUTGOING_REQUEST_TIMEOUT);
      if (option != null) {
        if (option instanceof String) {
          try {
            requestTimeout = Integer.valueOf((String) option).intValue();
          } catch (final NumberFormatException e) {
            // Ignore
          }
        } else if (option instanceof Integer) {
          requestTimeout = ((Integer) option).intValue();
        }
      }
    }

    final XMPPOutgoingFileTransfer fileTransfer = new XMPPOutgoingFileTransfer(manager, fileID.getXMPPID(), localFileToSend, progressListener, requestTimeout);

    try {
      fileTransfer.startSend(localFileToSend.getFile(), localFileToSend.getDescription());
    } catch (final XMPPException e) {
      throw new SendFileTransferException("Exception sending outgoing file transfer request", e);
    }
  }
View Full Code Here

    File inputFile = localFileTransferInfo.getFile();
    try {
      setInputStream(new BufferedInputStream(new FileInputStream(inputFile)));
    } catch (Exception e) {
      hardClose();
      throw new SendFileTransferException(NLS.bind(Messages.LocalFileOutgoingFileTransfer_EXCEPTION_OPENING_FOR_INPUT, inputFile));
    }
    URL url = getRemoteFileURL();
    Assert.isNotNull(url);
    try {
      File outputFile = new File(url.getPath());
      setOutputStream(new BufferedOutputStream(new FileOutputStream(outputFile)));
    } catch (Exception e) {
      hardClose();
      throw new SendFileTransferException(NLS.bind(Messages.LocalFileOutgoingFileTransfer_EXCEPTION_OPENING_FOR_OUTPUT, url));
    }
  }
View Full Code Here

      channel.connect();
      scpUtil.checkAck(responseStream);
      sendFileNameAndSize(localFile, targetFileName, outs, responseStream);
      setOutputStream(outs);
    } catch (final Exception e) {
      throw new SendFileTransferException(NLS.bind(
          Messages.ScpOutgoingFileTransfer_EXCEPTION_CONNECTING,
          getRemoteFileURL().toString()), e);
    }

  }
View Full Code Here

      protocol = targetID.getURI().getScheme();
    } catch (URISyntaxException e) {
      try {
        protocol = targetID.getURL().getProtocol();
      } catch (final MalformedURLException e1) {
        throw new SendFileTransferException(Messages.AbstractRetrieveFileTransfer_MalformedURLException);
      }
    }

    ISendFileTransferContainerAdapter fileTransfer = Activator.getDefault().getSendFileTransfer(protocol);

    // If no handler setup for this protocol then throw
    if (fileTransfer == null) {
      if (protocol.equalsIgnoreCase("file")) { //$NON-NLS-1$
        fileTransfer = new LocalFileOutgoingFileTransfer();
      }
    }

    if (fileTransfer == null) {
      throw new SendFileTransferException(NLS.bind(Messages.MultiProtocolOutgoingAdapter_EXCEPTION_NO_PROTOCOL_HANDER, targetID));
    }

    fileTransfer.setConnectContextForAuthentication(connectContext);
    fileTransfer.setProxy(proxy);
    fileTransfer.sendOutgoingRequest(targetID, outgoingFile, transferListener, options);
View Full Code Here

      protocol = targetID.getURI().getScheme();
    } catch (URISyntaxException e) {
      try {
        protocol = targetID.getURL().getProtocol();
      } catch (final MalformedURLException e1) {
        throw new SendFileTransferException(Messages.AbstractRetrieveFileTransfer_MalformedURLException);
      }
    }

    ISendFileTransferContainerAdapter fileTransfer = Activator.getDefault().getSendFileTransfer(protocol);

    // If no handler setup for this protocol then throw
    if (fileTransfer == null) {
      throw new SendFileTransferException(NLS.bind(Messages.MultiProtocolOutgoingAdapter_EXCEPTION_NO_PROTOCOL_HANDER, targetID));
    }

    fileTransfer.setConnectContextForAuthentication(connectContext);
    fileTransfer.setProxy(proxy);
    fileTransfer.sendOutgoingRequest(targetID, localFileToSend, transferListener, options);
View Full Code Here

    this.options = ops;

    try {
      this.remoteFileURL = targetReceiver.getURL();
    } catch (final MalformedURLException e) {
      throw new SendFileTransferException(NLS.bind(Messages.AbstractOutgoingFileTransfer_MalformedURLException, targetReceiver), e);
    }
    this.listener = transferListener;
    setupProxies();
    openStreams();
    fireSendStartEvent();
View Full Code Here

      // Then connect
      connect();
      // Make PUT request
      setOutputStream(urlConnection.getOutputStream());
    } catch (final Exception e) {
      throw new SendFileTransferException(NLS.bind(Messages.UrlConnectionOutgoingFileTransfer_EXCEPTION_COULD_NOT_CONNECT, getRemoteFileURL().toString()), e);
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.ecf.filetransfer.SendFileTransferException

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.