Ignore:
Timestamp:
Jun 22, 2009, 2:00:26 PM (14 years ago)
Author:
Nicklas Nordborg
Message:

References #234: Proof-of-concept: run a selected GenePattern? visualization module from BASE

The process is now a bit more generic. In theory it should be possible to run any visualizer module. Got rid of hard-coded urls to servers.

Location:
extensions/net.sf.basedb.genepattern/trunk
Files:
6 added
5 edited
2 moved

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.genepattern/trunk/META-INF/extensions.xml

    r1132 r1134  
    6161  <extension
    6262    id="net.sf.basedb.genepattern.visualizer"
    63     extends="net.sf.basedb.clients.web.menu.extensions"
     63    extends="net.sf.basedb.clients.web.toolbar.item.bioassayset"
    6464    >
    65     <index>4</index>
     65    <index>1</index>
    6666    <about>
    67       <name>Visualizer test</name>
     67      <name>GenePattern Visualizer</name>
    6868      <description>
    69         A simple test of a visualizer
     69        Runs a GenePattern visualizer module.
    7070      </description>
    7171    </about>
    7272    <action-factory>
    7373      <factory-class>
    74         net.sf.basedb.clients.web.extensions.menu.FixedMenuItemFactory
     74        net.sf.basedb.clients.web.extensions.toolbar.FixedButtonFactory
    7575      </factory-class>
    7676      <parameters>
    77         <title>Visualizer test&amp;hellip;</title>
    78         <onClick>Main.openPopup('$HOME$/test_visualizer.jsp?ID='+getSessionId(), 'VisualizerTest', 500, 400)</onClick>
     77        <title>GenePattern visualizer&amp;hellip;</title>
     78        <onClick>Main.openPopup('$HOME$/run_visualizer.jsp?ID='+getSessionId(), 'GPVisualizer', 800, 600)</onClick>
    7979        <icon>~/images/genepattern.gif</icon>
     80        <tooltip>Runs a GenePattern visualizer module with data from this bioassay set</tooltip>
    8081      </parameters>
    8182    </action-factory>
  • extensions/net.sf.basedb.genepattern/trunk/resources/getFile.jsp

    r1132 r1134  
    1 
    2 <%@page import="net.sf.basedb.util.FileUtil"%>
    3 <%@page import="net.sf.basedb.util.StaticCache"%>
    4 <%@page import="net.sf.basedb.core.Application"%><%-- $Id$
     1<%-- $Id$
    52  ------------------------------------------------------------------
    63  Copyright (C) 2009 Nicklas Nordborg
     
    2522  ------------------------------------------------------------------
    2623
    27   @author Jari, Nicklas
     24  @author Nicklas
    2825--%>
    2926<%@ page
    3027  pageEncoding="UTF-8"
    3128  session="false"
     29  import="net.sf.basedb.core.Application"
     30  import="net.sf.basedb.util.StaticCache"
     31  import="net.sf.basedb.util.FileUtil"
    3232%>
    3333<%
  • extensions/net.sf.basedb.genepattern/trunk/resources/run_visualizer.jsp

    r1132 r1134  
    2222  ------------------------------------------------------------------
    2323
    24   @author Jari, Nicklas
     24  @author Nicklas
    2525--%>
    2626<%@ page
     
    3131  import="net.sf.basedb.core.Presets.Preset"
    3232  import="net.sf.basedb.clients.web.Base"
     33  import="net.sf.basedb.clients.web.extensions.ExtensionsControl"
    3334  import="net.sf.basedb.clients.web.util.HTML"
    3435%>
     
    4142Presets presets = new Presets();
    4243if (presetsXml != null) presets.loadFrom(presetsXml);
    43 
     44final String homeUrl = ExtensionsControl.getHomeUrl("net.sf.basedb.genepattern.options");
    4445%>
    4546<base:page type="popup" title="">
    46 <base:head>
     47<base:head scripts="ajax.js">
    4748  <script language="JavaScript">
    48   function browseOnClick(callback)
    49   {
    50     var frm = document.forms['visualizer'];
    51     var url = getRoot() + 'filemanager/index.jsp?ID=<%=ID%>&cmd=SelectOne&title=Select+file&callback=' + callback;
    52     Main.openPopup(url, 'SelectFile', 1000, 700);
    53   }
    54   function setGctFileCallback(fileId, path)
    55   {
    56     var frm = document.forms['visualizer'];
    57     frm['dataset.filename'].value = path;
    58   }
    59   function setCmsFileCallback(fileId, path)
    60   {
    61     var frm = document.forms['visualizer'];
    62     frm['comparative.marker.selection.filename'].value = path;
    63   }
    6449  function doVisualize()
    6550  {
     
    6752    frm.submit();
    6853  }
     54  function getModuleList()
     55  {
     56    var frm = document.forms['visualizer'];
     57    var url = '<%=homeUrl%>/Ajax.servlet?ID=<%=ID%>&cmd=ListModules';
     58    url += '&server=' + encodeURIComponent(frm['server'].value);
     59    var request = Ajax.getXmlHttpRequest();
     60    request.open("GET", url, true);
     61    Ajax.setReadyStateHandler(request, getModulesListCallback);
     62    request.send(null);
     63    document.getElementById('ajaxStatus').innerHTML = 'Please wait. . .';
     64    setTimeout('showProgress()', 250);
     65  }
     66  function showProgress()
     67  {
     68    var progress = document.getElementById('ajaxStatus');
     69    if (progress.innerHTML.indexOf('Please wait') == 0)
     70    {
     71      progress.innerHTML += ' .';
     72      setTimeout('showProgress()', 250);
     73    }
     74  }
    6975
     76  function getModulesListCallback(request)
     77  {
     78    if (document.getElementById('ajaxStatus').innerHTML.indexOf('Please wait') != 0) return;
     79    var frm = document.forms['visualizer'];
     80    var responseText = request != null ?
     81      request.responseText :
     82      'status:error\nstacktrace:No response from server';
     83    var response = Ajax.parseResponse(responseText);
     84    if (response.isError())
     85    {
     86      var stacktrace = response.getElements()[0]['stacktrace'];
     87      document.getElementById('ajaxStatus').innerHTML =
     88        '<div class="error stacktrace" style="width: 420px; height: 15em; overflow: auto;">' + stacktrace + '</div>';
     89    }
     90    else
     91    {
     92      var modules = response.getElements();
     93      modules.sort(compareGpModules);
     94      var html = '<div style="width: 420px; height: 15em; overflow: auto;">';
     95      for (var i = 0; i < modules.length; i++)
     96      {
     97        var type = modules[i]['taskType'];
     98        if (type == 'Visualizer')
     99        {
     100          html += '<a id="module.' + i + '" href="javascript:setModule('+i+')" title="' + modules[i]['description'] + '">';
     101          html += modules[i]['name'] + '</a><br>';
     102        }
     103      }
     104      html += '</div>';
     105      document.getElementById('ajaxStatus').innerHTML = html;
     106    }
     107  }
     108  function compareGpModules(m1, m2)
     109  {
     110    var type1 = m1['taskType'];
     111    var type2 = m2['taskType'];
     112    if (type1 < type2) return -1;
     113    if (type1 > type2) return 1;
     114    var name1 = m1['name'];
     115    var name2 = m2['name'];
     116    if (name1 < name2) return -1;
     117    if (name1 > name2) return 1;
     118    return 0;
     119  }
     120  function setModule(index)
     121  {
     122    var frm = document.forms['visualizer'];
     123    frm['module'].value = document.getElementById('module.'+index).innerHTML;
     124  }
    70125  </script>
    71126</base:head>
     
    74129  <form action="Visualizer.servlet" method="post" name="visualizer">
    75130  <input type="hidden" name="ID" value="<%=ID%>">
     131  <input type="hidden" name="cmd" value="SelectServerModule">
    76132 
    77   <h3>Run visualizer</h3>
     133  <h3 class="docked">Run visualizer</h3>
     134  <div class="boxedbottom">
    78135    <table class="form" cellspacing=0>
    79136    <tr>
    80       <td class="prompt">GenePattern servers</td>
     137      <td></td>
     138      <td>Select a GenePattern visualizer module.</td>
     139    </tr>
     140    <tr>
     141      <td class="prompt">GenePattern server</td>
    81142      <td>
    82       <select name="server" style="width: 25em;">
     143      <select name="server" class="required">
    83144      <%
    84       String selected = "selected";
    85145      for (Presets.Preset server : presets)
    86146      {
    87147        %>
    88         <option <%=selected%>><%=HTML.encodeTags(server.getName())%>
     148        <option><%=HTML.encodeTags(server.getName())%>
    89149        <%
    90         selected = "";
    91150      }
    92151      %>
     
    94153      </td>
    95154    </tr>
    96 
    97155    <tr>
    98       <td class="prompt">Module name</td>
     156      <td class="prompt">Visualizer module</td>
    99157      <td>
    100         <input class="text required" type="text" name="module" size="40"
    101           value="ComparativeMarkerSelectionViewer">
     158        <input class="text required" type="text" name="module" size="40" value="">
    102159      </td>
    103160    </tr>
     161    <tr>
     162      <td class="prompt">Available modules</td>
     163      <td>
     164      <table border=0 cellspacing=0><tr><td><base:button
     165          title="Get list" onclick="getModuleList()"
     166          image="<%=homeUrl + "/images/genepattern.gif" %>"
     167          /></td>
     168        </tr></table>
     169      </td>
     170    </tr>
     171    <tr>
     172      <td class="prompt"></td>
     173      <td id="ajaxStatus"></td>
     174    </tr>
     175    </table>
     176    </div>
    104177
    105178
    106     <tr>
    107         <td class="prompt">CMS output file</td>
    108         <td>
    109           <table border="0" cellspacing="0" cellpadding="0">
    110           <tr>
    111           <td><input type="text" class="text required"
    112             name="comparative.marker.selection.filename" size="60"
    113             value="/gp-ComparativeMarkerSelection/2009-06-16/normalized.imputed.comp.marker.odf">&nbsp;</td>
    114           <td><base:button
    115               title="Browse&hellip;"
    116               onclick="browseOnClick('setCmsFileCallback')"
    117               />
    118           </td>
    119           </tr>
    120           </table>
    121         </td>
    122     </tr>
    123     <tr>
    124         <td class="prompt">GCT data file</td>
    125         <td>
    126           <table border="0" cellspacing="0" cellpadding="0">
    127           <tr>
    128           <td><input type="text" class="text required"
    129             name="dataset.filename" size="60"
    130             value="/gp-ImputeMissingValuesKNN/2009-06-15/normalized.imputed.gct">&nbsp;</td>
    131           <td><base:button
    132               title="Browse&hellip;"
    133               onclick="browseOnClick('setGctFileCallback')"
    134               />
    135           </td>
    136           </tr>
    137           </table>
    138         </td>
    139     </tr>
    140     </table>
    141179    </form>
    142180    <table align="center">
     
    149187</base:body>
    150188</base:page>
    151 <%
    152 
    153 %>
  • extensions/net.sf.basedb.genepattern/trunk/resources/visualizer_applet.jsp

    r1132 r1134  
    2222  ------------------------------------------------------------------
    2323
    24   @author Jari, Nicklas
     24  @author Nicklas
    2525--%>
    2626<%@ page
    2727  pageEncoding="UTF-8"
    2828  session="false"
     29  import="net.sf.basedb.clients.web.util.HTML"
    2930  import="java.util.Map"
    3031%>
    3132<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
    3233<%
    33 Map<String, String> appletParameters = (Map<String, String>)request.getAttribute("appletParameters");
     34final Map<String, String> appletParameters =
     35  (Map<String, String>)request.getAttribute("appletParameters");
     36String module = appletParameters.get("name");
    3437%>
    35 <base:page type="popup" title="">
    36 <base:head >
    37 
    38 </base:head>
     38<base:page type="popup" title="<%=HTML.encodeTags(module)%>">
     39<base:head></base:head>
    3940<base:body>
    40   <h3><%=appletParameters.get("name")%></h3>
     41  <h3 class="docked"><%=HTML.encodeTags(module)%></h3>
    4142  <div class="boxedbottom">
    4243  The visualizer will start in it's own window. It is safe to
    4344  close this window once the visualizer is up and running.
    44  
     45  <p>
    4546  <applet
    4647    code="org.genepattern.visualizer.RunVisualizerApplet"
    4748    archive="runVisualizer.jar,commons-httpclient.jar,commons-codec-1.3.jar"
    48     codebase="downloads"
     49    codebase="visualizer"
    4950    width="1" height="1"
    5051    alt="Your browser can not run applets"
    5152    >
     53    <%
     54    for (Map.Entry<String, String> entry : appletParameters.entrySet())
     55    {
     56      %>
     57      <param name="<%=entry.getKey()%>" value="<%=entry.getValue()%>">
    5258      <%
    53       for (Map.Entry<String, String> entry : appletParameters.entrySet())
    54       {
    55         %>
    56         <param name="<%=entry.getKey()%>" value="<%=entry.getValue()%>">
    57         <%
    58       }
    59       %>
     59    }
     60    %>
    6061  </applet>
    6162  </div>
     
    6970</base:body>
    7071</base:page>
    71 <%
    72 
    73 %>
  • extensions/net.sf.basedb.genepattern/trunk/src/net/sf/basedb/genepattern/file/SupportFileTransferGateway.java

    r1132 r1134  
    88import java.util.List;
    99
    10 import org.genepattern.webservice.TaskIntegratorProxy;
    1110import org.genepattern.webservice.WebServiceException;
    1211
    1312import net.sf.basedb.core.Application;
    1413import net.sf.basedb.core.ConfigurationException;
     14import net.sf.basedb.genepattern.wrapper.GPClient;
    1515import net.sf.basedb.genepattern.wrapper.SupportFileInfo;
     16import net.sf.basedb.genepattern.wrapper.TaskInfo;
    1617import net.sf.basedb.util.StaticCache;
    1718
     
    3536{
    3637
    37   private List<SupportFileInfo> supportFiles;
    38   private String lsid;
     38  private final TaskInfo ti;
     39
    3940 
    4041  /**
     
    4445    @param lsid The LSID of a module
    4546  */
    46   public SupportFileTransferGateway(String lsid)
     47  public SupportFileTransferGateway(TaskInfo ti)
    4748  {
    48     this.lsid = lsid;
    49     this.supportFiles = new ArrayList<SupportFileInfo>();
    50   }
    51  
    52   /**
    53     Add information about a support file for the give module.
    54    
    55     @param fileInfo The file information
    56   */
    57   public void addFile(SupportFileInfo fileInfo)
    58   {
    59     supportFiles.add(fileInfo);
     49    this.ti = ti;
    6050  }
    6151 
     
    6858    @throws IOException
    6959  */
    70   public void downloadSupportFiles(TaskIntegratorProxy tiProxy)
     60  public void downloadSupportFiles(GPClient gp)
    7161    throws WebServiceException, IOException
    7262  {
     
    7868    }
    7969   
    80     List<String> toDownload = new ArrayList<String>();
    81     String cacheRoot = StaticCache.makeValidKey("gp-integration/" + lsid + "/", "-");
     70    String moduleLsid = ti.getLsid();
     71    String validKey = StaticCache.makeValidKey(moduleLsid, "-");
     72   
     73    List<SupportFileInfo> toDownload = new ArrayList<SupportFileInfo>();
     74    String cacheRoot = "gp-integration/" + validKey + "/";
     75    SupportFileInfo[] supportFiles = gp.getSupportFiles(moduleLsid);
    8276    for (SupportFileInfo file : supportFiles)
    8377    {
    8478      if (!cache.exists(cacheRoot + file.getFileName()))
    8579      {
    86         toDownload.add(file.getFileName());
     80        toDownload.add(file);
    8781      }
    8882    }
    89     File workDir = new File(System.getProperty("java.io.tmpdir"));
    90     tiProxy.getSupportFiles(lsid, toDownload.toArray(new String[0]), workDir);
    91     for (SupportFileInfo file : supportFiles)
     83    File workDir = new File(System.getProperty("java.io.tmpdir"), validKey);
     84    workDir.mkdirs();
     85    gp.downloadSupportFiles(moduleLsid, toDownload.toArray(new SupportFileInfo[0]), workDir);
     86    for (SupportFileInfo file : toDownload)
    9287    {
    9388      File sf = new File(workDir, file.getFileName());
  • extensions/net.sf.basedb.genepattern/trunk/src/net/sf/basedb/genepattern/servlet/Visualizer.java

    r1132 r1134  
    3131import net.sf.basedb.clients.web.Base;
    3232import net.sf.basedb.clients.web.extensions.ExtensionsControl;
     33import net.sf.basedb.core.PluginParameter;
    3334import net.sf.basedb.core.SessionControl;
    3435import net.sf.basedb.genepattern.GPServer;
     
    8081    throws IOException, ServletException
    8182  {
    82     String module = request.getParameter("module");
    83     String server = request.getParameter("server");
    84     SessionControl sc = Base.getSessionControl(request, false);
    85     String ID = sc.getId();
    86    
    87     GPServer gpServer = GPServer.get(sc, server);
    88     GPClient gp = new GPClient(gpServer);
    89    
     83    String cmd = request.getParameter("cmd");
     84    String forward = null;
    9085    try
    9186    {
    92       TaskInfo ti = gp.getTaskInfo(module);
    93       ParameterInfo[] parameters = ti.getParameters(null);
    94       SupportFileInfo[] supportFiles = gp.getSupportFiles(ti.getLsid());
    95      
    96       SupportFileTransferGateway sfgw = new SupportFileTransferGateway(ti.getLsid());
    97          
    98       Map<String, String> appletParameters = new LinkedHashMap<String, String>();
    99       appletParameters.put("name", module);
    100       appletParameters.put("gp_os", ti.getOs());
    101       appletParameters.put("gp_cpuType", ti.getCpuType());
    102       appletParameters.put("visualizer_java_flags", "-Xmx512M");
    103       appletParameters.put("context", ExtensionsControl.getHomeUrl("net.sf.basedb.genepattern.options"));
    104       List<String> parameterNames = new ArrayList<String>();
    105       List<String> fileParameters = new ArrayList<String>();
    106       for (ParameterInfo pi : parameters)
    107       {
    108         String name = pi.getName();
    109         String value = request.getParameter(name);
    110         if (value != null)
    111         {
    112           parameterNames.add(name);
    113           if (pi.isInputFile())
    114           {
    115             fileParameters.add(name);
    116             appletParameters.put(name, "http://auster.thep.lu.se:8080/trunk/filemanager/files/view/-" + ID + "-" + value);
    117           }
    118           else
    119           {
    120             appletParameters.put(name, value);
    121           }
    122         }
    123       }
    124       appletParameters.put("gp_paramNames", Values.getString(parameterNames, ",", true));
    125       appletParameters.put("gp_download", Values.getString(fileParameters, ",", true));
    126       appletParameters.put("commandLine", ti.getCommandLine());
    127      
    128       List<String> fileNames = new ArrayList<String>();
    129       List<Long> fileDates = new ArrayList<Long>();
    130       for (SupportFileInfo si : supportFiles)
    131       {
    132         sfgw.addFile(si);
    133         fileNames.add(si.getFileName());
    134         fileDates.add(si.getLastModified());
    135       }
    136       sfgw.downloadSupportFiles(gp.getTaskIntegratorProxy());
    137       appletParameters.put("gp_filenames", Values.getString(fileNames, ",", true));
    138       appletParameters.put("gp_fileDates", Values.getString(fileDates, ",", true));
    139       appletParameters.put("gp_lsid", ti.getLsid());
    140      
    141     //  response.getWriter().print("appletParameters=" + appletParameters.toString());
    142       request.setAttribute("appletParameters", appletParameters);
    143       request.getRequestDispatcher("visualizer.jsp").forward(request, response);
    144      
     87      if ("SelectServerModule".equals(cmd))
     88      {
     89        forward = selectServerModule(request, response);
     90      }
     91      else if ("RunVisualizerApplet".equals(cmd))
     92      {
     93        forward = runVisualizerApplet(request, response);
     94      }
    14595    }
    14696    catch (WebServiceException ex)
    14797    {
    14898      throw new ServletException(ex);
    149     }
     99    }
     100    if (forward != null)
     101    {
     102      request.getRequestDispatcher(forward).forward(request, response);
     103    }
    150104  }
    151105 
     
    158112  }
    159113 
     114  private String selectServerModule(HttpServletRequest request, HttpServletResponse response)
     115    throws WebServiceException
     116  {
     117    // Request parameters
     118    String server = request.getParameter("server");
     119    String module = request.getParameter("module");
     120    SessionControl sc = Base.getSessionControl(request, false);
     121   
     122    // Get the selected server & a web service connection to it
     123    GPServer gpServer = GPServer.get(sc, server);
     124    final GPClient gp = new GPClient(gpServer);
     125
     126    // Get the TaskInfo for the selected module
     127    final TaskInfo ti = gp.getTaskInfo(module);
     128   
     129    // Start a thread that downloads the module support files
     130    Thread t = new Thread(new Runnable()
     131    {
     132      @Override
     133      public void run()
     134      {
     135        SupportFileTransferGateway gw = new SupportFileTransferGateway(ti);
     136        try
     137        {
     138          gw.downloadSupportFiles(gp);
     139        }
     140        catch (Exception ex)
     141        {}
     142      }
     143    });
     144    t.start();
     145   
     146   
     147    ParameterInfo[] parameters = ti.getParameters(null);
     148    List<PluginParameter> moduleParameters = new ArrayList<PluginParameter>();
     149   
     150    for (ParameterInfo pi : parameters)
     151    {
     152      moduleParameters.add(pi.createPluginParameter("gp.", null));
     153    }
     154   
     155    request.setAttribute("moduleParameters", moduleParameters);
     156    return "visualizer_parameters.jsp";
     157  }
     158 
     159  private String runVisualizerApplet(HttpServletRequest request, HttpServletResponse response)
     160    throws WebServiceException, IOException
     161  {
     162   
     163    // Request parameters
     164    String server = request.getParameter("server");
     165    String module = request.getParameter("module");
     166    SessionControl sc = Base.getSessionControl(request, false);
     167    String ID = sc.getId();
     168   
     169    // Get the selected server & a web service connection to it
     170    GPServer gpServer = GPServer.get(sc, server);
     171    GPClient gp = new GPClient(gpServer);
     172   
     173    // Get the TaskInfo and ParameterInfo for the selected module
     174    TaskInfo ti = gp.getTaskInfo(module);
     175    ParameterInfo[] parameters = ti.getParameters(null);
     176   
     177    // Make sure that all support files have been cached in BASE
     178    SupportFileTransferGateway gw = new SupportFileTransferGateway(ti);
     179    gw.downloadSupportFiles(gp);
     180   
     181    // Create the applet parameters
     182    // 1. Environment parameters
     183    Map<String, String> appletParameters = new LinkedHashMap<String, String>();
     184    appletParameters.put("name", module);
     185    appletParameters.put("gp_lsid", ti.getLsid());
     186    appletParameters.put("gp_os", ti.getOs());
     187    appletParameters.put("gp_cpuType", ti.getCpuType());
     188    appletParameters.put("visualizer_java_flags", "-Xmx512M"); // TODO - should be configurable
     189    appletParameters.put("context", ExtensionsControl.getHomeUrl("net.sf.basedb.genepattern.options"));
     190    appletParameters.put("commandLine", ti.getCommandLine());
     191 
     192    // 2. Module-specific parameters
     193    List<String> parameterNames = new ArrayList<String>();
     194    List<String> fileParameters = new ArrayList<String>();
     195    final String scheme = request.getScheme();
     196    final String serverName = request.getServerName();
     197    final int serverPort = request.getServerPort();
     198    final String contextPath = request.getContextPath();
     199    final String baseFileUrl = scheme + "://" + serverName + ":" + serverPort +
     200      contextPath + "/filemanager/files/view/-" + ID + "-";
     201
     202    for (ParameterInfo pi : parameters)
     203    {
     204      String name = pi.getName();
     205      String value = Values.getStringOrNull(request.getParameter("gp." + name));
     206      if (value != null)
     207      {
     208        parameterNames.add(name);
     209        if (pi.isInputFile())
     210        {
     211          fileParameters.add(name);
     212          appletParameters.put(name, baseFileUrl + value);
     213        }
     214        else
     215        {
     216          appletParameters.put(name, value);
     217        }
     218      }
     219    }
     220    appletParameters.put("gp_paramNames", Values.getString(parameterNames, ",", true));
     221    appletParameters.put("gp_download", Values.getString(fileParameters, ",", true));
     222   
     223    // 3. Support file information
     224    SupportFileInfo[] supportFiles = gp.getSupportFiles(ti.getLsid());
     225    List<String> fileNames = new ArrayList<String>();
     226    List<Long> fileDates = new ArrayList<Long>();
     227    for (SupportFileInfo si : supportFiles)
     228    {
     229      fileNames.add(si.getFileName());
     230      fileDates.add(si.getLastModified());
     231    }
     232    appletParameters.put("gp_filenames", Values.getString(fileNames, ",", true));
     233    appletParameters.put("gp_fileDates", Values.getString(fileDates, ",", true));
     234   
     235    request.setAttribute("appletParameters", appletParameters);
     236    return "visualizer_applet.jsp";
     237  }
     238 
    160239}
  • extensions/net.sf.basedb.genepattern/trunk/src/net/sf/basedb/genepattern/wrapper/GPClient.java

    r1132 r1134  
    11package net.sf.basedb.genepattern.wrapper;
     2
     3import java.io.File;
    24
    35import net.sf.basedb.core.signal.SignalException;
     
    103105  }
    104106 
     107  /**
     108    Get the underlying {@link TaskIntegratorProxy} instance.
     109    Use this method to access functionality that is not exposed by this
     110    class.
     111  */
    105112  public TaskIntegratorProxy getTaskIntegratorProxy()
    106113    throws WebServiceException
     
    150157  }
    151158
     159  /**
     160    Get information about a specific module that is installed on the
     161    current GenePattern server.
     162    @param module The name of LSID of the module
     163    @return A TaskInfo object
     164    @throws WebServiceException If there is a problem retreiving the information
     165  */
    152166  public TaskInfo getTaskInfo(String module)
    153167    throws WebServiceException
     
    157171  }
    158172 
     173  /**
     174    Get information about the support files that are required by
     175    a (visualizer) module.
     176   
     177    @param module The LSID of the module (the name will not work)
     178    @return An array with SupprtFileInfo objects
     179    @throws WebServiceException If there is a problem retreiving the information
     180  */
    159181  public SupportFileInfo[] getSupportFiles(String module)
    160182    throws WebServiceException
    161183  {
    162184    TaskIntegratorProxy tiProxy = getTaskIntegratorProxy();
    163    
    164185    String[] fileNames = tiProxy.getSupportFileNames(module);
    165186    long[] dates = tiProxy.getLastModificationTimes(module, fileNames);
     
    172193  }
    173194 
     195  /**
     196    Download support files required by a (visualizer) module. NOTE!
     197    Existing files in the specified directory are overwritten!
     198   
     199    @param module The LSID of the module (the name will not work)
     200    @param files An array with the files to download, or null to
     201      download all support files
     202    @param toDir The directory to download the files to
     203    @throws WebServiceException If there is a problem downloading the files
     204  */
     205  public void downloadSupportFiles(String module, SupportFileInfo[] files, File toDir)
     206    throws WebServiceException
     207  {
     208    TaskIntegratorProxy tiProxy = getTaskIntegratorProxy();
     209    if (files == null) files = getSupportFiles(module);
     210    String[] fileNames = new String[files.length];
     211    for (int i = 0; i < files.length; ++i)
     212    {
     213      fileNames[i] = files[i].getFileName();
     214    }
     215    tiProxy.getSupportFiles(module, fileNames, toDir);
     216  }
    174217 
    175218  /**
Note: See TracChangeset for help on using the changeset viewer.