[MOBY-guts] biomoby commit
Gary Schlitz
gss at pub.open-bio.org
Thu Jun 17 17:37:05 UTC 2004
gss
Thu Jun 17 13:37:05 EDT 2004
Update of /home/repository/moby/moby-live/S-MOBY/ref-impl/server/src/org/smoby/ref/tools
In directory pub.open-bio.org:/tmp/cvs-serv25498/S-MOBY/ref-impl/server/src/org/smoby/ref/tools
Modified Files:
URIInvestigator.java
Log Message:
Cleanup
moby-live/S-MOBY/ref-impl/server/src/org/smoby/ref/tools URIInvestigator.java,1.4,1.5
===================================================================
RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/server/src/org/smoby/ref/tools/URIInvestigator.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- /home/repository/moby/moby-live/S-MOBY/ref-impl/server/src/org/smoby/ref/tools/URIInvestigator.java 2004/06/16 23:33:25 1.4
+++ /home/repository/moby/moby-live/S-MOBY/ref-impl/server/src/org/smoby/ref/tools/URIInvestigator.java 2004/06/17 17:37:05 1.5
@@ -176,10 +176,30 @@
switch (status)
{
+ case HttpServletResponse.SC_NOT_MODIFIED:
+
+ // The resource has not been modified since it was
+ // registered, so there is nothing to do but log a message.
+ //
+ syncLog.info("IN-SYNC : " + providerURI);
+ break;
+
+ case HttpServletResponse.SC_NOT_FOUND:
+
+ // The resource is no longer accessible, so de-register it
+ // from the database.
+ //
+ if (alreadyRegistered) {
+ deregisterProvider(manager, true);
+ } else {
+ syncLog.info("IGNORED : " + providerURI + " doesn't exist");
+ }
+ break;
+
case HttpServletResponse.SC_OK:
- // The call succeeded, so graphString should contain a valid graph.
- // Try to parse it.
+ // The call succeeded, so see if graphString contains
+ // a valid graph by trying to parse it.
//
lastModifiedDate = null;
@@ -226,61 +246,30 @@
Parser parser = Parser.forInputStream(in, Parser.LANGUAGE_RDF_XML);
provider = parser.parseProvider();
}
- catch (UnparsableGraphException e)
- {
- syncLog.warn("Unparsable graph found at " + providerURI +
- (alreadyRegistered ? "; deregistering" : "; ignoring"));
- if (alreadyRegistered) {
- deregisterProvider(manager);
- }
- return;
- }
+ catch (Throwable t) {}
- if (alreadyRegistered) {
- deregisterProvider(manager);
- }
-
- try
- {
- manager.registerProvider(provider, lastModifiedDate);
-
- // Log a message about successfully registering the graph:
- //
- syncLog.info((alreadyRegistered ? "UPDATED : " : "ADDED : ") + providerURI);
- }
- catch (StorageException e) {
- syncLog.error("Error storing graph for " + providerURI, e);
- }
-
- break;
-
- case HttpServletResponse.SC_NOT_MODIFIED:
-
- // The resource has not been modified since it was
- // registered, so there is nothing to do but log a message.
+ // De-register the provider, printing a removal message if
+ // a provider couldn't be parsed
//
- syncLog.info("IN-SYNC : " + providerURI);
- break;
-
- case HttpServletResponse.SC_NOT_FOUND:
+ deregisterProvider(manager, provider==null);
- // The resource is no longer accessible, so de-register it
- // from the database.
+ // If a provider was parsed, then register it
//
- if (alreadyRegistered)
- {
- try
- {
- manager.deregisterProvider(providerURI);
- syncLog.info("REMOVED : " + providerURI);
- }
- catch (StorageException e) {
- syncLog.error("Unable to de-register provider " + providerURI, e);
- }
- }
- else {
- syncLog.info("IGNORED : " + providerURI + " doesn't exist");
+ if (provider != null)
+ {
+ try
+ {
+ manager.registerProvider(provider, lastModifiedDate);
+
+ // Log a message about successfully registering the graph:
+ //
+ syncLog.info((alreadyRegistered ? "UPDATED : " : "ADDED : ") + providerURI);
+ }
+ catch (StorageException e) {
+ syncLog.error("Error storing graph for " + providerURI, e);
+ }
}
+
break;
default:
@@ -293,10 +282,13 @@
}
}
- private void deregisterProvider(StorageManager manager)
+ private void deregisterProvider(StorageManager manager, boolean removing)
{
try {
manager.deregisterProvider(providerURI);
+ if (removing) {
+ syncLog.info("REMOVED : " + providerURI);
+ }
}
catch (StorageException e) {
syncLog.error("Unable to de-register provider " + providerURI, e);
More information about the MOBY-guts
mailing list