public class ProteinTreeComponentsFactory
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
dbName
The name of the db to use.
|
static java.lang.String |
defaultDbFolderPath
The folder containing the databases.
|
static java.lang.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.
|
java.io.File |
getDbFolder()
Returns the folder where the db in the sequence factory is stored.
|
java.lang.String |
getDbFolderName()
Returns the folder name where to store information about the protein
sequence database loaded in the sequence factory.
|
java.lang.Integer |
getInitialSize()
Retrieves the initial tag size from the db.
|
static ProteinTreeComponentsFactory |
getInstance()
Static method returning the instance of the factory.
|
Node |
getNode(java.lang.String tag)
Retrieves the node of the given tag.
|
java.lang.Integer |
getProteinLength(java.lang.String accession)
Retrieves the length of a protein.
|
java.lang.String |
getVersion()
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(java.util.ArrayList<java.lang.String> tags)
Loads nodes in the cache.
|
void |
loadParameters()
Loads all tree parameters.
|
void |
loadProteinLengths()
Loads all protein lengths in cache.
|
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(java.lang.String tag,
Node node)
Adds a node to the database.
|
void |
saveNodes(java.util.HashMap<java.lang.String,java.lang.Object> nodes)
Adds nodes to the database.
|
void |
saveProteinLengths(java.util.HashMap<java.lang.String,java.lang.Object> lengths)
Adds a protein length to the database.
|
void |
setCorrupted(boolean corrupted)
Sets whether the database is corrupted.
|
void |
setImportComplete(boolean completed)
Sets whether the import was completed.
|
void |
setVersion(java.lang.String version)
Sets the version.
|
public static final java.lang.String defaultDbFolderPath
public static final java.lang.String folderSeparator
public static final java.lang.String dbName
public static ProteinTreeComponentsFactory getInstance() throws java.io.IOException
java.io.IOExceptionpublic boolean initiate()
throws java.sql.SQLException,
java.io.IOException
java.sql.SQLException - exception thrown whenever an error occurred while
attempting to connect to the databasejava.io.IOException - exception thrown whenever an error occurred while
attempting to connect to the databasepublic boolean delete()
throws java.io.IOException
java.io.IOExceptionpublic void close()
throws java.io.IOException,
java.sql.SQLException
java.io.IOExceptionjava.sql.SQLException - exception thrown if closing the db failedpublic java.lang.String getDbFolderName()
public java.io.File getDbFolder()
throws java.io.IOException
java.io.IOExceptionpublic void saveNode(java.lang.String tag,
Node node)
throws java.sql.SQLException,
java.io.IOException,
java.lang.InterruptedException
tag - the tag referring to the node of interestnode - the nodejava.sql.SQLException - exception thrown whenever an error occurred while
loading data in the databasejava.io.IOException - exception thrown whenever an error occurred while
loading data in the databasejava.lang.InterruptedExceptionpublic void saveNodes(java.util.HashMap<java.lang.String,java.lang.Object> nodes)
throws java.sql.SQLException,
java.io.IOException
nodes - map of the nodesjava.sql.SQLException - exception thrown whenever an error occurred while
loading data in the databasejava.io.IOException - exception thrown whenever an error occurred while
loading data in the databasepublic Node getNode(java.lang.String tag) throws java.sql.SQLException, java.lang.ClassNotFoundException, java.io.IOException, java.lang.InterruptedException
tag - the tag of interestjava.sql.SQLExceptionjava.lang.ClassNotFoundExceptionjava.io.IOExceptionjava.lang.InterruptedExceptionpublic void loadNodes(java.util.ArrayList<java.lang.String> tags)
throws java.sql.SQLException,
java.io.IOException,
java.lang.ClassNotFoundException,
java.lang.InterruptedException
tags - list of tags corresponding to the nodes to loadjava.sql.SQLExceptionjava.io.IOExceptionjava.lang.ClassNotFoundExceptionjava.lang.InterruptedExceptionpublic void saveProteinLengths(java.util.HashMap<java.lang.String,java.lang.Object> lengths)
throws java.sql.SQLException,
java.io.IOException
lengths - the lengthsjava.sql.SQLException - exception thrown whenever an error occurred while
loading data in the databasejava.io.IOException - exception thrown whenever an error occurred while
loading data in the databasepublic java.lang.Integer getProteinLength(java.lang.String accession)
throws java.sql.SQLException,
java.lang.ClassNotFoundException,
java.io.IOException,
java.lang.InterruptedException
accession - the accession of the protein of interestjava.sql.SQLExceptionjava.lang.ClassNotFoundExceptionjava.io.IOExceptionjava.lang.InterruptedExceptionpublic void saveInitialSize(int size)
throws java.sql.SQLException,
java.io.IOException,
java.lang.InterruptedException
size - the initial tag sizejava.sql.SQLExceptionjava.io.IOExceptionjava.lang.InterruptedExceptionpublic java.lang.Integer getInitialSize()
throws java.sql.SQLException,
java.io.IOException,
java.lang.ClassNotFoundException,
java.lang.InterruptedException
java.sql.SQLExceptionjava.io.IOExceptionjava.lang.ClassNotFoundExceptionjava.lang.InterruptedExceptionpublic void loadProteinLengths()
throws java.sql.SQLException,
java.lang.ClassNotFoundException,
java.io.IOException,
java.lang.InterruptedException
java.sql.SQLExceptionjava.lang.ClassNotFoundExceptionjava.io.IOExceptionjava.lang.InterruptedExceptionpublic void loadParameters()
throws java.sql.SQLException,
java.lang.ClassNotFoundException,
java.io.IOException,
java.lang.InterruptedException
java.sql.SQLExceptionjava.lang.ClassNotFoundExceptionjava.io.IOExceptionjava.lang.InterruptedExceptionpublic void setImportComplete(boolean completed)
throws java.sql.SQLException,
java.io.IOException,
java.lang.InterruptedException
completed - java.sql.SQLExceptionjava.io.IOExceptionjava.lang.InterruptedExceptionpublic boolean importComplete()
throws java.sql.SQLException,
java.io.IOException,
java.lang.ClassNotFoundException,
java.lang.InterruptedException
java.sql.SQLExceptionjava.io.IOExceptionjava.lang.ClassNotFoundExceptionjava.lang.InterruptedExceptionpublic void setCorrupted(boolean corrupted)
throws java.sql.SQLException,
java.io.IOException,
java.lang.InterruptedException
corrupted - java.sql.SQLExceptionjava.io.IOExceptionjava.lang.InterruptedExceptionpublic boolean isCorrupted()
throws java.sql.SQLException,
java.io.IOException,
java.lang.ClassNotFoundException,
java.lang.InterruptedException
java.sql.SQLExceptionjava.io.IOExceptionjava.lang.ClassNotFoundExceptionjava.lang.InterruptedExceptionpublic void setVersion(java.lang.String version)
throws java.sql.SQLException,
java.io.IOException,
java.lang.InterruptedException
version - the versionjava.sql.SQLExceptionjava.io.IOExceptionjava.lang.InterruptedExceptionpublic java.lang.String getVersion()
throws java.sql.SQLException,
java.io.IOException,
java.lang.ClassNotFoundException,
java.lang.InterruptedException
java.sql.SQLExceptionjava.io.IOExceptionjava.lang.ClassNotFoundExceptionjava.lang.InterruptedExceptionpublic void loadTags()
throws java.sql.SQLException
java.sql.SQLExceptionCopyright © 2014. All Rights Reserved.