com.caucho.server.distcache
Class DataStore

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

public class DataStore
extends java.lang.Object

Manages the backing for the file database objects


Constructor Summary
DataStore(java.lang.String serverName, MnodeStore mnodeStore)
           
 
Method Summary
 void addOrphanListener(MnodeOrphanListener listener)
           
 void destroy()
           
 long getCount()
           
protected  void init()
           
 boolean isClosed()
           
 boolean isDataAvailable(long id)
          Checks if we have the data
 boolean load(long id, WriteStream os)
          Reads the object from the data store.
 java.sql.Blob loadBlob(long id)
          Reads the object from the data store.
 java.io.InputStream openInputStream(long id)
          Reads the object from the data store.
 boolean remove(long id)
          Removes the data, returning true on success
 void removeOrphanListener(MnodeOrphanListener listener)
           
 long save(java.io.InputStream is, int length)
          Saves the data, returning true on success.
 long save(StreamSource source, int length)
          Saves the data, returning true on success.
 java.lang.String toString()
           
 void validateDatabase()
          Clears the expired data
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataStore

public DataStore(java.lang.String serverName,
                 MnodeStore mnodeStore)
          throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

init

protected void init()
             throws java.lang.Exception
Throws:
java.lang.Exception

addOrphanListener

public void addOrphanListener(MnodeOrphanListener listener)

removeOrphanListener

public void removeOrphanListener(MnodeOrphanListener listener)

load

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

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

loadBlob

public java.sql.Blob loadBlob(long id)
Reads the object from the data store.

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

isDataAvailable

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

Parameters:
id - the hash identifier for the data
Returns:
true on successful load

openInputStream

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

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

save

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

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 long save(java.io.InputStream is,
                 int length)
          throws java.io.IOException
Saves the data, returning true on success.

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

remove

public boolean remove(long id)
Removes the data, returning true on success

Parameters:
id - the data's unique id.

validateDatabase

public void validateDatabase()
Clears the expired data


getCount

public long getCount()

isClosed

public boolean isClosed()

destroy

public void destroy()

toString

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