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 TypeMethodDescriptionlong
getDataSize
(String ref) Determine the size of the data abstracted.<T> T
Retrieve 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:DataSource
Retrieve an object of the specified class identified by a specific reference.- Specified by:
getObject
in 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:DataSource
Retrieve a stream of data identified by a specific reference.- Specified by:
getStream
in 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:DataSource
Determine the size of the data abstracted.- Specified by:
getDataSize
in 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
-