Changeset 5265


Ignore:
Timestamp:
Mar 11, 2010, 9:51:50 AM (12 years ago)
Author:
Nicklas Nordborg
Message:

References #1443: External Plugin Executor

  • Moved around and renamed some things.
  • Added possibilty for the external executor to communicate with exporter and importer plug-ins.
  • Implemented support plug-ins for BFS export and import (has very limited functionality)

It should now be possible to complete both a configuaration sequence and a job execution sequence without errors. But there are lot of holes that needs to be fixed. For example:

  • The external program is never executed
  • The data to export is hard-coded into the exporter
  • No context-checking that experiment has proper raw data type, number of channels, etc.
  • No parameters are included in the export
  • Not possible to define parameters that selects experimental factors, bioassays, etc.
  • And probably other things as well...
Location:
branches/2.15-stable
Files:
10 added
1 deleted
7 edited
1 moved

Legend:

Unmodified
Added
Removed
  • branches/2.15-stable/src/core/net/sf/basedb/core/Formula.java

    r5208 r5265  
    129129   
    130130    @param type The type of formula to return, or null to return any type
    131     @param rawDataType The raw data type the formula should be useful for
     131    @param rawDataType The raw data type the formula should be useful for,
     132      or null to not filter on the raw data type
    132133    @param source Source data intensity transformation that the formula
    133134      should be useful for. This includes all formulas that has specified
     
    152153        Expressions.integer(type.getValue())));
    153154    }
    154     Expression rdtExpression = Hql.property("rawDataType");
    155     query.restrictPermanent(
    156       Restrictions.or(
    157         Restrictions.eq(rdtExpression, Expressions.parameter("rawDataType", rawDataType.getId())),
    158         Restrictions.and(
    159           Restrictions.eq(rdtExpression, null),
    160           Restrictions.eq(Hql.property("channels"), Expressions.integer(rawDataType.getChannels()))
     155    if (rawDataType != null)
     156    {
     157      Expression rdtExpression = Hql.property("rawDataType");
     158      query.restrictPermanent(
     159        Restrictions.or(
     160          Restrictions.eq(rdtExpression, Expressions.parameter("rawDataType", rawDataType.getId())),
     161          Restrictions.and(
     162            Restrictions.eq(rdtExpression, null),
     163            Restrictions.eq(Hql.property("channels"), Expressions.integer(rawDataType.getChannels()))
     164          )
    161165        )
    162       )
    163     );
     166      );
     167    }
    164168    if (source != null)
    165169    {
  • branches/2.15-stable/src/core/net/sf/basedb/core/Install.java

    r5248 r5265  
    627627        "itself.",
    628628        "net.sf.basedb.core.plugin.AnnotationSetterPlugin", null);
     629      createPluginType("External executor IO support",
     630        "This is a tagging interface that should be implemented by import and export plug-ins " +
     631        "that wants to cooperate with the External Executor plug-in in either the export or import " +
     632        "step. This interface doesn't define any methods but requires that implementing classes " +
     633        "implement other methods (eg. configure(), run(), etc) in a special way. Consult the " +
     634        "API documentation for more details.",
     635        "net.sf.basedb.plugins.executor.IOSupport", null);
    629636     
    630637      createPluginDefinition("net.sf.basedb.plugins.Base1PluginExecuter", null, null, true, null, false);
     
    674681      createPluginDefinition("net.sf.basedb.plugins.batchimport.ArrayBatchImporter", null, null, true, null, false);
    675682      createPluginDefinition("net.sf.basedb.plugins.batchimport.ArraySlideImporter", null, null, true, null, false);
     683      createPluginDefinition("net.sf.basedb.plugins.executor.ExternalProgramExecutor", null, keyEveryoneUse, true, null, false);
     684      createPluginDefinition("net.sf.basedb.plugins.executor.BfsExporterSupport", null, keyEveryoneUse, true, null, false);
     685      createPluginDefinition("net.sf.basedb.plugins.executor.BfsImporterSupport", null, keyEveryoneUse, true, null, false);
    676686     
    677687      // Plugin configurations
  • branches/2.15-stable/src/core/net/sf/basedb/core/PluginDefinition.java

    r5038 r5265  
    11161116 
    11171117  /**
    1118     Get an instance of the plugin.
     1118    Get an unitialized instance of the plugin.
    11191119    @throws PermissionDeniedException If the logged in user doesn't have
    11201120      {@link Permission#USE} permission to the items.
    11211121    @throws BaseException If there is a problem creating an instance.
    11221122  */
    1123   Plugin newInstance()
     1123  public Plugin newInstance()
    11241124    throws PermissionDeniedException, BaseException
    11251125  {
     
    11361136 
    11371137  /**
    1138     Get an instance of the plugin implementation.
     1138    Get an unitialized instance of the plugin implementation.
     1139    @param <P> The kind of returned object that extends Plugin.
     1140    @param clazz The class of the plugin which must be a subclass of <code>Plugin</code>
     1141    @param jarPath Overrides the default JAR path for a plugin, null to use the default
     1142      JAR path
     1143    @return An uninitialised plugin instance
     1144    @throws PermissionDeniedException
     1145    @throws BaseException
     1146   */
     1147  public <P extends Plugin> P newInstance(Class<P> clazz, String jarPath)
     1148    throws PermissionDeniedException, BaseException
     1149  {
     1150    Plugin p = newInstance(jarPath);
     1151    if (!clazz.isInstance(p))
     1152    {
     1153      throw new InvalidDataException("Plugin does not implement "+clazz.getName()+": "+toString());
     1154    }
     1155    return clazz.cast(p);
     1156  }
     1157
     1158 
     1159  /**
     1160    Get an initialized instance of the plugin implementation.
    11391161    @param <P> The kind of returned object that extends Plugin.
    11401162    @param clazz The class of the plugin which must be a subclass of <code>Plugin</code>
     
    11531175    throws PermissionDeniedException, BaseException
    11541176  {
    1155     Plugin p = newInstance(jarPath);
    1156     if (!clazz.isInstance(p))
    1157     {
    1158       throw new InvalidDataException("Plugin does not implement "+clazz.getName()+": "+toString());
    1159     }
     1177    P p = newInstance(clazz, jarPath);
    11601178    if (sc == null) sc = getSessionControl();
    11611179    p.init(sc.getPluginSessionControl(this, job),
  • branches/2.15-stable/src/core/net/sf/basedb/util/FileUtil.java

    r5219 r5265  
    612612  */
    613613  public static int deleteTempDirectory(File root)
    614     throws IOException
    615614  {
    616615    int numDeleted = 0;
  • branches/2.15-stable/src/core/net/sf/basedb/util/export/spotdata/MatrixBfsExporter.java

    r5213 r5265  
    4242  extends BfsExporter
    4343{
     44 
     45  public static final String SUBTYPE = "matrix";
    4446
    4547  /**
     
    5961  public String getBFSSubtype()
    6062  {
    61     return "matrix";
     63    return SUBTYPE;
    6264  }
    6365
  • branches/2.15-stable/src/core/net/sf/basedb/util/export/spotdata/SerialBfsExporter.java

    r5213 r5265  
    4444  extends BfsExporter
    4545{
     46 
     47  public static final String SUBTYPE = "serial";
     48 
    4649  /**
    4750    Create a new serial BFS exporter.
     
    6164  public String getBFSSubtype()
    6265  {
    63     return "serial";
     66    return SUBTYPE;
    6467  }
    6568 
  • branches/2.15-stable/src/plugins/core/net/sf/basedb/plugins/BfsExporterPlugin.java

    r5258 r5265  
    121121    Collections.singleton(GuiContext.item(Item.BIOASSAYSET));
    122122
    123   private static final String FORMAT_BFS_SERIAL = "serial";
    124   private static final String FORMAT_BFS_MATRIX = "matrix";
    125 
    126  
    127123  private ThreadSignalHandler signalHandler;
    128124  private RequestInformation configureJob;
     
    226222       
    227223        // Export options
    228         storeValue(job, request, ri.getParameter("fileformat"));
    229         storeValue(job, request, ri.getParameter("filenamegenerator"));
     224        storeValue(job, request, ri.getParameter(PARAMETER_FILEFORMAT));
     225        storeValue(job, request, ri.getParameter(PARAMETER_FILENAMEGENERATOR));
    230226        storeValues(job, request, ri.getParameter("spotFields"));
    231227        storeValues(job, request, ri.getParameter("reporterFields"));
     
    329325      }
    330326 
    331       String format = (String)job.getValue("fileformat");
    332       String filenameGen = (String)job.getValue("filenamegenerator");
     327      String format = (String)job.getValue(PARAMETER_FILEFORMAT);
     328      String filenameGen = (String)job.getValue(PARAMETER_FILENAMEGENERATOR);
    333329      List<String> reporterFields = (List<String>)job.getValues("reporterFields");
    334330      List<String> spotFields = (List<String>)job.getValues("spotFields");
     
    342338      if (progress != null) progress.display(0, "Exporting ...");
    343339      BfsExporter exporter = null;
    344       if (FORMAT_BFS_SERIAL.equals(format))
     340      if (SerialBfsExporter.SUBTYPE.equals(format))
    345341      {
    346342        exporter = new SerialBfsExporter();
    347343      }
    348       else if (FORMAT_BFS_MATRIX.equals(format))
     344      else if (MatrixBfsExporter.SUBTYPE.equals(format))
    349345      {
    350346        exporter = new MatrixBfsExporter();
     
    489485        ));
    490486
    491       // Export File format
    492       Enumeration<String, String> formats = new Enumeration<String, String>();
    493       formats.add(FORMAT_BFS_SERIAL, "Serial BFS");
    494       formats.add(FORMAT_BFS_MATRIX, "Matrix BFS");
    495       parameters.add(new PluginParameter<String>(
    496           "fileformat",
    497           "File format",
    498           "Please specify if you want to export a serial or matrix BFS. " +
    499           "The serial format has one data file for each assay, and the matrix format " +
    500           "has one data file for each selected spot field. In both cases, " +
    501           "reporter fields and assay fields are exported in two separate files.",
    502           new StringParameterType(255, null, true, 1, 0, 0, formats)
    503         ));
    504      
    505       Enumeration<String, String> filenameGen = new Enumeration<String, String>();
    506       filenameGen.add("names", "Assay/formula names");
    507       filenameGen.add("sequence", "Sequence");
    508       parameters.add(new PluginParameter<String>(
    509           "filenamegenerator",
    510           "File name strategy",
    511           "Please select a data file name generation strategy.\n\n" +
    512           "Assay formula/names = file names are created based on the " +
    513           "names of assays or selected spot fields\n" +
    514           "Sequence = file names follows a strict sequnce, sdata-1.txt, " +
    515           "sdata-2.txt, etc.",
    516           new StringParameterType(255, null, true, 1, 0, 0, filenameGen)
    517         ));
     487      // File format parameter
     488      parameters.add(getFileFormatParameter());
     489      // File name generation strategy parameter
     490      parameters.add(getFileNameGeneratorParameter());
    518491
    519492      // Save to directory options
     
    746719  }
    747720 
     721  public final static String PARAMETER_FILEFORMAT = "fileformat";
     722 
     723  /**
     724    Create a plug-in parameter that asks for the BFS subtype to use in
     725    the export.
     726  */
     727  public static PluginParameter<String> getFileFormatParameter()
     728  {
     729    Enumeration<String, String> formats = new Enumeration<String, String>();
     730    formats.add(SerialBfsExporter.SUBTYPE, "Serial BFS");
     731    formats.add(MatrixBfsExporter.SUBTYPE, "Matrix BFS");
     732    return new PluginParameter<String>(
     733        PARAMETER_FILEFORMAT,
     734        "File format",
     735        "Please specify if you want to export a serial or matrix BFS. " +
     736        "The serial format has one data file for each assay, and the matrix format " +
     737        "has one data file for each selected spot field. In both cases, " +
     738        "reporter fields and assay fields are exported in two separate files.",
     739        new StringParameterType(255, null, true, 1, 0, 0, formats)
     740      );
     741  }
     742 
     743  public final static String PARAMETER_FILENAMEGENERATOR = "filenamegenerator";
     744
     745  /**
     746    Create a plug-in parameter that asks for the file name generation strategy.
     747  */
     748  public static PluginParameter<String> getFileNameGeneratorParameter()
     749  {
     750    Enumeration<String, String> filenameGen = new Enumeration<String, String>();
     751    filenameGen.add("names", "Assay/formula names");
     752    filenameGen.add("sequence", "Sequence");
     753    return new PluginParameter<String>(
     754        PARAMETER_FILENAMEGENERATOR,
     755        "File name strategy",
     756        "Please select a data file name generation strategy.\n\n" +
     757        "Assay formula/names = file names are created based on the " +
     758        "names of assays or selected spot fields\n" +
     759        "Sequence = file names follows a strict sequnce, sdata-1.txt, " +
     760        "sdata-2.txt, etc.",
     761        new StringParameterType(255, null, true, 1, 0, 0, filenameGen)
     762      );
     763  }
     764 
    748765  public static class ExtendedExportableField
    749766  {
  • branches/2.15-stable/www/plugins/net/sf/basedb/plugins/executor/external_plugin_parameters.jsp

    r5259 r5265  
    3838  import="net.sf.basedb.clients.web.WebException"
    3939  import="net.sf.basedb.clients.web.util.HTML" 
    40   import="net.sf.basedb.plugins.ExternalPluginExecutor"
     40  import="net.sf.basedb.plugins.executor.ExternalProgramExecutor"
    4141  import="net.sf.basedb.util.Values" 
    4242  import="java.util.ArrayList"
     
    136136              for (Object value : values)
    137137              {
    138                 Iterator<Element> it = ExternalPluginExecutor.getParameterElementsFromXml(value.toString());
     138                Iterator<Element> it = ExternalProgramExecutor.getParameterElementsFromXml(value.toString());
    139139                while(it.hasNext())
    140140                {
Note: See TracChangeset for help on using the changeset viewer.