Package com.github.workerframework.api
Class DataStoreSource
java.lang.Object
com.github.cafapi.common.util.ref.DataSource
com.github.workerframework.api.DataStoreSource
An implementation of a DataSource that uses a Worker DataStore and a CAF Codec.
-
Constructor Summary
ConstructorsConstructorDescriptionDataStoreSource(DataStore dataStore, Codec codec) Create a new DataStoreSource. -
Method Summary
Modifier and TypeMethodDescriptionlonggetDataSize(String ref) Determine the size of the data abstracted.<T> TRetrieve an object of the specified class identified by a specific reference.Retrieve a stream of data identified by a specific reference.
-
Constructor Details
-
DataStoreSource
Create a new DataStoreSource.- Parameters:
dataStore- the store of remote datacodec- the method to decode remote data into returned objects
-
-
Method Details
-
getObject
Description copied from class:DataSourceRetrieve an object of the specified class identified by a specific reference.- Specified by:
getObjectin classDataSource- Type Parameters:
T- the type of the object instance- Parameters:
ref- the reference that points to an instance of an object of the specified classclazz- the class of the object instance the reference points to- Returns:
- the object instance of the specified class identified by the specified reference
- Throws:
DataSourceException- if the object instance cannot be acquired
-
getStream
Description copied from class:DataSourceRetrieve a stream of data identified by a specific reference.- Specified by:
getStreamin classDataSource- Parameters:
ref- the reference that points to a stream of data- Returns:
- a stream of data identified by the specified reference
- Throws:
DataSourceException- if the data stream cannot be acquired
-
getDataSize
Description copied from class:DataSourceDetermine the size of the data abstracted.- Specified by:
getDataSizein classDataSource- Parameters:
ref- the reference that points to the data- Returns:
- the size of the data, in bytes
- Throws:
DataSourceException- if the data size cannot be acquired
-