Interface TenantStore


public interface TenantStore
  • Method Details

    • getClientKeys

      Set<String> getClientKeys(Environment env)
      Retrieves all known tenant keys.
      Parameters:
      env - The env to query.
      Returns:
      Set of all keys.
    • getActiveTenantInfo

      Optional<TenantInfo> getActiveTenantInfo(TenantContext clientContext)
      Given the provided context, this method will try to look up full tenant details from the store. This may return empty if no stored tenant info can be found.
      Parameters:
      clientContext - The tenant to lookup
      Returns:
      Optional tenant info
    • getActiveTenantInfo

      Optional<TenantInfo> getActiveTenantInfo(CloudIdContext cloudIdContext)
      Given the provided context, this method will try to look up full tenant details from the store by Cloud Id. This may return empty if no stored tenant info can be found.
      Parameters:
      cloudIdContext - The tenant to lookup by cloud Id
      Returns:
      Optional tenant info
    • getRawTenantInfo

      Optional<TenantInfo> getRawTenantInfo(Environment environment, String clientKey)
    • save

      Optional<TenantInfo> save(Environment environment, TenantInfo tenantInfo)
      Stores new TenantInfo (overwriting existing data). Implementations should take care not to overwrite null attributes however, since this will be called for both installed and enabled events. The latter will not include the shared secret again.
      Parameters:
      environment - The environment to update
      tenantInfo - The updated tenant info
      Returns:
      The currently active tenantinfo written to the store
    • getTenantProperties

      TenantProperties getTenantProperties(TenantContext context)
      Retrieves tenant properties for the provided tenant.
      Parameters:
      context - The context to access this tenant
      Returns:
      tenant properties for the provided tenant.
    • setTenantProperty

      void setTenantProperty(TenantContext context, String key, String value)
      Set a given property for the provided tenant.
      Parameters:
      context - The context to lookup the tenant
      key - the property key
      value - the property value
    • removeProperty

      void removeProperty(TenantContext context, String key)
      Revert a specific tenant property back to default
      Parameters:
      context - The context to lookup the tenant
      key - the property key
    • getTenantCount

      long getTenantCount(Environment environment)
      Returns the unique tenants in our db.
      Parameters:
      environment - the environment to query
      Returns:
      the number of tenants
    • getActiveTenantIdForClientKey

      Optional<TenantId> getActiveTenantIdForClientKey(Environment environment, String clientKey)
      Provides fast lookup to find the active tenant uuid given a client key.
      Parameters:
      environment - the environment to query
      clientKey - the client key to lookup
      Returns:
      The active tenant id or empty if none can be found.
    • getActiveTenantIdForCloudId

      Optional<TenantId> getActiveTenantIdForCloudId(Environment environment, String cloudId)
      Provides fast lookup to find the active tenant uuid given a cloud id.
      Parameters:
      environment - the environment to query
      cloudId - the client key to lookup
      Returns:
      The active tenant id or empty if none can be found.
    • getClientKeyForTenantId

      Optional<String> getClientKeyForTenantId(Environment environment, TenantId tenantId)
      Provides fast lookup to find the client key for the given tenant uuid.
      Parameters:
      environment - the environment to query
      tenantId - the tenant to lookup
      Returns:
      The client key or empty if none can be found