Class IdCommandContext<E extends IdProtocolMessageType,S extends IdSessionType>
java.lang.Object
com.io7m.idstore.server.controller.command_exec.IdCommandContext<E,S>
- Type Parameters:
E- The type of error messagesS- The type of sessions
- Direct Known Subclasses:
IdACommandContext,IdUCommandContext
public abstract class IdCommandContext<E extends IdProtocolMessageType,S extends IdSessionType>
extends Object
The context for execution of a command (or set of commands in a
transaction).
-
Constructor Summary
ConstructorsConstructorDescriptionIdCommandContext(com.io7m.repetoir.core.RPServiceDirectoryType inServices, UUID inRequestId, IdDatabaseTransactionType inTransaction, S inSession, String inRemoteHost, String inRemoteUserAgent) The context for execution of a command (or set of commands in a transaction). -
Method Summary
Modifier and TypeMethodDescriptionfail(int statusCode, IdErrorCode errorCode, String text) Fail with a constant error message.Produce an exception indicating a database error.failFormatted(int statusCode, IdErrorCode errorCode, String text, Object... args) Fail with a constant error message.Produce an exception indicating a mail system error.Produce an exception indicating a password format error.Produce an exception indicating a protocol error.Produce an exception indicating a security policy error.Produce an exception indicating a validation error.final OffsetDateTimenow()final Stringfinal Stringfinal UUIDfinal voidsecurityCheck(IdSecActionType action) Check the given action against the security policy.final com.io7m.repetoir.core.RPServiceDirectoryTypeservices()final Ssession()final io.opentelemetry.api.trace.Tracertracer()
-
Constructor Details
-
IdCommandContext
public IdCommandContext(com.io7m.repetoir.core.RPServiceDirectoryType inServices, UUID inRequestId, IdDatabaseTransactionType inTransaction, S inSession, String inRemoteHost, String inRemoteUserAgent) The context for execution of a command (or set of commands in a transaction).- Parameters:
inServices- The service directoryinRequestId- The request IDinTransaction- The transactioninSession- The user sessioninRemoteHost- The remote hostinRemoteUserAgent- The remote user agent
-
-
Method Details
-
session
- Returns:
- The user session
-
remoteHost
- Returns:
- The remote host
-
remoteUserAgent
- Returns:
- The remote user agent
-
services
public final com.io7m.repetoir.core.RPServiceDirectoryType services()- Returns:
- The service directory used during execution
-
requestId
- Returns:
- The ID of the incoming request
-
transaction
- Returns:
- The database transaction
-
tracer
public final io.opentelemetry.api.trace.Tracer tracer()- Returns:
- The OpenTelemetry tracer
-
now
- Returns:
- The current time
-
failDatabase
Produce an exception indicating a database error.- Parameters:
e- The database exception- Returns:
- An execution failure
-
failSecurity
Produce an exception indicating a security policy error.- Parameters:
e- The security exception- Returns:
- An execution failure
-
failMail
Produce an exception indicating a mail system error.- Parameters:
email- The email addresse- The mail system exception- Returns:
- An execution failure
-
failValidity
Produce an exception indicating a validation error.- Parameters:
e- The exception- Returns:
- An execution failure
-
failPassword
Produce an exception indicating a password format error.- Parameters:
e- The exception- Returns:
- An execution failure
-
failProtocol
Produce an exception indicating a protocol error.- Parameters:
e- The exception- Returns:
- An execution failure
-
securityCheck
Check the given action against the security policy.- Parameters:
action- The action- Throws:
IdSecurityException- On errors
-
fail
Fail with a constant error message.- Parameters:
statusCode- The status codeerrorCode- The error codetext- The message- Returns:
- An exception
-
failFormatted
public final IdCommandExecutionFailure failFormatted(int statusCode, IdErrorCode errorCode, String text, Object... args) Fail with a constant error message.- Parameters:
statusCode- The status codeerrorCode- The error codetext- The messageargs- The format arguments- Returns:
- An exception
-