Refactoring: shorter class names.

This commit is contained in:
akwizgran
2011-10-12 17:25:37 +01:00
parent c5d9d9fa64
commit 64e2d7bca9
16 changed files with 56 additions and 58 deletions

View File

@@ -8,7 +8,7 @@ import net.sf.briar.api.transport.BatchTransportWriter;
* An interface for transport plugins that do not support bidirectional, * An interface for transport plugins that do not support bidirectional,
* reliable, ordered, timely delivery of data. * 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 * Attempts to create and return a BatchTransportReader for the given

View File

@@ -8,7 +8,7 @@ import net.sf.briar.api.transport.BatchTransportWriter;
* An interface for receiving readers and writers created by a batch-mode * An interface for receiving readers and writers created by a batch-mode
* transport plugin. * transport plugin.
*/ */
public interface BatchTransportCallback extends TransportCallback { public interface BatchPluginCallback extends PluginCallback {
void readerCreated(BatchTransportReader r); void readerCreated(BatchTransportReader r);

View File

@@ -4,7 +4,7 @@ import java.io.IOException;
import net.sf.briar.api.TransportId; import net.sf.briar.api.TransportId;
public interface TransportPlugin { public interface Plugin {
/** Returns the plugin's transport identifier. */ /** Returns the plugin's transport identifier. */
TransportId getId(); TransportId getId();

View File

@@ -10,7 +10,7 @@ import net.sf.briar.api.TransportProperties;
* An interface through which a transport plugin interacts with the rest of * An interface through which a transport plugin interacts with the rest of
* the application. * the application.
*/ */
public interface TransportCallback { public interface PluginCallback {
/** Returns the plugin's configuration. */ /** Returns the plugin's configuration. */
TransportConfig getConfig(); TransportConfig getConfig();

View File

@@ -7,7 +7,7 @@ import net.sf.briar.api.transport.StreamTransportConnection;
* An interface for transport plugins that support bidirectional, reliable, * An interface for transport plugins that support bidirectional, reliable,
* ordered, timely delivery of data. * 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 * Attempts to create and return a StreamTransportConnection to the given

View File

@@ -7,7 +7,7 @@ import net.sf.briar.api.transport.StreamTransportConnection;
* An interface for receiving connections created by a stream-mode transport * An interface for receiving connections created by a stream-mode transport
* plugin. * plugin.
*/ */
public interface StreamTransportCallback extends TransportCallback { public interface StreamPluginCallback extends PluginCallback {
void incomingConnectionCreated(StreamTransportConnection c); void incomingConnectionCreated(StreamTransportConnection c);

View File

@@ -3,9 +3,9 @@ package net.sf.briar.plugins;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.Executor; 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; protected final Executor executor;

View File

@@ -21,14 +21,14 @@ import net.sf.briar.api.ContactId;
import net.sf.briar.api.TransportConfig; import net.sf.briar.api.TransportConfig;
import net.sf.briar.api.TransportId; import net.sf.briar.api.TransportId;
import net.sf.briar.api.TransportProperties; 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.plugins.StreamTransportPlugin; import net.sf.briar.api.plugins.StreamPlugin;
import net.sf.briar.api.transport.StreamTransportConnection; import net.sf.briar.api.transport.StreamTransportConnection;
import net.sf.briar.plugins.AbstractPlugin; import net.sf.briar.plugins.AbstractPlugin;
import net.sf.briar.util.OsUtils; import net.sf.briar.util.OsUtils;
import net.sf.briar.util.StringUtils; 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; public static final int TRANSPORT_ID = 2;
@@ -36,13 +36,13 @@ class BluetoothPlugin extends AbstractPlugin implements StreamTransportPlugin {
private static final Logger LOG = private static final Logger LOG =
Logger.getLogger(BluetoothPlugin.class.getName()); Logger.getLogger(BluetoothPlugin.class.getName());
private final StreamTransportCallback callback; private final StreamPluginCallback callback;
private final long pollingInterval; private final long pollingInterval;
private LocalDevice localDevice = null; private LocalDevice localDevice = null;
private StreamConnectionNotifier streamConnectionNotifier = null; private StreamConnectionNotifier streamConnectionNotifier = null;
BluetoothPlugin(Executor executor, StreamTransportCallback callback, BluetoothPlugin(Executor executor, StreamPluginCallback callback,
long pollingInterval) { long pollingInterval) {
super(executor); super(executor);
this.callback = callback; this.callback = callback;

View File

@@ -10,8 +10,8 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import net.sf.briar.api.ContactId; 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.plugins.BatchTransportPlugin; import net.sf.briar.api.plugins.BatchPlugin;
import net.sf.briar.api.transport.BatchTransportReader; import net.sf.briar.api.transport.BatchTransportReader;
import net.sf.briar.api.transport.BatchTransportWriter; import net.sf.briar.api.transport.BatchTransportWriter;
import net.sf.briar.api.transport.TransportConstants; import net.sf.briar.api.transport.TransportConstants;
@@ -19,19 +19,18 @@ import net.sf.briar.plugins.AbstractPlugin;
import org.apache.commons.io.FileSystemUtils; import org.apache.commons.io.FileSystemUtils;
abstract class FilePlugin extends AbstractPlugin abstract class FilePlugin extends AbstractPlugin implements BatchPlugin {
implements BatchTransportPlugin {
private static final Logger LOG = private static final Logger LOG =
Logger.getLogger(FilePlugin.class.getName()); Logger.getLogger(FilePlugin.class.getName());
protected final BatchTransportCallback callback; protected final BatchPluginCallback callback;
protected abstract File chooseOutputDirectory(); protected abstract File chooseOutputDirectory();
protected abstract void writerFinished(File f); protected abstract void writerFinished(File f);
protected abstract void readerFinished(File f); protected abstract void readerFinished(File f);
protected FilePlugin(Executor executor, BatchTransportCallback callback) { protected FilePlugin(Executor executor, BatchPluginCallback callback) {
super(executor); super(executor);
this.callback = callback; this.callback = callback;
} }

View File

@@ -8,7 +8,7 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import net.sf.briar.api.TransportId; import net.sf.briar.api.TransportId;
import net.sf.briar.api.plugins.BatchTransportCallback; import net.sf.briar.api.plugins.BatchPluginCallback;
class RemovableDrivePlugin extends FilePlugin class RemovableDrivePlugin extends FilePlugin
implements RemovableDriveMonitor.Callback { implements RemovableDriveMonitor.Callback {
@@ -22,7 +22,7 @@ implements RemovableDriveMonitor.Callback {
private final RemovableDriveFinder finder; private final RemovableDriveFinder finder;
private final RemovableDriveMonitor monitor; private final RemovableDriveMonitor monitor;
RemovableDrivePlugin(Executor executor, BatchTransportCallback callback, RemovableDrivePlugin(Executor executor, BatchPluginCallback callback,
RemovableDriveFinder finder, RemovableDriveMonitor monitor) { RemovableDriveFinder finder, RemovableDriveMonitor monitor) {
super(executor, callback); super(executor, callback);
this.finder = finder; this.finder = finder;

View File

@@ -10,7 +10,7 @@ import java.util.concurrent.Executor;
import net.sf.briar.api.ContactId; import net.sf.briar.api.ContactId;
import net.sf.briar.api.TransportId; import net.sf.briar.api.TransportId;
import net.sf.briar.api.TransportProperties; import net.sf.briar.api.TransportProperties;
import net.sf.briar.api.plugins.StreamTransportCallback; import net.sf.briar.api.plugins.StreamPluginCallback;
class SimpleSocketPlugin extends SocketPlugin { class SimpleSocketPlugin extends SocketPlugin {
@@ -20,7 +20,7 @@ class SimpleSocketPlugin extends SocketPlugin {
private final long pollingInterval; private final long pollingInterval;
SimpleSocketPlugin(Executor executor, StreamTransportCallback callback, SimpleSocketPlugin(Executor executor, StreamPluginCallback callback,
long pollingInterval) { long pollingInterval) {
super(executor, callback); super(executor, callback);
this.pollingInterval = pollingInterval; this.pollingInterval = pollingInterval;

View File

@@ -9,18 +9,17 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import net.sf.briar.api.ContactId; import net.sf.briar.api.ContactId;
import net.sf.briar.api.plugins.StreamTransportCallback; import net.sf.briar.api.plugins.StreamPluginCallback;
import net.sf.briar.api.plugins.StreamTransportPlugin; import net.sf.briar.api.plugins.StreamPlugin;
import net.sf.briar.api.transport.StreamTransportConnection; import net.sf.briar.api.transport.StreamTransportConnection;
import net.sf.briar.plugins.AbstractPlugin; import net.sf.briar.plugins.AbstractPlugin;
abstract class SocketPlugin extends AbstractPlugin abstract class SocketPlugin extends AbstractPlugin implements StreamPlugin {
implements StreamTransportPlugin {
private static final Logger LOG = private static final Logger LOG =
Logger.getLogger(SocketPlugin.class.getName()); Logger.getLogger(SocketPlugin.class.getName());
protected final StreamTransportCallback callback; protected final StreamPluginCallback callback;
// This field must only be accessed with this's lock held // This field must only be accessed with this's lock held
protected ServerSocket socket = null; protected ServerSocket socket = null;
@@ -35,7 +34,7 @@ implements StreamTransportPlugin {
protected abstract SocketAddress getRemoteSocketAddress(ContactId c); protected abstract SocketAddress getRemoteSocketAddress(ContactId c);
protected SocketPlugin(Executor executor, protected SocketPlugin(Executor executor,
StreamTransportCallback callback) { StreamPluginCallback callback) {
super(executor); super(executor);
this.callback = callback; this.callback = callback;
} }

View File

@@ -8,7 +8,7 @@ import java.util.Scanner;
import net.sf.briar.api.ContactId; import net.sf.briar.api.ContactId;
import net.sf.briar.api.TransportConfig; import net.sf.briar.api.TransportConfig;
import net.sf.briar.api.TransportProperties; 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.api.transport.StreamTransportConnection;
import net.sf.briar.plugins.ImmediateExecutor; import net.sf.briar.plugins.ImmediateExecutor;
@@ -60,7 +60,7 @@ public class BluetoothClientTest {
plugin.stop(); plugin.stop();
} }
private static class ClientCallback implements StreamTransportCallback { private static class ClientCallback implements StreamPluginCallback {
private TransportConfig config = new TransportConfig(); private TransportConfig config = new TransportConfig();
private TransportProperties local = new TransportProperties(); private TransportProperties local = new TransportProperties();

View File

@@ -9,7 +9,7 @@ import java.util.Scanner;
import net.sf.briar.api.ContactId; import net.sf.briar.api.ContactId;
import net.sf.briar.api.TransportConfig; import net.sf.briar.api.TransportConfig;
import net.sf.briar.api.TransportProperties; 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.api.transport.StreamTransportConnection;
import net.sf.briar.plugins.ImmediateExecutor; import net.sf.briar.plugins.ImmediateExecutor;
@@ -40,7 +40,7 @@ public class BluetoothServerTest {
plugin.stop(); plugin.stop();
} }
private static class ServerCallback implements StreamTransportCallback { private static class ServerCallback implements StreamPluginCallback {
private TransportConfig config = new TransportConfig(); private TransportConfig config = new TransportConfig();
private TransportProperties local = new TransportProperties(); private TransportProperties local = new TransportProperties();

View File

@@ -11,7 +11,7 @@ import java.util.concurrent.Executor;
import junit.framework.TestCase; import junit.framework.TestCase;
import net.sf.briar.TestUtils; import net.sf.briar.TestUtils;
import net.sf.briar.api.ContactId; 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.BatchTransportWriter;
import net.sf.briar.api.transport.TransportConstants; import net.sf.briar.api.transport.TransportConstants;
import net.sf.briar.plugins.ImmediateExecutor; import net.sf.briar.plugins.ImmediateExecutor;
@@ -37,8 +37,8 @@ public class RemovableDrivePluginTest extends TestCase {
public void testGetId() { public void testGetId() {
Mockery context = new Mockery(); Mockery context = new Mockery();
final Executor executor = context.mock(Executor.class); final Executor executor = context.mock(Executor.class);
final BatchTransportCallback callback = final BatchPluginCallback callback =
context.mock(BatchTransportCallback.class); context.mock(BatchPluginCallback.class);
final RemovableDriveFinder finder = final RemovableDriveFinder finder =
context.mock(RemovableDriveFinder.class); context.mock(RemovableDriveFinder.class);
final RemovableDriveMonitor monitor = final RemovableDriveMonitor monitor =
@@ -59,8 +59,8 @@ public class RemovableDrivePluginTest extends TestCase {
Mockery context = new Mockery(); Mockery context = new Mockery();
final Executor executor = context.mock(Executor.class); final Executor executor = context.mock(Executor.class);
final BatchTransportCallback callback = final BatchPluginCallback callback =
context.mock(BatchTransportCallback.class); context.mock(BatchPluginCallback.class);
final RemovableDriveFinder finder = final RemovableDriveFinder finder =
context.mock(RemovableDriveFinder.class); context.mock(RemovableDriveFinder.class);
final RemovableDriveMonitor monitor = final RemovableDriveMonitor monitor =
@@ -91,8 +91,8 @@ public class RemovableDrivePluginTest extends TestCase {
Mockery context = new Mockery(); Mockery context = new Mockery();
final Executor executor = context.mock(Executor.class); final Executor executor = context.mock(Executor.class);
final BatchTransportCallback callback = final BatchPluginCallback callback =
context.mock(BatchTransportCallback.class); context.mock(BatchPluginCallback.class);
final RemovableDriveFinder finder = final RemovableDriveFinder finder =
context.mock(RemovableDriveFinder.class); context.mock(RemovableDriveFinder.class);
final RemovableDriveMonitor monitor = final RemovableDriveMonitor monitor =
@@ -128,8 +128,8 @@ public class RemovableDrivePluginTest extends TestCase {
Mockery context = new Mockery(); Mockery context = new Mockery();
final Executor executor = context.mock(Executor.class); final Executor executor = context.mock(Executor.class);
final BatchTransportCallback callback = final BatchPluginCallback callback =
context.mock(BatchTransportCallback.class); context.mock(BatchPluginCallback.class);
final RemovableDriveFinder finder = final RemovableDriveFinder finder =
context.mock(RemovableDriveFinder.class); context.mock(RemovableDriveFinder.class);
final RemovableDriveMonitor monitor = final RemovableDriveMonitor monitor =
@@ -167,8 +167,8 @@ public class RemovableDrivePluginTest extends TestCase {
Mockery context = new Mockery(); Mockery context = new Mockery();
final Executor executor = context.mock(Executor.class); final Executor executor = context.mock(Executor.class);
final BatchTransportCallback callback = final BatchPluginCallback callback =
context.mock(BatchTransportCallback.class); context.mock(BatchPluginCallback.class);
final RemovableDriveFinder finder = final RemovableDriveFinder finder =
context.mock(RemovableDriveFinder.class); context.mock(RemovableDriveFinder.class);
final RemovableDriveMonitor monitor = final RemovableDriveMonitor monitor =
@@ -206,8 +206,8 @@ public class RemovableDrivePluginTest extends TestCase {
Mockery context = new Mockery(); Mockery context = new Mockery();
final Executor executor = context.mock(Executor.class); final Executor executor = context.mock(Executor.class);
final BatchTransportCallback callback = final BatchPluginCallback callback =
context.mock(BatchTransportCallback.class); context.mock(BatchPluginCallback.class);
final RemovableDriveFinder finder = final RemovableDriveFinder finder =
context.mock(RemovableDriveFinder.class); context.mock(RemovableDriveFinder.class);
final RemovableDriveMonitor monitor = final RemovableDriveMonitor monitor =
@@ -248,8 +248,8 @@ public class RemovableDrivePluginTest extends TestCase {
Mockery context = new Mockery(); Mockery context = new Mockery();
final Executor executor = context.mock(Executor.class); final Executor executor = context.mock(Executor.class);
final BatchTransportCallback callback = final BatchPluginCallback callback =
context.mock(BatchTransportCallback.class); context.mock(BatchPluginCallback.class);
final RemovableDriveFinder finder = final RemovableDriveFinder finder =
context.mock(RemovableDriveFinder.class); context.mock(RemovableDriveFinder.class);
final RemovableDriveMonitor monitor = final RemovableDriveMonitor monitor =
@@ -294,8 +294,8 @@ public class RemovableDrivePluginTest extends TestCase {
public void testEmptyDriveIsIgnored() throws Exception { public void testEmptyDriveIsIgnored() throws Exception {
Mockery context = new Mockery(); Mockery context = new Mockery();
final Executor executor = context.mock(Executor.class); final Executor executor = context.mock(Executor.class);
final BatchTransportCallback callback = final BatchPluginCallback callback =
context.mock(BatchTransportCallback.class); context.mock(BatchPluginCallback.class);
final RemovableDriveFinder finder = final RemovableDriveFinder finder =
context.mock(RemovableDriveFinder.class); context.mock(RemovableDriveFinder.class);
final RemovableDriveMonitor monitor = final RemovableDriveMonitor monitor =
@@ -318,8 +318,8 @@ public class RemovableDrivePluginTest extends TestCase {
public void testFilenames() { public void testFilenames() {
Mockery context = new Mockery(); Mockery context = new Mockery();
final Executor executor = context.mock(Executor.class); final Executor executor = context.mock(Executor.class);
final BatchTransportCallback callback = final BatchPluginCallback callback =
context.mock(BatchTransportCallback.class); context.mock(BatchPluginCallback.class);
final RemovableDriveFinder finder = final RemovableDriveFinder finder =
context.mock(RemovableDriveFinder.class); context.mock(RemovableDriveFinder.class);
final RemovableDriveMonitor monitor = final RemovableDriveMonitor monitor =
@@ -341,8 +341,8 @@ public class RemovableDrivePluginTest extends TestCase {
@Test @Test
public void testSmallFileIsIgnored() throws Exception { public void testSmallFileIsIgnored() throws Exception {
Mockery context = new Mockery(); Mockery context = new Mockery();
final BatchTransportCallback callback = final BatchPluginCallback callback =
context.mock(BatchTransportCallback.class); context.mock(BatchPluginCallback.class);
final RemovableDriveFinder finder = final RemovableDriveFinder finder =
context.mock(RemovableDriveFinder.class); context.mock(RemovableDriveFinder.class);
final RemovableDriveMonitor monitor = final RemovableDriveMonitor monitor =
@@ -370,8 +370,8 @@ public class RemovableDrivePluginTest extends TestCase {
@Test @Test
public void testReaderIsCreated() throws Exception { public void testReaderIsCreated() throws Exception {
Mockery context = new Mockery(); Mockery context = new Mockery();
final BatchTransportCallback callback = final BatchPluginCallback callback =
context.mock(BatchTransportCallback.class); context.mock(BatchPluginCallback.class);
final RemovableDriveFinder finder = final RemovableDriveFinder finder =
context.mock(RemovableDriveFinder.class); context.mock(RemovableDriveFinder.class);
final RemovableDriveMonitor monitor = final RemovableDriveMonitor monitor =

View File

@@ -14,7 +14,7 @@ import junit.framework.TestCase;
import net.sf.briar.api.ContactId; import net.sf.briar.api.ContactId;
import net.sf.briar.api.TransportConfig; import net.sf.briar.api.TransportConfig;
import net.sf.briar.api.TransportProperties; 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.api.transport.StreamTransportConnection;
import net.sf.briar.plugins.ImmediateExecutor; import net.sf.briar.plugins.ImmediateExecutor;
@@ -99,7 +99,7 @@ public class SimpleSocketPluginTest extends TestCase {
plugin.stop(); plugin.stop();
} }
private static class StreamCallback implements StreamTransportCallback { private static class StreamCallback implements StreamPluginCallback {
private TransportConfig config = new TransportConfig(); private TransportConfig config = new TransportConfig();
private TransportProperties local = new TransportProperties(); private TransportProperties local = new TransportProperties();