GigaSpaces XAP 7.0 API

org.openspaces.persistency.patterns
Class SQLDataProviderSplitter

java.lang.Object
  extended by org.openspaces.persistency.patterns.AbstractManagedDataSourceSplitter
      extended by org.openspaces.persistency.patterns.BulkDataPersisterSplitter
          extended by org.openspaces.persistency.patterns.SQLDataProviderSplitter
All Implemented Interfaces:
BulkDataPersister, ManagedDataSource, SQLDataProvider

public class SQLDataProviderSplitter
extends BulkDataPersisterSplitter
implements SQLDataProvider

A sql data provider that redirects the sql basded operatinos to the given data source that can handle the given type.

Author:
kimchy

Field Summary
 
Fields inherited from class org.openspaces.persistency.patterns.AbstractManagedDataSourceSplitter
dataSources
 
Fields inherited from interface com.gigaspaces.datasource.ManagedDataSource
DATA_CLASS_PROPS, NUMBER_OF_PARTITIONS, STATIC_PARTITION_NUMBER
 
Constructor Summary
SQLDataProviderSplitter(ManagedDataSourceEntriesProvider[] dataSources)
           
 
Method Summary
 DataIterator iterator(SQLQuery sqlQuery)
           Create an iterator over all objects that match the given SQLQuery.
 
Methods inherited from class org.openspaces.persistency.patterns.BulkDataPersisterSplitter
executeBulk
 
Methods inherited from class org.openspaces.persistency.patterns.AbstractManagedDataSourceSplitter
getDataSource, init, initialLoad, setInitalLoadThreadPoolSize, shutdown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.gigaspaces.datasource.ManagedDataSource
init, initialLoad, shutdown
 

Constructor Detail

SQLDataProviderSplitter

public SQLDataProviderSplitter(ManagedDataSourceEntriesProvider[] dataSources)
Method Detail

iterator

public DataIterator iterator(SQLQuery sqlQuery)
                      throws DataSourceException
Description copied from interface: SQLDataProvider
 Create an iterator over all objects that match the given SQLQuery.
 SQLQuery contains a string representation of SQL 'where' clause.
 The format matches the PreparedStatement format(field1 = ? and field2 > ? and ....).
 The prepared values are accessible by SQLQuery.getPreparedValues() method
 
 Example implementation with SQL PreparedStatement:
 
 
 PreparedStatement st = con.prepareStatement(query.getSelectAllQuery());
 
 int index = 0;
 
 if(query.hasPreparedValues())
 {
        for(Iterator iter = query.getPreparedValues().iterator();iter.hasNext())
        {
                st.setObject(++index,iter.next());
        }
 }
 
 ResultSet rs = st.executeQuery();
 
 return new ResultSetIterator(rs);
 
 

Specified by:
iterator in interface SQLDataProvider
Returns:
a DataIterator or null if no data was found that match the given template
Throws:
DataSourceException

GigaSpaces XAP 7.0 API

Copyright © GigaSpaces.