Updated the transport plugin API.

This commit is contained in:
akwizgran
2011-08-03 16:13:13 +01:00
parent 6e7d5a06b2
commit 7baefb3e7b
4 changed files with 55 additions and 11 deletions

View File

@@ -1,7 +1,9 @@
package net.sf.briar.api.transport.batch;
import java.util.Map;
/**
* 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.
*/
public interface BatchTransportCallback {
@@ -9,4 +11,8 @@ public interface BatchTransportCallback {
void readerCreated(BatchTransportReader r);
void writerCreated(BatchTransportWriter w);
void setLocalTransports(Map<String, String> transports);
void setConfig(Map<String, String> config);
}

View File

@@ -13,16 +13,32 @@ import net.sf.briar.api.transport.InvalidTransportException;
public interface BatchTransportPlugin {
/**
* Initialises the plugin and returns. Any connections that are later
* established by contacts or through polling will be passed to the given
* callback.
* Returns the plugin's name, which is used to distinguish its transport
* and configuration properties from those of other plugins.
*/
void start(Map<ContactId, Map<String, String>> transports,
String getName();
/**
* Starts the plugin. Any connections that are later initiated by contacts
* or established through polling will be passed to the given callback.
*/
void start(Map<String, String> localTransports,
Map<ContactId, Map<String, String>> remoteTransports,
Map<String, String> config, BatchTransportCallback c)
throws InvalidTransportException, InvalidConfigException;
/**
* Stops the plugin. No further connections will be passed to the callback
* after this method has returned.
*/
void stop();
/** Updates the plugin's local transport properties. */
void setLocalTransports(Map<String, String> transports)
throws InvalidTransportException;
/** Updates the plugin's transport properties for the given contact. */
void setTransports(ContactId c, Map<String, String> transports)
void setRemoteTransports(ContactId c, Map<String, String> transports)
throws InvalidTransportException;
/** Updates the plugin's configuration properties. */

View File

@@ -1,5 +1,7 @@
package net.sf.briar.api.transport.stream;
import java.util.Map;
/**
* An interface for receiving connections created by a stream-mode transport
* plugin.
@@ -7,4 +9,8 @@ package net.sf.briar.api.transport.stream;
public interface StreamTransportCallback {
void connectionCreated(StreamTransportConnection c);
void setLocalTransports(Map<String, String> transports);
void setConfig(Map<String, String> config);
}

View File

@@ -13,16 +13,32 @@ import net.sf.briar.api.transport.InvalidTransportException;
public interface StreamTransportPlugin {
/**
* Initialises the plugin and returns. Any connections that are later
* established by contacts or through polling will be passed to the given
* callback.
* Returns the plugin's name, which is used to distinguish its transport
* and configuration properties from those of other plugins.
*/
void start(Map<ContactId, Map<String, String>> transports,
String getName();
/**
* Starts the plugin. Any connections that are later initiated by contacts
* or established through polling will be passed to the given callback.
*/
void start(Map<String, String> localTransports,
Map<ContactId, Map<String, String>> remoteTransports,
Map<String, String> config, StreamTransportCallback c)
throws InvalidTransportException, InvalidConfigException;
/**
* Stops the plugin. No further connections will be passed to the callback
* after this method has returned.
*/
void stop();
/** Updates the plugin's local transport properties. */
void setLocalTransports(Map<String, String> transports)
throws InvalidTransportException;
/** Updates the plugin's transport properties for the given contact. */
void setTransports(ContactId c, Map<String, String> transports)
void setRemoteTransports(ContactId c, Map<String, String> transports)
throws InvalidTransportException;
/** Updates the plugin's configuration properties. */