Author: mes
Date: 2012-07-19 16:00:04 -0700 (Thu, 19 Jul 2012)
New Revision: 29930

Modified:
   
csplugins/trunk/ucsd/mes/genomespace/genomespace-plugin/src/main/java/cytoscape/genomespace/GSUtils.java
   
csplugins/trunk/ucsd/mes/genomespace/genomespace-plugin/src/main/java/cytoscape/genomespace/LoadNetworkFromURL.java
Log:
support for format conversion through URLs

Modified: 
csplugins/trunk/ucsd/mes/genomespace/genomespace-plugin/src/main/java/cytoscape/genomespace/GSUtils.java
===================================================================
--- 
csplugins/trunk/ucsd/mes/genomespace/genomespace-plugin/src/main/java/cytoscape/genomespace/GSUtils.java
    2012-07-19 22:59:01 UTC (rev 29929)
+++ 
csplugins/trunk/ucsd/mes/genomespace/genomespace-plugin/src/main/java/cytoscape/genomespace/GSUtils.java
    2012-07-19 23:00:04 UTC (rev 29930)
@@ -125,13 +125,22 @@
        }
 
        public static File downloadToTempFile(String urlString) {
+               return downloadToTempFile(urlString,null);
+       }
+
+       public static File downloadToTempFile(String urlString, GSDataFormat 
format) {
                InputStream is = null;
                OutputStream os = null;
                File tempFile = null;
                try {
                        URL url = new URL(urlString);
                        DataManagerClient dmc = 
getSession().getDataManagerClient();
-                       is = dmc.getInputStream(url);
+
+                       if ( format == null )
+                               is = dmc.getInputStream(url);
+                       else
+                               is = 
dmc.getInputStream(dmc.getFileUrl(url,format.getUrl()));
+
                        tempFile = File.createTempFile("tempGS","." + 
getExtension(url.toString()));
                        os =new FileOutputStream(tempFile);
                        byte buf[] = new byte[1024];

Modified: 
csplugins/trunk/ucsd/mes/genomespace/genomespace-plugin/src/main/java/cytoscape/genomespace/LoadNetworkFromURL.java
===================================================================
--- 
csplugins/trunk/ucsd/mes/genomespace/genomespace-plugin/src/main/java/cytoscape/genomespace/LoadNetworkFromURL.java
 2012-07-19 22:59:01 UTC (rev 29929)
+++ 
csplugins/trunk/ucsd/mes/genomespace/genomespace-plugin/src/main/java/cytoscape/genomespace/LoadNetworkFromURL.java
 2012-07-19 23:00:04 UTC (rev 29930)
@@ -9,6 +9,7 @@
 
 import org.genomespace.sws.GSLoadEventListener;
 import org.genomespace.sws.GSLoadEvent;
+import org.genomespace.datamanager.core.GSDataFormat;
 
 public class LoadNetworkFromURL implements GSLoadEventListener {
        private static final CyLogger logger = 
CyLogger.getLogger(LoadNetworkFromURL.class);
@@ -24,7 +25,13 @@
                        return;
 
                try {
-                       File tmp = GSUtils.downloadToTempFile(netURL);
+
+                       final String ext = GSUtils.getExtension(netURL);
+            GSDataFormat dataFormat = null; 
+                       if ( ext != null && ext.equalsIgnoreCase("adj") )
+                               dataFormat = 
GSUtils.findConversionFormat(GSUtils.getSession().getDataManagerClient().listDataFormats(),
 "xgmml");
+
+                       File tmp = 
GSUtils.downloadToTempFile(netURL,dataFormat);
                        
Cytoscape.createNetworkFromFile(tmp.getPath()).setTitle(netURL);
                } catch ( Exception e ) { e.printStackTrace(); }
        }

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to