com.revusky.oreo
Class AbstractDataSource

java.lang.Object
  |
  +--com.revusky.oreo.AbstractDataSource
All Implemented Interfaces:
DataSource, java.rmi.Remote
Direct Known Subclasses:
AbstractMutableDataSource, InMemoryIndex

public abstract class AbstractDataSource
extends java.lang.Object
implements DataSource

A convenient base class for DataSource implementations. Implements some methods that are likely to be used by most.

Author:
Jonathan Revusky

Constructor Summary
AbstractDataSource()
          Our constructor must throw the exception since the superclass's constructor does.
 
Method Summary
 void close()
          A method that should be called to free any resources associated with the data source.
 Record get(java.lang.Object key)
          method that exists for backward compatibility This is equivalent to get(null, key);
 java.lang.String getName()
           
 void init(java.util.Properties props)
          A method that initializes a DataSource with a set of initialization properties.
 java.util.List keys()
          This is equivalent to calling keys(null) where no record type is specified.
 void wipeCache()
          If this data source is backed by some external mechanism, like an RDBMS, wipes the in-memory cache, if one is being maintained.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.revusky.oreo.DataSource
get, getRecords, keys
 

Constructor Detail

AbstractDataSource

public AbstractDataSource()
                   throws java.io.IOException
Our constructor must throw the exception since the superclass's constructor does.
Method Detail

getName

public java.lang.String getName()
                         throws java.io.IOException
Specified by:
getName in interface DataSource
Following copied from interface: com.revusky.oreo.DataSource
Returns:
a unique string by which this DataSource will be known.

init

public void init(java.util.Properties props)
          throws java.io.IOException
Description copied from interface: DataSource
A method that initializes a DataSource with a set of initialization properties. This is called internally within Oreo and should not be called by application code. As an implementor, you should make sure that this method is only called once, for example, throw a RuntimeException if an attempt is made to call this on a DataSource a second time.
Specified by:
init in interface DataSource

get

public final Record get(java.lang.Object key)
                 throws java.io.IOException
Description copied from interface: DataSource
method that exists for backward compatibility This is equivalent to get(null, key);
Specified by:
get in interface DataSource

keys

public final java.util.List keys()
                          throws java.io.IOException
Description copied from interface: DataSource
This is equivalent to calling keys(null) where no record type is specified.
Specified by:
keys in interface DataSource

wipeCache

public void wipeCache()
               throws java.io.IOException
Description copied from interface: DataSource
If this data source is backed by some external mechanism, like an RDBMS, wipes the in-memory cache, if one is being maintained. Otherwise, it does nothing.
Specified by:
wipeCache in interface DataSource

close

public void close()
           throws java.io.IOException
Description copied from interface: DataSource
A method that should be called to free any resources associated with the data source. Note that no other methods should be called on this object after this one. (In many implementations, this method will likely do nothing.)
Specified by:
close in interface DataSource