Class CassandraSpaceDataSource
- All Implemented Interfaces:
ClusterInfoAware
SpaceDataSource.- Since:
- 9.1.1
- Author:
- Dan Kilman
-
Field Summary
FieldsFields inherited from class org.openspaces.persistency.ClusterInfoAwareSpaceDataSource
augmentInitialLoadEntries, clusterInfo, initialLoadChunksRoutingQueries, initialLoadQueries, initialLoadQueryScanningBasePackages -
Constructor Summary
ConstructorsConstructorDescriptionCassandraSpaceDataSource(PropertyValueSerializer fixedPropertyValueSerializer, PropertyValueSerializer dynamicPropertyValueSerializer, org.apache.cassandra.cql.jdbc.CassandraDataSource cassandraDataSource, HectorCassandraClient hectorClient, int minimumNumberOfConnections, int maximumNumberOfConnections, int batchLimit, String[] initialLoadQueryScanningBasePackages, boolean augmentInitialLoadEntries, ClusterInfo clusterInfo) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes open jdbc connections and the hector client connection pool.getById(DataSourceIdQuery idQuery) This method is invoked whenever the space needs to read an entry from the data source according to its Id.getDataIterator(DataSourceQuery query) This method is invoked whenever the space needs to read data which matches the providedDataSourceQueryfrom the space data source.getDataIteratorByIds(DataSourceIdsQuery idsQuery) This method is invoked whenever the space needs to read several entries from the data source according to their ids.protected Map<String,SpaceTypeDescriptor> This method is invoked afterSpaceDataSource.initialMetadataLoad()and is used for pre fetching data from the data source on space initialization.This method is invoked on space initialization (beforeSpaceDataSource.initialDataLoad()is invoked) and is used for introducing data types kept in the data source to the space.booleanReturnsfalse, inheritance is not supported.Methods inherited from class org.openspaces.persistency.ClusterInfoAwareSpaceDataSource
createInitialLoadQuery, getInitialLoadQueries, obtainInitialLoadQueries, setClusterInfo, setInitialLoadQueryScanningBasePackagesMethods inherited from class com.gigaspaces.datasource.SpaceDataSource
getPartitionRoutingInfo, setPartitionRoutingInfo
-
Field Details
-
CQL_VERSION
- See Also:
-
-
Constructor Details
-
CassandraSpaceDataSource
public CassandraSpaceDataSource(PropertyValueSerializer fixedPropertyValueSerializer, PropertyValueSerializer dynamicPropertyValueSerializer, org.apache.cassandra.cql.jdbc.CassandraDataSource cassandraDataSource, HectorCassandraClient hectorClient, int minimumNumberOfConnections, int maximumNumberOfConnections, int batchLimit, String[] initialLoadQueryScanningBasePackages, boolean augmentInitialLoadEntries, ClusterInfo clusterInfo)
-
-
Method Details
-
close
public void close()Closes open jdbc connections and the hector client connection pool. -
getDataIterator
Description copied from class:SpaceDataSourceThis method is invoked whenever the space needs to read data which matches the providedDataSourceQueryfrom 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
SpaceDataSource.supportsInheritance()method.- Overrides:
getDataIteratorin classSpaceDataSource- Parameters:
query- TheDataSourceQueryto get results for.- Returns:
- A
DataIteratorinstance contains results for the providedDataSourceQuery.
-
getById
Description copied from class:SpaceDataSourceThis method is invoked whenever the space needs to read an entry from the data source according to its Id.The returned value can be either a POJO or a
SpaceDocumentinstance.The default implementation of this method is delegated to the
SpaceDataSource.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.- Overrides:
getByIdin classSpaceDataSource- Parameters:
idQuery- TheDataSourceIdQueryto get a result for.- Returns:
- A result from the
SpaceDataSourcewhich matches the providedDataSourceIdQuery.
-
getDataIteratorByIds
Description copied from class:SpaceDataSourceThis method is invoked whenever the space needs to read several entries from the data source according to their ids.The returned values can be either POJOs or
SpaceDocumentinstances.The default implementation of this method is delegated to the
SpaceDataSource.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.- Overrides:
getDataIteratorByIdsin classSpaceDataSource- Parameters:
idsQuery- TheDataSourceIdsQueryto get a result for.- Returns:
- A
DataIteratorinstance contains results for the providedDataSourceIdsQuery.
-
initialMetadataLoad
Description copied from class:SpaceDataSourceThis method is invoked on space initialization (beforeSpaceDataSource.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
SpaceTypeDescriptorusingSpaceTypeDescriptorBuilder.- Overrides:
initialMetadataLoadin classClusterInfoAwareSpaceDataSource- Returns:
- A
DataIteratorinstance which contains allSpaceTypeDescriptorinstances to be introduced to the Space upon its initialization - null is treated as an empty iterator.
-
initialDataLoad
Description copied from class:SpaceDataSourceThis method is invoked afterSpaceDataSource.initialMetadataLoad()and is used for pre fetching data from the data source on space initialization.The returned
DataIteratorinstance should contain POJOs orSpaceDocuments which their type was previously introduced to the space onSpaceDataSource.initialMetadataLoad()invocation.- Overrides:
initialDataLoadin classSpaceDataSource- Returns:
- A
DataIteratorinstance which contains all data to be written to Space upon its initialization - null is treated as an empty iterator.
-
supportsInheritance
public boolean supportsInheritance()Returnsfalse, inheritance is not supported.- Overrides:
supportsInheritancein classSpaceDataSource- Returns:
false.
-
getInitialLoadEntriesMap
-