[MOBY-guts] biomoby commit

Eddie Kawas kawas at pub.open-bio.org
Fri Mar 24 18:16:57 UTC 2006


kawas
Fri Mar 24 13:16:56 EST 2006
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/util
In directory pub.open-bio.org:/tmp/cvs-serv15402/org/biomoby/registry/rdfagent/util

Modified Files:
	SignatureURLConnection.java 
Log Message:
the service_validation table wasnt updated properly. In cases where there was a file at the signatureURL, the table removed the entry for the url even though the file contained in valid 'stuff' in it.

moby-live/Java/src/main/org/biomoby/registry/rdfagent/util SignatureURLConnection.java,1.9,1.10
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/util/SignatureURLConnection.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/util/SignatureURLConnection.java	2006/03/24 17:52:38	1.9
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/rdfagent/util/SignatureURLConnection.java	2006/03/24 18:16:56	1.10
@@ -92,31 +92,31 @@
 					urlConnection.disconnect();
 					Log.info("Closing the url connection.");
 
-					if (Constants.REGISTRY_ENABLE_DEREGISTER) {
-						// remove the url from the hit list if necessary and if
-						// deregistration is enabled
-						CentralDataAccess central = null;
-						try {
-							central = new CentralDataAccessImpl();
-							int count = central.getErrorCountForURL(url);
-							if (count != 0) {
-								Log.info("Attempting to remove " + url
-										+ " from the 'hit list'.");
-								if (central.deleteErrorCountForURL(url)) {
-									Log.info("Removal success!");
-								} else {
-									Log.info("Removal failed.");
-								}
-							}
-							if (central != null)
-								central.cleanup();
-						} catch (MobyException e) {
-							Log.exception(this.getClass().getName(),
-									"getRdfFromURL(String)", e);
-							Log.severe(e.getLocalizedMessage());
-							code = 417;
-						}
-					}
+//					if (Constants.REGISTRY_ENABLE_DEREGISTER) {
+//						// remove the url from the hit list if necessary and if
+//						// deregistration is enabled
+//						CentralDataAccess central = null;
+//						try {
+//							central = new CentralDataAccessImpl();
+//							int count = central.getErrorCountForURL(url);
+//							if (count != 0) {
+//								Log.info("Attempting to remove " + url
+//										+ " from the 'hit list'.");
+//								if (central.deleteErrorCountForURL(url)) {
+//									Log.info("Removal success!");
+//								} else {
+//									Log.info("Removal failed.");
+//								}
+//							}
+//							if (central != null)
+//								central.cleanup();
+//						} catch (MobyException e) {
+//							Log.exception(this.getClass().getName(),
+//									"getRdfFromURL(String)", e);
+//							Log.severe(e.getLocalizedMessage());
+//							code = 417;
+//						}
+//					}
 					Log.info("Got an RDF model.");
 					if (code == 200 || code == 202)
 						return model;
@@ -194,11 +194,15 @@
 			if (parser.isRDFValid()) {
 				// RDF was valid and no bad service found
 				if (services.length == 0) {
+					// there was nothing in the document
 					performURLErrorHandling(url, 501);
 					return services;
 				}
-				if (services != null)
+				if (services != null) {
+					// RDF document was ok after all, so remove url from hitlist
+					removeFromHitlist(url);
 					return services;
+				}
 			} else {
 				Log.info("RDF contained some invalid services.");
 				// RDF was found to contain bad services
@@ -225,11 +229,15 @@
 					}
 				}
 				if (services.length == 0) {
+					// there was nothing in the document
 					performURLErrorHandling(url, 501);
 					return services;
 				}
-				if (services != null)
+				if (services != null) {
+					// RDF document was ok after all, so remove url from hitlist
+					removeFromHitlist(url);
 					return services;
+				}
 			}
 		}
 		return new MobyService[] {};
@@ -239,6 +247,36 @@
 		 * 
 		 */
 
+	/**
+	 * @param url
+	 */
+	private void removeFromHitlist(String url) {
+		if (Constants.REGISTRY_ENABLE_DEREGISTER) {
+			// remove the url from the hit list if necessary and if
+			// deregistration is enabled
+			CentralDataAccess central = null;
+			try {
+				central = new CentralDataAccessImpl();
+				int count = central.getErrorCountForURL(url);
+				if (count != 0) {
+					Log.info("Attempting to remove " + url
+							+ " from the 'hit list'.");
+					if (central.deleteErrorCountForURL(url)) {
+						Log.info("Removal success!");
+					} else {
+						Log.info("Removal failed.");
+					}
+				}
+				if (central != null)
+					central.cleanup();
+			} catch (MobyException e) {
+				Log.exception(this.getClass().getName(),
+						"getRdfFromURL(String)", e);
+				Log.severe(e.getLocalizedMessage());
+			}
+		}
+	}
+
 	private void performURLErrorHandling(String url, int code) {
 		if (code == 400) {
 			Log




More information about the MOBY-guts mailing list