private java.io.File getDirectory(DataSource dataSource, String directoryName) { String path = getPath() + "/" + directoryName; java.io.File f = new java.io.File(path); if (!f.exists()) directoryName = getApplicationDirectory(dataSource.getDirectory()).getAbsolutePath(); return ensureDirectory(directoryName); }
public java.io.File getDirectory() { String directoryName = getPath(); java.io.File f = new java.io.File(directoryName); if (!f.exists()) directoryName = getApplicationDirectory(dataSource.getDirectory()).getAbsolutePath(); return ensureDirectory(directoryName); }
private java.io.File getDirectory() { String directoryName = getPath(); java.io.File f = new java.io.File(directoryName); if (!f.exists()) directoryName = getApplicationDirectory(getDataSource().getDirectory()).getAbsolutePath(); return ensureDirectory(directoryName); }
File directory = getApplicationDirectory(dataSource.getDirectory()); String directoryPath = directory.getCanonicalPath();
public Download queueForDownload(DataSource dataSource, Downloadable downloadable) { Action action = Action.valueOf(dataSource.getAction()); File directory = getApplicationDirectory(dataSource.getDirectory()); File target = new File(directory, downloadable.getUri()); if (action.equals(Extract) || action.equals(Flatten)) target = ensureDirectory(target.getParentFile()); return downloadManager.queueForDownload(dataSource.getName() + ": " + downloadable.getUri(), dataSource.getBaseUrl() + downloadable.getUri(), action, new FileAndChecksum(target, downloadable.getLatestChecksum()), asFragments(target, downloadable.getFragments(), false)); }
private void addOrUpdateInQueue(DataSource dataSource, Downloadable downloadable) { Action action = Action.valueOf(dataSource.getAction()); File directory = getApplicationDirectory(dataSource.getDirectory()); File target = directory; // Flatten if (action.equals(Copy)) target = new File(directory, downloadable.getUri()); else if (action.equals(Extract)) target = target.getParentFile(); downloadManager.addOrUpdateInQueue(dataSource.getName() + ": " + downloadable.getUri(), dataSource.getBaseUrl() + downloadable.getUri(), action, new FileAndChecksum(target, downloadable.getLatestChecksum()), asFragments(directory, downloadable.getFragments(), action.equals(Extract))); }
public static DatasourceType asDatasourceType(DataSource dataSource) { DatasourceType datasourceType = new ObjectFactory().createDatasourceType(); datasourceType.setId(dataSource.getId()); datasourceType.setName(dataSource.getName()); datasourceType.setBaseUrl(dataSource.getBaseUrl()); datasourceType.setDirectory(dataSource.getDirectory()); datasourceType.setAction(ActionType.fromValue(dataSource.getAction())); return datasourceType; }