Class ClientInfo

java.lang.Object
net.ygbstudio.jbrave.core.local.ClientInfo

public class ClientInfo extends Object
Represents the client information.

This class represents a source of truth for admission control/pacing semantics tied to a token identity.

  • Method Details

    • fromProperties

      @Contract("_,_ -> new") @NotNull public static @NotNull ClientInfo fromProperties(String propertiesFileName, String customPropertyName)
      Create a new instance of ClientInfo from properties file.
      Parameters:
      propertiesFileName - the name of the properties file.
      customPropertyName - property name specified by the caller.
      Returns:
      a new instance of ClientInfo.
    • fromProperties

      @NotNull public static @NotNull ClientInfo fromProperties(String propertiesFileName)
      Create a new instance of ClientInfo from properties file with the preconfigured property name brave.subscriptionToken
      Parameters:
      propertiesFileName - the name of the properties file.
      Returns:
      a new instance of ClientInfo.
    • fromEnvironment

      @Contract("_ -> new") @NotNull public static @NotNull ClientInfo fromEnvironment(String envVarName)
      Create a new instance of ClientInfo from environment variable.
      Parameters:
      envVarName - Environment variable specified by the caller.
      Returns:
      a new instance of ClientInfo.
      Throws:
      BraveLocalEnvironmentException - if the environment variable is not set.
    • fromEnvironment

      @NotNull public static @NotNull ClientInfo fromEnvironment()
      Create a new instance of ClientInfo from the preconfigured environment variable BRAVE_SUBSCRIPTION_TOKEN
      Returns:
      a new instance of ClientInfo.
      Throws:
      BraveLocalEnvironmentException - if the environment variable is not set.
    • subscriptionToken

      public String subscriptionToken()
    • requestGate

      public BraveExecutionGate requestGate()