public abstract class SpaceDataSource extends Object
SpaceDataSource
is used for reading data into the Space upon a request from the Space
or on Space initialization.Constructor and Description |
---|
SpaceDataSource() |
Modifier and Type | Method and Description |
---|---|
Object |
getById(DataSourceIdQuery idQuery)
This method is invoked whenever the space needs to read an entry from the data source
according to its Id.
|
DataIterator<Object> |
getDataIterator(DataSourceQuery query)
This method is invoked whenever the space needs to read data which matches the provided
DataSourceQuery from the space data source. |
DataIterator<Object> |
getDataIteratorByIds(DataSourceIdsQuery idsQuery)
This method is invoked whenever the space needs to read several entries from the data source
according to their ids.
|
PartitionRoutingInfo |
getPartitionRoutingInfo()
Gets the current partition routing info (if exists) to optimize initial load
|
DataIterator<Object> |
initialDataLoad()
This method is invoked after
initialMetadataLoad() and is used for pre fetching data
from the data source on space initialization. |
DataIterator<SpaceTypeDescriptor> |
initialMetadataLoad()
This method is invoked on space initialization (before
initialDataLoad() is invoked)
and is used for introducing data types kept in the data source to the space. |
void |
setPartitionRoutingInfo(PartitionRoutingInfo partitionRoutingInfo)
Sets the current partition routing info (if exists)
|
boolean |
supportsInheritance()
Determines whether this implementation supports types inheritance.
|
public PartitionRoutingInfo getPartitionRoutingInfo()
public void setPartitionRoutingInfo(PartitionRoutingInfo partitionRoutingInfo)
partitionRoutingInfo
- public DataIterator<SpaceTypeDescriptor> initialMetadataLoad()
initialDataLoad()
is invoked)
and is used for introducing data types kept in the data source to the space. Please note that derived types should be returned after their super types from the iterator.
It is
possible to create a SpaceTypeDescriptor
using SpaceTypeDescriptorBuilder
.
DataIterator
instance which contains all SpaceTypeDescriptor
instances to be introduced to the Space upon its initialization - null is treated as an empty
iterator.public DataIterator<Object> initialDataLoad()
initialMetadataLoad()
and is used for pre fetching data
from the data source on space initialization. The returned DataIterator
instance
should contain POJOs or SpaceDocument
s which their type was previously introduced to
the space on initialMetadataLoad()
invocation.
DataIterator
instance which contains all data to be written to Space upon
its initialization - null is treated as an empty iterator.public DataIterator<Object> getDataIterator(DataSourceQuery query)
DataSourceQuery
from the space data source. If this implementation doesn't supports types inheritance this method will be invoked for each type in the inheritance tree of the queried type.
The implementation's type inheritance support can be determined
by overriding the supportsInheritance()
method.
query
- The DataSourceQuery
to get results for.DataIterator
instance contains results for the provided DataSourceQuery
.public Object getById(DataSourceIdQuery idQuery)
The returned value can be either a POJO or a SpaceDocument
instance.
The default implementation of this method is delegated to the getDataIterator(DataSourceQuery)
method so if the data source does not have an optimized
way of reading an entity by its Id - the default implementation may suffice.
idQuery
- The DataSourceIdQuery
to get a result for.SpaceDataSource
which matches the provided DataSourceIdQuery
.public DataIterator<Object> getDataIteratorByIds(DataSourceIdsQuery idsQuery)
The returned values can be either POJOs or SpaceDocument
instances.
The default implementation of this method is delegated to the getById(DataSourceIdQuery)
method for each id, so if the data source does not have an
optimized way of reading an serveral entities by their ids - the default implementation may
suffice.
idsQuery
- The DataSourceIdsQuery
to get a result for.DataIterator
instance contains results for the provided DataSourceIdsQuery
.public boolean supportsInheritance()
If types inheritance is
not supported - getDataIterator(DataSourceQuery)
will be invoked for each derived
type of the query's data type. Otherwise a single getDataIterator(DataSourceQuery)
invocation will be made for the query.
SpaceDataSource
implementation supports types inheritance,
otherwise false.Copyright © GigaSpaces.