Package glair.vision.model
Class BaseSessions<T extends BaseSessionsParam>
java.lang.Object
glair.vision.model.BaseSessions<T>
- Type Parameters:
T- The type of session parameters extendingBaseSessionsParam.
- Direct Known Subclasses:
ActiveLivenessSessions,KtpSessions,NpwpSessions,PassiveLivenessSessions
The base class for sessions handling, providing common functionality and
configurations for different session types.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final StringThe base URL for the session operations, e.g., "ocr/:version/ktp-sessions".protected final ConfigThe configuration settings used for session operations.protected static final LoggerThe logger instance used for logging within this class and its subclasses.protected final StringThe type of the session, e.g., "KTP". -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBaseSessions(Config config, String sessionType, String baseUrl) Constructs a BaseSessions instance with the specified configuration, session type, and base URL. -
Method Summary
Modifier and TypeMethodDescriptionCreates a session with the provided parameters using default configuration settings.create(T param, VisionSettings newVisionSettings) Creates a session with the provided parameters using custom configuration settings.createBody(T param) Creates the body of the session request based on the provided parameters.Gets the Base URL path.Gets the session type.Retrieves a session with the specified session ID using default configuration settings.retrieve(String sid, VisionSettings newVisionSettings) Retrieves a session with the specified session ID using custom configuration settings.
-
Field Details
-
logger
The logger instance used for logging within this class and its subclasses. -
config
The configuration settings used for session operations. -
sessionType
The type of the session, e.g., "KTP". -
baseUrl
The base URL for the session operations, e.g., "ocr/:version/ktp-sessions".
-
-
Constructor Details
-
BaseSessions
Constructs a BaseSessions instance with the specified configuration, session type, and base URL.- Parameters:
config- The configuration settings to use for session operations.sessionType- The type of the session, e.g., "KTP"baseUrl- The base URL for the session operations, e.g., "ocr/:version/ktp-sessions"
-
-
Method Details
-
getSessionType
Gets the session type.- Returns:
- The session type.
-
getBaseUrl
Gets the Base URL path.- Returns:
- The Base URL path.
-
create
Creates a session with the provided parameters using default configuration settings.- Parameters:
param- The session parameters.- Returns:
- The result of the session creation.
- Throws:
Exception- If an error occurs during the session creation.
-
create
Creates a session with the provided parameters using custom configuration settings.- Parameters:
param- The session parameters.newVisionSettings- The custom vision settings to use.- Returns:
- The result of the session creation.
- Throws:
Exception- If an error occurs during the session creation.
-
retrieve
Retrieves a session with the specified session ID using default configuration settings.- Parameters:
sid- The session ID to retrieve.- Returns:
- The result of the session retrieval.
- Throws:
Exception- If an error occurs during the session retrieval.
-
retrieve
Retrieves a session with the specified session ID using custom configuration settings.- Parameters:
sid- The session ID to retrieve.newVisionSettings- The custom vision settings to use.- Returns:
- The result of the session retrieval.
- Throws:
Exception- If an error occurs during the session retrieval.
-
createBody
Creates the body of the session request based on the provided parameters.- Parameters:
param- The session parameters.- Returns:
- A map representing the session request body.
-