Examples of FtpConnection


Examples of net.sf.jftp.net.FtpConnection

public FtpUpload(String host, String dir, String file)
{
   Log.setLogger(this);

   FtpConnection con = new FtpConnection(host);

  con.addConnectionListener(this);

  con.setConnectionHandler(handler);

  con.login("anonymous","no@no.no");

  while(!isThere)
  {
    try { Thread.sleep(10); }
    catch(Exception ex) { ex.printStackTrace(); }
  }

  con.chdir(dir);

  con.upload(file);
}
View Full Code Here

Examples of net.sf.jftp.net.FtpConnection

   // register app as Logger, debug() and debugRaw below are from now on called by
  // FtpConnection
   Log.setLogger(this);

  // create a FtpConnection - note that it does *not* connect instantly
   FtpConnection con = new FtpConnection(host);

  //System.out.println("2) "+(System.currentTimeMillis()-current)+"ms.");

  // set updatelistener, interface methods are below
  con.addConnectionListener(this);

  // set handler
  con.setConnectionHandler(handler);

  // connect and login. this is from where connectionFailed() may be called for example
  con.login("cdemon","........");

  //System.out.println("3) "+(System.currentTimeMillis()-current)+"ms.");

  // login calls connectionInitialized() below which sets isThere to true
  while(!isThere)
  {
    try { Thread.sleep(10); }
    catch(Exception ex) { ex.printStackTrace(); }
  }

  //System.out.println("4) "+(System.currentTimeMillis()-current)+"ms.");

  // download the file - this method blocks until the download has finished
  // if you want non-blocking, multithreaded io, just use
  //
  // con.handleDownload(file);
  //
  // which spawns a new thread for the download
  con.download(file);

  time = (System.currentTimeMillis()-current);

  System.out.println("Download took "+time+"ms.");
}
View Full Code Here

Examples of net.sf.jftp.net.FtpConnection

            j.setModal(true);
            j.show();
        }
        */
        //***also need to get max connections!!
        con = new FtpConnection(htmp, potmp, dtmp, crlf);

        //con.addConnectionListener((ConnectionListener) JFtp.localDir);
        //con.addConnectionListener((ConnectionListener) JFtp.remoteDir);
        //JFtp.remoteDir.setCon(con);
        if(useLocal)
View Full Code Here

