Interface SchemaServiceBase

All Superinterfaces:
AutoCloseable
All Known Subinterfaces:
SchemaService, SchemaServiceAuthenticatedMutator, SchemaServiceUtilLayer
All Known Implementing Classes:
SchemaService.Delegating, SchemaServiceBase.Delegating, SchemaServiceEmptyTransientImpl, SchemaServiceEtcdImpl, SchemaServiceKvImpl, SchemaServiceLegacyTransientImpl, StaticSchemaServiceImpl

public interface SchemaServiceBase extends AutoCloseable
Provides methods for interacting with the system Schema store. This interface is meant to be extended.
  • Method Details

    • about

      String about()
      Information about a SchemaService instance. Useful for debugging.
      Returns:
      a string containing information about the instance
    • authenticate

      default boolean authenticate(@NotNull String user, @NotNull String password)
      Authenticate using the given user and password. Implementations are not required to allow re-authentication.
      Parameters:
      user - the user to authenticate
      password - the password for the user
      Returns:
      true only if the authentication succeeded
    • authenticate

      boolean authenticate(@NotNull String user, @NotNull String password, @NotNull String operateAs)
      Authenticate using the given user and password, operating as the operateAs user. Implementations are not required to allow re-authentication.
      Parameters:
      user - the user to authenticate
      password - the password for the user
      operateAs - attempt to operate as this effective user
      Returns:
      true only if the authentication succeeded
    • authenticate

      boolean authenticate()
      Authenticate using default authentication. This will be using the default private key or however AuthenticationClientManager.getDefault() has been authenticated.
      Returns:
      true only if the authentication succeeded
    • containsNamespace

      boolean containsNamespace(@NotNull String namespace, boolean includeDeleted)
      Find out whether the given namespace is known to the schema service.
      Parameters:
      namespace - the namespace in question
      includeDeleted - true if deleted namespaces should be considered
      Returns:
      true if the namespace is found
    • containsNamespace

      default boolean containsNamespace(@NotNull String namespace)
      Find out whether the given namespace is known to the schema service.
      Parameters:
      namespace - the namespace in question
      Returns:
      true if the namespace is found
    • containsSchema

      boolean containsSchema(@NotNull String namespace, @NotNull String tableName)
      Find out if the given schema exists. Does not check for deleted schemas.
      Parameters:
      namespace - the namespace of the table
      tableName - the table name
      Returns:
      true if a schema is found for namespace.tableName
    • listNamespaces

      @NotNull default Collection<String> listNamespaces()
      Get a collection of the namespaces available.
      Returns:
      a collection of namespace names
    • listNamespaces

      @NotNull Collection<String> listNamespaces(boolean includeDeleted)
      Get a collection of the namespaces available.
      Parameters:
      includeDeleted - true if deleted namespaces should be included
      Returns:
      a collection of namespace names
    • listTableNames

      @NotNull default Collection<String> listTableNames(@NotNull String namespace)
      Get a collection of all table names in the specified namespace.
      Parameters:
      namespace - the name of the namespace
      Returns:
      a collection of all available schemas in namespace
    • listTableNames

      @NotNull Collection<String> listTableNames(@NotNull String namespace, boolean includeDeleted)
      Get a collection of all table names in the specified namespace.
      Parameters:
      namespace - the name of the namespace
      includeDeleted - tf deleted schemas should be included
      Returns:
      a collection of all available schemas in namespace, empty list if namespace does not exit
    • removeNamespace

      void removeNamespace(@NotNull String namespaceName, @NotNull String code, @NotNull String comment) throws SchemaException
      Remove the given namespace. The namespace must be empty (contain no schemas).
      Parameters:
      namespaceName - the namespace to remove
      code - pass-thru to kv persistence, indicates the code source of this update
      comment - pass-thru to kv persistence - a comment for this update
      Throws:
      SchemaException - if the namespace cannot be removed
    • removeNamespace

      void removeNamespace(@NotNull String namespaceName)
      Remove the given namespace. The namespace must be empty (contain no schemas).
      Parameters:
      namespaceName - the namespace to remove
      Throws:
      SchemaException - if the namespace cannot be removed
    • deleteSchema

      void deleteSchema(@NotNull String namespace, @NotNull String tableName) throws IllegalArgumentException, SchemaException
      Delete the specified schema.
      Parameters:
      namespace - the namespace of the schema to delete
      tableName - the name of the schema to delete
      Throws:
      IllegalArgumentException - if the namespace or table could not be found
      SchemaException - if the schema could not be deleted
    • deleteSchema

      void deleteSchema(@NotNull String namespace, @NotNull String tableName, @NotNull String code, @NotNull String comment) throws IllegalArgumentException, SchemaException
      Delete the specified schema.
      Parameters:
      namespace - the namespace of the schema to delete
      tableName - the name of the schema to delete
      code - pass-thru to kv persistence, indicates the code source of this delete
      comment - pass-thru to kv persistence - a comment for this delete
      Throws:
      IllegalArgumentException - if the namespace or table could not be found
      SchemaException - if the schema could not be deleted
    • shutdown

      default void shutdown()
      Shut down the schema service. This may involve cleaning up threads and releasing resources.
    • close

      default void close()
      Specified by:
      close in interface AutoCloseable
    • initializationStage

      default Future<Void> initializationStage()
      Get a future representing a possibly asynchronous initialization stage. The initialization stage is finished when the future is done, and does not throw an exception.
      Returns:
      a Future representing successful completion of initialization.