Interface DataStore
- All Known Implementing Classes:
JsonStore,MysqlDataStore,SQLiteDataStore
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidcheckOwnership(UltiToolsPlugin plugin, Class<?> dataEntity) Deprecated, for removal: This API element is subject to removal in a future version.default voidcheckOwnership(File dataFolder, Class<?> dataEntity) Deprecated, for removal: This API element is subject to removal in a future version.It served only thegetOperator(File, Class)overload removed in 6.4.0;getOperator(DataScope, Class)checks ownership itself.voidSave all possible caches and destroy all data operation classes.default DataSourcegetDataSource(DataScope scope) Get the JDBCDataSourcebacking this store for the given scope, needing no entity class up front (a connection pool needs only a JDBC URL).default <T extends BaseDataEntity<String>>
DataOperator<T> getOperator(DataScope scope, Class<T> dataEntity) Get a data operator for the entityscopeowns, refusing outright when it does not (D-14).default <T extends BaseDataEntity<String>>
DataOperator<T> getOperatorUnchecked(DataScope scope, Class<T> dataEntity) Internal, unchecked construction path used ONLY bygetOperator(DataScope, Class), called after its ownscope.owns(...)check has already passed (CR-01, 02-13).Get the type of data storage.
-
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 thegetOperator(File, Class)overload removed in 6.4.0;getOperator(DataScope, Class)checks ownership itself. UsegetOperator(DataScope, Class)instead.Ownership check for a data folder: refuses unlessdataFolderbelongs to a registered external plugin whose scope ownsdataEntity. As of 6.4.0 only the shipped stores' own legacygetOperator(File, Class)methods call it.- Parameters:
dataFolder- the external plugin's data folderdataEntity- data entity class- Throws:
DataAccessException- ifdataFoldermatches no registered scope, or matches one that does not owndataEntity- 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 thegetOperator(UltiToolsPlugin, Class)overload removed in 6.4.0;getOperator(DataScope, Class)checks ownership itself. UsegetOperator(DataScope, Class)instead.Ownership check for a plugin: refuses unless the framework's entity registry recordspluginas the owner ofdataEntity. As of 6.4.0 only the shipped stores' own legacygetOperator(UltiToolsPlugin, Class)methods call it.- Parameters:
plugin- the requesting plugindataEntity- data entity class- Throws:
DataAccessException- ifplugindoes not owndataEntity- Since:
- 6.3.0
- Scheduled removal version:
- 6.5.0
-
getDataSource
Get the JDBCDataSourcebacking 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 entityscopeowns, refusing outright when it does not (D-14). The credential is framework-minted and unforgeable (DataScope's constructor and static factories are package-private tomanager), so this is the only operator entry point: a caller reachingUltiTools#getDataStore()directly --publicin 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) orUltiToolsAPI.getDataOperator(JavaPlugin, Class)(external plugins), both of which pass the scope the framework minted for them. The two legacy overloads taking anUltiToolsPluginor aFile, 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 ownscope.owns(...)check has already passed (02-13, CR-01).- Type Parameters:
T- Must inheritBaseDataEntity- Parameters:
scope- the requesting scopedataEntity- data entity class- Returns:
- data operator for that entity
- Throws:
DataAccessException- ifscopedoes not owndataEntity- Since:
- 6.3.0
-
getOperatorUnchecked
default <T extends BaseDataEntity<String>> DataOperator<T> getOperatorUnchecked(DataScope scope, Class<T> dataEntity) Internal, unchecked construction path used ONLY bygetOperator(DataScope, Class), called after its ownscope.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 shapescoperesolves to.This member is technically
public-- Java gives interface members no narrower visibility -- but it is not reachable as a bypass: nothing outside themanagerpackage can construct aDataScopeto pass to it (the same unforgeabilitygetOperator(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-extensibleDataStorecontract in the same sense the other members are; the default throws, matching the same "backend does not support this by default" posturegetDataSource(DataScope)already uses. The three backends this framework ships each override it.- Type Parameters:
T- Must inheritBaseDataEntity- Parameters:
scope- the requesting scope, already verified to owndataEntitydataEntity- 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.
-
getOperator(UltiToolsPlugin, Class)overload removed in 6.4.0;getOperator(DataScope, Class)checks ownership itself.