Package com.mucommander.commons.file

Examples of com.mucommander.commons.file.FileURL


            public Object getElementAt(int i) {
                ConnectionHandler connHandler = connections.get(i);

                // Show login (but not password) in the URL
                // Note: realm returned by ConnectionHandler does not contain credentials
                FileURL clonedRealm = (FileURL)connHandler.getRealm().clone();
                Credentials loginCredentials = new Credentials(connHandler.getCredentials().getLogin(), "");
                clonedRealm.setCredentials(loginCredentials);

                return clonedRealm.toString(true)
                        +" ("+Translator.get(connHandler.isLocked()?"server_connections_dialog.connection_busy":"server_connections_dialog.connection_idle")+")";
            }
        });

        // Only one list index can be selected at a time
View Full Code Here


    FileURL getServerURL() throws MalformedURLException {
        updateValues();
        if(!lastInitialDir.startsWith("/"))
            lastInitialDir = "/"+lastInitialDir;
     
        FileURL url = FileURL.getFileURL(FileProtocols.FTP+"://"+lastServer+lastInitialDir);

        if(anonymousUser)
            url.setCredentials(new Credentials(ANONYMOUS_CREDENTIALS.getLogin(), new String(passwordField.getPassword())));
        else
            url.setCredentials(new Credentials(lastUsername, lastPassword));

        // Set port
        url.setPort(lastPort);

        // Set passiveMode property to true (default) or false
        url.setProperty(FTPFile.PASSIVE_MODE_PROPERTY_NAME, ""+passiveMode);

        // Set FTP encoding property
        url.setProperty(FTPFile.ENCODING_PROPERTY_NAME, encodingSelectBox.getSelectedEncoding());

        // Set connection retry properties
        url.setProperty(FTPFile.NB_CONNECTION_RETRIES_PROPERTY_NAME, ""+nbRetriesSpinner.getValue());
        url.setProperty(FTPFile.CONNECTION_RETRY_DELAY_PROPERTY_NAME, ""+retryDelaySpinner.getValue());

        return url;
    }
View Full Code Here

  // //////////////////////////////

  @Override
  FileURL getServerURL() throws MalformedURLException {
    updateValues();
    FileURL url = FileURL.getFileURL(FileProtocols.VSPHERE + "://"
        + lastVsphere + "/" + lastGuest
        + "/" + PathUtils.removeLeadingSeparator(lastDir));
    url.setCredentials(new Credentials(lastUsername,  new String(passwordField.getPassword())));
    url.setProperty(VSphereFile.GUEST_CREDENTIALS, lastGuestUsername + ":" + new String(guestPasswordField.getPassword()));

    return url;
  }
View Full Code Here

    @Override
    FileURL getServerURL() throws MalformedURLException {
        updateValues();

        FileURL url = FileURL.getFileURL(FileProtocols.NFS+"://"+lastServer+(lastShare.startsWith("/")?"":"/")+lastShare);

        // Set port
        url.setPort(lastPort);

        // Set NFS version
        url.setProperty(NFSFile.NFS_VERSION_PROPERTY_NAME, lastNfsVersion);

        // Set NFS protocol
        url.setProperty(NFSFile.NFS_PROTOCOL_PROPERTY_NAME, lastNfsProtocol);

        return url;
    }
View Full Code Here

    FileURL getServerURL() throws MalformedURLException {
        updateValues();
        if(!lastInitialDir.startsWith("/"))
            lastInitialDir = "/"+lastInitialDir;

        FileURL url = FileURL.getFileURL(FileProtocols.S3+"://"+lastServer+lastInitialDir);

        // Set credentials
        url.setCredentials(new Credentials(lastUsername, lastPassword));

        // Set port
        url.setPort(lastPort);

        return url;
    }
View Full Code Here

    public void locationChanging(LocationEvent e) {
        // Change the location field's text to the folder being changed, only if the folder change was not initiated
        // by the location field (to preserve the path entered by the user while the folder is being changed)
        if(!folderChangeInitiatedByLocationField) {
            FileURL folderURL = e.getFolderURL();

            String locationText;
            if(folderURL.getScheme().equals(FileProtocols.FILE)) {
                // Do not display the URL's scheme & host for local files
              if (FileURL.LOCALHOST.equals(folderURL.getHost())) {
                locationText = folderURL.getPath();
                // Under for OSes with 'root drives' (Windows, OS/2), remove the leading '/' character
                if(LocalFile.hasRootDrives())
                  locationText = PathUtils.removeLeadingSeparator(locationText, "/");
              }
              // For network files with FILE scheme display the URL in UNC format
              else {
                locationText = "\\\\" + folderURL.getHost() + folderURL.getPath().replace('/', '\\');
                if(!locationText.endsWith(UNCFile.SEPARATOR))
                        locationText += UNCFile.SEPARATOR;
              }
            }
            // Display the full URL for protocols other than 'file'
            else {
                locationText = folderURL.toString(false);
            }
            setText(locationText);
        }

        // Disable component until the folder has been changed, cancelled or failed.
View Full Code Here

      } else if (i<100) {
        num = "0" + Integer.toString(i);
      } else {
        num = Integer.toString(i);
      }
        FileURL childURL = (FileURL)destFolder.getURL().clone();
        childURL.setPath(destFolder.addTrailingSeparator(childURL.getPath()) + sourceFile.getName() + "." + num);
      DummyDestFile fileHolder = new DummyDestFile(childURL, size);
      files.add(fileHolder);
  }
View Full Code Here

     * @return                a stream on the right file.
     * @exception IOException thrown if any IO related error occurs.
     */
    private static InputStream getInputStream(AbstractFile file) throws IOException {
        AbstractFile backup;
        FileURL test;

        test = (FileURL)file.getURL().clone();
        test.setPath(test.getPath() + BACKUP_SUFFIX);

        // Checks whether the backup file is a better choice than the target one.
        backup = FileFactory.getFile(test);
        if(backup != null && backup.exists() && (file.getSize() < backup.getSize()))
            return backup.getInputStream();
View Full Code Here

  ///////////////////////
  /// LocationAdapter ///
  ///////////////////////
 
  public void locationChanged(LocationEvent locationEvent) {
    FileURL file = locationEvent.getFolderURL();
   
    // remove the new location from the history as it should be put
    // at the end of the list to preserve the insertion order of the history
    boolean alreadyExists = history.remove(file);
   
View Full Code Here

  public FileURL[] getBackFolders() {
    if(!hasBackFolder())
      return new FileURL[0];

    int backLen = historyIndex;
    FileURL urls[] = new FileURL[backLen];

    int cur = 0;
    for(int i=historyIndex-1; i>=0; i--)
      urls[cur++] = history.get(i);
View Full Code Here

TOP

Related Classes of com.mucommander.commons.file.FileURL

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.