[MOBY-guts] biomoby commit

Martin Senger senger at pub.open-bio.org
Sun Nov 20 12:30:51 UTC 2005


senger
Sun Nov 20 07:30:51 EST 2005
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client
In directory pub.open-bio.org:/tmp/cvs-serv4966/src/main/org/biomoby/client

Modified Files:
	BaseCmdLineClient.java CentralDigestCachedImpl.java 
	CentralImpl.java GraphsServlet.java ServicesEdge.java 
Log Message:


moby-live/Java/src/main/org/biomoby/client BaseCmdLineClient.java,1.4,1.5 CentralDigestCachedImpl.java,1.14,1.15 CentralImpl.java,1.35,1.36 GraphsServlet.java,1.14,1.15 ServicesEdge.java,1.6,1.7
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/BaseCmdLineClient.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/BaseCmdLineClient.java	2005/10/12 11:36:59	1.4
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/BaseCmdLineClient.java	2005/11/20 12:30:51	1.5
@@ -297,12 +297,12 @@
 	}
     }
 
-    protected MobyObject createInstance (MobyObject obj)
+    protected MobyObject createInstance (MobyObject mobj)
 	throws MobyException {
 	try {
-	    return (MobyObject)obj.getClass().newInstance();
+	    return (MobyObject)mobj.getClass().newInstance();
 	} catch (Exception e) {
-	    throw new MobyException ("Cannot instantiate data type '" + obj.getClass().getName() + "'.");
+	    throw new MobyException ("Cannot instantiate data type '" + mobj.getClass().getName() + "'.");
 	}
     }
 
@@ -351,14 +351,14 @@
     /**************************************************************************
      *
      *************************************************************************/
