com.caucho.distcache.jdbc
Class JdbcDataStore

java.lang.Object
  extended by com.caucho.server.distcache.DataStore
      extended by com.caucho.distcache.jdbc.JdbcDataStore

public class JdbcDataStore
extends DataStore

Manages the backing for the file database objects


Constructor Summary
JdbcDataStore(JdbcMnodeStore mnodeStore, java.lang.String tableName, java.lang.String serverName)
           
 
Method Summary
 void addOrphanListener(MnodeOrphanListener listener)
           
 void close()
           
 void destroy()
           
 long getCount()
           
 void init()
           
 boolean isDataAvailable(HashKey id)
          Checks if we have the data
 boolean load(HashKey id, CacheDataBacking dataBacking)
           
 boolean load(HashKey id, WriteStream os)
          Reads the object from the data store.
 java.io.InputStream openInputStream(HashKey id)
          Reads the object from the data store.
 void removeExpiredData()
          Clears the expired data
 void removeOrphanListener(MnodeOrphanListener listener)
           
 void save(HashKey valueHash, CacheDataBacking dataBacking)
           
 boolean save(HashKey id, java.io.InputStream is, int length)
          Saves the data, returning true on success.
 boolean save(HashKey id, StreamSource source, int length)
          Saves the data, returning true on success.
 java.lang.String toString()
           
 boolean updateExpires(HashKey id)
          Updates the expires time for the data.
 void validateDatabase()
          Clears the expired data
 
Methods inherited from class com.caucho.server.distcache.DataStore
load, loadBlob
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JdbcDataStore

public JdbcDataStore(JdbcMnodeStore mnodeStore,
                     java.lang.String tableName,
                     java.lang.String serverName)
              throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

init

public void init()
          throws java.lang.Exception
Overrides:
init in class DataStore
Throws:
java.lang.Exception

addOrphanListener

public void addOrphanListener(MnodeOrphanListener listener)
Overrides:
addOrphanListener in class DataStore

removeOrphanListener

public void removeOrphanListener(MnodeOrphanListener listener)
Overrides:
removeOrphanListener in class DataStore

load

public boolean load(HashKey id,
                    WriteStream os)
Reads the object from the data store.

Overrides:
load in class DataStore
Parameters:
id - the hash identifier for the data
os - the WriteStream to hold the data
Returns:
true on successful load

load

public boolean load(HashKey id,
                    CacheDataBacking dataBacking)
Parameters:
valueKey -
dataBacking -
Returns:

isDataAvailable

public boolean isDataAvailable(HashKey id)
Checks if we have the data

Overrides:
isDataAvailable in class DataStore
Parameters:
id - the hash identifier for the data
Returns:
true on successful load

openInputStream

public java.io.InputStream openInputStream(HashKey id)
Reads the object from the data store.

Overrides:
openInputStream in class DataStore
Parameters:
id - the hash identifier for the data
os - the WriteStream to hold the data
Returns:
true on successful load

save

public boolean save(HashKey id,
                    StreamSource source,
                    int length)
             throws java.io.IOException
Saves the data, returning true on success.

Overrides:
save in class DataStore
Parameters:
id - the object's unique id.
is - the input stream to the serialized object
length - the length object the serialized object
Throws:
java.io.IOException

save

public void save(HashKey valueHash,
                 CacheDataBacking dataBacking)
Parameters:
valueHash -
dataBacking -

save

public boolean save(HashKey id,
                    java.io.InputStream is,
                    int length)
             throws java.io.IOException
Saves the data, returning true on success.

Overrides:
save in class DataStore
Parameters:
id - the object's unique id.
is - the input stream to the serialized object
length - the length object the serialized object
Throws:
java.io.IOException

updateExpires

public boolean updateExpires(HashKey id)
Updates the expires time for the data.

Overrides:
updateExpires in class DataStore
Parameters:
id - the hash identifier for the data
Returns:
true if the database contains the id

removeExpiredData

public void removeExpiredData()
Clears the expired data

Overrides:
removeExpiredData in class DataStore

validateDatabase

public void validateDatabase()
Clears the expired data

Overrides:
validateDatabase in class DataStore

getCount

public long getCount()
Overrides:
getCount in class DataStore

close

public void close()

destroy

public void destroy()
Overrides:
destroy in class DataStore

toString

public java.lang.String toString()
Overrides:
toString in class DataStore