Refactored FileUtils.

Removed methods that are no longer needed for Java 6, moved the remaining method into the utils directory.
This commit is contained in:
akwizgran
2015-12-10 15:58:52 +00:00
parent 947da886bf
commit 912ba394c5
19 changed files with 274 additions and 366 deletions

View File

@@ -1,6 +1,8 @@
package org.briarproject.plugins.file;
import static java.util.logging.Level.WARNING;
import org.briarproject.api.ContactId;
import org.briarproject.api.TransportId;
import org.briarproject.api.plugins.simplex.SimplexPluginCallback;
import java.io.File;
import java.io.IOException;
@@ -11,10 +13,7 @@ import java.util.List;
import java.util.concurrent.Executor;
import java.util.logging.Logger;
import org.briarproject.api.ContactId;
import org.briarproject.api.TransportId;
import org.briarproject.api.plugins.simplex.SimplexPluginCallback;
import org.briarproject.api.system.FileUtils;
import static java.util.logging.Level.WARNING;
class RemovableDrivePlugin extends FilePlugin
implements RemovableDriveMonitor.Callback {
@@ -27,10 +26,10 @@ implements RemovableDriveMonitor.Callback {
private final RemovableDriveFinder finder;
private final RemovableDriveMonitor monitor;
RemovableDrivePlugin(Executor ioExecutor, FileUtils fileUtils,
SimplexPluginCallback callback, RemovableDriveFinder finder,
RemovableDriveMonitor monitor, int maxLatency) {
super(ioExecutor, fileUtils, callback, maxLatency);
RemovableDrivePlugin(Executor ioExecutor, SimplexPluginCallback callback,
RemovableDriveFinder finder, RemovableDriveMonitor monitor,
int maxLatency) {
super(ioExecutor, callback, maxLatency);
this.finder = finder;
this.monitor = monitor;
}

View File

@@ -1,14 +1,13 @@
package org.briarproject.plugins.file;
import java.util.concurrent.Executor;
import org.briarproject.api.TransportId;
import org.briarproject.api.plugins.simplex.SimplexPlugin;
import org.briarproject.api.plugins.simplex.SimplexPluginCallback;
import org.briarproject.api.plugins.simplex.SimplexPluginFactory;
import org.briarproject.api.system.FileUtils;
import org.briarproject.util.OsUtils;
import java.util.concurrent.Executor;
public class RemovableDrivePluginFactory implements SimplexPluginFactory {
// Maximum latency 14 days (Royal Mail or lackadaisical carrier pigeon)
@@ -16,12 +15,9 @@ public class RemovableDrivePluginFactory implements SimplexPluginFactory {
private static final int POLLING_INTERVAL = 10 * 1000; // 10 seconds
private final Executor ioExecutor;
private final FileUtils fileUtils;
public RemovableDrivePluginFactory(Executor ioExecutor,
FileUtils fileUtils) {
public RemovableDrivePluginFactory(Executor ioExecutor) {
this.ioExecutor = ioExecutor;
this.fileUtils = fileUtils;
}
public TransportId getId() {
@@ -49,7 +45,7 @@ public class RemovableDrivePluginFactory implements SimplexPluginFactory {
} else {
return null;
}
return new RemovableDrivePlugin(ioExecutor, fileUtils, callback,
finder, monitor, MAX_LATENCY);
return new RemovableDrivePlugin(ioExecutor, callback, finder, monitor,
MAX_LATENCY);
}
}