Xindice API
version 1.2m1

org.apache.xindice.core.filer
Class SizeableMemFiler

java.lang.Object
  extended byorg.apache.xindice.util.SimpleConfigurable
      extended byorg.apache.xindice.core.filer.SizeableMemFiler
All Implemented Interfaces:
Configurable, DBObject, Filer, Named

public final class SizeableMemFiler
extends SimpleConfigurable
implements Filer

SizeableMemFiler is an In-Memory Filer implementation for Xindice. SizeableMemFiler can be used for temporary collections and caching. It's basically a layering on top of HashMap.

Version:
$Revision: 541516 $, $Date: 2007-05-24 22:46:51 -0400 (Thu, 24 May 2007) $
Author:
Terry Rosenbaum (terry@amicas.com)

Field Summary
static int INITIAL_SIZE
           
static String INITIAL_SIZE_KEY
           
 
Fields inherited from class org.apache.xindice.util.SimpleConfigurable
config
 
Constructor Summary
SizeableMemFiler()
           
SizeableMemFiler(Map hashTable)
           
SizeableMemFiler(Map hashTable, boolean readOnly)
           
 
Method Summary
 boolean close()
          close closes the DBObject
 boolean create()
          create creates a new DBObject and any associated resources for the new DBObject, such as disk files, etc.
 boolean deleteRecord(Key key)
          deleteRecord removes a Record from the Filer based on the specified Key.
 boolean drop()
          drop instructs the DBObjectimplementation to remove itself from existence.
 boolean exists()
          exists returns whether or not a physical representation of this DBObject actually exists.
 void flush()
          flush forcefully flushes any unwritten buffers to disk.
 String getName()
          getName retrieves the contextually important name of the object
 long getRecordCount()
          getRecordCount returns the number of Records in the Filer.
 RecordSet getRecordSet()
          getRecordSet returns a RecordSet object for the current Filer.
 boolean isOpened()
          isOpened returns whether or not the DBObject is opened for business.
 boolean open()
          open opens the DBObject
 Record readRecord(Key key)
          readRecord returns a Record from the Filer based on the specified Key.
 Record readRecord(Key key, boolean metaOnly)
          readRecord returns a Record from the Filer based on the specified Key containing filer meta information and value.
 void setLocation(File root, String location)
          setLocation tells the Filer where to store its data.
 Record writeRecord(Key key, Value value)
          writeRecord writes a Value to the Filer based on the specified Key.
 
Methods inherited from class org.apache.xindice.util.SimpleConfigurable
getConfig, setConfig
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.xindice.util.Configurable
getConfig, setConfig
 

Field Detail

INITIAL_SIZE_KEY

public static final String INITIAL_SIZE_KEY
See Also:
Constant Field Values

INITIAL_SIZE

public static final int INITIAL_SIZE
See Also:
Constant Field Values
Constructor Detail

SizeableMemFiler

public SizeableMemFiler()

SizeableMemFiler

public SizeableMemFiler(Map hashTable,
                        boolean readOnly)

SizeableMemFiler

public SizeableMemFiler(Map hashTable)
Method Detail

setLocation

public void setLocation(File root,
                        String location)
Description copied from interface: Filer
setLocation tells the Filer where to store its data.

Specified by:
setLocation in interface Filer
Parameters:
root - The root under which to store data
location - The name to use for storing data

getName

public String getName()
Description copied from interface: Named
getName retrieves the contextually important name of the object

Specified by:
getName in interface Named
Returns:
The object's name

create

public boolean create()
Description copied from interface: DBObject
create creates a new DBObject and any associated resources for the new DBObject, such as disk files, etc.

Specified by:
create in interface DBObject
Returns:
Whether or not the DBObject was created

open

public boolean open()
Description copied from interface: DBObject
open opens the DBObject

Specified by:
open in interface DBObject
Returns:
Whether or not the DBObject was opened

isOpened

public boolean isOpened()
Description copied from interface: DBObject
isOpened returns whether or not the DBObject is opened for business.

Specified by:
isOpened in interface DBObject
Returns:
The open status of the DBObject

exists

public boolean exists()
Description copied from interface: DBObject
exists returns whether or not a physical representation of this DBObject actually exists. In the case of a HashFiler, this would check for the file, and in the case of an FTPFiler, it might perform a connection check.

Specified by:
exists in interface DBObject
Returns:
Whether or not the physical resource exists

drop

public boolean drop()
Description copied from interface: DBObject
drop instructs the DBObjectimplementation to remove itself from existence. The DBObject's parent is responsible for removing any references to the DBObject in its own context.

Specified by:
drop in interface DBObject
Returns:
Whether or not the DBObject was dropped

close

public boolean close()
Description copied from interface: DBObject
close closes the DBObject

Specified by:
close in interface DBObject
Returns:
Whether or not the DBObject was closed

flush

public void flush()
Description copied from interface: Filer
flush forcefully flushes any unwritten buffers to disk.

Specified by:
flush in interface Filer

readRecord

public Record readRecord(Key key)
                  throws DBException
Description copied from interface: Filer
readRecord returns a Record from the Filer based on the specified Key.

Specified by:
readRecord in interface Filer
Parameters:
key - The Record's Key
Returns:
The returned Record
Throws:
DBException

readRecord

public Record readRecord(Key key,
                         boolean metaOnly)
                  throws DBException
Description copied from interface: Filer
readRecord returns a Record from the Filer based on the specified Key containing filer meta information and value.

Specified by:
readRecord in interface Filer
Parameters:
key - The Record's Key
metaOnly - if true, resulting record contains only meta information
Returns:
The returned Record
Throws:
DBException

writeRecord

public Record writeRecord(Key key,
                          Value value)
                   throws DBException
Description copied from interface: Filer
writeRecord writes a Value to the Filer based on the specified Key.

Specified by:
writeRecord in interface Filer
Parameters:
key - The Record's Key
value - The Record's Value
Returns:
Written Record
Throws:
DBException

deleteRecord

public boolean deleteRecord(Key key)
                     throws DBException
Description copied from interface: Filer
deleteRecord removes a Record from the Filer based on the specified Key.

Specified by:
deleteRecord in interface Filer
Parameters:
key - The Record's Key
Returns:
Whether or not the Record was deleted
Throws:
DBException

getRecordCount

public long getRecordCount()
                    throws DBException
Description copied from interface: Filer
getRecordCount returns the number of Records in the Filer.

Specified by:
getRecordCount in interface Filer
Returns:
The Record count
Throws:
DBException

getRecordSet

public RecordSet getRecordSet()
                       throws DBException
Description copied from interface: Filer
getRecordSet returns a RecordSet object for the current Filer.

Specified by:
getRecordSet in interface Filer
Returns:
The Filer Enumerator
Throws:
DBException

Xindice API
version 1.2m1

Copyright (c) 1999-2007 The Apache Software Foundation. All Rights Reserved.