Interface DataAcc

All Known Implementing Classes:
DataHub

public interface DataAcc
Provides access to named DataConn instances and nested logic execution within a data access scope.

Application logic uses this interface (or a custom interface extending it) to retrieve managed data connections and to invoke sub-logic units within the same execution context.

  • Method Summary

    Modifier and Type
    Method
    Description
    <C extends DataConn>
    C
    getDataConn(String name, Class<C> cls)
    Retrieves a data connection associated with the specified data source name and casts it to the requested connection class type.
    <D> void
    run(Logic<D> logic)
    Executes the specified Logic within the current data access context.
    Starts a sequential LogicRun chain within the current data access context.
  • Method Details

    • getDataConn

      <C extends DataConn> C getDataConn(String name, Class<C> cls) throws com.github.sttk.errs.Err
      Retrieves a data connection associated with the specified data source name and casts it to the requested connection class type.

      If a connection for the given name already exists in the current execution scope, that connection instance is returned. Otherwise, a new connection is created from the corresponding registered DataSrc.

      Type Parameters:
      C - the expected type of DataConn
      Parameters:
      name - the registered logical name of the data source
      cls - the Class representing the target connection type C
      Returns:
      the data connection instance associated with the specified name
      Throws:
      com.github.sttk.errs.Err - if no data source is registered for name, if creating the connection fails or returns null, or if the connection cannot be cast to cls
    • run

      <D> void run(Logic<D> logic) throws com.github.sttk.errs.Err
      Executes the specified Logic within the current data access context.
      Type Parameters:
      D - the type of data access interface expected by the logic
      Parameters:
      logic - the logic unit to execute
      Throws:
      com.github.sttk.errs.Err - if an error occurs while executing logic
    • start

      LogicRun start()
      Starts a sequential LogicRun chain within the current data access context.
      Returns:
      a new LogicRun instance for chaining logic executions