Use namespaced strings for Transport IDs

This commit is contained in:
Torsten Grote
2016-11-17 17:06:26 -02:00
parent 37e61c97ea
commit e32313c30b
16 changed files with 71 additions and 32 deletions

View File

@@ -49,20 +49,17 @@ import static java.util.logging.Level.INFO;
import static java.util.logging.Level.WARNING;
import static javax.bluetooth.DiscoveryAgent.GIAC;
import static org.briarproject.api.keyagreement.KeyAgreementConstants.TRANSPORT_ID_BLUETOOTH;
import static org.briarproject.api.plugins.BluetoothConstants.ID;
import static org.briarproject.api.plugins.BluetoothConstants.PROP_ADDRESS;
import static org.briarproject.api.plugins.BluetoothConstants.PROP_UUID;
import static org.briarproject.api.plugins.BluetoothConstants.UUID_BYTES;
@MethodsNotNullByDefault
@ParametersNotNullByDefault
class BluetoothPlugin implements DuplexPlugin {
// Share an ID with the Android Bluetooth plugin
static final TransportId ID = new TransportId("bt");
private static final Logger LOG =
Logger.getLogger(BluetoothPlugin.class.getName());
private static final int UUID_BYTES = 16;
private static final String PROP_ADDRESS = "address";
private static final String PROP_UUID = "uuid";
private final Executor ioExecutor;
private final SecureRandom secureRandom;
@@ -507,7 +504,7 @@ class BluetoothPlugin implements DuplexPlugin {
private final StreamConnectionNotifier ss;
BluetoothKeyAgreementListener(BdfList descriptor,
private BluetoothKeyAgreementListener(BdfList descriptor,
StreamConnectionNotifier ss) {
super(descriptor);
this.ss = ss;

View File

@@ -10,6 +10,8 @@ import org.briarproject.api.plugins.duplex.DuplexPluginFactory;
import java.security.SecureRandom;
import java.util.concurrent.Executor;
import static org.briarproject.api.plugins.BluetoothConstants.ID;
public class BluetoothPluginFactory implements DuplexPluginFactory {
private static final int MAX_LATENCY = 30 * 1000; // 30 seconds
@@ -30,7 +32,7 @@ public class BluetoothPluginFactory implements DuplexPluginFactory {
@Override
public TransportId getId() {
return BluetoothPlugin.ID;
return ID;
}
@Override

View File

@@ -19,7 +19,8 @@ import static java.util.logging.Level.WARNING;
class RemovableDrivePlugin extends FilePlugin
implements RemovableDriveMonitor.Callback {
static final TransportId ID = new TransportId("file");
static final TransportId ID =
new TransportId("org.briarproject.bramble.file");
private static final Logger LOG =
Logger.getLogger(RemovableDrivePlugin.class.getName());

View File

@@ -28,7 +28,8 @@ import static java.util.logging.Level.WARNING;
@ParametersNotNullByDefault
class ModemPlugin implements DuplexPlugin, Modem.Callback {
static final TransportId ID = new TransportId("modem");
static final TransportId ID =
new TransportId("org.briarproject.bramble.modem");
private static final Logger LOG =
Logger.getLogger(ModemPlugin.class.getName());