org.infinispan.loaders.jdbc
Class DataManipulationHelper

java.lang.Object
  extended by org.infinispan.loaders.jdbc.DataManipulationHelper

public abstract class DataManipulationHelper
extends Object

The purpose of this class is to factorize the repeating code between JdbcStringBasedCacheStore and JdbcBinaryCacheStore. This class implements GOF's template method pattern.

Author:
Mircea.Markus@jboss.com

Field Summary
protected  StreamingMarshaller marshaller
           
 
Constructor Summary
DataManipulationHelper(ConnectionFactory connectionFactory, TableManipulation tableManipulation, StreamingMarshaller marshaller)
           
 
Method Summary
 void clear()
           
protected abstract  boolean fromStreamProcess(Object objFromStream, PreparedStatement ps, ObjectInput objectInput)
           
 void fromStreamSupport(ObjectInput objectInput)
           
protected abstract  String getLoadAllKeysSql()
           
protected  boolean includeKey(Object key, Set<Object> keysToExclude)
           
protected abstract  void loadAllKeysProcess(ResultSet rs, Set<Object> keys, Set<Object> keysToExclude)
           
 Set<Object> loadAllKeysSupport(Set<Object> keysToExclude)
           
protected abstract  void loadAllProcess(ResultSet rs, Set<InternalCacheEntry> result)
           
 Set<InternalCacheEntry> loadAllSupport(boolean filterExpired)
           
 Set<InternalCacheEntry> loadSome(int maxEntries)
           
static void logAndThrow(Exception e, String message)
           
protected abstract  void toStreamProcess(ResultSet rs, InputStream is, ObjectOutput objectOutput)
           
 void toStreamSupport(ObjectOutput objectOutput, byte streamDelimiter, boolean filterExpired)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

marshaller

protected StreamingMarshaller marshaller
Constructor Detail

DataManipulationHelper

public DataManipulationHelper(ConnectionFactory connectionFactory,
                              TableManipulation tableManipulation,
                              StreamingMarshaller marshaller)
Method Detail

clear

public void clear()
           throws CacheLoaderException
Throws:
CacheLoaderException

fromStreamSupport

public final void fromStreamSupport(ObjectInput objectInput)
                             throws CacheLoaderException
Throws:
CacheLoaderException

toStreamSupport

public final void toStreamSupport(ObjectOutput objectOutput,
                                  byte streamDelimiter,
                                  boolean filterExpired)
                           throws CacheLoaderException
Throws:
CacheLoaderException

loadAllSupport

public final Set<InternalCacheEntry> loadAllSupport(boolean filterExpired)
                                             throws CacheLoaderException
Throws:
CacheLoaderException

loadAllKeysSupport

public Set<Object> loadAllKeysSupport(Set<Object> keysToExclude)
                               throws CacheLoaderException
Throws:
CacheLoaderException

loadSome

public final Set<InternalCacheEntry> loadSome(int maxEntries)
                                       throws CacheLoaderException
Throws:
CacheLoaderException

includeKey

protected boolean includeKey(Object key,
                             Set<Object> keysToExclude)

getLoadAllKeysSql

protected abstract String getLoadAllKeysSql()

loadAllProcess

protected abstract void loadAllProcess(ResultSet rs,
                                       Set<InternalCacheEntry> result)
                                throws SQLException,
                                       CacheLoaderException
Throws:
SQLException
CacheLoaderException

loadAllKeysProcess

protected abstract void loadAllKeysProcess(ResultSet rs,
                                           Set<Object> keys,
                                           Set<Object> keysToExclude)
                                    throws SQLException,
                                           CacheLoaderException
Throws:
SQLException
CacheLoaderException

toStreamProcess

protected abstract void toStreamProcess(ResultSet rs,
                                        InputStream is,
                                        ObjectOutput objectOutput)
                                 throws CacheLoaderException,
                                        SQLException,
                                        IOException
Throws:
CacheLoaderException
SQLException
IOException

fromStreamProcess

protected abstract boolean fromStreamProcess(Object objFromStream,
                                             PreparedStatement ps,
                                             ObjectInput objectInput)
                                      throws SQLException,
                                             CacheLoaderException,
                                             IOException,
                                             ClassNotFoundException,
                                             InterruptedException
Throws:
SQLException
CacheLoaderException
IOException
ClassNotFoundException
InterruptedException

logAndThrow

public static void logAndThrow(Exception e,
                               String message)
                        throws CacheLoaderException
Throws:
CacheLoaderException


Copyright © 2011 JBoss, a division of Red Hat. All Rights Reserved.