Alignment API and Server 3.2

fr.inrialpes.exmo.align.service
Class CacheImpl

java.lang.Object
  extended by fr.inrialpes.exmo.align.service.CacheImpl

public class CacheImpl
extends Object

This class caches the content of the alignment database. I.e., It loads the metadata in the hash table It stores the alignment when requested It


Field Summary
(package private)  Hashtable alignmentTable
           
static String CACHED
           
(package private)  Connection conn
           
(package private)  int CONNECTION_ERROR
           
(package private)  String host
           
(package private)  int INIT_ERROR
           
(package private)  Hashtable ontologyTable
           
static String OURI1
           
static String OURI2
           
(package private)  String port
           
(package private)  int rights
           
static String STORED
           
(package private)  int SUCCESS
           
static String SVCNS
           
(package private)  int VERSION
           
 
Constructor Summary
CacheImpl(DBService service)
           
 
Method Summary
 void cleanUpCache()
           
 void close()
           
 String generateAlignmentId()
           
private  String generateCellId(String alId)
           
 Alignment getAlignment(String id)
          retrieve full alignment from id (and cache it)
 Set getAlignments(URI uri)
           
 Set<Alignment> getAlignments(URI uri1, URI uri2)
           
 Alignment getMetadata(String id)
          retrieve alignment metadata from id This is more difficult because we return the alignment we have disreagarding if it is complete o only metadata
 void init(Parameters p)
          loads the alignment descriptions from the database and put them in the alignmentTable hashtable
 void initDatabase()
           
protected  Enumeration listAlignments()
           
private  void loadAlignments(boolean force)
          loads the alignment descriptions from the database and put them in the alignmentTable hashtable index them under the ontology URIs Beware, the Alignment API has two attributes: onto1 is the OWLOntology object uri1 is the URI object from which loading the ontologies In the database we store: owlontology1 the URI string of the ontology file1 the URI string from which loading the ontologies uri1 which should be the same as the last one...
 String quote(String s)
          quote: Prepare a string to be used in SQL queries by preceeding occurences of "'", """, and "\" by a "\".
private  int randomNum()
           
 String recordAlignment(String id, Alignment alignment, boolean force)
          records alignment identified by id
 String recordNewAlignment(Alignment alignment, boolean force)
          records newly created alignment
 String recordNewAlignment(String id, Alignment al, boolean force)
          records alignment identified by id
 void resetCacheStamp(Alignment result)
           
 void resetDatabase(boolean force)
           
protected  Alignment retrieveAlignment(String id, Alignment alignment)
          loads the full alignments from the database and put them in the alignmentTable hastable should be invoked when: ( result.getExtension(CACHED) == "" && result.getExtension(STORED) != "") {
protected  Alignment retrieveDescription(String id)
          loads the description of alignments from the database and set them in an alignment object
 void storeAlignment(String id)
           
 void updateDatabase()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

alignmentTable

Hashtable alignmentTable

ontologyTable

Hashtable ontologyTable

host

String host

port

String port

rights

int rights

VERSION

final int VERSION
See Also:
Constant Field Values

conn

Connection conn

CONNECTION_ERROR

final int CONNECTION_ERROR
See Also:
Constant Field Values

SUCCESS

final int SUCCESS
See Also:
Constant Field Values

INIT_ERROR

final int INIT_ERROR
See Also:
Constant Field Values

SVCNS

public static final String SVCNS
See Also:
Constant Field Values

CACHED

public static final String CACHED
See Also:
Constant Field Values

STORED

public static final String STORED
See Also:
Constant Field Values

OURI1

public static final String OURI1
See Also:
Constant Field Values

OURI2

public static final String OURI2
See Also:
Constant Field Values
Constructor Detail

CacheImpl

public CacheImpl(DBService service)
Method Detail

init

public void init(Parameters p)
          throws SQLException,
                 AlignmentException
loads the alignment descriptions from the database and put them in the alignmentTable hashtable

Throws:
SQLException
AlignmentException

close

public void close()
           throws SQLException
Throws:
SQLException

loadAlignments

private void loadAlignments(boolean force)
                     throws SQLException
loads the alignment descriptions from the database and put them in the alignmentTable hashtable index them under the ontology URIs Beware, the Alignment API has two attributes: onto1 is the OWLOntology object uri1 is the URI object from which loading the ontologies In the database we store: owlontology1 the URI string of the ontology file1 the URI string from which loading the ontologies uri1 which should be the same as the last one... Since alignments are indexed by the URI of the ontologies, we use the "ouri1" temporary extension to contain this URI.

Throws:
SQLException

listAlignments

protected Enumeration listAlignments()

retrieveDescription

protected Alignment retrieveDescription(String id)
loads the description of alignments from the database and set them in an alignment object


retrieveAlignment

protected Alignment retrieveAlignment(String id,
                                      Alignment alignment)
                               throws SQLException,
                                      AlignmentException,
                                      URISyntaxException
loads the full alignments from the database and put them in the alignmentTable hastable should be invoked when: ( result.getExtension(CACHED) == "" && result.getExtension(STORED) != "") {

Throws:
SQLException
AlignmentException
URISyntaxException

generateAlignmentId

public String generateAlignmentId()

generateCellId

private String generateCellId(String alId)

randomNum

private int randomNum()

getMetadata

public Alignment getMetadata(String id)
                      throws Exception
retrieve alignment metadata from id This is more difficult because we return the alignment we have disreagarding if it is complete o only metadata

Throws:
Exception

getAlignment

public Alignment getAlignment(String id)
                       throws Exception
retrieve full alignment from id (and cache it)

Throws:
Exception

getAlignments

public Set getAlignments(URI uri)

getAlignments

public Set<Alignment> getAlignments(URI uri1,
                                    URI uri2)

recordNewAlignment

public String recordNewAlignment(Alignment alignment,
                                 boolean force)
records newly created alignment


recordNewAlignment

public String recordNewAlignment(String id,
                                 Alignment al,
                                 boolean force)
                          throws AlignmentException
records alignment identified by id

Throws:
AlignmentException

recordAlignment

public String recordAlignment(String id,
                              Alignment alignment,
                              boolean force)
records alignment identified by id


quote

public String quote(String s)
quote: Prepare a string to be used in SQL queries by preceeding occurences of "'", """, and "\" by a "\". This should be implemented at a lower level within Java itself (or the sql package). This function is used here for protecting everything to be entered in the database


storeAlignment

public void storeAlignment(String id)
                    throws Exception
Throws:
Exception

resetCacheStamp

public void resetCacheStamp(Alignment result)

cleanUpCache

public void cleanUpCache()

initDatabase

public void initDatabase()
                  throws SQLException
Throws:
SQLException

resetDatabase

public void resetDatabase(boolean force)
                   throws SQLException,
                          AlignmentException
Throws:
SQLException
AlignmentException

updateDatabase

public void updateDatabase()
                    throws SQLException,
                           AlignmentException
Throws:
SQLException
AlignmentException

Alignment API and Server 3.2

(C) INRIA & friends, 2003-2008