public class ProteinTreeComponentsFactory extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
dbName
The name of the db to use.
|
static String |
folderSeparator
The splitter in the key between database name and database version.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the factory, closes all connection and deletes the file.
|
boolean |
delete()
Sets the currently loaded database as corrupted and tries to delete it.
|
static void |
deletOutdatedTrees()
Deletes the outdated trees.
|
File |
getDbFolder()
Returns the folder where the db in the sequence factory is stored.
|
String |
getDbFolderName()
Returns the folder name where to store information about the protein
sequence database loaded in the sequence factory.
|
static String |
getDefaultDbFolderPath()
Returns the default folder to use when storing the trees.
|
String |
getFastaFilePath()
Returns the FASTA file path.
|
static String |
getFastaFilePath(ObjectsDB objectsDB)
Returns the FASTA file path.
|
Integer |
getInitialSize()
Retrieves the initial tag size from the db.
|
static ProteinTreeComponentsFactory |
getInstance()
Static method returning the instance of the factory.
|
Node |
getNode(String tag)
Retrieves the node of the given tag.
|
String |
getVersion()
Returns the version.
|
static String |
getVersion(ObjectsDB objectsDB)
Returns the version.
|
boolean |
importComplete()
Returns a boolean indicating whether the import was complete.
|
boolean |
initiate()
Initiates the connection to the database and indicates whether the
corresponding folder is already created.
|
boolean |
isCorrupted()
Returns a boolean indicating whether the database is corrupted.
|
void |
loadNodes(ArrayList<String> tags)
Loads nodes in the cache.
|
void |
loadParameters()
Loads all tree parameters.
|
void |
loadTags()
Loads the tags implemented in the database.
|
void |
saveInitialSize(int size)
Saves the initial tag size in the parameters table of the DB.
|
void |
saveNode(String tag,
Node node)
Adds a node to the database.
|
void |
saveNodes(HashMap<String,Object> nodes,
WaitingHandler waitingHandler)
Adds nodes to the database.
|
void |
setCorrupted(boolean corrupted)
Sets whether the database is corrupted.
|
static void |
setDefaultDbFolderPath(String defaultDbFolderPath)
Sets the default folder to use when storing the trees.
|
void |
setFastaFilePath(String fastaFilePath)
Sets the FASTA file path.
|
void |
setImportComplete(boolean completed)
Sets whether the import was completed.
|
void |
setVersion(String version)
Sets the version.
|
public static final String folderSeparator
public static final String dbName
public static ProteinTreeComponentsFactory getInstance() throws IOException
IOExceptionpublic boolean initiate()
throws SQLException,
IOException
SQLException - exception thrown whenever an error occurred while
attempting to connect to the databaseIOException - exception thrown whenever an error occurred while
attempting to connect to the databasepublic boolean delete()
throws IOException
IOExceptionpublic void close()
throws IOException,
SQLException
IOExceptionSQLException - exception thrown if closing the db failedpublic String getDbFolderName()
public File getDbFolder() throws IOException
IOExceptionpublic void saveNode(String tag, Node node) throws SQLException, IOException, InterruptedException
tag - the tag referring to the node of interestnode - the nodeSQLException - exception thrown whenever an error occurred while
loading data in the databaseIOException - exception thrown whenever an error occurred while
loading data in the databaseInterruptedExceptionpublic void saveNodes(HashMap<String,Object> nodes, WaitingHandler waitingHandler) throws SQLException, IOException
nodes - map of the nodeswaitingHandler - the waiting handlerSQLException - exception thrown whenever an error occurred while
loading data in the databaseIOException - exception thrown whenever an error occurred while
loading data in the databasepublic Node getNode(String tag) throws SQLException, ClassNotFoundException, IOException, InterruptedException
tag - the tag of interestSQLExceptionClassNotFoundExceptionIOExceptionInterruptedExceptionpublic void loadNodes(ArrayList<String> tags) throws SQLException, IOException, ClassNotFoundException, InterruptedException
tags - list of tags corresponding to the nodes to loadSQLExceptionIOExceptionClassNotFoundExceptionInterruptedExceptionpublic void saveInitialSize(int size)
throws SQLException,
IOException,
InterruptedException
size - the initial tag sizeSQLExceptionIOExceptionInterruptedExceptionpublic Integer getInitialSize() throws SQLException, IOException, ClassNotFoundException, InterruptedException
SQLExceptionIOExceptionClassNotFoundExceptionInterruptedExceptionpublic void loadParameters()
throws SQLException,
ClassNotFoundException,
IOException,
InterruptedException
public void setImportComplete(boolean completed)
throws SQLException,
IOException,
InterruptedException
completed - SQLExceptionIOExceptionInterruptedExceptionpublic boolean importComplete()
throws SQLException,
IOException,
ClassNotFoundException,
InterruptedException
SQLExceptionIOExceptionClassNotFoundExceptionInterruptedExceptionpublic void setCorrupted(boolean corrupted)
throws SQLException,
IOException,
InterruptedException
corrupted - SQLExceptionIOExceptionInterruptedExceptionpublic boolean isCorrupted()
throws SQLException,
IOException,
ClassNotFoundException,
InterruptedException
SQLExceptionIOExceptionClassNotFoundExceptionInterruptedExceptionpublic void setVersion(String version) throws SQLException, IOException, InterruptedException
version - the versionSQLExceptionIOExceptionInterruptedExceptionpublic static String getVersion(ObjectsDB objectsDB) throws SQLException, IOException, ClassNotFoundException, InterruptedException
objectsDB - the objects db to look intoSQLExceptionIOExceptionClassNotFoundExceptionInterruptedExceptionpublic String getVersion() throws SQLException, IOException, ClassNotFoundException, InterruptedException
SQLExceptionIOExceptionClassNotFoundExceptionInterruptedExceptionpublic void setFastaFilePath(String fastaFilePath) throws SQLException, IOException, InterruptedException
fastaFilePath - the FASTA file pathSQLExceptionIOExceptionInterruptedExceptionpublic String getFastaFilePath() throws SQLException, IOException, ClassNotFoundException, InterruptedException
SQLExceptionIOExceptionClassNotFoundExceptionInterruptedExceptionpublic static String getFastaFilePath(ObjectsDB objectsDB) throws SQLException, IOException, ClassNotFoundException, InterruptedException
objectsDB - the objects DB to look intoSQLExceptionIOExceptionClassNotFoundExceptionInterruptedExceptionpublic void loadTags()
throws SQLException
SQLExceptionpublic static String getDefaultDbFolderPath()
public static void setDefaultDbFolderPath(String defaultDbFolderPath)
defaultDbFolderPath - the default folder to use when storing the treespublic static void deletOutdatedTrees()
throws IOException
IOExceptionCopyright © 2014. All rights reserved.