[MOBY-guts] biomoby commit

Eddie Kawas kawas at pub.open-bio.org
Tue Aug 30 23:30:58 UTC 2005


kawas
Tue Aug 30 19:30:58 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-serv29089/org/biomoby/client/ui/graphical/servlet/lsid/authority

Modified Files:
	MobyAuthority.java LSIDAuthorityMetaData.java 
	LSIDAuthorityData.java LSIDDataLookup.java 
Log Message:
updated the getData portion of the LSID resolver so that lsids under the namespace objectclass have data (a schema) attached to them.

moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority MobyAuthority.java,1.2,1.3 LSIDAuthorityMetaData.java,1.1,1.2 LSIDAuthorityData.java,1.1,1.2 LSIDDataLookup.java,1.2,1.3
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/MobyAuthority.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/MobyAuthority.java	2005/05/31 18:13:13	1.2
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/MobyAuthority.java	2005/08/30 23:30:58	1.3
@@ -23,8 +23,15 @@
  */
 
 /**
- * @author Eddie Kawas <p> Created for <p> This class was created to ... <p> For
- *         questions, comments, or bugs <p> email me at edward.kawas at gmail.com
+ * @author Eddie Kawas
+ *         <p>
+ *         Created for
+ *         <p>
+ *         This class was created to ...
+ *         <p>
+ *         For questions, comments, or bugs
+ *         <p>
+ *         email me at edward.kawas at gmail.com
  */
 public class MobyAuthority extends SimpleAuthority {
     private LSIDDataLookup lookup = null;
@@ -47,16 +54,34 @@
             return null;
 
         return new LSIDMetadataPort[] {
-                new SOAPLocation("BioMOBYSOAPPort", "http://"
+                new SOAPLocation("BioMOBYMetadataSOAPPort", "http://"
                         + properties.getProperty("lsid_domain") + ":"
                         + properties.getProperty("lsid_port")
                         + "/authority/metadata"),
-                new HTTPLocation("BioMOBYHTTPPort", properties.getProperty("lsid_domain"),
-                        Integer.parseInt(properties.getProperty("lsid_port")), "/authority/metadata") };
+                new HTTPLocation("BioMOBYMetadataHTTPPort", properties
+                        .getProperty("lsid_domain"), Integer
+                        .parseInt(properties.getProperty("lsid_port")),
+                        "/authority/metadata") };
     }
 
     public LSIDDataPort[] getDataLocations(LSID lsid, String url) {
-        return new LSIDDataPort[0];
+
+        if (lookup == null)
+            return null;
+        
+        if (!lookup.isValidDataType(lsid)) {
+            return new LSIDDataPort[0];
+        }
+        
+        return new LSIDDataPort[] {
+                new SOAPLocation("BioMOBYDataSOAPPort", "http://"
+                        + properties.getProperty("lsid_domain") + ":"
+                        + properties.getProperty("lsid_port")
+                        + "/authority/data"),
+                new HTTPLocation("BioMOBYDataHTTPPort", properties
+                        .getProperty("lsid_domain"), Integer
+                        .parseInt(properties.getProperty("lsid_port")),
+                        "/authority/data") };
     }
 
     /*
@@ -75,6 +100,11 @@
                 for (int i = 0; i < metaLocs.length; ++i) {
                     wsdl.setMetadataLocation(metaLocs[i]);
                 }
+            LSIDDataPort[] dataLocs = getDataLocations(lsid, url);
+            if (dataLocs != null)
+                for (int i = 0; i < dataLocs.length; ++i) {
+                    wsdl.setDataLocation(dataLocs[i]);
+                }
             return new ExpiringResponse(wsdl.toString(), getExpiration());
         } catch (LSIDException e) {
             throw new LSIDServerException(e, e.getErrorCode(),
@@ -92,4 +122,4 @@
             throws LSIDServerException {
         lookup = new LSIDDataLookup();
     }
-}
+}
\ No newline at end of file

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/LSIDAuthorityMetaData.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/LSIDAuthorityMetaData.java	2005/04/07 16:42:26	1.1
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/LSIDAuthorityMetaData.java	2005/08/30 23:30:58	1.2
@@ -119,6 +119,7 @@
                 break;
             case LSIDDataLookup.MOBY_PREDICATE:
             /* type is rdfpredicate */{
+            	//TODO - find the predicate that was requested.
             }
                 break;
             default:

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/LSIDAuthorityData.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/LSIDAuthorityData.java	2005/04/07 16:42:26	1.1
+++ /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
@@ -1,10 +1,20 @@
 package org.biomoby.client.ui.graphical.servlet.lsid.authority;