-    protected boolean createChildren (MobyObject obj)
+    protected boolean createChildren (MobyObject mobj)
 	throws MobyException {
 	boolean someChildrenCreated = false;
 	try {
 	    HashMap methodsAndArticleNames = new HashMap();
 	    HashMap methodsAndChildTypes = new HashMap();
 	    HashMap methodNamesAndHowManyTimes = new HashMap();
-	    Class myClass = obj.getClass();
+	    Class myClass = mobj.getClass();
 	    Field[] fields = myClass.getFields();
 	    for (int i = 0; i < fields.length; i++) {
 		String fieldName = fields[i].getName();
@@ -392,20 +392,20 @@
 		    Class childType = (Class)entry.getValue();
 		    int count = ( ((Integer)methodNamesAndHowManyTimes.get (method.getName())).intValue() );
 		    while (count-- > 0) {
-			if (createOneChild (obj, method, childType, (String)methodsAndArticleNames.get (method)))
+			if (createOneChild (mobj, method, childType, (String)methodsAndArticleNames.get (method)))
 			    someChildrenCreated = true;
 		    }
 		}
 	    } else {
 		// this is a leaf that does not have any children...
-		if (obj.isPrimitiveType()) {
+		if (mobj.isPrimitiveType()) {
 		    // ...if it is a primitive type, we may ignore it if there is no more values
-		    return setPrimitiveValue (obj, articleName);
+		    return setPrimitiveValue (mobj, articleName);
 		} else {
 		    // ...if it is an Object leaf, we always keep it
 		    // but id and namespaces are here like values for
 		    // primitives so filltem
-		    setIdAndNamespace (obj);
+		    setIdAndNamespace (mobj);
 		    return true;
 		}
 	    }
@@ -422,12 +422,12 @@
     /**************************************************************************
      *
      *************************************************************************/
-    boolean createOneChild (MobyObject parent, Method setMethod, Class childType, String articleName)
+    boolean createOneChild (MobyObject parent, Method setMethod, Class childType, String artName)
 	throws MobyException {
 	try {
 	    MobyObject child = createInstance (childType);
 	    if (child.isPrimitiveType()) {
-		if (setPrimitiveValue (child, articleName)) {
+		if (setPrimitiveValue (child, artName)) {
 		    setMethod.invoke (parent, new Object[] { child });
 		    return true;
 		}

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralDigestCachedImpl.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralDigestCachedImpl.java	2005/11/12 16:43:47	1.14
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralDigestCachedImpl.java	2005/11/20 12:30:51	1.15
@@ -215,7 +215,7 @@
 
 
     /**
-     * Create a cache directory from 'cacheDir' and 'registryId' if it
+     * Create a cache directory from 'cacheDirectory' and 'registryId' if it
      * does not exist yet. Make sure that it is writable. Return a
      * File representing created directory.
      *
@@ -223,11 +223,11 @@
      * cache is going to be created for. If null, an endpoint of a
      * default Moby registry is used.
      */
-    protected File createCacheDir (String cacheDir, String registryId)
+    protected File createCacheDir (String cacheDirectory, String registryId)
 	throws MobyException {
 	if (registryId == null || registryId.equals (""))
 	    registryId = CentralImpl.DEFAULT_ENDPOINT;
-	File cache = new File (cacheDir + fileSeparator + clean (registryId));
+	File cache = new File (cacheDirectory + fileSeparator + clean (registryId));
 	try {
 	    if (! cache.exists())
 		if (! cache.mkdirs())
@@ -246,11 +246,13 @@
      * Remove cache and all (but given in 'subCacheDirNames') its
      * subdirectories.
      */
-    protected void removeCacheDir (String cacheDir, String registryId, String[] subCacheDirNames)
+    protected void removeCacheDir (String cacheDirectory,
+        String registryId,
+        String[] subCacheDirNames)
 	throws MobyException {
 	if (registryId == null || registryId.equals (""))
 	    registryId = CentralImpl.DEFAULT_ENDPOINT;
-	File cache = new File (cacheDir + fileSeparator + clean (registryId));
+	File cache = new File (cacheDirectory + fileSeparator + clean (registryId));
 	try {
 	    if (! cache.exists()) return;
 	    if (! cache.isDirectory())
@@ -263,7 +265,8 @@
 		for (int f = 0; f < files.length; f++) {
 		    if (files[f].isDirectory())
 			throw new MobyException ("Found a directory '" + files[f].getAbsolutePath() + "' where no directory should be");
-		    files[f].delete();
+		    if (! files[f].delete())
+		    	log.error ("Can't delete file '" + files[f] + "'.");
 		}
 		cacheSubDir.delete();
 	    }
@@ -673,7 +676,8 @@
 		    if (ignored (list[i])) continue;
 		    v.addElement (createDataTypeFromXML (load (list[i]), "-dummy-"));
 		} catch (NoSuccessException e) {
-		    System.err.println (MSG_CACHE_BAD_FILE (list[i], e));
+			log.error (MSG_CACHE_BAD_FILE (list[i], e));
+			//System.err.println (MSG_CACHE_BAD_FILE (list[i], e));
 		}
 	    }
 	    MobyDataType[] result = new MobyDataType [v.size()];
@@ -736,7 +740,7 @@
 			v.addElement (servs[j]);
 		    }
 		} catch (MobyException e) {
-		    System.err.println (MSG_CACHE_BAD_FILE (list[i], e));
+		    log.error (MSG_CACHE_BAD_FILE (list[i], e));
 		}
 	    }
 	    MobyService[] result = new MobyService [v.size()];
@@ -799,6 +803,7 @@
 		try {
 		    types[i].setParentNames (createServiceTypeRelationshipsFromXML (load (file)));
 		} catch (MobyException e) {
+			log.error (MSG_CACHE_BAD_FILE (file, e));
 		    System.err.println (MSG_CACHE_BAD_FILE (file, e));
 		}
 	    }

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralImpl.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralImpl.java	2005/11/12 16:43:47	1.35
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralImpl.java	2005/11/20 12:30:51	1.36
@@ -154,7 +154,7 @@
     	    dbf.setNamespaceAware(true);	
 	    docBuilder = dbf.newDocumentBuilder();
         } catch (Exception e) {
-            throw new MobyException ("Could not configure an XML parser: " + e);
+            throw new MobyException ("Could not configure an XML parser: " + e, e);
         }
 
 	cache = new Hashtable();
@@ -241,7 +241,7 @@
 	try {
 	    document=docBuilder.parse(new ByteArrayInputStream(xml.getBytes()));
 	} catch (Exception e) {
-	    throw new MobyException(e.toString());
+	    throw new MobyException(e.toString(), e);
 	}
 	Element root = document.getDocumentElement();
 
@@ -465,12 +465,13 @@
      *************************************************************************/
     public MobyService[] extractServices (String xml)
 	throws MobyException {
-	    
+//    	if (xmk == null)
+//			throw new MobyException ()
 	Document document = null;
 	try {
 	    document = docBuilder.parse(new ByteArrayInputStream(xml.getBytes()));
 	} catch (Exception e) {
-	    throw new MobyException(e.toString());
+	    throw new MobyException(e.toString(), e);
 	}
 
 	NodeList list = document.getElementsByTagName ("Service");
@@ -677,7 +678,7 @@
 	try {
 	    document = docBuilder.parse(new ByteArrayInputStream(result.getBytes()));
 	} catch (Exception e) {
-	    throw new MobyException(e.toString());
+	    throw new MobyException(e.toString(), e);
 	}
 
 	NodeList list = document.getElementsByTagName ("serviceName");
@@ -723,7 +724,7 @@
 	try {
 	    document = docBuilder.parse (new ByteArrayInputStream (result.getBytes()));
 	} catch (Exception e) {
-	    throw new MobyException (e.toString());
+	    throw new MobyException (e.toString(), e);
 	}
 
 	NodeList list = document.getElementsByTagName ("serviceName");
@@ -774,7 +775,7 @@
 	try {
 	    document = docBuilder.parse(new ByteArrayInputStream(result.getBytes()));
 	} catch (Exception e) {
-	    throw new MobyException(e.toString());
+	    throw new MobyException(e.toString(), e);
 	}
 
 	NodeList list = document.getElementsByTagName ("serviceProvider");
@@ -832,7 +833,8 @@
 	Document document = null;
 	try {
 	    document = docBuilder.parse(new ByteArrayInputStream(result.getBytes()));}
-	catch(Exception e){throw new MobyException(e.toString());}
+	catch(Exception e){throw new MobyException(e.toString(), e);
+		}
 
 	NodeList list = document.getElementsByTagName ("serviceType");
 	if (list == null || list.getLength() == 0)
@@ -888,7 +890,7 @@
 	try {
 	    document = docBuilder.parse(new ByteArrayInputStream(result.getBytes()));
 	} catch (Exception e) {
-	    throw new MobyException(e.toString());
+	    throw new MobyException(e.toString(), e);
 	}
 
 	NodeList list = document.getDocumentElement().getElementsByTagName ("Namespace");
@@ -960,7 +962,7 @@
 	try {
 	    document = docBuilder.parse(new ByteArrayInputStream(result.getBytes()));
 	} catch (Exception e) {
-	    throw new MobyException(e.toString());
+	    throw new MobyException(e.toString(), e);
 	}
 
 	NodeList list = document.getElementsByTagName ("Object");
@@ -1027,7 +1029,7 @@
 	try {
 	    document = docBuilder.parse(new ByteArrayInputStream (xmlSource.getBytes()));
 	} catch (Exception e) {
-	    throw new MobyException(e.toString());
+	    throw new MobyException(e.toString(), e);
 	}
 
 	NodeList list = document.getElementsByTagName ("retrieveObjectDefinition");
@@ -1135,7 +1137,7 @@
 	// parse returned XML
 	Document document = null;
 	try{document=docBuilder.parse(new ByteArrayInputStream(result.getBytes()));}
-	catch(Exception e){throw new MobyException(e.toString());}
+	catch(Exception e){throw new MobyException(e.toString(), e);}
 
 	Element service = document.getDocumentElement();
 	Node wsdl = service.getFirstChild();
@@ -1555,7 +1557,7 @@
 	Vector v = new Vector();
 	Document document = null;
 	try{document=docBuilder.parse(new ByteArrayInputStream(result.getBytes()));}
-	catch(Exception e){throw new MobyException(e.toString());}
+	catch(Exception e){throw new MobyException(e.toString(), e);}
 
 	NodeList list = document.getElementsByTagName ("Relationship");
 	for (int i = 0; i < list.getLength(); i++) {
@@ -1611,7 +1613,7 @@
 	Map results = new HashMap();
 	Document document = null;
 	try{document=docBuilder.parse(new ByteArrayInputStream(result.getBytes()));}
-	catch(Exception e){throw new MobyException(e.toString());}
+	catch(Exception e){throw new MobyException(e.toString(), e);}
 
 	NodeList list = document.getElementsByTagName ("Relationship");
 
@@ -1668,7 +1670,7 @@
 	Vector v = new Vector();
 	Document document = null;
 	try{document=docBuilder.parse(new ByteArrayInputStream(result.getBytes()));}
-	catch(Exception e){throw new MobyException(e.toString());}
+	catch(Exception e){throw new MobyException(e.toString(), e);}
 
 	NodeList list = document.getElementsByTagName ("Relationship");
 
@@ -1732,7 +1734,7 @@
 	try {
 	    document = docBuilder.parse (new ByteArrayInputStream (result.getBytes()));
 	} catch (Exception e) {
-	    throw new MobyException(e.toString());
+	    throw new MobyException(e.toString(), e);
 	}
 
 	NodeList list = document.getElementsByTagName ("Resource");
@@ -1771,7 +1773,7 @@
 		try {
 		    return url.openStream();
 		} catch (java.io.IOException e2) {
-		    throw new MobyException (e2.toString());
+		    throw new MobyException (e2.toString(), e2);
 		}
 	    }
 	}

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/GraphsServlet.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/GraphsServlet.java	2005/11/06 16:47:10	1.14
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/GraphsServlet.java	2005/11/20 12:30:51	1.15
@@ -1759,11 +1759,11 @@
      * cached files starting from CACHE_DIR directory, otherwise we
      * store them inside this servlet context on the 'contextPath'.
      ********************************************************************/
-    protected SimpleFileCache initCache (ServletContext context,
+    protected SimpleFileCache initCache (ServletContext sContext,
 					 String contextPath) {
 	String cacheDir = (String)initParams.get (CACHE_DIR);
 	if (UUtils.isEmpty (cacheDir)) {
-	    return new ServletFileCache (context, contextPath);
+	    return new ServletFileCache (sContext, contextPath);
 	} else {
 	    String cacheURL = (String)initParams.get (CACHE_URL);
 	    return new FileCache (cacheDir, cacheURL);

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ServicesEdge.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ServicesEdge.java	2005/07/19 12:39:59	1.6
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ServicesEdge.java	2005/11/20 12:30:51	1.7
@@ -219,9 +219,9 @@
     /*************************************************************************
      * Checks if the given connection type is known.
      *************************************************************************/
-    private boolean checkConnectionType (int connectionType) {
-	return (connectionType >= MIN_CONNECTION_TYPE &&
-		connectionType <= MAX_CONNECTION_TYPE);
+    private boolean checkConnectionType (int conType) {
+	return (conType >= MIN_CONNECTION_TYPE &&
+		conType <= MAX_CONNECTION_TYPE);
     }
 
 }




More information about the MOBY-guts mailing list