Package org.biojava.bio.program.indexdb
Class BioStore
- java.lang.Object
-
- org.biojava.bio.program.indexdb.BioStore
-
- All Implemented Interfaces:
IndexStore
public class BioStore extends Object implements IndexStore
BioStores represent directory and file structures which index flat files according to the OBDA specification. The preferred method of constructing new instances is to useBioStoreFactory.- Author:
- Matthew Pocock, Keith James
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcommit()commitwrites an index to disk.Recordget(String id)getreturns a record specified by a primary identifier.Listget(String id, String namespace)getreturns a list ofRecords by searching against the primary identifiers if the namespace argument is equal to the primary namespace or otherwise by searching the secondary namespaces.FilegetLocation()getLocationreturns the directory where the index is located.AnnotationgetMetaData()getMetaDatareturns a data structure which represents an OBDA "config.dat" flatfile indexing configuration file.StringgetName()The name of this store or null if the name has not been set.ListgetRecordList()getRecordListreturns all theRecords in the index.voidwriteRecord(RAF file, long offset, int length, String id, Map secIDs)writeRecordcreates and writes a newRecord
-
-
-
Constructor Detail
-
BioStore
public BioStore(File location, boolean cache) throws IOException, BioException
Creates a newBioStoreflatfile index at the specified location with the specified caching behaviour.- Parameters:
location- aFileindicating the index directory.cache- abooleanindicating whether the implementation should cache its state.- Throws:
IOException- if an error occurs.BioException- if an error occurs.
-
-
Method Detail
-
getLocation
public File getLocation()
getLocationreturns the directory where the index is located.- Returns:
- a
File.
-
getMetaData
public Annotation getMetaData()
Description copied from interface:IndexStoregetMetaDatareturns a data structure which represents an OBDA "config.dat" flatfile indexing configuration file.- Specified by:
getMetaDatain interfaceIndexStore- Returns:
- an
Annotation.
-
get
public Record get(String id)
Description copied from interface:IndexStoregetreturns a record specified by a primary identifier.- Specified by:
getin interfaceIndexStore- Parameters:
id- aStringprimary ID.- Returns:
- a
Record.
-
get
public List get(String id, String namespace) throws BioException
Description copied from interface:IndexStoregetreturns a list ofRecords by searching against the primary identifiers if the namespace argument is equal to the primary namespace or otherwise by searching the secondary namespaces. The list of Record instances retuned may be empty, but is never null.- Specified by:
getin interfaceIndexStore- Parameters:
id- aStringprimary ID.namespace- aString.- Returns:
- a
ListofRecords. - Throws:
BioException- if an error occurs.
-
writeRecord
public void writeRecord(RAF file, long offset, int length, String id, Map secIDs)
Description copied from interface:IndexStorewriteRecordcreates and writes a newRecord- Specified by:
writeRecordin interfaceIndexStore- Parameters:
file- aRAFfile.offset- alongbyte offset.length- anintbyte record length.id- aStringprimary ID.secIDs- aMapof primary ID to aListof secondary IDs.
-
getRecordList
public List getRecordList()
getRecordListreturns all theRecords in the index.- Returns:
- a
ListofRecords.
-
commit
public void commit() throws CommitFailure
commitwrites an index to disk.- Throws:
CommitFailure- if an error occurs.
-
-