[MOBY-guts] biomoby commit

Eddie Kawas kawas at pub.open-bio.org
Fri Sep 30 14:50:40 UTC 2005


kawas
Fri Sep 30 10:50:40 EDT 2005
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority
In directory pub.open-bio.org:/tmp/cvs-serv6551/org/biomoby/client/ui/graphical/servlet/lsid/authority

Modified Files:
	LSIDAuthorityData.java LSIDDataLookup.java 
Log Message:
modified the get data logic.

moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority LSIDAuthorityData.java,1.2,1.3 LSIDDataLookup.java,1.3,1.4
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/LSIDAuthorityData.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/LSIDAuthorityData.java	2005/08/30 23:30:58	1.2
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/LSIDAuthorityData.java	2005/09/30 14:50:40	1.3
@@ -47,19 +47,26 @@
         // "No data exists for the given lsid");
         LSID lsid = req.getLsid();
         if (lookup.isValidDataType(lsid)) {
-            String datatype = lsid.getObject();
-            // build the schema
-            Builder builder = new Builder();
-            Element root = builder.buildSchema(datatype);
-            // create a jDom document
-            Document doc = new Document(root);
-            XMLOutputter fmt = new XMLOutputter();
-            Format format = Format.getPrettyFormat();
-            fmt.setFormat(format);
-            // convert document to string
-            String schema = fmt.outputString(doc);
-            // return an input stream
-            return new ByteArrayInputStream(schema.getBytes());
+
+            int type = lookup.dataLsidType(lsid);
+            if (type == LSIDDataLookup.OBJECT_CLASS) {
+                String datatype = lsid.getObject();
+                // build the schema
+                Builder builder = new Builder();
+                Element root = builder.buildSchema(datatype);
+                // create a jDom document
+                Document doc = new Document(root);
+                XMLOutputter fmt = new XMLOutputter();
+                Format format = Format.getPrettyFormat();
+                fmt.setFormat(format);
+                // convert document to string
+                String schema = fmt.outputString(doc);
+                // return an input stream
+                return new ByteArrayInputStream(schema.getBytes());
+            }
+            if (type == LSIDDataLookup.SERVICE_INSTANCE) {
+                
+            }
         }
         throw new LSIDServerException(LSIDServerException.NO_DATA_AVAILABLE,
                 "No data exists for the given lsid");

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/LSIDDataLookup.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/LSIDDataLookup.java	2005/08/30 23:30:58	1.3
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/LSIDDataLookup.java	2005/09/30 14:50:40	1.4
@@ -65,12 +65,34 @@
                 
     }
     
+    /**
+     * 
+     * @param lsid an lsid to check whether we have 'data' on it or not
+     * @return true if getData has actual data under the namespace of the lsid. False otherwise. 
+     */
     public boolean isValidDataType (LSID lsid) {
         String ns = lsid.getNamespace();
-        if (ns.equalsIgnoreCase(mobyobject.getProperty("lsid_namespace")))
+        if (ns.equalsIgnoreCase(mobyobject.getProperty("lsid_namespace")) || ns.equalsIgnoreCase(mobycentral.getProperty("lsid_namespace")))
                 return true;
         return false;
     }
+    
+
+    public int dataLsidType(LSID lsid) {
+        String ns = lsid.getNamespace();
+        String id = lsid.getObject();
+        String ver = lsid.getRevision();
+        if (ver != null || (ver != null && ver.length() != 0))
+            return UNKNOWN;
+        if (ns.equalsIgnoreCase(mobyobject.getProperty("lsid_namespace"))) {
+            return LSIDDataLookup.OBJECT_CLASS;
+        }
+        if (ns.equalsIgnoreCase(mobycentral.getProperty("lsid_namespace"))) {
+            return LSIDDataLookup.SERVICE_INSTANCE;
+        }        
+        return UNKNOWN;
+    }
+    
     public int lsidType(LSID lsid) throws LSIDServerException {
         String ns = lsid.getNamespace();
         String id = lsid.getObject();




More information about the MOBY-guts mailing list