use of com.mucommander.commons.file.FileURL in project mucommander by mucommander.
the class GoogleDriveFile method toFile.
private GoogleDriveFile toFile(File file) {
FileURL url = (FileURL) getURL().clone();
String parentPath = PathUtils.removeTrailingSeparator(url.getPath()) + AbstractFile.DEFAULT_SEPARATOR;
url.setPath(parentPath + file.getName());
GoogleDriveFile result = new GoogleDriveFile(url, file);
result.setParent(this);
return result;
}
use of com.mucommander.commons.file.FileURL in project mucommander by mucommander.
the class DropboxConnectionHandler method getCredentialFileURL.
public static FileURL getCredentialFileURL(String account) throws IOException {
AbstractFile credentialFolder = getCredentialsFolder();
FileURL credentialFileURL = (FileURL) credentialFolder.getURL().clone();
credentialFileURL.setPath(credentialFolder.addTrailingSeparator(credentialFileURL.getPath()) + account);
return credentialFileURL;
}
use of com.mucommander.commons.file.FileURL in project mucommander by mucommander.
the class DropboxFile method ls.
@Override
public AbstractFile[] ls() throws IOException, UnsupportedFileOperationException {
try (DropboxConnectionHandler connHandler = getConnHandler()) {
DbxUserFilesRequests r = connHandler.getDbxClient().files();
ListFolderResult result;
try {
result = r.listFolder(getId());
} catch (DbxException e) {
LOGGER.error("failed to list folder", e);
return null;
}
return result.getEntries().stream().filter(meta -> !(meta instanceof DeletedMetadata)).map(meta -> {
FileURL url = (FileURL) fileURL.clone();
url.setPath(meta.getPathDisplay());
return new DropboxFile(url, this, meta);
}).toArray(AbstractFile[]::new);
}
}
use of com.mucommander.commons.file.FileURL in project mucommander by mucommander.
the class DropboxPanel method getServerURL.
@Override
public FileURL getServerURL() throws MalformedURLException {
FileURL url = FileURL.getFileURL(String.format("%s://%s", SCHEMA, accountAlias.getText()));
url.setCredentials(new Credentials(accountAlias.getText(), token.getText()));
return url;
}
use of com.mucommander.commons.file.FileURL in project mucommander by mucommander.
the class FTPPanel method getServerURL.
// //////////////////////////////
// ServerPanel implementation //
// //////////////////////////////
@Override
public 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;
}
Aggregations