public interface ImaPluginListener
Modifier and Type | Field and Description |
---|---|
static String |
COPYRIGHT |
Modifier and Type | Method and Description |
---|---|
void |
initialize(ImaPlugin plugin)
Callback when the plug-in is loaded.
|
boolean |
onAuthenticate(ImaConnection connect)
Callback to request authentication of a connection.
|
void |
onConfigUpdate(String name,
Object subname,
Object value)
Callback for a configuration update.
|
ImaConnectionListener |
onConnection(ImaConnection connect,
String protocol)
Callback for a new connection with a known protocol.
|
int |
onProtocolCheck(ImaConnection connect,
byte[] data)
Callback when a new connection is detected which might be for this plug-in.
|
void |
startMessaging(boolean active)
Callback when messaging is started within the server.
|
void |
terminate(int reason)
Callback to inform the plug-in it should release resources.
|
static final String COPYRIGHT
void initialize(ImaPlugin plugin)
It is expected that the plug-in will save the ImaPlugin object for later use.
plugin
- The plug-in object which contains methods which the plug-in can call for services.boolean onAuthenticate(ImaConnection connect)
Note that this function is not currently implemented and will not be called. For future compatibility the plug-in should return false.
This connection may have been accepted by this or any other protocol.
The connection is blocked (will not process data) until it has been authenticated.
If this method returns true, the plug-in is required to call the ImaConnection methods authenticate() or setIdenity() with an auth option on the specified connection. This can be done either before returning from this callback or later. If this method returns false, authentication processing is continued using other authenticators.
connect
- The connection to authenticateint onProtocolCheck(ImaConnection connect, byte[] data)
If this callback returns 0 the connection is accepted. If it returns a negative value the connection is not accepted. If it returns a positive value, this indicates the number of bytes of data it needs to determine if the connection belongs to it. If another plug-in accepts the connection before more data is available, this method will not be reinvoked.
The data commonly has the first record sent by the client, but is only guaranteed to have a single byte.
Before returning, this method may set the protocol name in the connection using the connect.setProtocol() method. If it does not do so, the name of the plug-in will be used as the protocol.
connect
- The connection objectdata
- Data from the first packet receivedImaConnectionListener onConnection(ImaConnection connect, String protocol)
This is called when a connection is known to be accepted by this plug-in. This can either be due to returning a zero value from onProtocolCheck(), or using a framer like WebSockets which declares the protocol.
If the plug-in is unwilling to accept this connection this method should return null.
connect
- The connection objectprotocol
- The protocol of the connectionvoid onConfigUpdate(String name, Object subname, Object value)
When a protocol is created it has a set of properties which it can receive using ImaPlugin.getConfig(). This method allows the plug-in to be notified when a property changes.
Note: This method is not currently invoked.
name
- The name of the propertysubname
- If the base property is a Map object, the name of the inner property.value
- The value of the propertyvoid startMessaging(boolean active)
active
- Specifies whether this server instance is the active peer
or the backup in a high availability pair, true for active
and false for backup.void terminate(int reason)
reason
- The reason for the close as a return code. 0=normalCopyright © Contributors to the Eclipse Foundation 2014-2021