public class BioStoreFactory extends Object
BioStoreFactory
creates BioStore
instances. These are directory and file structures which index flat
files according to the OBDA specification.Modifier and Type | Field and Description |
---|---|
static String |
KEYS
KEYS is the key used to identify the secondary
namespaces in the OBDA config.dat files. |
static AnnotationType |
META_DATA_TYPE
AnnotationType that all meta-data files should fit.
|
static String |
PRIMARY_KEY_NAME
PRIMARY_KEY_NAME is the key used to identify the
primary namespace in the OBDA config.dat files. |
static String |
SEQUENCE_FORMAT
SEQUENCE_FORMAT is the key used to identify the
format of the indexed sequence files represented by the store
in the OBDA config.dat files. |
static String |
STORE_NAME
STORE_NAME is the key used to identify the
arbitrary name of the store in the OBDA config.dat files. |
Constructor and Description |
---|
BioStoreFactory()
Creates a new
BioStoreFactory . |
Modifier and Type | Method and Description |
---|---|
void |
addKey(String keyName,
int length)
addKey adds a new identifier namespace. |
static int |
calculatePrimRecLen(int idLen)
calculatePrimRecLen calculates the byte length of
primary namespace records. |
static int |
calculateSecRecLen(int idLen,
String primaryKey,
Map keys)
calculateSecRecLen calculates the byte length of
secondary namespace records. |
BioStore |
createBioStore()
createBioStore creates a BioStore
reflecting the current state of the factory and returns a
reference to it. |
Set |
getKeys() |
String |
getPrimaryKey()
getPrimaryKey returns the primary identifier
namespace. |
LifeScienceIdentifier |
getSequenceFormat()
getSequenceFormat returns the current sequence
format name. |
File |
getStoreLocation()
getStoreLocation returns the directory of the bew
index. |
String |
getStoreName()
getStoreName returns the name to be given to the
new index. |
static File |
makeConfigFile(File storeLoc)
makeConfigFile returns a file which represents an
OBDA "config.dat" in the specified index directory. |
static File |
makePrimaryKeyFile(File storeLoc,
String key)
makePrimaryKeyFile returns a file which represents
an OBDA "key_<primary namespace>.key" primary key file on the
specified index directory. |
static File |
makeSecondaryFile(File storeLoc,
String key)
makeSecondaryFile returns a file which represents
an OBDA "id_<secondary namespace>.index" secondary key file on
the specified. |
void |
removeKey(String keyName)
removeKey removes the specified
key. |
void |
setPrimaryKey(String primaryKey)
setPrimaryKey sets the primary identifier
namespace. |
void |
setSequenceFormat(LifeScienceIdentifier format)
setSequenceFormat sets the sequence format name
which will be indicated in the index. |
void |
setStoreLocation(File storeLoc)
setStoreLocation sets the directory of the new
index. |
void |
setStoreName(String name)
setStoreName sets the name to be given to the new
index. |
public static final String STORE_NAME
STORE_NAME
is the key used to identify the
arbitrary name of the store in the OBDA config.dat files.public static final String SEQUENCE_FORMAT
SEQUENCE_FORMAT
is the key used to identify the
format of the indexed sequence files represented by the store
in the OBDA config.dat files.public static final String PRIMARY_KEY_NAME
PRIMARY_KEY_NAME
is the key used to identify the
primary namespace in the OBDA config.dat files.public static final String KEYS
KEYS
is the key used to identify the secondary
namespaces in the OBDA config.dat files.public static final AnnotationType META_DATA_TYPE
public BioStoreFactory()
BioStoreFactory
.public void setStoreName(String name)
setStoreName
sets the name to be given to the new
index.name
- a String
.public String getStoreName()
getStoreName
returns the name to be given to the
new index.String
.public void setStoreLocation(File storeLoc)
setStoreLocation
sets the directory of the new
index.storeLoc
- a File
.public File getStoreLocation()
getStoreLocation
returns the directory of the bew
index.File
.public void setSequenceFormat(LifeScienceIdentifier format)
setSequenceFormat
sets the sequence format name
which will be indicated in the index.format
- a LifeScienceIdentifier
which must
be one of those mandated by the OBDA flatfile indexing
specification.public LifeScienceIdentifier getSequenceFormat()
getSequenceFormat
returns the current sequence
format name.LifeScienceIdentifier
.public void setPrimaryKey(String primaryKey)
setPrimaryKey
sets the primary identifier
namespace.primaryKey
- a String
.public String getPrimaryKey()
getPrimaryKey
returns the primary identifier
namespace.String
.public void addKey(String keyName, int length)
addKey
adds a new identifier namespace.keyName
- a String
.length
- an int
indicating the byte length of
the key records.public void removeKey(String keyName)
removeKey
removes the specified
key.keyName
- a String
.public BioStore createBioStore() throws BioException
createBioStore
creates a BioStore
reflecting the current state of the factory and returns a
reference to it.BioStore
.BioException
- if an error occurs.public static File makeConfigFile(File storeLoc) throws IOException
makeConfigFile
returns a file which represents an
OBDA "config.dat" in the specified index directory.storeLoc
- a File
indicating the index
directory.File
representing "config.dat".IOException
- if an error occurs.public static File makePrimaryKeyFile(File storeLoc, String key) throws IOException
makePrimaryKeyFile
returns a file which represents
an OBDA "key_<primary namespace>.key" primary key file on the
specified index directory.storeLoc
- a File
indicating the parent path.key
- a String
primary key namespace.File
representing a "key_<primary
namespace>.key".IOException
- if an error occurs.public static File makeSecondaryFile(File storeLoc, String key) throws IOException
makeSecondaryFile
returns a file which represents
an OBDA "id_<secondary namespace>.index" secondary key file on
the specified.storeLoc
- a File
indicating the parent path.key
- a String
secondary key namespace.File
representing an "id_<secondary
namespace>.index" file.IOException
- if an error occurs.public static int calculatePrimRecLen(int idLen)
calculatePrimRecLen
calculates the byte length of
primary namespace records.idLen
- an int
the number of bytes required
to hold the primary namespace ID.int
record length in bytes.public static int calculateSecRecLen(int idLen, String primaryKey, Map keys)
calculateSecRecLen
calculates the byte length of
secondary namespace records.idLen
- an int
the number of bytes required
to hold the secondary namespace ID.primaryKey
- a String
the primary namespace
ID.keys
- a Map
of secondary keys to their byte
lengths.int
record length in bytes.Copyright © 2014 BioJava. All rights reserved.