From 2740b2b0024df685ae964a5cba800b65d1616575 Mon Sep 17 00:00:00 2001 From: akwizgran Date: Tue, 2 Aug 2011 13:08:44 +0100 Subject: [PATCH] s/transport details/transport properties/g --- api/net/sf/briar/api/db/DatabaseComponent.java | 12 +++++++----- components/net/sf/briar/db/Database.java | 16 ++++++++-------- components/net/sf/briar/db/JdbcDatabase.java | 2 +- .../db/ReadWriteLockDatabaseComponent.java | 2 +- .../db/SynchronizedDatabaseComponent.java | 2 +- .../net/sf/briar/db/DatabaseComponentTest.java | 4 ++-- test/net/sf/briar/db/H2DatabaseTest.java | 18 +++++++++--------- 7 files changed, 29 insertions(+), 27 deletions(-) diff --git a/api/net/sf/briar/api/db/DatabaseComponent.java b/api/net/sf/briar/api/db/DatabaseComponent.java index 5671f13f1..7fc3908bf 100644 --- a/api/net/sf/briar/api/db/DatabaseComponent.java +++ b/api/net/sf/briar/api/db/DatabaseComponent.java @@ -55,8 +55,8 @@ public interface DatabaseComponent { void removeListener(DatabaseListener d); /** - * Adds a new contact to the database with the given transport details and - * returns an ID for the contact. + * Adds a new contact to the database with the given transport properties + * and returns an ID for the contact. */ ContactId addContact(Map transports) throws DbException; @@ -110,10 +110,10 @@ public interface DatabaseComponent { /** Returns the set of groups to which the user subscribes. */ Collection getSubscriptions() throws DbException; - /** Returns the local transport details. */ + /** Returns the local transport properties. */ Map getTransports() throws DbException; - /** Returns the transport details for the given contact. */ + /** Returns the transport properties for the given contact. */ Map getTransports(ContactId c) throws DbException; /** Returns the contacts to which the given group is visible. */ @@ -151,7 +151,9 @@ public interface DatabaseComponent { /** Records the user's rating for the given author. */ void setRating(AuthorId a, Rating r) throws DbException; - /** Sets the local transport details, replacing any existing details. */ + /** + * Sets the local transport properties, replacing any existing properties. + */ void setTransports(Map transports) throws DbException; /** diff --git a/components/net/sf/briar/db/Database.java b/components/net/sf/briar/db/Database.java index 35e083bb3..02eabb4dc 100644 --- a/components/net/sf/briar/db/Database.java +++ b/components/net/sf/briar/db/Database.java @@ -77,8 +77,8 @@ interface Database { void addBatchToAck(T txn, ContactId c, BatchId b) throws DbException; /** - * Adds a new contact to the database with the given transport details and - * returns an ID for the contact. + * Adds a new contact to the database with the given transport properties + * and returns an ID for the contact. *

* Locking: contacts write, transports write. */ @@ -268,14 +268,14 @@ interface Database { Collection getSubscriptions(T txn, ContactId c) throws DbException; /** - * Returns the local transport details. + * Returns the local transport properties. *

* Locking: transports read. */ Map getTransports(T txn) throws DbException; /** - * Returns the transport details for the given contact. + * Returns the transport properties for the given contact. *

* Locking: contacts read, transports read. */ @@ -397,8 +397,7 @@ interface Database { long timestamp) throws DbException; /** - * Sets the local transport details, replacing any existing transport - * details. + * Sets the local transport properties, replacing any existing properties. *

* Locking: transports write. */ @@ -406,8 +405,9 @@ interface Database { throws DbException; /** - * Sets the transport details for the given contact, replacing any existing - * transport details unless the existing details have a newer timestamp. + * Sets the transport properties for the given contact, replacing any + * existing properties unless the existing properties have a newer + * timestamp. *

* Locking: contacts write, transports write. */ diff --git a/components/net/sf/briar/db/JdbcDatabase.java b/components/net/sf/briar/db/JdbcDatabase.java index 5363496f6..37de77f4c 100644 --- a/components/net/sf/briar/db/JdbcDatabase.java +++ b/components/net/sf/briar/db/JdbcDatabase.java @@ -444,7 +444,7 @@ abstract class JdbcDatabase implements Database { int rowsAffected = ps.executeUpdate(); assert rowsAffected == 1; ps.close(); - // Store the contact's transport details + // Store the contact's transport properties if(transports != null) { sql = "INSERT INTO contactTransports (contactId, key, value)" + " VALUES (?, ?, ?)"; diff --git a/components/net/sf/briar/db/ReadWriteLockDatabaseComponent.java b/components/net/sf/briar/db/ReadWriteLockDatabaseComponent.java index 1b1d2bb16..2e7aca33c 100644 --- a/components/net/sf/briar/db/ReadWriteLockDatabaseComponent.java +++ b/components/net/sf/briar/db/ReadWriteLockDatabaseComponent.java @@ -818,7 +818,7 @@ class ReadWriteLockDatabaseComponent extends DatabaseComponentImpl { public void receiveTransports(ContactId c, Transports t) throws DbException { - // Update the contact's transport details + // Update the contact's transport properties contactLock.writeLock().lock(); try { if(!containsContact(c)) throw new NoSuchContactException(); diff --git a/components/net/sf/briar/db/SynchronizedDatabaseComponent.java b/components/net/sf/briar/db/SynchronizedDatabaseComponent.java index a5f58fa0f..d0e09670c 100644 --- a/components/net/sf/briar/db/SynchronizedDatabaseComponent.java +++ b/components/net/sf/briar/db/SynchronizedDatabaseComponent.java @@ -608,7 +608,7 @@ class SynchronizedDatabaseComponent extends DatabaseComponentImpl { public void receiveTransports(ContactId c, Transports t) throws DbException { - // Update the contact's transport details + // Update the contact's transport properties synchronized(contactLock) { if(!containsContact(c)) throw new NoSuchContactException(); synchronized(transportLock) { diff --git a/test/net/sf/briar/db/DatabaseComponentTest.java b/test/net/sf/briar/db/DatabaseComponentTest.java index a4ccdcfef..ffb4d1f93 100644 --- a/test/net/sf/briar/db/DatabaseComponentTest.java +++ b/test/net/sf/briar/db/DatabaseComponentTest.java @@ -744,10 +744,10 @@ public abstract class DatabaseComponentTest extends TestCase { allowing(database).commitTransaction(txn); allowing(database).containsContact(txn, contactId); will(returnValue(true)); - // Get the local transport details + // Get the local transport properties oneOf(database).getTransports(txn); will(returnValue(transports)); - // Add the transports to the writer + // Add the properties to the writer oneOf(transportWriter).writeTransports(transports); }}); DatabaseComponent db = createDatabaseComponent(database, cleaner); diff --git a/test/net/sf/briar/db/H2DatabaseTest.java b/test/net/sf/briar/db/H2DatabaseTest.java index 9f56e9303..9966684da 100644 --- a/test/net/sf/briar/db/H2DatabaseTest.java +++ b/test/net/sf/briar/db/H2DatabaseTest.java @@ -783,24 +783,24 @@ public class H2DatabaseTest extends TestCase { Database db = open(false); Connection txn = db.startTransaction(); - // Add a contact with some transport details + // Add a contact with some transport properties Map transports = Collections.singletonMap("foo", "bar"); assertEquals(contactId, db.addContact(txn, transports)); assertEquals(transports, db.getTransports(txn, contactId)); - // Replace the transport details + // Replace the transport properties transports = new TreeMap(); transports.put("foo", "bar baz"); transports.put("bar", "baz quux"); db.setTransports(txn, contactId, transports, 1); assertEquals(transports, db.getTransports(txn, contactId)); - // Remove the transport details + // Remove the transport properties db.setTransports(txn, contactId, Collections.emptyMap(), 2); assertEquals(Collections.emptyMap(), db.getTransports(txn, contactId)); - // Set the local transport details + // Set the local transport properties db.setTransports(txn, transports); assertEquals(transports, db.getTransports(txn)); - // Remove the local transport details + // Remove the local transport properties db.setTransports(txn, Collections.emptyMap()); assertEquals(Collections.emptyMap(), db.getTransports(txn)); @@ -813,22 +813,22 @@ public class H2DatabaseTest extends TestCase { Database db = open(false); Connection txn = db.startTransaction(); - // Add a contact with some transport details + // Add a contact with some transport properties Map transports = Collections.singletonMap("foo", "bar"); assertEquals(contactId, db.addContact(txn, transports)); assertEquals(transports, db.getTransports(txn, contactId)); - // Replace the transport details using a timestamp of 2 + // Replace the transport properties using a timestamp of 2 Map transports1 = new TreeMap(); transports1.put("foo", "bar baz"); transports1.put("bar", "baz quux"); db.setTransports(txn, contactId, transports1, 2); assertEquals(transports1, db.getTransports(txn, contactId)); - // Try to replace the transport details using a timestamp of 1 + // Try to replace the transport properties using a timestamp of 1 Map transports2 = new TreeMap(); transports2.put("bar", "baz"); transports2.put("quux", "fnord"); db.setTransports(txn, contactId, transports2, 1); - // The old transports should still be there + // The old properties should still be there assertEquals(transports1, db.getTransports(txn, contactId)); db.commitTransaction(txn);