Interface DataStore

All Known Implementing Classes:
JsonStore, MysqlDataStore, SQLiteDataStore

public interface DataStore
Data storage interface.
  • Method Details

    • getStoreType

      String getStoreType()
      Get the type of data storage.
      Returns:
      Data storage type
    • checkOwnership

      @Deprecated(since="6.4.0", forRemoval=true) default void checkOwnership(File dataFolder, Class<?> dataEntity)
      Deprecated, for removal: This API element is subject to removal in a future version.
      It served only the getOperator(File, Class) overload removed in 6.4.0; getOperator(DataScope, Class) checks ownership itself. Use getOperator(DataScope, Class) instead.
      Ownership check for a data folder: refuses unless dataFolder belongs to a registered external plugin whose scope owns dataEntity. As of 6.4.0 only the shipped stores' own legacy getOperator(File, Class) methods call it.
      Parameters:
      dataFolder - the external plugin's data folder
      dataEntity - data entity class
      Throws:
      DataAccessException - if dataFolder matches no registered scope, or matches one that does not own dataEntity
      Since:
      6.3.0
      Scheduled removal version:
      6.5.0
    • checkOwnership

      @Deprecated(since="6.4.0", forRemoval=true) default void checkOwnership(UltiToolsPlugin plugin, Class<?> dataEntity)
      Deprecated, for removal: This API element is subject to removal in a future version.
      It served only the getOperator(UltiToolsPlugin, Class) overload removed in 6.4.0; getOperator(DataScope, Class) checks ownership itself. Use getOperator(DataScope, Class) instead.
      Ownership check for a plugin: refuses unless the framework's entity registry records plugin as the owner of dataEntity. As of 6.4.0 only the shipped stores' own legacy getOperator(UltiToolsPlugin, Class) methods call it.
      Parameters:
      plugin - the requesting plugin
      dataEntity - data entity class
      Throws:
      DataAccessException - if plugin does not own dataEntity
      Since:
      6.3.0
      Scheduled removal version:
      6.5.0
    • getDataSource

      default DataSource getDataSource(DataScope scope)
      Get the JDBC DataSource backing this store for the given scope, needing no entity class up front (a connection pool needs only a JDBC URL).
      Parameters:
      scope - the requesting scope
      Returns:
      the JDBC data source for that scope
      Since:
      6.3.0
    • getOperator

      default <T extends BaseDataEntity<String>> DataOperator<T> getOperator(DataScope scope, Class<T> dataEntity)
      Get a data operator for the entity scope owns, refusing outright when it does not (D-14). The credential is framework-minted and unforgeable (DataScope's constructor and static factories are package-private to manager), so this is the only operator entry point: a caller reaching UltiTools#getDataStore() directly -- public in the published jar -- still cannot obtain an operator for an entity it does not own.

      Module code does not call this directly; it uses UltiToolsPlugin#getDataOperator(Class) (internal modules) or UltiToolsAPI.getDataOperator(JavaPlugin, Class) (external plugins), both of which pass the scope the framework minted for them. The two legacy overloads taking an UltiToolsPlugin or a File, deprecated in 6.3.0, were removed in 6.4.0.

      Delegates to getOperatorUnchecked(DataScope, Class), an internal construction path with no ownership check of its own, reachable only after this method's own scope.owns(...) check has already passed (02-13, CR-01).

      Type Parameters:
      T - Must inherit BaseDataEntity
      Parameters:
      scope - the requesting scope
      dataEntity - data entity class
      Returns:
      data operator for that entity
      Throws:
      DataAccessException - if scope does not own dataEntity
      Since:
      6.3.0
    • getOperatorUnchecked

      default <T extends BaseDataEntity<String>> DataOperator<T> getOperatorUnchecked(DataScope scope, Class<T> dataEntity)
      Internal, unchecked construction path used ONLY by getOperator(DataScope, Class), called after its own scope.owns(...) check has already passed (CR-01, 02-13). It builds the actual operator -- path/identity resolution, connection-pool cache, operator cache, transactionManagerFor(...) wiring -- for the internal/external shape scope resolves to.

      This member is technically public -- Java gives interface members no narrower visibility -- but it is not reachable as a bypass: nothing outside the manager package can construct a DataScope to pass to it (the same unforgeability getOperator(DataScope, Class) itself relies on), so a caller able to invoke this method at all already holds a scope it could just as validly pass to the checked entry point instead. It is not part of the officially-extensible DataStore contract in the same sense the other members are; the default throws, matching the same "backend does not support this by default" posture getDataSource(DataScope) already uses. The three backends this framework ships each override it.

      Type Parameters:
      T - Must inherit BaseDataEntity
      Parameters:
      scope - the requesting scope, already verified to own dataEntity
      dataEntity - data entity class
      Returns:
      data operator for that entity
      Since:
      6.3.0
    • destroyAllOperators

      void destroyAllOperators()
      Save all possible caches and destroy all data operation classes.