public class BioIndex extends Object implements IndexStore
This class may not be thread-safe.
Constructor and Description |
---|
BioIndex(File indexDirectory)
Load an existing index file.
|
BioIndex(File indexDirectory,
String namespace,
int idLength) |
Modifier and Type | Method and Description |
---|---|
void |
commit()
Commit the stored indices to permanent storage.
|
Index |
fetch(String id)
Fetch an Index based upon an ID.
|
Set |
getFiles()
Retrieve the Set of files that are currently indexed.
|
SequenceFormat |
getFormat()
Retrieve the format of the index file.
|
Set |
getIDs()
Retrieve the set of all current IDs.
|
String |
getName()
Retrieve the name of this store.
|
SequenceBuilderFactory |
getSBFactory()
Retrieve the SequenceBuilderFactory used to build Sequence instances.
|
SymbolTokenization |
getSymbolParser()
Retrieve the symbol parser used to turn the sequence characters
into Symobl objects.
|
int |
guessRecLen(RandomAccessFile file) |
void |
rollback()
Discard all uncommited changes.
|
void |
store(Index indx)
Add the Index to the store.
|
public BioIndex(File indexDirectory, String namespace, int idLength) throws IOException, BioException
IOException
BioException
public BioIndex(File indexDirectory) throws IOException, BioException
IOException
BioException
public String getName()
IndexStore
getName
in interface IndexStore
public int guessRecLen(RandomAccessFile file) throws IOException
IOException
public Index fetch(String id) throws IllegalIDException, BioException
IndexStore
fetch
in interface IndexStore
id
- The ID of the sequence Index to retrieveIllegalIDException
- if the ID couldn't be foundBioException
- if the fetch fails in the underlying storage mechanismpublic void store(Index indx)
IndexStore
This method should be transactional. If the store fails, the IndexStore should be left in its original state.
If the file of the Index is not known yet, it is the responsibility of the IndexStore to add it to the set returned by getFiles.
store
in interface IndexStore
indx
- the Index to addpublic void commit() throws BioException
IndexStore
commit
in interface IndexStore
BioException
- if for any reason the commit failspublic void rollback()
IndexStore
rollback
in interface IndexStore
public Set getIDs()
IndexStore
This set should either be immutable, or modifiable totally separately from the IndexStore.
getIDs
in interface IndexStore
public Set getFiles()
IndexStore
getFiles
in interface IndexStore
public SequenceFormat getFormat()
IndexStore
This set should either be immutable, or modifiable totally separately from the IndexStore.
getFormat
in interface IndexStore
public SequenceBuilderFactory getSBFactory()
IndexStore
getSBFactory
in interface IndexStore
public SymbolTokenization getSymbolParser()
IndexStore
getSymbolParser
in interface IndexStore
Copyright © 2014 BioJava. All rights reserved.