Skip to content
Snippets Groups Projects
Commit 6737e4dd authored by akwizgran's avatar akwizgran
Browse files

Merged common methods of BatchTransportPlugin and

StreamTransportPlugin into a superclass.
parent b54668c5
No related branches found
No related tags found
No related merge requests found
package net.sf.briar.api.transport;
import java.io.IOException;
import java.util.Map;
import net.sf.briar.api.ContactId;
import net.sf.briar.api.TransportId;
public interface TransportPlugin {
/** Returns the plugin's transport identifier. */
TransportId getId();
/**
* Stops the plugin. No further connections will be passed to the callback
* after this method has returned.
*/
void stop() throws IOException;
/** Updates the plugin's local transport properties. */
void setLocalProperties(Map<String, String> properties)
throws InvalidPropertiesException;
/** Updates the plugin's transport properties for the given contact. */
void setRemoteProperties(ContactId c, Map<String, String> properties)
throws InvalidPropertiesException;
/** Updates the plugin's configuration properties. */
void setConfig(Map<String, String> config) throws InvalidConfigException;
/**
* Returns true if the plugin's poll() method should be called
* periodically to attempt to establish connections.
*/
boolean shouldPoll();
/**
* Returns the desired interval in milliseconds between calls to the
* plugin's poll() method.
*/
long getPollingInterval();
/**
* Attempts to establish connections using the current transport and
* configuration properties, and passes any created connections to the
* callback.
*/
void poll();
}
......@@ -4,18 +4,15 @@ import java.io.IOException;
import java.util.Map;
import net.sf.briar.api.ContactId;
import net.sf.briar.api.TransportId;
import net.sf.briar.api.transport.InvalidConfigException;
import net.sf.briar.api.transport.InvalidPropertiesException;
import net.sf.briar.api.transport.TransportPlugin;
/**
* An interface for transport plugins that do not support bidirectional,
* reliable, ordered, timely delivery of data.
*/
public interface BatchTransportPlugin {
/** Returns the plugin's transport identifier. */
TransportId getId();
public interface BatchTransportPlugin extends TransportPlugin {
/**
* Starts the plugin. Any connections that are later initiated by contacts
......@@ -26,42 +23,6 @@ public interface BatchTransportPlugin {
Map<String, String> config, BatchTransportCallback c)
throws InvalidPropertiesException, InvalidConfigException, IOException;
/**
* Stops the plugin. No further connections will be passed to the callback
* after this method has returned.
*/
void stop() throws IOException;
/** Updates the plugin's local transport properties. */
void setLocalProperties(Map<String, String> properties)
throws InvalidPropertiesException;
/** Updates the plugin's transport properties for the given contact. */
void setRemoteProperties(ContactId c, Map<String, String> properties)
throws InvalidPropertiesException;
/** Updates the plugin's configuration properties. */
void setConfig(Map<String, String> config) throws InvalidConfigException;
/**
* Returns true if the plugin's poll() method should be called
* periodically to attempt to establish connections.
*/
boolean shouldPoll();
/**
* Returns the desired interval in milliseconds between calls to the
* plugin's poll() method.
*/
long getPollingInterval();
/**
* Attempts to establish incoming and/or outgoing connections using the
* current transport and configuration properties, and passes any created
* readers and/or writers to the callback.
*/
void poll();
/**
* Attempts to create and return a BatchTransportReader for the given
* contact using the current transport and configuration properties.
......
package net.sf.briar.api.transport.stream;
import java.io.IOException;
import java.util.Map;
import net.sf.briar.api.ContactId;
import net.sf.briar.api.TransportId;
import net.sf.briar.api.transport.InvalidConfigException;
import net.sf.briar.api.transport.InvalidPropertiesException;
import net.sf.briar.api.transport.TransportPlugin;
/**
* An interface for transport plugins that support bidirectional, reliable,
* ordered, timely delivery of data.
*/
public interface StreamTransportPlugin {
/** Returns the plugin's transport identifier. */
TransportId getId();
public interface StreamTransportPlugin extends TransportPlugin {
/**
* Starts the plugin. Any connections that are later initiated by contacts
......@@ -23,43 +21,7 @@ public interface StreamTransportPlugin {
void start(Map<String, String> localProperties,
Map<ContactId, Map<String, String>> remoteProperties,
Map<String, String> config, StreamTransportCallback c)
throws InvalidPropertiesException, 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 setLocalProperties(Map<String, String> properties)
throws InvalidPropertiesException;
/** Updates the plugin's transport properties for the given contact. */
void setRemoteProperties(ContactId c, Map<String, String> properties)
throws InvalidPropertiesException;
/** Updates the plugin's configuration properties. */
void setConfig(Map<String, String> config) throws InvalidConfigException;
/**
* Returns true if the plugin's poll() method should be called
* periodically to attempt to establish connections.
*/
boolean shouldPoll();
/**
* Returns the desired interval in milliseconds between calls to the
* plugin's poll() method.
*/
long getPollingInterval();
/**
* Attempts to establish connections using the current transport and
* configuration properties, and passes any created connections to the
* callback.
*/
void poll();
throws InvalidPropertiesException, InvalidConfigException, IOException;
/**
* Attempts to create and return a StreamTransportConnection to the given
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment