GigaSpaces XAP 7.0 API

com.gigaspaces.datasource
Interface ManagedDataSource<T>

All Known Subinterfaces:
DataPersister<T>, DataProvider<T>, ExternalDataSource<T>, ManagedDataSourceEntriesProvider, MapDataSource<K,V>, SQLDataProvider<T>
All Known Implementing Classes:
AbstractHibernateExternalDataSource, AbstractManagedDataSourceDelegator, AbstractManagedDataSourceSplitter, BulkDataPersisterExceptionHandler, BulkDataPersisterSplitter, CriteriaHibernateExternalDataSource, DataProviderSplitter, DefaultHibernateExternalDataSource, HibernateDataSource, HibernateMapDataSource, SQLDataProviderExceptionHandler, SQLDataProviderSplitter, StatelessHibernateExternalDataSource

public interface ManagedDataSource<T>

ManagedDataSource should be implemented when initialization and shutdown operations are needed by the data source.

Usually in case of external databases - init() will establish a JDBC connection and shutdown() will close it.

If the implementation requires configuration, it can be configured in external properties file.
The content of this file is passed to init() The location of the properties file should be defined in the space schema or property:

space-config.ExternalDataSource.init-properties-file

Since:
6.0
Author:
anna
See Also:
DataProvider, DataPersister

Field Summary
static String DATA_CLASS_PROPS
          use this constant to get from the Properties the loaded class
static String NUMBER_OF_PARTITIONS
          use this constant to get from the Properties the number of partitions
static String STATIC_PARTITION_NUMBER
          use this constant to get from the Properties the partition number
 
Method Summary
 void init(Properties prop)
          Initialize and configure the data source using given properties.
 DataIterator<T> initialLoad()
           Creates and returns an iterator over all the entries that should be loaded into space.
 void shutdown()
          Close the data source and clean any used resources.
 

Field Detail

DATA_CLASS_PROPS

static final String DATA_CLASS_PROPS
use this constant to get from the Properties the loaded class

See Also:
Constant Field Values

NUMBER_OF_PARTITIONS

static final String NUMBER_OF_PARTITIONS
use this constant to get from the Properties the number of partitions

See Also:
Constant Field Values

STATIC_PARTITION_NUMBER

static final String STATIC_PARTITION_NUMBER
use this constant to get from the Properties the partition number

See Also:
Constant Field Values
Method Detail

init

void init(Properties prop)
          throws DataSourceException
Initialize and configure the data source using given properties.
Called when space is started.
The properties are loaded from a file that can be defined in the space schema or as a property named:

space-config.ExternalDataSource.properties-file partitionId and number of partitions are also in the Properties - can be read with STATIC_PARTITION_NUMBER and NUMBER_OF_PARTITIONS

Parameters:
prop - - contains user defined param and Partition data
Throws:
DataSourceException

initialLoad

DataIterator<T> initialLoad()
                            throws DataSourceException
Creates and returns an iterator over all the entries that should be loaded into space.

Returns:
a DataIterator or null if no data should be loaded into space
Throws:
DataSourceException

shutdown

void shutdown()
              throws DataSourceException
Close the data source and clean any used resources.
Called before space shutdown.

Throws:
DataSourceException

GigaSpaces XAP 7.0 API

Copyright © GigaSpaces.