Class ServiceRegistryServiceGrpcImpl

java.lang.Object
io.deephaven.dhservice.client.ServiceRegistryServiceGrpcImpl
All Implemented Interfaces:
SafeCloseable, NamedImplementation, AuthenticatedService, ServiceRegistryService, AutoCloseable

public class ServiceRegistryServiceGrpcImpl extends Object implements ServiceRegistryService
Implementation of the ServiceRegistryService API which sends requests over grpc to a remote server.
  • Method Details

    • make

      public static ServiceRegistryService make(@NotNull @NotNull ClientConnectionConfig configs)
      Create an instance with the given config.
      Parameters:
      configs - use this ClientConnectionConfig
      Returns:
      a new instance
    • make

      Create an instance with the default config.
      Returns:
      a new instance
      Throws:
      ClientConnectionConfigProvider.ProviderException - if a parsing exception occurs while processing the config
      IOException - if an IO exception occurs while loading the config
    • registerEndpointConfig

      @NotNull public @NotNull DeephavenLease registerEndpointConfig(@NotNull @NotNull RoutingEndpointConfig config, @Nullable @Nullable DeephavenLease lease)
      Description copied from interface: ServiceRegistryService
      Stores the given endpoint configuration in backing store. Returns the DeephavenLease instance after successfully storing the endpoint config. DeephavenLease can be used to schedule lease renewals until it is revoked.
      Specified by:
      registerEndpointConfig in interface ServiceRegistryService
      Parameters:
      config - The endpoint config to store
      lease - Optional lease instance that will be used to register when present
      Returns:
      Returns the DeephavenLease instance after successfully storing the endpoint config.
    • revokeLease

      public void revokeLease(@NotNull @NotNull DeephavenLease deephavenLease)
      Description copied from interface: ServiceRegistryService
      Revoke the given deephaven lease. Revoke will delete the stored endpoint configuration from backing store.
      Specified by:
      revokeLease in interface ServiceRegistryService
      Parameters:
      deephavenLease - the deephaven lease to revoke
    • renewLease

      public boolean renewLease(@NotNull @NotNull DeephavenLease deephavenLease)
      Description copied from interface: ServiceRegistryService
      Renew the lease for the given lease.
      Specified by:
      renewLease in interface ServiceRegistryService
      Parameters:
      deephavenLease - the deephaven lease to renew
      Returns:
      true if lease renewal was successful, false if error is lease is not found. All other errors should result in an unchecked exception.
    • about

      @NotNull public @NotNull String about()
      Description copied from interface: ServiceRegistryService
      Information about a ServiceRegistryServer instance. Useful for debugging.
      Specified by:
      about in interface ServiceRegistryService
      Returns:
      a string containing information about the implementing instance
    • getAllEndpointConfigs

      @NotNull public @NotNull Collection<RoutingEndpointConfig> getAllEndpointConfigs()
      Description copied from interface: ServiceRegistryService
      Returns collection of all the active endpoint configs currently registered in backing store
      Specified by:
      getAllEndpointConfigs in interface ServiceRegistryService
      Returns:
      collection of active endpoint configs in backing store
    • getEndpointConfigs

      @NotNull public @NotNull Collection<RoutingEndpointConfig> getEndpointConfigs(@NotNull @NotNull String processName)
      Description copied from interface: ServiceRegistryService
      Returns collection of active endpoint configs registered in backing store for the process name
      Specified by:
      getEndpointConfigs in interface ServiceRegistryService
      Parameters:
      processName - The name of the process
      Returns:
      collection of active endpoint configs for the process name
    • getEndpointConfig

      @Nullable public @Nullable RoutingEndpointConfig getEndpointConfig(@NotNull @NotNull String processName, @NotNull @NotNull String endpointId)
      Description copied from interface: ServiceRegistryService
      Returns endpoint config from backing store for the given processName and endpoint identifier, that may optionally be null
      Specified by:
      getEndpointConfig in interface ServiceRegistryService
      Parameters:
      processName - The name of the process
      endpointId - The endpoint identifier(e.g. port tag)
      Returns:
      The stored endpoint configuration that may optionally be null
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface SafeCloseable
    • authenticate

      public boolean authenticate()
      Description copied from interface: AuthenticatedService
      Attempt default authentication if this is not already authenticated.
      Specified by:
      authenticate in interface AuthenticatedService
      Returns:
      true if authentication succeeded, else false
    • authenticate

      public boolean authenticate(@NotNull @NotNull String keyFile)
      Description copied from interface: AuthenticatedService
      Authenticate, or re-authenticate using the given private key file.
      Specified by:
      authenticate in interface AuthenticatedService
      Returns:
      true if authentication succeeded, else false
    • authenticate

      public boolean authenticate(@NotNull @NotNull String user, @NotNull @NotNull String password, @Nullable @Nullable String operateAsUser)
      Description copied from interface: AuthenticatedService
      Authenticate, or re-authenticate using the given credentials.
      Specified by:
      authenticate in interface AuthenticatedService
      Parameters:
      user - user to authenticate
      password - password for authentication
      operateAsUser - optional operate-as user
      Returns:
      true if authentication succeeded, else false
    • authenticate

      public boolean authenticate(@NotNull @NotNull String user, @NotNull @NotNull String password)
      Description copied from interface: AuthenticatedService
      Authenticate, or re-authenticate using the given credentials.
      Specified by:
      authenticate in interface AuthenticatedService
      Parameters:
      user - user to authenticate
      password - password for authentication
      Returns:
      true if authentication succeeded, else false
    • setTokenFactoryFactory

      public boolean setTokenFactoryFactory(@Nullable @Nullable TokenFactoryFactory tokenAuthenticationManager)
      Description copied from interface: AuthenticatedService
      Set the authentication client manager to use for token generation. If tokenAuthenticationManager is null or is not already authenticated, this call will de-authenticate the connection.
      Specified by:
      setTokenFactoryFactory in interface AuthenticatedService
      Parameters:
      tokenAuthenticationManager - the authentication client manager to be used for future calls.
      Returns:
      true if authentication succeeded, else false
    • getAuthenticatedUser

      public UserContext getAuthenticatedUser()
      Specified by:
      getAuthenticatedUser in interface AuthenticatedService