mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 02:39:05 +01:00
Refactoring: shorter class names.
This commit is contained in:
@@ -8,7 +8,7 @@ import net.sf.briar.api.transport.BatchTransportWriter;
|
||||
* An interface for transport plugins that do not support bidirectional,
|
||||
* reliable, ordered, timely delivery of data.
|
||||
*/
|
||||
public interface BatchTransportPlugin extends TransportPlugin {
|
||||
public interface BatchPlugin extends Plugin {
|
||||
|
||||
/**
|
||||
* Attempts to create and return a BatchTransportReader for the given
|
||||
@@ -8,7 +8,7 @@ import net.sf.briar.api.transport.BatchTransportWriter;
|
||||
* An interface for receiving readers and writers created by a batch-mode
|
||||
* transport plugin.
|
||||
*/
|
||||
public interface BatchTransportCallback extends TransportCallback {
|
||||
public interface BatchPluginCallback extends PluginCallback {
|
||||
|
||||
void readerCreated(BatchTransportReader r);
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.io.IOException;
|
||||
|
||||
import net.sf.briar.api.TransportId;
|
||||
|
||||
public interface TransportPlugin {
|
||||
public interface Plugin {
|
||||
|
||||
/** Returns the plugin's transport identifier. */
|
||||
TransportId getId();
|
||||
@@ -10,7 +10,7 @@ import net.sf.briar.api.TransportProperties;
|
||||
* An interface through which a transport plugin interacts with the rest of
|
||||
* the application.
|
||||
*/
|
||||
public interface TransportCallback {
|
||||
public interface PluginCallback {
|
||||
|
||||
/** Returns the plugin's configuration. */
|
||||
TransportConfig getConfig();
|
||||
@@ -7,7 +7,7 @@ import net.sf.briar.api.transport.StreamTransportConnection;
|
||||
* An interface for transport plugins that support bidirectional, reliable,
|
||||
* ordered, timely delivery of data.
|
||||
*/
|
||||
public interface StreamTransportPlugin extends TransportPlugin {
|
||||
public interface StreamPlugin extends Plugin {
|
||||
|
||||
/**
|
||||
* Attempts to create and return a StreamTransportConnection to the given
|
||||
@@ -7,7 +7,7 @@ import net.sf.briar.api.transport.StreamTransportConnection;
|
||||
* An interface for receiving connections created by a stream-mode transport
|
||||
* plugin.
|
||||
*/
|
||||
public interface StreamTransportCallback extends TransportCallback {
|
||||
public interface StreamPluginCallback extends PluginCallback {
|
||||
|
||||
void incomingConnectionCreated(StreamTransportConnection c);
|
||||
|
||||
@@ -3,9 +3,9 @@ package net.sf.briar.plugins;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import net.sf.briar.api.plugins.TransportPlugin;
|
||||
import net.sf.briar.api.plugins.Plugin;
|
||||
|
||||
public abstract class AbstractPlugin implements TransportPlugin {
|
||||
public abstract class AbstractPlugin implements Plugin {
|
||||
|
||||
protected final Executor executor;
|
||||
|
||||
|
||||
@@ -21,14 +21,14 @@ import net.sf.briar.api.ContactId;
|
||||
import net.sf.briar.api.TransportConfig;
|
||||
import net.sf.briar.api.TransportId;
|
||||
import net.sf.briar.api.TransportProperties;
|
||||
import net.sf.briar.api.plugins.StreamTransportCallback;
|
||||
import net.sf.briar.api.plugins.StreamTransportPlugin;
|
||||
import net.sf.briar.api.plugins.StreamPluginCallback;
|
||||
import net.sf.briar.api.plugins.StreamPlugin;
|
||||
import net.sf.briar.api.transport.StreamTransportConnection;
|
||||
import net.sf.briar.plugins.AbstractPlugin;
|
||||
import net.sf.briar.util.OsUtils;
|
||||
import net.sf.briar.util.StringUtils;
|
||||
|
||||
class BluetoothPlugin extends AbstractPlugin implements StreamTransportPlugin {
|
||||
class BluetoothPlugin extends AbstractPlugin implements StreamPlugin {
|
||||
|
||||
public static final int TRANSPORT_ID = 2;
|
||||
|
||||
@@ -36,13 +36,13 @@ class BluetoothPlugin extends AbstractPlugin implements StreamTransportPlugin {
|
||||
private static final Logger LOG =
|
||||
Logger.getLogger(BluetoothPlugin.class.getName());
|
||||
|
||||
private final StreamTransportCallback callback;
|
||||
private final StreamPluginCallback callback;
|
||||
private final long pollingInterval;
|
||||
|
||||
private LocalDevice localDevice = null;
|
||||
private StreamConnectionNotifier streamConnectionNotifier = null;
|
||||
|
||||
BluetoothPlugin(Executor executor, StreamTransportCallback callback,
|
||||
BluetoothPlugin(Executor executor, StreamPluginCallback callback,
|
||||
long pollingInterval) {
|
||||
super(executor);
|
||||
this.callback = callback;
|
||||
|
||||
@@ -10,8 +10,8 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.sf.briar.api.ContactId;
|
||||
import net.sf.briar.api.plugins.BatchTransportCallback;
|
||||
import net.sf.briar.api.plugins.BatchTransportPlugin;
|
||||
import net.sf.briar.api.plugins.BatchPluginCallback;
|
||||
import net.sf.briar.api.plugins.BatchPlugin;
|
||||
import net.sf.briar.api.transport.BatchTransportReader;
|
||||
import net.sf.briar.api.transport.BatchTransportWriter;
|
||||
import net.sf.briar.api.transport.TransportConstants;
|
||||
@@ -19,19 +19,18 @@ import net.sf.briar.plugins.AbstractPlugin;
|
||||
|
||||
import org.apache.commons.io.FileSystemUtils;
|
||||
|
||||
abstract class FilePlugin extends AbstractPlugin
|
||||
implements BatchTransportPlugin {
|
||||
abstract class FilePlugin extends AbstractPlugin implements BatchPlugin {
|
||||
|
||||
private static final Logger LOG =
|
||||
Logger.getLogger(FilePlugin.class.getName());
|
||||
|
||||
protected final BatchTransportCallback callback;
|
||||
protected final BatchPluginCallback callback;
|
||||
|
||||
protected abstract File chooseOutputDirectory();
|
||||
protected abstract void writerFinished(File f);
|
||||
protected abstract void readerFinished(File f);
|
||||
|
||||
protected FilePlugin(Executor executor, BatchTransportCallback callback) {
|
||||
protected FilePlugin(Executor executor, BatchPluginCallback callback) {
|
||||
super(executor);
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.sf.briar.api.TransportId;
|
||||
import net.sf.briar.api.plugins.BatchTransportCallback;
|
||||
import net.sf.briar.api.plugins.BatchPluginCallback;
|
||||
|
||||
class RemovableDrivePlugin extends FilePlugin
|
||||
implements RemovableDriveMonitor.Callback {
|
||||
@@ -22,7 +22,7 @@ implements RemovableDriveMonitor.Callback {
|
||||
private final RemovableDriveFinder finder;
|
||||
private final RemovableDriveMonitor monitor;
|
||||
|
||||
RemovableDrivePlugin(Executor executor, BatchTransportCallback callback,
|
||||
RemovableDrivePlugin(Executor executor, BatchPluginCallback callback,
|
||||
RemovableDriveFinder finder, RemovableDriveMonitor monitor) {
|
||||
super(executor, callback);
|
||||
this.finder = finder;
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.util.concurrent.Executor;
|
||||
import net.sf.briar.api.ContactId;
|
||||
import net.sf.briar.api.TransportId;
|
||||
import net.sf.briar.api.TransportProperties;
|
||||
import net.sf.briar.api.plugins.StreamTransportCallback;
|
||||
import net.sf.briar.api.plugins.StreamPluginCallback;
|
||||
|
||||
class SimpleSocketPlugin extends SocketPlugin {
|
||||
|
||||
@@ -20,7 +20,7 @@ class SimpleSocketPlugin extends SocketPlugin {
|
||||
|
||||
private final long pollingInterval;
|
||||
|
||||
SimpleSocketPlugin(Executor executor, StreamTransportCallback callback,
|
||||
SimpleSocketPlugin(Executor executor, StreamPluginCallback callback,
|
||||
long pollingInterval) {
|
||||
super(executor, callback);
|
||||
this.pollingInterval = pollingInterval;
|
||||
|
||||
@@ -9,18 +9,17 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.sf.briar.api.ContactId;
|
||||
import net.sf.briar.api.plugins.StreamTransportCallback;
|
||||
import net.sf.briar.api.plugins.StreamTransportPlugin;
|
||||
import net.sf.briar.api.plugins.StreamPluginCallback;
|
||||
import net.sf.briar.api.plugins.StreamPlugin;
|
||||
import net.sf.briar.api.transport.StreamTransportConnection;
|
||||
import net.sf.briar.plugins.AbstractPlugin;
|
||||
|
||||
abstract class SocketPlugin extends AbstractPlugin
|
||||
implements StreamTransportPlugin {
|
||||
abstract class SocketPlugin extends AbstractPlugin implements StreamPlugin {
|
||||
|
||||
private static final Logger LOG =
|
||||
Logger.getLogger(SocketPlugin.class.getName());
|
||||
|
||||
protected final StreamTransportCallback callback;
|
||||
protected final StreamPluginCallback callback;
|
||||
|
||||
// This field must only be accessed with this's lock held
|
||||
protected ServerSocket socket = null;
|
||||
@@ -35,7 +34,7 @@ implements StreamTransportPlugin {
|
||||
protected abstract SocketAddress getRemoteSocketAddress(ContactId c);
|
||||
|
||||
protected SocketPlugin(Executor executor,
|
||||
StreamTransportCallback callback) {
|
||||
StreamPluginCallback callback) {
|
||||
super(executor);
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.util.Scanner;
|
||||
import net.sf.briar.api.ContactId;
|
||||
import net.sf.briar.api.TransportConfig;
|
||||
import net.sf.briar.api.TransportProperties;
|
||||
import net.sf.briar.api.plugins.StreamTransportCallback;
|
||||
import net.sf.briar.api.plugins.StreamPluginCallback;
|
||||
import net.sf.briar.api.transport.StreamTransportConnection;
|
||||
import net.sf.briar.plugins.ImmediateExecutor;
|
||||
|
||||
@@ -60,7 +60,7 @@ public class BluetoothClientTest {
|
||||
plugin.stop();
|
||||
}
|
||||
|
||||
private static class ClientCallback implements StreamTransportCallback {
|
||||
private static class ClientCallback implements StreamPluginCallback {
|
||||
|
||||
private TransportConfig config = new TransportConfig();
|
||||
private TransportProperties local = new TransportProperties();
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.util.Scanner;
|
||||
import net.sf.briar.api.ContactId;
|
||||
import net.sf.briar.api.TransportConfig;
|
||||
import net.sf.briar.api.TransportProperties;
|
||||
import net.sf.briar.api.plugins.StreamTransportCallback;
|
||||
import net.sf.briar.api.plugins.StreamPluginCallback;
|
||||
import net.sf.briar.api.transport.StreamTransportConnection;
|
||||
import net.sf.briar.plugins.ImmediateExecutor;
|
||||
|
||||
@@ -40,7 +40,7 @@ public class BluetoothServerTest {
|
||||
plugin.stop();
|
||||
}
|
||||
|
||||
private static class ServerCallback implements StreamTransportCallback {
|
||||
private static class ServerCallback implements StreamPluginCallback {
|
||||
|
||||
private TransportConfig config = new TransportConfig();
|
||||
private TransportProperties local = new TransportProperties();
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.concurrent.Executor;
|
||||
import junit.framework.TestCase;
|
||||
import net.sf.briar.TestUtils;
|
||||
import net.sf.briar.api.ContactId;
|
||||
import net.sf.briar.api.plugins.BatchTransportCallback;
|
||||
import net.sf.briar.api.plugins.BatchPluginCallback;
|
||||
import net.sf.briar.api.transport.BatchTransportWriter;
|
||||
import net.sf.briar.api.transport.TransportConstants;
|
||||
import net.sf.briar.plugins.ImmediateExecutor;
|
||||
@@ -37,8 +37,8 @@ public class RemovableDrivePluginTest extends TestCase {
|
||||
public void testGetId() {
|
||||
Mockery context = new Mockery();
|
||||
final Executor executor = context.mock(Executor.class);
|
||||
final BatchTransportCallback callback =
|
||||
context.mock(BatchTransportCallback.class);
|
||||
final BatchPluginCallback callback =
|
||||
context.mock(BatchPluginCallback.class);
|
||||
final RemovableDriveFinder finder =
|
||||
context.mock(RemovableDriveFinder.class);
|
||||
final RemovableDriveMonitor monitor =
|
||||
@@ -59,8 +59,8 @@ public class RemovableDrivePluginTest extends TestCase {
|
||||
|
||||
Mockery context = new Mockery();
|
||||
final Executor executor = context.mock(Executor.class);
|
||||
final BatchTransportCallback callback =
|
||||
context.mock(BatchTransportCallback.class);
|
||||
final BatchPluginCallback callback =
|
||||
context.mock(BatchPluginCallback.class);
|
||||
final RemovableDriveFinder finder =
|
||||
context.mock(RemovableDriveFinder.class);
|
||||
final RemovableDriveMonitor monitor =
|
||||
@@ -91,8 +91,8 @@ public class RemovableDrivePluginTest extends TestCase {
|
||||
|
||||
Mockery context = new Mockery();
|
||||
final Executor executor = context.mock(Executor.class);
|
||||
final BatchTransportCallback callback =
|
||||
context.mock(BatchTransportCallback.class);
|
||||
final BatchPluginCallback callback =
|
||||
context.mock(BatchPluginCallback.class);
|
||||
final RemovableDriveFinder finder =
|
||||
context.mock(RemovableDriveFinder.class);
|
||||
final RemovableDriveMonitor monitor =
|
||||
@@ -128,8 +128,8 @@ public class RemovableDrivePluginTest extends TestCase {
|
||||
|
||||
Mockery context = new Mockery();
|
||||
final Executor executor = context.mock(Executor.class);
|
||||
final BatchTransportCallback callback =
|
||||
context.mock(BatchTransportCallback.class);
|
||||
final BatchPluginCallback callback =
|
||||
context.mock(BatchPluginCallback.class);
|
||||
final RemovableDriveFinder finder =
|
||||
context.mock(RemovableDriveFinder.class);
|
||||
final RemovableDriveMonitor monitor =
|
||||
@@ -167,8 +167,8 @@ public class RemovableDrivePluginTest extends TestCase {
|
||||
|
||||
Mockery context = new Mockery();
|
||||
final Executor executor = context.mock(Executor.class);
|
||||
final BatchTransportCallback callback =
|
||||
context.mock(BatchTransportCallback.class);
|
||||
final BatchPluginCallback callback =
|
||||
context.mock(BatchPluginCallback.class);
|
||||
final RemovableDriveFinder finder =
|
||||
context.mock(RemovableDriveFinder.class);
|
||||
final RemovableDriveMonitor monitor =
|
||||
@@ -206,8 +206,8 @@ public class RemovableDrivePluginTest extends TestCase {
|
||||
|
||||
Mockery context = new Mockery();
|
||||
final Executor executor = context.mock(Executor.class);
|
||||
final BatchTransportCallback callback =
|
||||
context.mock(BatchTransportCallback.class);
|
||||
final BatchPluginCallback callback =
|
||||
context.mock(BatchPluginCallback.class);
|
||||
final RemovableDriveFinder finder =
|
||||
context.mock(RemovableDriveFinder.class);
|
||||
final RemovableDriveMonitor monitor =
|
||||
@@ -248,8 +248,8 @@ public class RemovableDrivePluginTest extends TestCase {
|
||||
|
||||
Mockery context = new Mockery();
|
||||
final Executor executor = context.mock(Executor.class);
|
||||
final BatchTransportCallback callback =
|
||||
context.mock(BatchTransportCallback.class);
|
||||
final BatchPluginCallback callback =
|
||||
context.mock(BatchPluginCallback.class);
|
||||
final RemovableDriveFinder finder =
|
||||
context.mock(RemovableDriveFinder.class);
|
||||
final RemovableDriveMonitor monitor =
|
||||
@@ -294,8 +294,8 @@ public class RemovableDrivePluginTest extends TestCase {
|
||||
public void testEmptyDriveIsIgnored() throws Exception {
|
||||
Mockery context = new Mockery();
|
||||
final Executor executor = context.mock(Executor.class);
|
||||
final BatchTransportCallback callback =
|
||||
context.mock(BatchTransportCallback.class);
|
||||
final BatchPluginCallback callback =
|
||||
context.mock(BatchPluginCallback.class);
|
||||
final RemovableDriveFinder finder =
|
||||
context.mock(RemovableDriveFinder.class);
|
||||
final RemovableDriveMonitor monitor =
|
||||
@@ -318,8 +318,8 @@ public class RemovableDrivePluginTest extends TestCase {
|
||||
public void testFilenames() {
|
||||
Mockery context = new Mockery();
|
||||
final Executor executor = context.mock(Executor.class);
|
||||
final BatchTransportCallback callback =
|
||||
context.mock(BatchTransportCallback.class);
|
||||
final BatchPluginCallback callback =
|
||||
context.mock(BatchPluginCallback.class);
|
||||
final RemovableDriveFinder finder =
|
||||
context.mock(RemovableDriveFinder.class);
|
||||
final RemovableDriveMonitor monitor =
|
||||
@@ -341,8 +341,8 @@ public class RemovableDrivePluginTest extends TestCase {
|
||||
@Test
|
||||
public void testSmallFileIsIgnored() throws Exception {
|
||||
Mockery context = new Mockery();
|
||||
final BatchTransportCallback callback =
|
||||
context.mock(BatchTransportCallback.class);
|
||||
final BatchPluginCallback callback =
|
||||
context.mock(BatchPluginCallback.class);
|
||||
final RemovableDriveFinder finder =
|
||||
context.mock(RemovableDriveFinder.class);
|
||||
final RemovableDriveMonitor monitor =
|
||||
@@ -370,8 +370,8 @@ public class RemovableDrivePluginTest extends TestCase {
|
||||
@Test
|
||||
public void testReaderIsCreated() throws Exception {
|
||||
Mockery context = new Mockery();
|
||||
final BatchTransportCallback callback =
|
||||
context.mock(BatchTransportCallback.class);
|
||||
final BatchPluginCallback callback =
|
||||
context.mock(BatchPluginCallback.class);
|
||||
final RemovableDriveFinder finder =
|
||||
context.mock(RemovableDriveFinder.class);
|
||||
final RemovableDriveMonitor monitor =
|
||||
|
||||
@@ -14,7 +14,7 @@ import junit.framework.TestCase;
|
||||
import net.sf.briar.api.ContactId;
|
||||
import net.sf.briar.api.TransportConfig;
|
||||
import net.sf.briar.api.TransportProperties;
|
||||
import net.sf.briar.api.plugins.StreamTransportCallback;
|
||||
import net.sf.briar.api.plugins.StreamPluginCallback;
|
||||
import net.sf.briar.api.transport.StreamTransportConnection;
|
||||
import net.sf.briar.plugins.ImmediateExecutor;
|
||||
|
||||
@@ -99,7 +99,7 @@ public class SimpleSocketPluginTest extends TestCase {
|
||||
plugin.stop();
|
||||
}
|
||||
|
||||
private static class StreamCallback implements StreamTransportCallback {
|
||||
private static class StreamCallback implements StreamPluginCallback {
|
||||
|
||||
private TransportConfig config = new TransportConfig();
|
||||
private TransportProperties local = new TransportProperties();
|
||||
|
||||
Reference in New Issue
Block a user