Mentions légales du service

Skip to content
Snippets Groups Projects
Commit f6064a2b authored by Jérôme Euzenat's avatar Jérôme Euzenat
Browse files

- implemented unstoreAlignment

- cleaned up exceptions
parent f77b7734
No related branches found
No related tags found
No related merge requests found
...@@ -88,12 +88,12 @@ public class CacheImpl { ...@@ -88,12 +88,12 @@ public class CacheImpl {
//********************************************************************** //**********************************************************************
public CacheImpl( DBService serv ) { public CacheImpl( DBService serv ) {
service = serv; service = serv;
try { //try {
conn = service.getConnection(); conn = service.getConnection();
} catch(Exception e) { //} catch(Exception e) {
// Rather raise an exception // Rather raise an exception
System.err.println(e.toString()); //System.err.println(e.toString());
} //}
alignmentTable = new Hashtable<String,Alignment>(); alignmentTable = new Hashtable<String,Alignment>();
ontologyTable = new Hashtable<URI,Set<Alignment>>(); ontologyTable = new Hashtable<URI,Set<Alignment>>();
} }
...@@ -343,26 +343,29 @@ public class CacheImpl { ...@@ -343,26 +343,29 @@ public class CacheImpl {
* This is more difficult because we return the alignment we have * This is more difficult because we return the alignment we have
* disreagarding if it is complete o only metadata * disreagarding if it is complete o only metadata
*/ */
public Alignment getMetadata( String id ) throws Exception { public Alignment getMetadata( String id ) throws AlignmentException {
Alignment result = alignmentTable.get( id ); Alignment result = alignmentTable.get( id );
if ( result == null ) if ( result == null )
throw new Exception("getMetadata: Cannot find alignment"); throw new AlignmentException("getMetadata: Cannot find alignment");
return result; return result;
} }
/** /**
* retrieve full alignment from id (and cache it) * retrieve full alignment from id (and cache it)
*/ */
public Alignment getAlignment( String id ) throws Exception { public Alignment getAlignment( String id ) throws AlignmentException, SQLException {
Alignment result = alignmentTable.get( id ); Alignment result = alignmentTable.get( id );
if ( result == null ) if ( result == null )
throw new Exception("getAlignment: Cannot find alignment"); throw new AlignmentException("getAlignment: Cannot find alignment");
// If not cached, retrieve it now // If not cached, retrieve it now
if ( result.getExtension( SVCNS, CACHED) == "" if ( result.getExtension( SVCNS, CACHED) == ""
&& result.getExtension(SVCNS, STORED) != "") { && result.getExtension(SVCNS, STORED) != "") {
retrieveAlignment( id, result ); try { retrieveAlignment( id, result ); }
catch (URISyntaxException urisex) {
throw new AlignmentException("getAlignment: Cannot find alignment", urisex);
};
} }
return result; return result;
...@@ -494,7 +497,7 @@ public class CacheImpl { ...@@ -494,7 +497,7 @@ public class CacheImpl {
/** /**
* Non publicised class * Non publicised class
*/ */
public void unStoreAlignment( String id ) throws Exception { public void unstoreAlignment( String id ) throws SQLException, AlignmentException {
Alignment alignment = getAlignment( id ); Alignment alignment = getAlignment( id );
if ( alignment != null ) { if ( alignment != null ) {
Statement st = createStatement(); Statement st = createStatement();
...@@ -509,7 +512,7 @@ public class CacheImpl { ...@@ -509,7 +512,7 @@ public class CacheImpl {
} }
} }
public void storeAlignment( String id ) throws Exception { public void storeAlignment( String id ) throws AlignmentException, SQLException {
String query = null; String query = null;
Alignment alignment = getAlignment( id ); Alignment alignment = getAlignment( id );
Statement st = createStatement(); Statement st = createStatement();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment