com.ados.hestia.utils.io
Class FileStore

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

public class FileStore
extends Object
implements IStore

This realize IStore interface using file to store data.

Version:
$Revision: 1312 $ $Date: 2005-11-09 07:34:17 +0900 $
See Also:
Serialized Form

Field Summary
protected static DateFormat gFormat
           
protected static long gIndex
           
protected  File m_file
           
protected  String m_id
           
protected  String m_repositoryID
           
protected  boolean m_temporary
           
 
Constructor Summary
FileStore(File folder, String repoID, String id, boolean temporary)
          Construct.
 
Method Summary
 OutputStream createStream()
          Create output stream to write data.
protected  void finalize()
          
protected  void generateFileName(File folder)
          Generate name of corresponded file using store repository.
 File getFile()
          Returns file with content for this store.
 String getID()
          Returns id of store.
 String getRepositoryID()
          Return owner repository identification.
 long getSize()
          Returns size of data at store.
 int hashCode()
          
 InputStream openSharedStream()
          Open shared stream to read data.
 InputStream openStream()
          Open ordinary stream to read data.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

gIndex

protected static long gIndex

gFormat

protected static DateFormat gFormat

m_file

protected File m_file

m_id

protected String m_id

m_repositoryID

protected String m_repositoryID

m_temporary

protected boolean m_temporary
Constructor Detail

FileStore

public FileStore(File folder,
                 String repoID,
                 String id,
                 boolean temporary)
Construct.

Parameters:
folder. - Base folder where this Store will be exist.
repoID - id of owner repository.
id - store identification across repository.
temporary - indicate temporary or persistent this object.
Method Detail

generateFileName

protected void generateFileName(File folder)
Generate name of corresponded file using store repository. Note! some filesystems has limitation of number of entries at folder. To prevent this collission additional catalog is created.

Parameters:
folder - where FileStore must be allocated.

openStream

public InputStream openStream()
                       throws IOException
Open ordinary stream to read data.

Specified by:
openStream in interface IStore
Returns:
opened stream
Throws:
IOException - if stream can not be opened

openSharedStream

public InputStream openSharedStream()
                             throws IOException
Open shared stream to read data.

Specified by:
openSharedStream in interface IStore
Returns:
opened shared stream
Throws:
IOException - if stream can not be opened

createStream

public OutputStream createStream()
                          throws IOException
Create output stream to write data.

Specified by:
createStream in interface IStore
Returns:
create opened stream
Throws:
IOException - if stream can not be opened

getSize

public long getSize()
Returns size of data at store.

Specified by:
getSize in interface IStore
Returns:
size of data at store

getID

public String getID()
Returns id of store.

Specified by:
getID in interface IStore
Returns:
id of store.

getRepositoryID

public String getRepositoryID()
Return owner repository identification.

Returns:
owner repository identification.

getFile

public File getFile()
Returns file with content for this store.

Returns:
file with content for this store.

finalize

protected void finalize()
                 throws Throwable

Overrides:
finalize in class Object
Throws:
Throwable

hashCode

public int hashCode()

Overrides:
hashCode in class Object

toString

public String toString()

Overrides:
toString in class Object


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