com.ados.hestia.utils.io
Class SmartStore

java.lang.Object
  extended by com.ados.hestia.utils.io.SmartStore
All Implemented Interfaces:
IStore, Serializable

public class SmartStore
extends Object
implements IStore

Automatically switch Memory based IStore File based IStore.

Version:
$Revision: 1312 $ $Date: 2005-11-09 07:34:17 +0900 $
See Also:
FileStore, MemoryStore, This is used to prevent using uncontroling memory resources.
If Store with big data size will be found then automatically
MemoryStore will be converted to FileStore and futher FileStore
will be used.
, Serialized Form

Nested Class Summary
protected  class SmartStore.SmartStoreOutStream
           
 
Field Summary
protected  File m_baseFolder
          Temporary folder where FileStore will be allocated.
protected  String m_id
           
protected  String m_repositoryID
           
protected  IStore m_store
           
protected static int MEMORY_LIMIT
           
 
Constructor Summary
SmartStore(String repositoryID, File baseFolder)
           
 
Method Summary
 OutputStream createStream()
          Create output stream to write data.
protected  IStore getActiveStore()
           
 String getID()
          Returns id of store.
 long getSize()
          Returns size of data at store.
 InputStream openSharedStream()
          Open shared stream to read data.
 InputStream openStream()
          Open ordinary stream to read data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MEMORY_LIMIT

protected static final int MEMORY_LIMIT
See Also:
Constant Field Values

m_store

protected IStore m_store

m_id

protected String m_id

m_repositoryID

protected String m_repositoryID

m_baseFolder

protected File m_baseFolder
Temporary folder where FileStore will be allocated.

Constructor Detail

SmartStore

public SmartStore(String repositoryID,
                  File baseFolder)
Method Detail

createStream

public OutputStream createStream()
                          throws IOException
Description copied from interface: IStore
Create output stream to write data.

Specified by:
createStream in interface IStore
Returns:
create opened stream
Throws:
IOException - if stream can not be opened
See Also:
com.ados.hestia.store.IStore#createStream()

getActiveStore

protected IStore getActiveStore()
                         throws IOException
Throws:
IOException

getSize

public long getSize()
Description copied from interface: IStore
Returns size of data at store.

Specified by:
getSize in interface IStore
Returns:
size of data at store
See Also:
com.ados.hestia.store.IStore#getSize()

openSharedStream

public InputStream openSharedStream()
                             throws IOException
Description copied from interface: IStore
Open shared stream to read data.

Specified by:
openSharedStream in interface IStore
Returns:
opened shared stream
Throws:
IOException - if stream can not be opened
See Also:
com.ados.hestia.store.IStore#openSharedStream()

openStream

public InputStream openStream()
                       throws IOException
Description copied from interface: IStore
Open ordinary stream to read data.

Specified by:
openStream in interface IStore
Returns:
opened stream
Throws:
IOException - if stream can not be opened
See Also:
com.ados.hestia.store.IStore#openStream()

getID

public String getID()
Description copied from interface: IStore
Returns id of store.

Specified by:
getID in interface IStore
Returns:
id of store.
See Also:
com.ados.hestia.store.IStore#getID()


Copyright © 2005-2006 ADOS Co.,Ltd.. All Rights Reserved.