Examples of net.sf.jftp.net.FtpConnection

           
            if(opt == 1) {
              RemoteCommand rc = new RemoteCommand();
            }
            else if(opt == 0) {
              FtpConnection conn = (FtpConnection) con;
              Shell s = new Shell(conn.getCommandInputReader(), conn.getCommandOutputStream());
            }

            //fresh();
        }
        else if(e.getActionCommand().equals("cd"))
        {
            PathChanger pthc = new PathChanger("remote");

            //fresh();
            //String tmp = UITool.getPathFromDialog();
            //setPath(tmp);
        }
        else if(e.getActionCommand().equals("fresh"))
        {
            fresh();
        }
        else if(e.getActionCommand().equals("->"))
        {
            blockedTransfer(-2);
        }
        else if(e.getActionCommand().equals("<-"))
        {
            blockedTransfer(-2);
        }
        else if(e.getActionCommand().equals("list"))
        {
            try
            {
              if(!(con instanceof FtpConnection)) {
                 Log.debug("Can only list FtpConnection output!");
              }
             
              PrintStream out = new PrintStream(Settings.ls_out);
              for(int i=0; i<((FtpConnection)con).currentListing.size(); i++) {
                out.println(((FtpConnection)con).currentListing.get(i));
              }
              out.flush();
              out.close();
             
                java.net.URL url = new java.io.File(Settings.ls_out).toURL();
                Displayer d = new Displayer(url, new Font("monospaced",Font.PLAIN, 11));
                JFtp.desktop.add(d, new Integer(Integer.MAX_VALUE - 13));
            }
            catch(java.net.MalformedURLException ex)
            {
                ex.printStackTrace();
                Log.debug("ERROR: Malformed URL!");
            }
            catch(FileNotFoundException ex2)
            {
                ex2.printStackTrace();
                Log.debug("ERROR: File not found!");
            }
        }
        else if(e.getActionCommand().equals("type") && (!JFtp.uiBlocked))
        {
            if(!(con instanceof FtpConnection))
            {
                Log.debug("You can only set the transfer type for ftp connections.");

                return;
            }

            FtpConnection c = (FtpConnection) con;
            String t = c.getTypeNow();
            boolean ret = false;

            if(t.equals(FtpConnection.ASCII))
            {
                ret = c.type(FtpConnection.BINARY);
            }
            else if(t.equals(FtpConnection.BINARY))
            {
                ret = c.type(FtpConnection.EBCDIC);
            }

            if(t.equals(FtpConnection.EBCDIC) ||
                   (!ret && !t.equals(FtpConnection.L8)))
            {
                ret = c.type(FtpConnection.L8);
            }

            if(!ret)
            {
                c.type(FtpConnection.ASCII);
                Log.debug("Warning: type should be \"I\" if you want to transfer binary files!");
            }

            Log.debug("Type is now " + c.getTypeNow());
        }

        else if(e.getActionCommand().equals("que")) /*&& (!JFtp.uiBlocked))*/
        {
            if(!(con instanceof FtpConnection))
View Full Code Here

Examples of net.sf.jftp.net.FtpConnection

        //System.out.println("path: "+path +":"+ con +":" +con.getPWD() +":"+c+":" +c.getPWD());
  
        if((c != null) && (c instanceof FtpConnection))
        {
            FtpConnection con = (FtpConnection) c;

            String tmp = con.getCachedPWD();
            SaveSet s = new SaveSet(Settings.login_def, con.getHost(),
                                    con.getUsername(), con.getPassword(),
                                    Integer.toString(con.getPort()), tmp,
                                    con.getLocalPath());
        }
        else if((c != null) && (c instanceof FilesystemConnection))
        {
            JFtp.localDir.getCon().setLocalPath(path);
        }
View Full Code Here

Examples of net.sf.jftp.net.FtpConnection

    public void update(String url)
    {
        try
        {
            FtpURLConnection uc = new FtpURLConnection(new java.net.URL(url));
            FtpConnection con = uc.getFtpConnection();

            JFtp.statusP.jftp.addConnection(url, con);

            //con.addConnectionListener((ConnectionListener) JFtp.localDir);
            //con.addConnectionListener((ConnectionListener) JFtp.remoteDir);
View Full Code Here

Examples of net.sf.jftp.net.FtpConnection

            //this.setVisible(false);
            setCursor(new Cursor(Cursor.WAIT_CURSOR));

            //JFtp.mainFrame.setVisible(true);
            //JFtp.mainFrame.toFront();
            FtpConnection con = null;
            JFtp.setHost(host.getText());

            String htmp = StringUtils.cut(host.getText(), " ");
            String utmp = StringUtils.cut(user.getText(), " ");
            String ptmp = StringUtils.cut(pass.getText(), " ");
View Full Code Here

Examples of net.sf.jftp.net.FtpConnection

        BasicConnection c = JFtp.remoteDir.getCon();

        if((c != null) && (c instanceof FtpConnection))
        {
            FtpConnection con = (FtpConnection) c;

            //con.setLocalPath(path);
            SaveSet s = new SaveSet(Settings.login_def, con.getHost(),
                                    con.getUsername(), con.getPassword(),
                                    Integer.toString(con.getPort()),
                                    con.getCachedPWD(), con.getLocalPath());
        }

        if(con.chdirNoRefresh(p))
        {
            path = con.getPWD();

            if(con instanceof FilesystemConnection)
            {
                JFtp.remoteDir.getCon().setLocalPath(path);
View Full Code Here

Examples of net.sf.jftp.net.FtpConnection

    Settings.setProperty("jftp.enableMultiThreading","true");
    Settings.maxConnections = 5;
    Settings.enableResuming = true;
   
    // create a FtpConnection
    FtpConnection con = null;
    if (port > -1)
      con = new FtpConnection(host,port,remotePath);
    else
      con = new FtpConnection(host);

    // set updatelistener, interface methods are below
    con.addConnectionListener(this);

    // set handler
    con.setConnectionHandler(handler);

    // connect and login.
    con.login(user,pass);

    // login calls connectionInitialized() below which sets established to true
    while(!established) {
      try {
        Thread.sleep(10);
      } catch(Exception exc) {
        throw exc;
      }
    }

    if (remotePath != null)
      con.chdirRaw(remotePath);

    if (localPath != null)
      con.setLocalPath(localPath);

    //System.out.println("LocalPath = " + con.getLocalPath());

    // which spawns a new thread for the download
    con.download(remoteFileName);
   
    File file = new File(con.getLocalPath(),localFileName);
   
    if (crc > 0 && crc != file.length())
      throw new Exception("CRC ERROR.");
   
    return file.getAbsolutePath();
View Full Code Here

Examples of org.cfeclipse.cfml.net.ftp.FTPConnection

          String absolutePath = remFile.getAbsolutePath();
         
          StructuredSelection selection2 = (StructuredSelection)comboViewer.getSelection();
         
          if (selection2.getFirstElement() instanceof FTPConnection) {
            FTPConnection ftpConn = (FTPConnection) selection2.getFirstElement();
          }
        }
       
        // Expand the item double-clicked on
        boolean isExpand = directoryTreeViewer.getExpandedState(firstElement);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.