2020-03-07 22:04:02 +01:00
|
|
|
package envoy.server.processors;
|
2019-12-30 14:53:40 +01:00
|
|
|
|
2020-01-06 13:58:28 +01:00
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
import envoy.server.net.ObjectWriteProxy;
|
|
|
|
|
2019-12-30 14:53:40 +01:00
|
|
|
/**
|
2020-10-19 18:17:51 +02:00
|
|
|
* This interface defines methods for processing objects of a specific type incoming from a client.
|
2019-12-30 15:15:25 +01:00
|
|
|
*
|
2019-12-30 14:53:40 +01:00
|
|
|
* @author Kai S. K. Engelbart
|
2019-12-30 15:15:25 +01:00
|
|
|
* @param <T> type of the request object
|
2019-12-30 14:53:40 +01:00
|
|
|
* @since Envoy Server Standalone v0.1-alpha
|
|
|
|
*/
|
2020-01-06 13:58:28 +01:00
|
|
|
public interface ObjectProcessor<T> {
|
2019-12-30 14:53:40 +01:00
|
|
|
|
2019-12-30 15:15:25 +01:00
|
|
|
/**
|
2020-01-11 18:28:48 +01:00
|
|
|
* @param input the request object
|
2020-03-26 20:14:09 +01:00
|
|
|
* @param socketID the ID of the socket from which the object was received
|
2020-01-11 18:28:48 +01:00
|
|
|
* @param writeProxy the object that allows writing to a client
|
|
|
|
* @throws IOException if something went wrong during processing
|
2019-12-30 15:15:25 +01:00
|
|
|
* @since Envoy Server Standalone v0.1-alpha
|
|
|
|
*/
|
2020-03-26 20:14:09 +01:00
|
|
|
void process(T input, long socketID, ObjectWriteProxy writeProxy) throws IOException;
|
2020-10-22 23:05:51 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return whether authentication is required for the given processor. Defaults to {@code true}.
|
|
|
|
* @since Envoy Server v0.3-beta
|
|
|
|
*/
|
|
|
|
default boolean isAuthenticationRequired() { return true; }
|
2020-03-23 22:12:27 +01:00
|
|
|
}
|