mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 18:59:06 +01:00
Provide more information about plugin states.
This commit is contained in:
@@ -9,6 +9,34 @@ import java.util.Collection;
|
||||
@NotNullByDefault
|
||||
public interface Plugin {
|
||||
|
||||
enum State {
|
||||
|
||||
/**
|
||||
* The plugin has not been started, has been stopped, or is disabled by
|
||||
* settings.
|
||||
*/
|
||||
DISABLED,
|
||||
|
||||
/**
|
||||
* The plugin has been started, has not been stopped, is enabled by
|
||||
* settings, but can't yet tell whether it can make or receive
|
||||
* connections.
|
||||
*/
|
||||
ENABLING,
|
||||
|
||||
/**
|
||||
* The plugin has been started, has not been stopped, is enabled by
|
||||
* settings, and can make or receive connections.
|
||||
*/
|
||||
AVAILABLE,
|
||||
|
||||
/**
|
||||
* The plugin has been started, has not been stopped, is enabled by
|
||||
* settings, but can't make or receive connections
|
||||
*/
|
||||
UNAVAILABLE
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the plugin's transport identifier.
|
||||
*/
|
||||
@@ -35,9 +63,9 @@ public interface Plugin {
|
||||
void stop() throws PluginException;
|
||||
|
||||
/**
|
||||
* Returns true if the plugin is running.
|
||||
* Returns the current state of the plugin.
|
||||
*/
|
||||
boolean isRunning();
|
||||
State getState();
|
||||
|
||||
/**
|
||||
* Returns true if the plugin should be polled periodically to attempt to
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.briarproject.bramble.api.plugin;
|
||||
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.bramble.api.plugin.Plugin.State;
|
||||
import org.briarproject.bramble.api.properties.TransportProperties;
|
||||
import org.briarproject.bramble.api.settings.Settings;
|
||||
|
||||
@@ -32,12 +33,7 @@ public interface PluginCallback extends ConnectionHandler {
|
||||
void mergeLocalProperties(TransportProperties p);
|
||||
|
||||
/**
|
||||
* Signals that the transport is enabled.
|
||||
* Signals that the transport's state may have changed.
|
||||
*/
|
||||
void transportEnabled();
|
||||
|
||||
/**
|
||||
* Signals that the transport is disabled.
|
||||
*/
|
||||
void transportDisabled();
|
||||
void pluginStateChanged(State state);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user