Class BaseSessions<T extends BaseSessionsParam>

java.lang.Object
glair.vision.model.BaseSessions<T>
Type Parameters:
T - The type of session parameters extending BaseSessionsParam.
Direct Known Subclasses:
ActiveLivenessSessions, KtpSessions, NpwpSessions, PassiveLivenessSessions

public class BaseSessions<T extends BaseSessionsParam> extends Object
The base class for sessions handling, providing common functionality and configurations for different session types.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final String
    The base URL for the session operations, e.g., "ocr/:version/ktp-sessions".
    protected final Config
    The configuration settings used for session operations.
    protected static final Logger
    The logger instance used for logging within this class and its subclasses.
    protected final String
    The type of the session, e.g., "KTP".
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    BaseSessions(Config config, String sessionType, String baseUrl)
    Constructs a BaseSessions instance with the specified configuration, session type, and base URL.
  • Method Summary

    Modifier and Type
    Method
    Description
    create(T param)
    Creates 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.
    protected HashMap<String,String>
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • logger

      protected static final Logger logger
      The logger instance used for logging within this class and its subclasses.
    • config

      protected final Config config
      The configuration settings used for session operations.
    • sessionType

      protected final String sessionType
      The type of the session, e.g., "KTP".
    • baseUrl

      protected final String baseUrl
      The base URL for the session operations, e.g., "ocr/:version/ktp-sessions".
  • Constructor Details

    • BaseSessions

      protected BaseSessions(Config config, String sessionType, String baseUrl)
      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

      public String getSessionType()
      Gets the session type.
      Returns:
      The session type.
    • getBaseUrl

      public String getBaseUrl()
      Gets the Base URL path.
      Returns:
      The Base URL path.
    • create

      public String create(T param) throws Exception
      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

      public String create(T param, VisionSettings newVisionSettings) throws Exception
      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

      public String retrieve(String sid) throws Exception
      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

      public String retrieve(String sid, VisionSettings newVisionSettings) throws Exception
      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

      protected HashMap<String,String> createBody(T param)
      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.