+
+import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 
+import org.biomoby.shared.schema.Builder;
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.output.Format;
+import org.jdom.output.XMLOutputter;
+
+import com.ibm.lsid.LSID;
 import com.ibm.lsid.server.LSIDDataService;
 import com.ibm.lsid.server.LSIDRequestContext;
 import com.ibm.lsid.server.LSIDServerException;
 import com.ibm.lsid.server.LSIDServiceConfig;
+
 /*
  * Created on Oct 20, 2004 <p>
  * By Eddie <p>
@@ -12,24 +22,52 @@
 
 /**
  * @author Eddie Kawas
- * <p>Created for
- * <p>This class was created to ...
- * <p>For questions, comments, or bugs
- * <p>email me at edward.kawas at gmail.com
+ *         <p>
+ *         Created for
+ *         <p>
+ *         This class was created to ...
+ *         <p>
+ *         For questions, comments, or bugs
+ *         <p>
+ *         email me at edward.kawas at gmail.com
  */
 public class LSIDAuthorityData implements LSIDDataService {
-	private LSIDDataLookup lookup = null;
+    private LSIDDataLookup lookup = null;
 
-    public InputStream getDataByRange(LSIDRequestContext req, int start, int length) throws LSIDServerException {
-        throw new LSIDServerException(LSIDServerException.METHOD_NOT_IMPLEMENTED, "getDataByRange not implemented");
+    public InputStream getDataByRange(LSIDRequestContext req, int start,
+            int length) throws LSIDServerException {
+        throw new LSIDServerException(
+                LSIDServerException.METHOD_NOT_IMPLEMENTED,
+                "getDataByRange not implemented");
     }
 
-    public InputStream getData(LSIDRequestContext req) throws LSIDServerException {
-		throw new LSIDServerException(LSIDServerException.NO_DATA_AVAILABLE, "No data exists for the given lsid");
+    public InputStream getData(LSIDRequestContext req)
+            throws LSIDServerException {
+        //throw new LSIDServerException(LSIDServerException.NO_DATA_AVAILABLE,
+        // "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());
+        }
+        throw new LSIDServerException(LSIDServerException.NO_DATA_AVAILABLE,
+                "No data exists for the given lsid");
     }
-    
-    public void initService(LSIDServiceConfig config) throws LSIDServerException {
+
+    public void initService(LSIDServiceConfig config)
+            throws LSIDServerException {
         lookup = new LSIDDataLookup();
     }
 
-}
+}
\ No newline at end of file

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/LSIDDataLookup.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/LSIDDataLookup.java	2005/05/31 18:13:13	1.2
+++ /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
@@ -65,12 +65,17 @@
                 
     }
     
+    public boolean isValidDataType (LSID lsid) {
+        String ns = lsid.getNamespace();
+        if (ns.equalsIgnoreCase(mobyobject.getProperty("lsid_namespace")))
+                return true;
+        return false;
+    }
     public int lsidType(LSID lsid) throws LSIDServerException {
         String ns = lsid.getNamespace();
         String id = lsid.getObject();
         String ver = lsid.getRevision();
         int result = UNKNOWN;
-        System.err.println(lsid.toString());
         String authority = lsid.getAuthority().getAuthority();
 
         if (ver != null || (ver != null && ver.length() != 0))




More information about the MOBY-guts mailing list