public class ProteinTreeComponentsFactory
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
dbFolderPath
The folder containing the databases.
|
static java.lang.String |
dbName
The name of the db to use.
|
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 |
loadParameters()
Loads all tree parameters.
|
void |
loadProteinLenths()
Loads all protein lengths in cache.
|
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 |
saveProteinLength(java.lang.String accession,
int length)
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 dbFolderPath
public static final java.lang.String folderSeparator
public static final java.lang.String dbName
public static ProteinTreeComponentsFactory getInstance() throws java.io.IOException
java.io.IOException
public 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()
public void close() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
- exception thrown if closing the db failedpublic java.lang.String getDbFolderName()
public java.io.File getDbFolder()
public void saveNode(java.lang.String tag, Node node) throws java.sql.SQLException, java.io.IOException
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 databasepublic 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
tag
- the tag of interestjava.sql.SQLException
java.lang.ClassNotFoundException
java.io.IOException
public void saveProteinLength(java.lang.String accession, int length) throws java.sql.SQLException, java.io.IOException
accession
- the protein accessionlength
- the lengthjava.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
accession
- the accession of the protein of interestjava.sql.SQLException
java.lang.ClassNotFoundException
java.io.IOException
public void saveInitialSize(int size) throws java.sql.SQLException, java.io.IOException
size
- the initial tag sizejava.sql.SQLException
java.io.IOException
public java.lang.Integer getInitialSize() throws java.sql.SQLException, java.io.IOException, java.lang.ClassNotFoundException
java.sql.SQLException
java.io.IOException
java.lang.ClassNotFoundException
public void loadProteinLenths() throws java.sql.SQLException, java.lang.ClassNotFoundException, java.io.IOException, java.lang.InterruptedException
java.sql.SQLException
java.lang.ClassNotFoundException
java.io.IOException
java.lang.InterruptedException
public void loadParameters() throws java.sql.SQLException, java.lang.ClassNotFoundException, java.io.IOException, java.lang.InterruptedException
java.sql.SQLException
java.lang.ClassNotFoundException
java.io.IOException
java.lang.InterruptedException
public void setImportComplete(boolean completed) throws java.sql.SQLException, java.io.IOException
completed
- java.sql.SQLException
java.io.IOException
public boolean importComplete() throws java.sql.SQLException, java.io.IOException, java.lang.ClassNotFoundException
java.sql.SQLException
java.io.IOException
java.lang.ClassNotFoundException
public void setCorrupted(boolean corrupted) throws java.sql.SQLException, java.io.IOException
corrupted
- java.sql.SQLException
java.io.IOException
public boolean isCorrupted() throws java.sql.SQLException, java.io.IOException, java.lang.ClassNotFoundException
java.sql.SQLException
java.io.IOException
java.lang.ClassNotFoundException
public void setVersion(java.lang.String version) throws java.sql.SQLException, java.io.IOException
version
- the versionjava.sql.SQLException
java.io.IOException
public java.lang.String getVersion() throws java.sql.SQLException, java.io.IOException, java.lang.ClassNotFoundException
java.sql.SQLException
java.io.IOException
java.lang.ClassNotFoundException
Copyright © 2013. All Rights Reserved.