GigaSpaces XAP 9.5 API

org.openspaces.persistency.patterns
Class SpaceDataSourceExceptionHandler

java.lang.Object
  extended by com.gigaspaces.datasource.SpaceDataSource
      extended by org.openspaces.persistency.patterns.SpaceDataSourceExceptionHandler

public class SpaceDataSourceExceptionHandler
extends SpaceDataSource

An exception handler that delegates SpaceDataSource execution and calls the provided PersistencyExceptionHandler in case of exceptions on query methods.

Since:
9.5
Author:
eitany

Constructor Summary
SpaceDataSourceExceptionHandler(SpaceDataSource dataSource, PersistencyExceptionHandler exceptionHandler)
           
 
Method Summary
 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(com.gigaspaces.datasource.DataSourceIdsQuery idsQuery)
          This method is invoked whenever the space needs to read several entries from the data source according to their ids.
 DataIterator<Object> initialDataLoad()
          This method is invoked after SpaceDataSource.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 SpaceDataSource.initialDataLoad() is invoked) and is used for introducing data types kept in the data source to the space.
 boolean supportsInheritance()
          Determines whether this implementation supports types inheritance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpaceDataSourceExceptionHandler

public SpaceDataSourceExceptionHandler(SpaceDataSource dataSource,
                                       PersistencyExceptionHandler exceptionHandler)
Method Detail

initialDataLoad

public DataIterator<Object> initialDataLoad()
Description copied from class: SpaceDataSource
This method is invoked after SpaceDataSource.initialMetadataLoad() and is used for pre fetching data from the data source on space initialization.

The returned DataIterator instance should contain POJOs or SpaceDocuments which their type was previously introduced to the space on SpaceDataSource.initialMetadataLoad() invocation.

Overrides:
initialDataLoad in class SpaceDataSource
Returns:
A DataIterator instance which contains all data to be written to Space upon its initialization - null is treated as an empty iterator.

initialMetadataLoad

public DataIterator<SpaceTypeDescriptor> initialMetadataLoad()
Description copied from class: SpaceDataSource
This method is invoked on space initialization (before SpaceDataSource.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.

Overrides:
initialMetadataLoad in class SpaceDataSource
Returns:
A DataIterator instance which contains all SpaceTypeDescriptor instances to be introduced to the Space upon its initialization - null is treated as an empty iterator.

getDataIterator

public DataIterator<Object> getDataIterator(DataSourceQuery query)
Description copied from class: SpaceDataSource
This method is invoked whenever the space needs to read data which matches the provided 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 SpaceDataSource.supportsInheritance() method.

Overrides:
getDataIterator in class SpaceDataSource
Parameters:
query - The DataSourceQuery to get results for.
Returns:
A DataIterator instance contains results for the provided DataSourceQuery.

getById

public Object getById(DataSourceIdQuery idQuery)
Description copied from class: SpaceDataSource
This 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 SpaceDocument instance.

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:
getById in class SpaceDataSource
Parameters:
idQuery - The DataSourceIdQuery to get a result for.
Returns:
A result from the SpaceDataSource which matches the provided DataSourceIdQuery.

getDataIteratorByIds

public DataIterator<Object> getDataIteratorByIds(com.gigaspaces.datasource.DataSourceIdsQuery idsQuery)
Description copied from class: SpaceDataSource
This 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 SpaceDocument instances.

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:
getDataIteratorByIds in class SpaceDataSource
Parameters:
idsQuery - The DataSourceIdsQuery to get a result for.
Returns:
A DataIterator instance contains results for the provided DataSourceIdsQuery.

supportsInheritance

public boolean supportsInheritance()
Description copied from class: SpaceDataSource
Determines whether this implementation supports types inheritance.

If types inheritance is not supported - SpaceDataSource.getDataIterator(DataSourceQuery) will be invoked for each derived type of the query's data type. Otherwise a single SpaceDataSource.getDataIterator(DataSourceQuery) invocation will be made for the query.

Overrides:
supportsInheritance in class SpaceDataSource
Returns:
true if this SpaceDataSource implementation supports types inheritance, otherwise false.

GigaSpaces XAP 9.5 API

Copyright © GigaSpaces.