Changeset 3783


Ignore:
Timestamp:
Sep 25, 2007, 2:30:55 PM (16 years ago)
Author:
Nicklas Nordborg
Message:

Merged changes from trunk between revisions 3758:3775
Minor changes in data layer
Somre more core classes and test programs added

Location:
branches/filedb
Files:
7 added
1 deleted
72 edited
4 copied

Legend:

Unmodified
Added
Removed
  • branches/filedb/build.xml

    r3738 r3783  
    605605      jarfile="${jar}/ExamplePlugins.jar"
    606606      manifest="${exampledir}/MANIFEST.MF"
    607     />
     607    >
     608      <metainf file="${exampledir}/base-plugins.xml"></metainf>
     609          <metainf file="${exampledir}/base-configurations.xml"></metainf>
     610    </jar>
    608611  </target>
    609612
  • branches/filedb/config/dist/base.config

    r3719 r3783  
    138138
    139139# The path to the directory where external plugins are installed
    140 plugin.dir=/usr/local/base2/plugins
     140plugins.dir=/usr/local/base2/plugins
    141141
    142142# Number of minutes to keep permission information for the logged
  • branches/filedb/doc/src/docbook/admindoc/installation_upgrade.xml

    r3725 r3783  
    343343            </listitem>
    344344          </varlistentry>
    345           <varlistentry>
    346             <term id="installation_upgrade.jobagent.user_account">Enable the job agent user account</term>
     345          <varlistentry id="installation_upgrade.jobagent.user_account">
     346            <term>Enable the job agent user account</term>
    347347            <listitem>
    348348              <para>
     
    367367      <para>
    368368        <variablelist>
    369           <varlistentry>
    370             <term id="installation_upgrade.jobagent.database">Create a user account on the database</term>
     369          <varlistentry id="installation_upgrade.jobagent.database">
     370            <term>Create a user account on the database</term>
    371371            <listitem>
    372372              <para>
     
    413413            </listitem>
    414414          </varlistentry>
    415           <varlistentry>
    416             <term id="installation_upgrade.jobagent.client.config">Edit the <filename>base.config</filename> file</term>
     415          <varlistentry id="installation_upgrade.jobagent.client.config">
     416            <term>Edit the <filename>base.config</filename> file</term>
    417417            <listitem>
    418418              <para>
     
    462462            </listitem>
    463463          </varlistentry>
    464           <varlistentry>
    465             <term id="installation_upgrade.jobagent.client.properties">Edit
     464          <varlistentry id="installation_upgrade.jobagent.client.properties">
     465            <term>Edit
    466466            the <filename>jobagent.properties</filename> file</term>
    467467            <listitem>
     
    744744      </varlistentry>
    745745
    746       <varlistentry>
    747         <term id="installation_upgrade.installation.database">BASE (database engine)</term>
     746      <varlistentry id="installation_upgrade.installation.database">
     747        <term>BASE (database engine)</term>
    748748        <listitem>
    749749          <para>
     
    841841      </varlistentry>
    842842
    843       <varlistentry>
    844         <term id="installation_upgrade.installation.configuration">BASE (configuration)</term>
     843      <varlistentry id="installation_upgrade.installation.configuration">
     844        <term>BASE (configuration)</term>
    845845        <listitem>
    846846          <para>
  • branches/filedb/doc/src/docbook/admindoc/plugin_installation.xml

    r3755 r3783  
    8585      and click on the &gbNew; button. The pop-up window that appears looks different
    8686      depending on if
    87       <property>plugin.dir</property>
     87      <property>plugins.dir</property>
    8888      in
    8989      <filename>base.config</filename>
  • branches/filedb/doc/src/docbook/appendix/base.config.xml

    r3753 r3783  
    601601    </varlistentry>
    602602    <varlistentry>
    603       <term><property>plugin.dir</property></term>
     603      <term><property>plugins.dir</property></term>
    604604      <listitem>
    605605        <para>
  • branches/filedb/doc/src/docbook/developerdoc/api_overview.xml

    r3757 r3783  
    649649    <sect2 id="data_api.files">
    650650      <title>Files and directories</title>
     651
     652      <para>
     653        This section covers the details of the BASE file
     654        system.
     655      </para>
     656
     657      <sect3 id="data_api.files.uml">
     658      <title>UML diagram</title>
     659     
     660        <figure id="data_api.figures.files">
     661          <title>Files and directories</title>
     662          <screenshot>
     663            <mediaobject>
     664              <imageobject>
     665                <imagedata
     666                  fileref="figures/uml/datalayer.files.png" format="PNG" />
     667              </imageobject>
     668            </mediaobject>
     669          </screenshot>
     670        </figure>
     671      </sect3>
     672     
     673      <sect3 id="data_api.files.description">
     674        <title>Description</title>
     675       
     676        <para>
     677          The <classname>DirectoryData</classname> class holds
     678          information about directories. Directories are organised in the
     679          ususal way as as tree structure. All directories must have
     680          a parent directory, except the system-defined root directory.
     681        </para>
     682       
     683        <para>
     684          The <classname>FileData</classname> class holds information about
     685          a file. The actual file contents is stored on disk in the directory
     686          specified by the <varname>userfiles</varname> setting in
     687          <filename>base.config</filename>. The <varname>internalName</varname>
     688          property is the name of the file on disk, but this is never exposed to
     689          client applications. The filenames and directories
     690          on the disk doesn't correspond to the the filenames and directories in
     691          BASE.
     692        </para>
     693       
     694        <para>
     695          The <varname>location</varname> property can take three values:
     696        </para>
     697       
     698        <itemizedlist>
     699        <listitem>
     700          <para>
     701          0 = The file is offline, ie. there is no file on the disk
     702          </para>
     703        </listitem>
     704        <listitem>
     705          <para>
     706          1 = The file is in primary storage, ie. it is located on the disk
     707          and can be used by BASE
     708          </para>
     709        </listitem>
     710        <listitem>
     711          <para>
     712          2 = The file is in secondary storage, ie. it has been moved to some
     713          other place and can't be used by BASE immediately.
     714          </para>
     715        </listitem>
     716        </itemizedlist>
     717       
     718        <para>
     719          The <varname>action</varname> property controls how a file is
     720          moved between primary and seconday storage. It can have the following
     721          values:
     722        </para>
     723       
     724        <itemizedlist>
     725        <listitem>
     726          <para>
     727          0 = Do nothing
     728          </para>
     729        </listitem>
     730        <listitem>
     731          <para>
     732          1 = If the file is in secondary storage, move it back to the primary storage
     733          </para>
     734        </listitem>
     735        <listitem>
     736          <para>
     737          2 = If the file is in primary storage, move it to the secondary storage
     738          </para>
     739        </listitem>
     740        </itemizedlist>
     741       
     742        <para>
     743          The actual moving between primary and secondary storage is done by an
     744          external program. See
     745          <xref linkend="appendix.base.config.secondary" /> and
     746          <xref linkend="plugin_developer.other.secondary" /> for more information.
     747        </para>
     748     
     749        <para>
     750          The <varname>md5</varname> property can be used to check for file
     751          corruption when it is moved between primary and secondary storage or
     752          when a user re-uploads a file that has been offline.
     753        </para>
     754       
     755        <para>
     756          BASE can store files in a compressed format. This is handled internally
     757          and is not visible to client applications. The <varname>compressed</varname>
     758          and <varname>diskSize</varname> properties are used to store information
     759          about this. A file may always be compressed if the users says so, but
     760          BASE can also do this automatically if the file is uploaded
     761          to a directory with the <varname>autoCompress</varname> flag set
     762          or if the file has MIME type with the <varname>autoCompress</varname>
     763          flag set.
     764        </para>
     765       
     766        <para>
     767          The <classname>FileTypeData</classname> class holds information about
     768          file types. It is used only to make it easier for users to organise
     769          their files.
     770        </para>
     771       
     772        <para>
     773          The <classname>MimeTypeData</classname> is used to register mime types and
     774          map them to file extensions. The information is only used to lookup values
     775          when needed. Given the filename we can set the <varname>File.mimeType</varname>
     776          and <varname>File.fileType</varname> properties. The MIME type is also
     777          used to decide if a file should be stored in a compressed format or not.
     778          The extension of a MIME type must be unique. Extensions should be registered
     779          without a dot, ie <emphasis>html</emphasis>, not <emphasis>.html</emphasis>. 
     780        </para>
     781       
     782      </sect3>
     783     
     784     
    651785    </sect2>
    652786   
  • branches/filedb/doc/src/docbook/developerdoc/plugin_developer.xml

    r3755 r3783  
    117117         manifest="MANIFEST.MF"
    118118         &gt;
     119         &lt;!--Include this to add required files for auto registration wizard--&gt;
     120         &lt;metainf file="./base-plugins.xml"&gt;&lt;/metainf&gt;
     121         &lt;metainf file="./base-configurations.xml"&gt;&lt;/metainf&gt;       
    119122      &lt;/jar&gt;
    120123
     
    133136Class-Path: OtherJar.jar ASecondJar.jar</programlisting>
    134137        </para>
     138        <para>
     139          If your plugin should support registration with the auto-installation-wizzard it
     140          could be a good idea to add the
     141          <sgmltag class="element">metainf</sgmltag>
     142          tags. By doing this you don't have to insert any files to the plugin-jar file
     143          after it had been created. Place the
     144          <filename>base-plugins.xml</filename>
     145          and
     146          <filename>base-configurations.xml</filename>
     147          (if any configurations are shipped with the plugin) in the project root
     148          directory before you compile. The files will end up in the jar-file's
     149          <filename class="directory">META-INF</filename>
     150          . Go to
     151          <xref linkend="plugin_developer.organize.autoinstallcompatible" />
     152          to get more information how to create this files.
     153        </para>
    135154      </sect3>
    136155       
     
    156175      <title>With Eclipse</title>
    157176      <para>
    158         If somebody is willing to add information to this
    159         chapter please send us a note or some written text to put here.
    160         Otherwise, this chapter will be removed.
     177        If somebody is willing to add information to this chapter please send us a note or
     178        some written text to put here. Otherwise, this chapter will be removed.
    161179      </para>
    162180    </sect2>
    163    
     181
    164182    <sect2 id="plugin_developer.organize.autoinstallcompatible">
    165183      <title>To be installed with auto install</title>
    166184      <para>
    167      
     185        A jar-file with plugins needs to have a specific XML-file in it's
     186        <filename>META-INF</filename>
     187        folder if the plugins should be possible to use with the auto installation in BASE.
     188        The XML-file should have the name
     189        <filename>base-plugins.xml</filename>
     190        and be in the format described below.
     191      </para>
     192      <programlisting>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
     193&lt;!DOCTYPE plugins SYSTEM "base-plugins.dtd" &gt;
     194&lt;plugins jarname="<filename>jarfile.jar</filename>"&gt;
     195  &lt;pluginclass classname="<classname>se.lu.thep.PluginClass</classname>"&gt;
     196    &lt;minbaseversion&gt;2.4&lt;/minbaseversion&gt;
     197    &lt;hasconfigurations/&gt;
     198    &lt;/pluginclass&gt;
     199    .
     200    .
     201    .
     202&lt;/plugins&gt;</programlisting>
     203      <para>
     204        The first two lines should be the same in all base-plugins.xml, rest of the tags are
     205        described in following list.
     206        <variablelist>
     207          <varlistentry>
     208            <term><sgmltag class="element">plugins</sgmltag></term>
     209            <listitem>
     210              <para>
     211                This is the root element in the XML-file and must have the
     212                attribute
     213                <sgmltag class="attribute">jarname</sgmltag>
     214                set. The attribute should hold the name of the jar-file the XML-file
     215                is in.
     216              </para>
     217            </listitem>
     218          </varlistentry>
     219          <varlistentry>
     220            <term>
     221              <sgmltag class="element">pluginclass</sgmltag>
     222            </term>
     223            <listitem>
     224              <para>
     225                This tag defines information about each plugin in the jar-file. The
     226                <sgmltag class="attribute">classname</sgmltag>
     227                attribute needs to have the full classname of the plugin's main
     228                class. There can be one or several of this element inside the
     229                <sgmltag>plugins</sgmltag>
     230                tag, which means that there should be one pluginclass-element for
     231                each plugin in the jar.
     232              </para>
     233            </listitem>
     234          </varlistentry>
     235          <varlistentry>
     236            <term>
     237              <sgmltag class="element">minbaseversion</sgmltag>
     238            </term>
     239            <listitem>
     240              <para>
     241                A required child element in
     242                <sgmltag class="element">pluginclass</sgmltag>
     243                . This defines from which version of BASE the plugin can be used.
     244                The plugin will not be included in auto installer if the
     245                BASE-version is lower then the value of this tag. Format of the
     246                value in this tag should be
     247                <emphasis>majorversion</emphasis>.<emphasis>minorversion</emphasis>
     248              </para>
     249            </listitem>
     250          </varlistentry>
     251          <varlistentry>
     252            <term>
     253              <sgmltag class="element">hasconfigurations</sgmltag>             
     254            </term>
     255            <listitem>
     256              <para>
     257                A required child element in
     258                <sgmltag class="element">pluginclass</sgmltag>
     259                . This should tell if there are plugin configurations
     260                shipped with the plugin. Setting the value to
     261                <emphasis>yes</emphasis>
     262                will indicate that there are available configurations in the
     263                jar-file. This can be left as an empty tag if no
     264                configurations are available for import.
     265              </para>
     266              <para>
     267                Configurations shipped with a jar-file should be exported with the
     268                plugin configuration exporter in BASE. The exported file must have
     269                the name
     270                <filename>base-configurations.xml</filename>
     271                . This file has to be put in the jar-file's
     272                <filename class="directory">META-INF</filename>
     273                folder together with
     274                <filename>base-plugins.xml</filename>.
     275              </para>
     276            </listitem>
     277          </varlistentry>
     278        </variablelist>
    168279      </para>
    169280    </sect2>
  • branches/filedb/doc/src/docbook/overviewdoc/resources.xml

    r3699 r3783  
    222222    <title>Demo server</title>
    223223    <para>
    224       There is a demo server available for anyone to use and to
    225       explore BASE without having to install anything. Follow the link
    226       from BASE web site to the demo server or go directly to
     224      There is a demo server up running for anyone who wants to explore BASE 2 without having
     225      to install it. Follow the link on BASE 2's home page to the demo server or go directly
     226      to
    227227      <ulink url="http://base2.thep.lu.se/demo/">
    228228        http://base2.thep.lu.se/demo/
     
    285285    </important>
    286286  </sect1>
     287
     288  <sect1 id="resources.basehacks">
     289    <title>BASE-hacks</title>
     290    <para>
     291      There is a trac/subversion server keeping track of changes made
     292      to third party projects that are changed to make them work with
     293      BASE. Open source project usually have a requirement that
     294      changes are made public. On
     295      the <ulink
     296      url='http://trac.thep.lu.se/trac/basehacks'>BASE-hacks web
     297      site</ulink> you will find a list of modified packages and
     298      information about the changes performed.
     299    </para>
     300  </sect1>
     301
    287302</chapter>
  • branches/filedb/doc/src/docbook/userdoc/analyse_mev.xml

    r3679 r3783  
    2929<sect1 id="experiments_analysis.mev">
    3030  <title>Analysing data with Multiexperiment Viewer (MeV)</title>
    31   <para>TODO</para>
     31  <para>
     32    MeV is a versatile microarray data analysis tool, incorporating
     33    sophisticated algorithms for clustering, visualization,
     34    classification, statistical analysis and biological theme
     35    discovery, <ulink
     36    url='http://www.tm4.org'>http://www.tm4.org</ulink>. We use a
     37    modified version of MeV and provide information about the changes
     38    at
     39    the <ulink url='http://trac.thep.lu.se/trac/basehacks'>BASE-hacks
     40    web site</ulink>.
     41  </para>
    3242</sect1>
  • branches/filedb/doc/src/docbook/userdoc/index.xml

    r3675 r3783  
    2929  <?dbhtml dir="userdoc"?>
    3030  <title>User documentation</title>
    31   <include file="about.xml"/>
     31  <include file="userdoc_overview.xml"/>
    3232  <include file="webclient.xml"/>
    3333  <include file="project_permission.xml"/>
  • branches/filedb/src/clients/migrate/net/sf/basedb/clients/migrate/QuotaTransfer.java

    r3725 r3783  
    9797      quotas.put(totalQuota, quota);
    9898    }
    99     else
     99    else if (quota.isInDatabase())
    100100    {
    101101      quota = Quota.getById(dc, quota.getId());
  • branches/filedb/src/clients/web/net/sf/basedb/clients/web/Base.java

    r3679 r3783  
    511511            if (value != null)
    512512            {
     513              boolean hasWildcard = value.indexOf('%') >= 0;
    513514              Type valueType = Type.valueOf(name.substring(7, colonIndex));
    514515 
     
    517518              filter.setValueType(valueType);
    518519             
    519               Operator op = Operator.EQ;
     520              Operator op = hasWildcard ? Operator.LIKE : Operator.EQ;
    520521              if (value.startsWith("<>") || value.startsWith("!="))
    521522              {
    522                 op = Operator.NEQ;
     523                op = hasWildcard ? Operator.NOTLIKE : Operator.NEQ;
    523524                value = value.substring(2);
    524525              }
     
    545546              else if (value.startsWith("="))
    546547              {
    547                 op = Operator.EQ;
     548                op = hasWildcard ? Operator.LIKE : Operator.EQ;
    548549                value = value.substring(1);
    549               }
    550               else if (value.indexOf('%') >= 0)
    551               {
    552                 op = Operator.LIKE;
    553550              }
    554551              if ("".equals(value)) value = null;
     
    669666        {}
    670667      }
    671       if (op == Operator.EQ && (value == null || (value != null && value.indexOf('%') >= 0)))
     668      if (op == Operator.EQ && value == null)
    672669      {
    673670        result = "=";
    674671      }
    675       else if (op == Operator.NEQ)
     672      else if (op == Operator.NEQ || op == Operator.NOTLIKE)
    676673      {
    677674        result = "<>";
  • branches/filedb/src/clients/web/net/sf/basedb/clients/web/plugins/SimpleExport.java

    r3679 r3783  
    227227    String whichItems = (String)job.getValue(WHICH_ITEMS);
    228228    String format = (String)job.getValue(FORMAT);
    229     List<Integer> selectedItems = (List<Integer>)job.getValues("item");
    230229    List<String> columns = (List<String>)job.getValues(WHICH_PROPERTIES);
    231230   
     
    265264    QueryWrapper queryWrapper = null;
    266265    ResultIterator result = null;
     266    Set<Integer>selectedItems = cc.getSelected();
    267267   
    268268    // The query wrapper allows us to get results from the query in a simplier way
  • branches/filedb/src/clients/web/net/sf/basedb/clients/web/taglib/table/Navigator.java

    r3679 r3783  
    337337    sb.append(" (").append(totalRows).append(totalRows == 1 ? " hit" : " hits");
    338338    sb.append(", <input name=\"rowsperpage\" class=\"text\" type=\"text\" value=\"").append(rowsPerPage).append("\"");
    339     sb.append(" size=\"2\" maxlength=\"2\" onkeypress=\"return Numbers.integerOnly(event, true);\"> per page");
     339    sb.append(" size=\"3\" maxlength=\"3\" onkeypress=\"return Numbers.integerOnly(event, true);\"> per page");
    340340    sb.append(")</td></tr>\n");
    341341    try
  • branches/filedb/src/core/net/sf/basedb/core/AbstractBatcher.java

    r3679 r3783  
    7575 
    7676  /**
    77     Constructor that initiate everything.
    78 
    79     @param dc The <code>DbControl</code> to get database access
     77    Constructor for a batcher.
    8078    @throws BaseException If there is an error
    8179  */
    82   AbstractBatcher(DbControl dc)
    83   {
    84     assert dc != null : "dc == null";
    85     this.dc = new WeakReference<DbControl>(dc);
    86     this.sc = dc.getSessionControl();
     80  AbstractBatcher()
     81  {
    8782    this.batchSize = Config.getInt("db.batch-size", 50);
    88     dc.addBatcher(this);
    8983  }
    9084
     
    133127  {
    134128    sc.updateLastAccess();
     129  }
     130 
     131  /**
     132    Set the DbControl that is controlling this batcher. This
     133    method MUST be called by all subclasses after successful construction
     134    of a batcher. This method also registers the batcher with the DbControl
     135    using {@link DbControl#addBatcher(Batcher)}
     136    @since 2.4.2
     137  */
     138  protected final void setDbControl(DbControl dc)
     139  {
     140    assert dc != null : "dc == null";
     141    this.dc = new WeakReference<DbControl>(dc);
     142    this.sc = dc.getSessionControl();
     143    dc.addBatcher(this);
    135144  }
    136145 
  • branches/filedb/src/core/net/sf/basedb/core/Application.java

    r3719 r3783  
    408408      log.info("plugins.autounload = " + autoUnloadPlugins);
    409409     
    410       String pluginDir = Config.getString("plugin.dir");
    411       nonCorePluginDirectory = pluginDir != null ? new java.io.File(pluginDir) : null;
     410      String pluginsDir = Config.getString("plugins.dir");
     411      nonCorePluginDirectory = pluginsDir != null ? new java.io.File(pluginsDir) : null;
    412412      log.info("plugins.dir = " + nonCorePluginDirectory);
    413413     
  • branches/filedb/src/core/net/sf/basedb/core/ArrayDesign.java

    r3741 r3783  
    5959public class ArrayDesign
    6060  extends AnnotatedItem<ArrayDesignData>
     61  implements FileStoreEnabled
    6162{
    6263 
     
    7879    @return The new <code>ArrayDesign</code> item
    7980    @throws BaseException If there is an error
     81    @deprecated Use {@link #getNew(DbControl, Platform)} instead
    8082  */
    8183  public static ArrayDesign getNew(DbControl dc, boolean affyChip)
    8284    throws BaseException
    8385  {
     86    Platform platform = Platform.getById(dc,
     87      SystemItems.getId(affyChip ? Platform.AFFYMETRIX : Platform.GENERIC));
     88    return getNew(dc, platform);
     89  }
     90
     91  public static ArrayDesign getNew(DbControl dc, Platform platform)
     92  {
    8493    ArrayDesign ad = dc.newItem(ArrayDesign.class);
    8594    ad.setName("New array design");
    86     ad.getData().setAffyChip(affyChip);
     95    ad.setPlatform(platform);
    8796    return ad;
    88   }
    89 
     97   
     98  }
     99 
    90100  /**
    91101    Get an <code>ArrayDesign</code> item when you know the ID.
     
    154164  }
    155165  // -------------------------------------------
    156 
     166  /*
     167    From the FileStoreEnabled interface
     168    -------------------------------------------
     169  */
     170  public FileSet getFileSet()
     171  {
     172    DbControl dc = getDbControl();
     173    FileSet fs = dc.getItem(FileSet.class, getData().getFileSet(), this);
     174    if (fs == null)
     175    {
     176      fs = FileSet.getNew(dc, this);
     177      getData().setFileSet(fs.getData());
     178      dc.saveItemIf(this, fs, false);
     179    }
     180    return fs;
     181  }
     182  public boolean hasFileSet()
     183  {
     184    return getData().getFileSet() != null;
     185  }
     186  public Platform getPlatform()
     187  {
     188    return getDbControl().getItem(Platform.class, getData().getPlatform());
     189  }
     190  public PlatformVariant getVariant()
     191  {
     192    return getDbControl().getItem(PlatformVariant.class, getData().getVariant());
     193  }
     194  // -------------------------------------------
    157195  /*
    158196    From the BasicItem class
     
    227265  // -------------------------------------------
    228266 
    229   /**
    230       @return TRUE if this is an AffyChip, FALSE otherwise.     
     267  private void setPlatform(Platform platform)
     268  {
     269    if (platform == null) throw new InvalidUseOfNullException("platform");
     270    getData().setPlatform(platform.getData());
     271  }
     272 
     273  private void setVariant(PlatformVariant variant)
     274  {
     275    if (variant == null) throw new InvalidUseOfNullException("variant");
     276    getData().setVariant(variant.getData());
     277  }
     278 
     279  /**
     280      @return TRUE if this is an AffyChip, FALSE otherwise.
     281      @deprecated Use {@link #getPlatform()} instead and compare the
     282        system ID with {@link Platform#AFFYMETRIX}
    231283  */
    232284  public boolean isAffyChip()
    233285  {
    234     return getData().isAffyChip();
     286    return Platform.AFFYMETRIX.equals(getData().getPlatform().getSystemId());
    235287  }
    236288
  • branches/filedb/src/core/net/sf/basedb/core/BasicBatcher.java

    r3679 r3783  
    131131    Constructor that initiate everything.
    132132
    133     @param dc DbControl to get database access
    134133    @param dataClass The class of the data objects that are accepted by this batcher
    135134    @param entityName The entity name of the data as known by Hibernate, use null
     
    137136    @throws BaseException If there is an error
    138137  */
    139   BasicBatcher(DbControl dc, Class<D> dataClass, String entityName)
    140     throws BaseException
    141   {
    142     super(dc);
     138  BasicBatcher(org.hibernate.Session session, Class<D> dataClass, String entityName)
     139    throws BaseException
     140  {
     141    super();
    143142    assert dataClass != null : "dataClass == null";
    144143   
     
    159158    try
    160159    {
    161       java.sql.Connection c = HibernateUtil.getConnection(dc.getHibernateSession());
     160      java.sql.Connection c = HibernateUtil.getConnection(session);
    162161      insertStatement = c.prepareStatement(insertSql);
    163162      updateStatement = c.prepareStatement(updateSql);
  • branches/filedb/src/core/net/sf/basedb/core/DbControl.java

    r3679 r3783  
    269269          batcher.close();
    270270        }
    271         catch (BaseException ex)
     271        catch (Throwable ex)
    272272        {
    273273          log.warn("Exception during rollback in batcher.close()", ex);
     
    281281      if (hStatelessSession != null) HibernateUtil.close(hStatelessSession);
    282282    }
    283     catch (BaseException ex)
     283    catch (Throwable ex)
    284284    {
    285285      log.warn("Exception during rollback in Hibernate", ex);
  • branches/filedb/src/core/net/sf/basedb/core/FeatureBatcher.java

    r3679 r3783  
    9191    throws BaseException
    9292  {
    93     super(dc, FeatureData.class, null);
     93    super(dc.getHibernateSession(), FeatureData.class, null);
    9494    this.arrayDesign = arrayDesign;
    9595    this.arrayDesignData = arrayDesign.getData();
    9696    this.isAffy = arrayDesign.isAffyChip();
     97    setDbControl(dc);
    9798  }
    9899
  • branches/filedb/src/core/net/sf/basedb/core/FilterBatcher.java

    r3679 r3783  
    142142  FilterBatcher(DbControl dc, BioAssaySet bioAssaySet)
    143143  {
    144     super(dc);
     144    super();
    145145    this.bioAssaySet = bioAssaySet;
    146146    this.bytesPerRow = VirtualTable.FILTER.getBytesPerRow(bioAssaySet.getRawDataType());
     147    setDbControl(dc);
    147148  }
    148149
  • branches/filedb/src/core/net/sf/basedb/core/Install.java

    r3764 r3783  
    679679      if (progress != null) progress.display((int)(25*progress_factor), "--Creating data file types...");
    680680      FileSetMemberTypeData celFile = createFileSetMemberType(
    681         "affymetric.cel", "CEL file", "Affymetrix CEL file",
     681        "affymetrix.cel", "CEL file", "Affymetrix CEL file",
    682682        Item.RAWBIOASSAY, "cel", rawDataType, true,
    683683        "todo", "todo");
    684684      FileSetMemberTypeData cdfFile = createFileSetMemberType(
    685         "affymetric.cdf", "CDF file", "Affymetrix CDF file",
     685        "affymetrix.cdf", "CDF file", "Affymetrix CDF file",
    686686        Item.ARRAYDESIGN, "cdf", reporterMapType, true,
    687687        "todo", "todo");
     
    22382238       
    22392239        HibernateUtil.commit(tx);
     2240        if (systemId != null) SystemItems.add(platform);
    22402241        log.info("createPlatform: OK [systemId="+systemId+"]");
    22412242      }
     
    22932294        HibernateUtil.saveData(session, fileType);
    22942295        HibernateUtil.commit(tx);
     2296        if (systemId != null) SystemItems.add(fileType);
    22952297        log.info("createFileSetMemberType: OK [systemId="+systemId+"]");
    22962298      }
  • branches/filedb/src/core/net/sf/basedb/core/Item.java

    r3764 r3783  
    513513    The item is a {@link PlatformFileType}
    514514  */
    515   PLATFORMFILETYPE(352, "Platform file type", "pft", null, PlatformFileTypeData.class, null,
     515  PLATFORMFILETYPE(352, "Platform file type", "pft", PlatformFileType.class, PlatformFileTypeData.class, null,
    516516    960),
    517517   
     
    519519    The item is a {@link FileSet}
    520520  */
    521   FILESET(353, "File set", "fs", null, FileSetData.class, null,
     521  FILESET(353, "File set", "fs", FileSet.class, FileSetData.class, null,
    522522    950),
    523523
     
    525525    The item is a {@link FileSetMember}
    526526  */
    527   FILESETMEMBER(354, "File set member", "fsm", null, FileSetMemberData.class, null,
     527  FILESETMEMBER(354, "File set member", "fsm", FileSetMember.class, FileSetMemberData.class, null,
    528528    955),
    529529   
     
    531531    The item is a {@link FileSetMemberType}
    532532  */
    533   FILESETMEMBERTYPE(355, "File set member type", "fsmt", null, FileSetMemberTypeData.class, null,
    534     980),
     533  FILESETMEMBERTYPE(355, "File set member type", "fsmt", FileSetMemberType.class, FileSetMemberTypeData.class, null,
     534    980)
    535535   
    536536    ;
  • branches/filedb/src/core/net/sf/basedb/core/MappingBatcher.java

    r3679 r3783  
    106106  MappingBatcher(DbControl dc, DataCube dataCube)
    107107  {
    108     super(dc);
     108    super();
    109109    this.dataCube = dataCube;
    110110    this.noRawMapping = dataCube.isInDatabase();
    111111    this.bytesPerRow = VirtualTable.RAWPARENTS.getBytesPerRow(dataCube.getRawDataType());
     112    setDbControl(dc);
    112113  }
    113114
  • branches/filedb/src/core/net/sf/basedb/core/Operator.java

    r3679 r3783  
    126126      return Restrictions.like(lvalue, rvalue);
    127127    }
     128  },
     129 
     130  NOTLIKE(11, "NOT LIKE", "NOT LIKE", true)
     131  {
     132    public Restriction getRestriction(Expression lvalue, Expression rvalue)
     133      throws InvalidDataException
     134    {
     135      return Restrictions.not(Restrictions.like(lvalue, rvalue));
     136    }
    128137  };
    129138
  • branches/filedb/src/core/net/sf/basedb/core/Platform.java

    r3764 r3783  
    2626import java.util.Set;
    2727
     28import net.sf.basedb.core.data.FileTypeIndex;
    2829import net.sf.basedb.core.data.PlatformData;
     30import net.sf.basedb.core.data.PlatformFileTypeData;
    2931import net.sf.basedb.core.query.Hql;
    3032import net.sf.basedb.core.query.Restrictions;
     
    334336    if (isFileOnly())
    335337    {
    336       // TODO - autogenerate a raw data type
     338      // TODO - autogenerate a raw data type in a proper way
     339      rdt = new RawDataType(getSystemId(), getName(), getDescription(), getData().getChannels(),
     340        "file", null, null, null);
    337341    }
    338342    else
     
    369373    return PlatformVariant.getNew(getDbControl(), this, systemId);
    370374  }
     375 
     376  /**
     377    @see PlatformFileType#getQuery(Platform, PlatformVariant, boolean)
     378  */
     379  public ItemQuery<PlatformFileType> getFileTypes(PlatformVariant variant, boolean restrict)
     380  {
     381    return PlatformFileType.getQuery(this, variant, restrict);
     382  }
     383 
     384  /**
     385    Add a file type to this platform/variant. If the file type has
     386    already been registered this method does nothing.
     387    @param type The file type
     388    @param variant An optional variant
     389    @throws PermissionDeniedException If the logged in user doesn't
     390      have write permission
     391    @throws InvalidUseOfNullException If type is null
     392  */
     393  public void addFileType(FileSetMemberType type, PlatformVariant variant)
     394  {
     395    checkPermission(Permission.WRITE);
     396    if (type == null) throw new InvalidUseOfNullException("type");
     397    FileTypeIndex index = new FileTypeIndex(variant == null ? null : variant.getData(), type.getData());
     398    if (!getData().getFileTypes().containsKey(index))
     399    {
     400      PlatformFileType platformFileType =
     401        PlatformFileType.getNew(getDbControl(), this, variant, type);
     402      getData().getFileTypes().put(index, platformFileType.getData());
     403      getDbControl().saveItemIf(this, platformFileType, false);
     404    }
     405  }
     406 
     407  /**
     408    Remove a file type from this platform/variant. If the file
     409    type isn't registered this method does nothing. If a variant is given
     410    the file type is only removed from that variant. If no variant
     411    is given the file type is only removed from the platform, not
     412    from other variants that have registered with the file type.
     413   
     414    @param type The file type to remove
     415    @param variant An optional variant
     416    @throws PermissionDeniedException If the logged in user doesn't
     417      have write permission
     418    @throws InvalidUseOfNullException If type is null
     419  */
     420  public void removeFileType(FileSetMemberType type, PlatformVariant variant)
     421  {
     422    checkPermission(Permission.WRITE);
     423    if (type == null) throw new InvalidUseOfNullException("type");
     424    FileTypeIndex index = new FileTypeIndex(variant == null ? null : variant.getData(), type.getData());
     425    if (getData().getFileTypes().containsKey(index))
     426    {
     427      PlatformFileTypeData pfData = getData().getFileTypes().remove(type.getData());
     428      if (pfData != null)
     429      {
     430        DbControl dc = getDbControl();
     431        PlatformFileType pf = dc.getItem(PlatformFileType.class, pfData);
     432        dc.deleteItem(pf);
     433      }
     434    }
     435  }
     436 
    371437}
  • branches/filedb/src/core/net/sf/basedb/core/PlatformVariant.java

    r3764 r3783  
    367367    return rdt;
    368368  }
    369 
    370 
     369 
     370  /**
     371    Get a query returning file types registered with this platform
     372    variant.
     373    @param restrict If TRUE the query will only return file types that
     374      has been directly registered with this variant, if FALSE the
     375      query will also return file types that have been registered
     376      with the platform
     377    @see PlatformFileType#getQuery(Platform, PlatformVariant, boolean)
     378  */
     379  public ItemQuery<PlatformFileType> getFileTypes(boolean restrict)
     380  {
     381    return PlatformFileType.getQuery(getPlatform(), this, restrict);
     382  }
     383 
     384  /**
     385    Add a file type to this platform variant. If the file type has
     386    already been registered this method does nothing.
     387    @param type The file type
     388    @throws PermissionDeniedException If the logged in user doesn't
     389      have write permission to the platform
     390    @throws InvalidUseOfNullException If type is null
     391    @see Platform#addFileType(FileSetMemberType, PlatformVariant)
     392  */
     393  public void addFileType(FileSetMemberType type)
     394  {
     395    getPlatform().addFileType(type, this);
     396  }
     397
     398  /**
     399    Remove a file type from this platform variant. If the file
     400    type isn't registered this method does nothing.
     401   
     402    @param type The file type to remove
     403    @throws PermissionDeniedException If the logged in user doesn't
     404      have write permission to the platform
     405    @throws InvalidUseOfNullException If type is null
     406    @see Platform#removeFileType(FileSetMemberType, PlatformVariant)
     407  */
     408  public void removeFileType(FileSetMemberType type)
     409  {
     410    getPlatform().removeFileType(type, this);
     411  }
    371412}
  • branches/filedb/src/core/net/sf/basedb/core/PluginConfiguration.java

    r3679 r3783  
    467467
    468468    int newVersion = getNewParameterVersion();
     469    int copyFromVersion = copyFrom.getParameterVersion();
    469470    try
    470471    {
    471472      for (Map.Entry<VersionedParameter, ParameterValueData<?>> fromEntry : from.entrySet())
    472473      {
    473         VersionedParameter toName = new VersionedParameter(fromEntry.getKey().getName(), newVersion);
    474         ParameterValueData<?> fromParameter = fromEntry.getValue();
    475         Class<? extends ParameterValueData> dataClass = fromParameter.getClass();
    476         if (org.hibernate.proxy.HibernateProxy.class.isAssignableFrom(dataClass))
     474        VersionedParameter fromName = fromEntry.getKey();
     475        if (copyFromVersion == fromName.getVersion())
    477476        {
    478           // The 'fromParameter' is a proxy, we need the real data class
    479           dataClass =
    480             (Class<? extends ParameterValueData>)org.hibernate.Hibernate.getClass(fromParameter);
     477          VersionedParameter toName = new VersionedParameter(fromName.getName(), newVersion);
     478          ParameterValueData<?> fromParameter = fromEntry.getValue();
     479          Class<? extends ParameterValueData> dataClass = fromParameter.getClass();
     480          if (org.hibernate.proxy.HibernateProxy.class.isAssignableFrom(dataClass))
     481          {
     482            // The 'fromParameter' is a proxy, we need the real data class
     483            dataClass =
     484              (Class<? extends ParameterValueData>)org.hibernate.Hibernate.getClass(fromParameter);
     485          }
     486          ParameterValueData<?> toParameter = dataClass.newInstance();
     487          toParameter.setLabel(fromParameter.getLabel());
     488          toParameter.setDescription(fromParameter.getDescription());
     489          toParameter.replaceValues(fromParameter.getValues());
     490          to.put(toName, toParameter);
    481491        }
    482         ParameterValueData<?> toParameter = dataClass.newInstance();
    483         toParameter.setLabel(fromParameter.getLabel());
    484         toParameter.setDescription(fromParameter.getDescription());
    485         toParameter.replaceValues(fromParameter.getValues());
    486         to.put(toName, toParameter);
    487492      }
    488493    }
  • branches/filedb/src/core/net/sf/basedb/core/PositionBatcher.java

    r3679 r3783  
    106106  PositionBatcher(DbControl dc, DataCube dataCube)
    107107  {
    108     super(dc);
     108    super();
    109109    this.dataCube = dataCube;
    110110    this.bytesPerRow = VirtualTable.POSITION.getBytesPerRow(dataCube.getRawDataType());
     111    setDbControl(dc);
    111112  }
    112113
  • branches/filedb/src/core/net/sf/basedb/core/PositionExtraValueBatcher.java

    r3679 r3783  
    154154  PositionExtraValueBatcher(DbControl dc, ExtraValue extraValue)
    155155  {
    156     super(dc);
     156    super();
    157157    this.extraValue = extraValue;
    158158    this.bytesPerRow = extraValue.getVirtualTable().getBytesPerRow(extraValue.getRawDataType());
    159159    this.valueType = extraValue.getExtraValueType().getValueType();
    160160    this.sqlType = valueType.getSQLType();
     161    setDbControl(dc);
    161162  }
    162163
  • branches/filedb/src/core/net/sf/basedb/core/RawBioAssay.java

    r3679 r3783  
    6262public class RawBioAssay
    6363  extends AnnotatedItem<RawBioAssayData>
    64   implements DiskConsumable
     64  implements DiskConsumable, FileStoreEnabled
    6565{
    6666  /**
     
    9595    @return The new <code>RawBioAssay</code> item
    9696    @throws BaseException If there is an error
     97    @deprecated Use {@link #getNew(DbControl, Platform, RawDataType)} or
     98      {@link #getNew(DbControl, PlatformVariant, RawDataType)} instead.
     99      This method will set the platform to {@link Platform#GENERIC}.
    97100  */
    98101  public static RawBioAssay getNew(DbControl dc, RawDataType rawDataType)
    99102    throws BaseException
    100103  {
     104    Platform generic = Platform.getById(dc, SystemItems.getId(Platform.GENERIC));
     105    return getNew(dc, generic, rawDataType);
     106  }
     107 
     108  public static RawBioAssay getNew(DbControl dc, Platform platform, RawDataType rawDataType)
     109  {
    101110    RawBioAssay rba = dc.newItem(RawBioAssay.class);
    102     rba.setRawDataType(rawDataType);
     111    rba.setPlatform(platform);
     112    RawDataType platformRdt = platform.getRawDataType();
     113    rba.setRawDataType(platformRdt != null ? platformRdt : rawDataType);
    103114    rba.setName("New raw bioassay");
    104115    return rba;
    105116  }
     117 
     118  /*
     119  public static RawBioAssay getNew(DbControl dc, PlatformVariant variant, RawDataType rawDataType)
     120  {
     121   
     122  }
     123  */
    106124
    107125  /**
     
    202220    {}
    203221    return annotatable;
     222  }
     223  // -------------------------------------------
     224  /*
     225    From the FileStoreEnabled interface
     226    -------------------------------------------
     227  */
     228  public FileSet getFileSet()
     229  {
     230    DbControl dc = getDbControl();
     231    FileSet fs = dc.getItem(FileSet.class, getData().getFileSet(), this);
     232    if (fs == null)
     233    {
     234      fs = FileSet.getNew(dc, this);
     235      getData().setFileSet(fs.getData());
     236      dc.saveItemIf(this, fs, false);
     237    }
     238    return fs;
     239  }
     240  public boolean hasFileSet()
     241  {
     242    return getData().getFileSet() != null;
     243  }
     244  public Platform getPlatform()
     245  {
     246    return getDbControl().getItem(Platform.class, getData().getPlatform());
     247  }
     248  public PlatformVariant getVariant()
     249  {
     250    return getDbControl().getItem(PlatformVariant.class, getData().getVariant());
    204251  }
    205252  // -------------------------------------------
     
    291338  {
    292339    super.onBeforeCommit(action);
    293     if (action == Transactional.Action.DELETE && getSpots() > 0)
    294     {
    295       RawDataBatcher rdb = RawDataBatcher.getNew(getDbControl(), this);
    296       rdb.deleteAll();
     340    if (action == Transactional.Action.DELETE)
     341    {
     342      if (getRawDataType().isStoredInDb() && getSpots() > 0)
     343      {
     344        RawDataBatcher rdb = RawDataBatcher.getNew(getDbControl(), this);
     345        rdb.deleteAll();
     346      }
    297347    }
    298348  }
    299349  // -------------------------------------------
    300350
     351  private void setPlatform(Platform platform)
     352  {
     353    if (platform == null) throw new InvalidUseOfNullException("platform");
     354    getData().setPlatform(platform.getData());
     355  }
     356 
     357  private void setVariant(PlatformVariant variant)
     358  {
     359    if (variant == null) throw new InvalidUseOfNullException("variant");
     360    getData().setVariant(variant.getData());
     361  }
     362 
    301363  /**
    302364    Get the raw data type this raw bioassay uses for the raw data.
  • branches/filedb/src/core/net/sf/basedb/core/RawDataBatcher.java

    r3679 r3783  
    161161    throws BaseException
    162162  {
    163     super(dc, RawData.class, rawBioAssay.getRawDataType().getEntityName());
     163    super(dc.getHibernateSession(), RawData.class, rawBioAssay.getRawDataType().getEntityName());
    164164    this.rawBioAssay = rawBioAssay;
    165165    this.rawBioAssayData = rawBioAssay.getData();
     
    205205      this.preloaded = null;
    206206    }
     207    setDbControl(dc);
    207208  }
    208209
  • branches/filedb/src/core/net/sf/basedb/core/RawDataType.java

    r3679 r3783  
    7777    this.isStoredInDb = "database".equals(storage);
    7878    this.table = isStoredInDb ? table : null;
    79     this.properties = Collections.unmodifiableList(properties);
     79    this.properties = properties == null ? null : Collections.unmodifiableList(properties);
    8080    this.formulas = formulas;
    8181    this.realTable = isStoredInDb ? new RealTable(table, "raw") : null;
     
    8989    }
    9090   
    91     this.namedProperties = new HashMap<String, RawDataProperty>(properties.size());
    92     for (RawDataProperty property : properties)
    93     {
    94       if (namedProperties.put(property.getName(), property) != null)
     91    this.namedProperties = new HashMap<String, RawDataProperty>(
     92        properties == null ? 0 : properties.size());
     93    if (properties != null)
     94    {
     95      for (RawDataProperty property : properties)
    9596      {
    96         throw new BaseException("RawDataProperty[name="+property.getName()+"] is already defined for raw data type: "+name);
     97        if (namedProperties.put(property.getName(), property) != null)
     98        {
     99          throw new BaseException("RawDataProperty[name="+property.getName()+"] is already defined for raw data type: "+name);
     100        }
    97101      }
    98102    }
    99     this.namedFormulas = new HashMap<String, IntensityFormula>(formulas.size());
    100     for (IntensityFormula formula : formulas)
    101     {
    102       if (namedFormulas.put(formula.getName(), formula) != null)
     103   
     104    this.namedFormulas = new HashMap<String, IntensityFormula>(
     105        formulas == null ? 0 : formulas.size());
     106    if (formulas != null)
     107    {
     108      for (IntensityFormula formula : formulas)
    103109      {
    104         throw new BaseException("IntensityFormula[name="+formula.getName()+"] is already defined for raw data type: "+name);
     110        if (namedFormulas.put(formula.getName(), formula) != null)
     111        {
     112          throw new BaseException("IntensityFormula[name="+formula.getName()+"] is already defined for raw data type: "+name);
     113        }
    105114      }
    106115    }
    107    
    108116  }
    109117
  • branches/filedb/src/core/net/sf/basedb/core/ReporterBatcher.java

    r3679 r3783  
    7777    throws BaseException
    7878  {
    79     super(dc, ReporterData.class, null);
     79    super(dc.getHibernateSession(), ReporterData.class, null);
    8080    extendedProperties = ExtendedProperties.getProperties("ReporterData");
    8181    batchedExternalIds = HibernateUtil.getDbEngine().caseInsensitiveComparison() ?
    8282      new TreeSet<String>(String.CASE_INSENSITIVE_ORDER) : new HashSet<String>();
     83    setDbControl(dc);
    8384  }
    8485
  • branches/filedb/src/core/net/sf/basedb/core/SpotBatcher.java

    r3679 r3783  
    141141  SpotBatcher(DbControl dc, BioAssaySet bioAssaySet)
    142142  {
    143     super(dc);
     143    super();
    144144    this.bioAssaySet = bioAssaySet;
    145145    this.numChannels = bioAssaySet.getRawDataType().getChannels();
    146146    this.bytesPerRow = VirtualTable.SPOT.getBytesPerRow(bioAssaySet.getRawDataType());
     147    setDbControl(dc);
    147148  }
    148149
  • branches/filedb/src/core/net/sf/basedb/core/SpotExtraValueBatcher.java

    r3679 r3783  
    144144  SpotExtraValueBatcher(DbControl dc, ExtraValue extraValue)
    145145  {
    146     super(dc);
     146    super();
    147147    this.extraValue = extraValue;
    148148    this.bytesPerRow = extraValue.getVirtualTable().getBytesPerRow(extraValue.getRawDataType());
    149149    this.valueType = extraValue.getExtraValueType().getValueType();
    150150    this.sqlType = valueType.getSQLType();
     151    setDbControl(dc);
    151152  }
    152153
  • branches/filedb/src/core/net/sf/basedb/core/data/FileSetData.java

    r3764 r3783  
    2424package net.sf.basedb.core.data;
    2525
    26 import java.util.Set;
     26import java.util.HashMap;
     27import java.util.Map;
    2728
    2829/**
     
    5556  }
    5657 
    57   private Set<FileSetMemberData> members;
     58  private Map<FileSetMemberTypeData, FileSetMemberData> members;
    5859  /**
    5960    The members of this file set. This is the inverse end.
    6061    @see FileSetMemberData#getFileSet()
    61     @hibernate.set lazy="true" cascade="delete" inverse="true"
     62    @hibernate.map lazy="true" cascade="delete" inverse="true"
    6263    @hibernate.collection-key column="`fileset_id`"
     64    @hibernate.index-many-to-many column="`filesetmembertype_id`" class="net.sf.basedb.core.data.FileSetMemberTypeData"
    6365    @hibernate.collection-one-to-many class="net.sf.basedb.core.data.FileSetMemberData"
    6466  */
    65   Set<FileSetMemberData> getMembers()
     67  public Map<FileSetMemberTypeData, FileSetMemberData> getMembers()
    6668  {
     69    if (members == null)
     70    {
     71      members = new HashMap<FileSetMemberTypeData, FileSetMemberData>();
     72    }
    6773    return members;
    6874  }
    69   void setMembers(Set<FileSetMemberData> members)
     75  void setMembers(Map<FileSetMemberTypeData, FileSetMemberData> members)
    7076  {
    7177    this.members = members;
  • branches/filedb/src/core/net/sf/basedb/core/data/FileSetMemberData.java

    r3764 r3783  
    7272  /**
    7373    Get the file.
    74     @hibernate.many-to-one outer-join="false" update="false"
     74    @hibernate.many-to-one outer-join="false"
    7575    @hibernate.column name="`file_id`" not-null="true"
    7676  */
  • branches/filedb/src/core/net/sf/basedb/core/data/FileStoreEnabledData.java

    r3764 r3783  
    5858{
    5959  /**
    60     Get the file set attached to this item
     60    Get the file set attached to this item.
    6161    @return A {@link FileSetData} object or null if no files are attached
    6262    @hibernate.many-to-one column="`fileset_id`" not-null="false" outer-join="false"
     63      unique="true" cascade="delete"
    6364  */
    6465  public FileSetData getFileSet();
  • branches/filedb/src/core/net/sf/basedb/core/data/PlatformData.java

    r3764 r3783  
    2424package net.sf.basedb.core.data;
    2525
     26import java.util.HashMap;
     27import java.util.Map;
    2628import java.util.Set;
    2729
     
    141143  }
    142144
    143   private Set<PlatformFileTypeData> fileTypes;
     145  private Map<FileTypeIndex, PlatformFileTypeData> fileTypes;
    144146  /**
    145147    The file types that can be used on this platform. This is
    146148    the inverse end.
    147149    @see PlatformFileTypeData#getPlatform()
    148     @hibernate.set lazy="true" cascade="delete" inverse="true"
     150    @hibernate.map lazy="true" cascade="delete" inverse="true"
    149151    @hibernate.collection-key column="`platform_id`"
     152    @hibernate.collection-composite-index class="net.sf.basedb.core.data.FileTypeIndex"
    150153    @hibernate.collection-one-to-many class="net.sf.basedb.core.data.PlatformFileTypeData"
    151154  */
    152   Set<PlatformFileTypeData> getFileTypes()
     155  public Map<FileTypeIndex, PlatformFileTypeData> getFileTypes()
    153156  {
     157    if (fileTypes == null)
     158    {
     159      fileTypes = new HashMap<FileTypeIndex, PlatformFileTypeData>();
     160    }
    154161    return fileTypes;
    155162  }
    156   void setFileTypes(Set<PlatformFileTypeData> fileTypes)
     163  void setFileTypes(Map<FileTypeIndex, PlatformFileTypeData> fileTypes)
    157164  {
    158165    this.fileTypes = fileTypes;
  • branches/filedb/src/core/net/sf/basedb/core/data/PlatformFileTypeData.java

    r3764 r3783  
    3232  @see net.sf.basedb.core.PlatformFileType
    3333  @base.modified $Date$
    34   @hibernate.class table="`PlatformsFileTypes`" lazy="true"
     34  @hibernate.class table="`PlatformFileTypes`" lazy="true"
    3535*/
    3636public class PlatformFileTypeData
  • branches/filedb/src/core/net/sf/basedb/core/data/PlatformVariantData.java

    r3764 r3783  
    3333  @see net.sf.basedb.core.PlatformVariant
    3434  @base.modified $Date$
    35   @hibernate.class table="`PlatformsVariants`" lazy="false"
     35  @hibernate.class table="`PlatformVariants`" lazy="false"
    3636*/
    3737public class PlatformVariantData
     
    115115    The raw data type this platform variant is locked to, or null.
    116116    Only used if fileOnly=false
    117     @hibernate.property column="`rawdatatype`" type="string" length="255" not-null="true"
     117    @hibernate.property column="`rawdatatype`" type="string" length="255" not-null="false"
    118118  */
    119119  public String getRawDataType()
  • branches/filedb/src/core/net/sf/basedb/core/data/RawBioAssayData.java

    r3764 r3783  
    8181  private PlatformData platform;
    8282  /**
    83     Get the platform this raw bioassay uses
     83    Get the platform this raw bioassay uses.
    8484    @since 2.5
    8585    @hibernate.many-to-one outer-join="false" update="false"
  • branches/filedb/src/core/net/sf/basedb/util/JarClassLoader.java

    r3679 r3783  
    121121    }
    122122    return cl;
     123  }
     124 
     125 
     126  /**
     127    Get a new class loader for the specified jar file. 
     128      @param jarPath The path to the jar file
     129      @return A class loader object
     130      @throws IOException If the jar file can't be loaded
     131  */
     132  public static final ClassLoader newInstance(String jarPath)
     133    throws IOException
     134  {
     135    return new JarClassLoader(jarPath);
    123136  }
    124137 
  • branches/filedb/src/core/net/sf/basedb/util/PluginInfo.java

    r3733 r3783  
    139139      Element rootElement = XMLUtil.getValidatedXML(is , installDtdURL, null).getRootElement();
    140140      String jarname = rootElement.getAttributeValue("jarname");
    141       JarReader jarReader = JarReader.getNewInstance(jar);
     141      ClassLoader jarLoader = JarClassLoader.newInstance(jarFile.getPath());
    142142      if (!jarname.equalsIgnoreCase(jarFile.getName()))
    143143      {
     
    156156        boolean hasConfigs = (configElement != null) && configElement.equals(hasConfigsValue);
    157157               
    158         Class c = jarReader.loadClass(classname);       
     158        Class c = jarLoader.loadClass(classname);       
    159159        if (versionCompatible(baseVersion) && Plugin.class.isAssignableFrom(c))
    160160        {     
     
    272272    return majorCompatible && minorCompatible;
    273273  }
    274    
    275   /**
    276     A private class to get information about plugin classes
    277     inside a jar file.
    278       @author Martin
    279       @version 2.5
    280    */
    281   private static class JarReader
    282     extends ClassLoader
    283   {
    284     /**
    285       The jar file for this reader.
    286      */
    287     private JarFile jar;
    288      
    289     /**
    290         @param jar The jar file that should be read
    291      */
    292     private JarReader(JarFile jar)
    293     {
    294       super(Thread.currentThread().getContextClassLoader());
    295       this.jar = jar;     
    296     }
    297    
    298     private static JarReader getNewInstance (JarFile jarFile)
    299     {
    300       return new JarReader(jarFile);
    301     }
    302    
    303     /*
    304       (non-Javadoc)
    305         @see java.lang.ClassLoader#findClass(java.lang.String)
    306     */
    307     protected Class<?> findClass(String name)
    308       throws ClassNotFoundException
    309     {
    310       byte[] b;
    311       try
    312       {
    313         InputStream in = null;
    314         JarEntry jarEntry = jar.getJarEntry(classNameToPath(name));
    315         if (jarEntry == null)
    316         {
    317           throw new ClassNotFoundException(name+" in file "+jar.getName());
    318         }
    319         in = jar.getInputStream(jarEntry);
    320         b = new byte[(int)jarEntry.getSize()];
    321         in.read(b, 0, b.length);       
    322       }     
    323       catch(IOException ex)
    324       {
    325         throw new ClassNotFoundException(name, ex);
    326       }     
    327       return defineClass(name, b, 0, b.length);
    328     }
    329    
    330     /**
    331       Convert a class name to a file path. Ie. replace dots with slahses and add .class
    332       to the end: net.sf.basedb.util.JarClassLoader -> net/sf/basedb/util/JarClassLoader.class
    333     */
    334     private String classNameToPath(String className)
    335     {
    336       return className.replaceAll("\\.", "/")+".class";
    337     }
    338   }
    339274}
  • branches/filedb/src/examples/plugins/build.xml

    r2155 r3783  
    3535         manifest="MANIFEST.MF"
    3636         >
     37    <metainf file="./base-plugins.xml"></metainf>
     38        <metainf file="./base-configurations.xml"></metainf>
    3739      </jar>
    3840    </target>
  • branches/filedb/src/plugins/core/net/sf/basedb/plugins/Base1PluginExecuter.java

    r3725 r3783  
    4444import net.sf.basedb.core.Include;
    4545import net.sf.basedb.core.IntegerParameterType;
    46 import net.sf.basedb.core.InvalidDataException;
    4746import net.sf.basedb.core.Item;
    4847import net.sf.basedb.core.ItemNotFoundException;
     
    5655import net.sf.basedb.core.PositionBatcher;
    5756import net.sf.basedb.core.ProgressReporter;
     57import net.sf.basedb.core.Reporter;
    5858import net.sf.basedb.core.RequestInformation;
    5959import net.sf.basedb.core.SpotBatcher;
     
    6363import net.sf.basedb.core.Type;
    6464import net.sf.basedb.core.User;
     65import net.sf.basedb.core.data.ReporterData;
    6566import net.sf.basedb.core.plugin.About;
    6667import net.sf.basedb.core.plugin.AboutImpl;
     
    109110import java.util.Set;
    110111import java.util.TreeMap;
    111 import java.util.regex.Matcher;
    112112import java.util.regex.Pattern;
    113113
     
    138138 
    139139  /**
    140     The plug-ing permissions.
     140    The plug-in permissions.
    141141  */
    142142  private static final Set<Permissions> permissions = new HashSet<Permissions>();
     
    207207 
    208208  /**
    209     The reporter fields that should be exported as a tab separeated string
     209    The reporter fields that should be exported as a tab separated string
    210210    of column headers.
    211211  */
     
    214214  /**
    215215    The spot fields that should be exported as a tab separated string of
    216     column headres.
     216    column headers.
    217217  */
    218218  private PluginParameter<String> usedFieldsParameter;
     
    265265  private int pluginDirectoryId = -1;
    266266
    267   /* From InteractivePlugin iterface*/
     267  /* From InteractivePlugin interface*/
    268268
    269269  /**
     
    273273    @param context The context from where the plugin is invoked.
    274274    @param item The item that should be checked if it is in context.
    275     @return null if the the item is in context, otherwise an error messge.
     275    @return null if the the item is in context, otherwise an error message.
    276276    @see net.sf.basedb.core.plugin.AbstractAnalysisPlugin#isInContext(net.sf.basedb.core.plugin.GuiContext, java.lang.Object)
    277277  */
     
    407407        storeValue(configuration, request, usedFieldsParameter);
    408408        storeValue(configuration, request, jobParametersParameter);
    409         // test the xml in the jobParameters parameres
     409        // test the xml in the jobParameters parameters
    410410        try
    411411        {
     
    448448 
    449449  /**
    450     Copies the content from a File to a directory on the filesystem.
     450    Copies the content from a File to a directory on the file system.
    451451   
    452452    @param f The file to be copied.
     
    483483        // Load existing...
    484484        jobDirectory = Directory.getByPath(dc, path);
    485         // ...and remove files and subdirectories in it
     485        // ...and remove files and sub directories in it
    486486        emptyDir(dc, path);
    487487      }
     
    503503 
    504504  /**
    505     Deletes all files and subdirectories under dir.
     505    Deletes all files and sub directories under dir.
    506506   
    507507    @param dir
    508     @return Returnes true if all deletions were succssful
     508    @return true if all deletions were successful
    509509  */
    510510  private boolean deleteDir(java.io.File dir)
     
    527527 
    528528  /**
    529     Deletes all files and subdirectories under dir. The directory given
     529    Deletes all files and sub directories under dir. The directory given
    530530    itself is not deleted.
    531531   
    532532    @param dc
    533533    @param dir
    534     @return Returnes true if all deletions were succssful
     534    @return true if all deletions were successful
    535535  */
    536536  private boolean emptyDir(DbControl dc, Path dir)
     
    567567      permissions.add(new Permissions(Item.PLUGINCONFIGURATION, EnumSet.of(Permission.WRITE), null));
    568568      permissions.add(new Permissions(Item.RAWBIOASSAY, null, EnumSet.of(Permission.READ)));
    569       permissions.add(new Permissions(Item.EXTRAVALUETYPE, null, EnumSet.of(Permission.READ)));
     569      permissions.add(new Permissions(Item.REPORTER, null, EnumSet.of(Permission.READ)));
     570      permissions.add(new Permissions(Item.EXTRAVALUETYPE, null, EnumSet.of(Permission.CREATE, Permission.USE)));
    570571      permissions.add(new Permissions(Item.USER, null, EnumSet.of(Permission.READ)));
    571572      permissions.add(new Permissions(Item.JOB, null, EnumSet.of(Permission.READ)));
     
    605606    {
    606607      DbControl dc = null;
     608      File stdin = null;
     609      File stdout = null;
     610      Transformation trans = null;
    607611      try
    608612      {
     
    611615        getConfigureJobParameters();
    612616 
    613         Transformation trans = null;
    614         File stdin = null;
    615617       
    616618        //Export
     
    653655          int exitValue = p.waitFor();
    654656
     657          progress.display(50, "Reading from error stream.");
    655658          for(int i = 0; errorStream.isAlive(); ++i)
    656659          {
     
    681684        {
    682685          //Copy files
    683           dc.deleteItem(stdin);
     686          progress.display(60, "Copying files to server.");
    684687          importFiles(dc, trans);
    685688          if (!deleteDir(getExecDirectory()))
     
    687690            response.setError("Could not remove execution directory: "+getExecDirectory().getAbsolutePath(), null);
    688691          }
    689         }
    690              
     692          stdout = File.getFile(dc, getPluginDirectory(dc), "stdout.txt", true);
     693        }
     694       
    691695        //Import data
    692696        try
    693697        {
    694698          progress.display(70, "Importing data from plugin.");
    695           importData(dc, trans);
     699          importData(dc, stdout, trans);
    696700          response.setDone(msg);
    697701        }
     
    700704          response.setError(ex.getMessage(), Arrays.asList(ex));
    701705          return;
     706        }
     707      }
     708      finally
     709      {
     710        if (dc != null)
     711        {
     712          dc.commit();
     713          dc.close();
     714        }
     715      }
     716     
     717      //Clean up
     718      try
     719      {
     720        dc = sc.newDbControl();
     721        if (!Values.getBoolean(String.valueOf(configuration.getValue(leaveStdinParameter.getName()))))
     722        {
     723          if (stdin != null)
     724          {
     725            stdin = File.getById(dc, stdin.getId());
     726            if (trans != null)
     727            {
     728              trans = Transformation.getById(dc, trans.getId());
     729              AnyToAny ata = AnyToAny.getByName(dc, trans, stdin.getPath().toString());
     730              dc.deleteItem(ata);
     731            }
     732            dc.deleteItem(stdin);
     733          }
     734        }
     735        if (!Values.getBoolean(String.valueOf(configuration.getValue(leaveStdoutParameter.getName()))))
     736        {
     737          if (stdout != null)
     738          {
     739            stdout = File.getById(dc, stdout.getId());
     740            if (trans != null)
     741            {
     742              trans = Transformation.getById(dc, trans.getId());
     743              AnyToAny ata = AnyToAny.getByName(dc, trans, stdout.getPath().toString());
     744              dc.deleteItem(ata);
     745            }
     746            dc.deleteItem(stdout);
     747          }
    702748        }
    703749      }
     
    801847    Map<String, String> names = new HashMap<String, String>();
    802848   
    803     names.put("reporter", "rep.id");
    804     names.put("reporterId", "rep.externalId");
    805    
    806849    ItemQuery<Formula> queryFormula = Formula.getQuery(Formula.Type.COLUMN_EXPRESSION,
    807850      bas.getRawDataType());
     
    812855      names.put(f.getName(), "frm."+f.getId());
    813856    }
     857   
     858    names.put("lastUpdate", "rep.lastUpdate");
     859    names.put("geneName", "rep.name");
     860    names.put("position", "rep.position");
     861    names.put("reporter", "rep.id");
     862    names.put("reporterId", "rep.externalId");
     863    names.put("geneSymbol", "rep.symbol");
     864   
     865    names.put("rawPosition", "raw.position");
     866    names.put("block", "raw.block");
     867    names.put("numCol", "raw.col");
     868    names.put("numRow", "raw.row");
     869    names.put("x", "raw.x");
     870    names.put("y", "raw.y");
    814871   
    815872    for (ExtraValue ev : bas.getExtraValues().list(dc))
     
    11191176 
    11201177  /**
    1121     Get the exec directory as a java.io.File. The exec directory is a sudirectory in
     1178    Get the exec directory as a java.io.File. The exec directory is a sub directory in
    11221179    "java.io.tmpdir".
    11231180   
     
    12451302   
    12461303    @return The id of the transformation the data is connected to.
    1247     @throws IOException if there is any error reading from stdou.txt
    1248   */
    1249   private int importData(DbControl dc, Transformation t)
     1304    @throws IOException if there is any error reading from stdout.txt
     1305  */
     1306  private int importData(DbControl dc, File stdout, Transformation t)
    12501307    throws IOException
    12511308  {
    12521309    BioAssaySet bas = null;
    12531310    SpotBatcher spotBatcher = null;
    1254     PositionBatcher posBatcher = null;
    12551311
    12561312    HashMap<String, BioAssay> idMap = new HashMap<String, BioAssay>();
    1257     HashMap<Integer, Integer> posMap = new HashMap<Integer, Integer>();
     1313    HashMap<Integer, ReporterData> posRepMap = new HashMap<Integer, ReporterData>();
    12581314    HashMap<String, ExtraValueType> evtMap = new HashMap<String, ExtraValueType>();
    12591315
    1260     File stdout = File.getFile(dc, getPluginDirectory(dc), "stdout.txt", true);
    12611316    FlatFileParser ffp = getInitializedFlatFileParser(stdout.getDownloadStream(0));
    12621317   
     
    13251380        }
    13261381        spotBatcher = bas.getSpotBatcher();
    1327 //        posBatcher = bas.getPositionBatcher();
    13281382
    13291383        for (String assayId : assays)
     
    14531507              spotBatcher.insert(ba.getDataCubeColumnNo(), position, intensities);
    14541508             
    1455 //              if (posMap.containsKey(position))
    1456 //              {
    1457 //                if (!posMap.get(position).equals(reporter))
    1458 //                  throw new BaseException("Invalid data. Position, "+position+", occures twice with different reporter data.");
    1459 //               
    1460 //              }
    1461 //              else
    1462 //              {
    1463 //                posMap.put(position, reporter);
    1464 //                posBatcher.insert(position, Reporter.getById(dc, reporter));
    1465 //              }
     1509              if (posRepMap.containsKey(position))
     1510              {
     1511                if (!reporter.equals(posRepMap.get(position).getId()))
     1512                  throw new BaseException("Invalid data. Position, "+position+", occurs twice with different reporter data.");
     1513              }
     1514              else
     1515              {
     1516                posRepMap.put(position, Reporter.getById(dc, reporter));
     1517              }
     1518             
    14661519              for (int i = 0; i < evBatcher.size(); i++)
    14671520              {
     
    14821535      }
    14831536    }
     1537
     1538    //Batch reporters
     1539    if (bas != null)
     1540    {
     1541      PositionBatcher posBatcher = bas.getPositionBatcher();
     1542      for (Integer position : posRepMap.keySet())
     1543      {
     1544        posBatcher.insert(position, posRepMap.get(position));
     1545      }
     1546    }
     1547   
    14841548    // save bas
    14851549    if (bas != null)
     
    15621626 
    15631627  /**
    1564     This thread read everything from one input streat ant writes everything to an output stream.
     1628    This thread read everything from one input stream ant writes everything to an output stream.
    15651629   
    15661630    @author Johan Enell
     
    15801644
    15811645    /**
    1582       Creates a steam handler connected to the specifiv streams.
     1646      Creates a steam handler connected to the specific streams.
    15831647     
    15841648      @param is The stream to read from.
  • branches/filedb/src/plugins/core/net/sf/basedb/plugins/BioAssaySetExporter.java

    r3705 r3783  
    858858      ExtraValueType evt = ev.getExtraValueType();
    859859      items.add(new QueryItem("xtra."+evt.getExternalId(), "[Extra] "+evt.getName(),
    860         evt.getName(), "xtra('" + evt.getExternalId() + "')", evt.getAverageMethod()));
     860        "_xc_"+evt.getName(), "xtra('" + evt.getExternalId() + "')", evt.getAverageMethod()));
    861861    }
    862862    Collections.sort(items, new QueryItemTitleComparator());
     
    895895  {
    896896    List<QueryItem> items = new ArrayList<QueryItem>();
    897     items.add(new QueryItem("raw.position", "[Raw] Position", "position", "raw('position')", Formula.AverageMethod.NONE));
     897    items.add(new QueryItem("raw.position", "[Raw] Position", "rawPosition", "raw('position')", Formula.AverageMethod.NONE));
    898898    items.add(new QueryItem("raw.block", "[Raw] Array block", "block", "raw('block')", Formula.AverageMethod.NONE));
    899899    items.add(new QueryItem("raw.metaGridX", "[Raw] Meta grid X", "metaGridX", "raw('metaGridX')", Formula.AverageMethod.NONE));
     
    918918    items.add(new QueryItem("rep.position", "Position", "position", "pos()", Formula.AverageMethod.NONE));
    919919    items.add(new QueryItem("rep.name", "Reporter Name", "name", "rep('name')", Formula.AverageMethod.MAX));
    920     items.add(new QueryItem("rep.externalId", "Reporter ID", "externalId", "rep('externalId')", Formula.AverageMethod.MAX));
     920    items.add(new QueryItem("rep.externalId", "Reporter ID", "reporterId", "rep('externalId')", Formula.AverageMethod.MAX));
    921921    items.add(new QueryItem("rep.symbol", "Gene symbol", "symbol", "rep('symbol')", Formula.AverageMethod.MAX));
    922922    items.add(new QueryItem("rep.description", "Description", "description", "rep('description')", Formula.AverageMethod.MAX));
  • branches/filedb/src/plugins/core/net/sf/basedb/plugins/FormulaFilter.java

    r3679 r3783  
    123123  }
    124124  /**
    125     Request use access to Experiment:s and read access to Job:s.
     125    Request use access to Experiment:s and read access to Job:s and ReporterLists.
    126126  */
    127127  public Collection<Permissions> getPermissions()
     
    131131      permissions.add(new Permissions(Item.EXPERIMENT, null, EnumSet.of(Permission.USE)));
    132132      permissions.add(new Permissions(Item.JOB, null, EnumSet.of(Permission.READ)));
     133      permissions.add(new Permissions(Item.REPORTERLIST, null, EnumSet.of(Permission.READ)));
    133134    }
    134135    return permissions;
  • branches/filedb/src/test/TestAnalyzePluginUtil.java

    r3679 r3783  
    3131import net.sf.basedb.core.Item;
    3232import net.sf.basedb.core.Permission;
     33import net.sf.basedb.core.Platform;
    3334import net.sf.basedb.core.RawBioAssay;
    3435import net.sf.basedb.core.RawDataBatcher;
     
    5960      for (int i = 0; i < rawBioAssays; i++)
    6061      {
    61         int rawBioAssayId = TestRawBioAssay.test_create("genepix", 0, 0, 0, 0, false);
     62        int rawBioAssayId = TestRawBioAssay.test_create(Platform.GENERIC, "genepix", 0, 0, 0, 0, false);
    6263       
    6364        FlatFileParser parser = new FlatFileParser();
  • branches/filedb/src/test/TestAnnotation.java

    r3679 r3783  
    5959    int booleanId = TestAnnotationType.test_create(null, Type.BOOLEAN, true, null, Item.ARRAYDESIGN, 1, null, true);
    6060    int enumId = TestAnnotationType.test_create(null, Type.INT, 3, null, Item.ARRAYDESIGN, 1, new Object[] { 1, 2, 3, 4, 5 }, false);
    61     int arrayDesignId = TestArrayDesign.test_create(true, false);
     61    int arrayDesignId = TestArrayDesign.test_create(Platform.GENERIC, true);
    6262
    6363    // Annotate the array design and list the annotations
     
    7474
    7575    // Test: inherit annotations
    76     int rawBioAssayId = TestRawBioAssay.test_create("genepix", 0, 0, 0, arrayDesignId, false);
     76    int rawBioAssayId = TestRawBioAssay.test_create(Platform.GENERIC, "genepix", 0, 0, 0, arrayDesignId, false);
    7777    test_inherit_annotation(rawBioAssayId, intAnnotationId);
    7878    test_inherit_annotation(rawBioAssayId, stringAnnotationId);
  • branches/filedb/src/test/TestArrayBatch.java

    r3679 r3783  
    3434import net.sf.basedb.core.ItemQuery;
    3535import net.sf.basedb.core.ItemResultList;
     36import net.sf.basedb.core.Platform;
    3637
    3738public class TestArrayBatch
     
    5253    write_header();
    5354    // Standard tests: create, load, list
    54     int arraydesign_id = TestArrayDesign.test_create(false, false);
     55    int arraydesign_id = TestArrayDesign.test_create(Platform.GENERIC, false);
    5556    int id = test_create(arraydesign_id, true);
    5657    int id2 = test_create(arraydesign_id, false);
  • branches/filedb/src/test/TestArrayDesign.java

    r3679 r3783  
    3131import net.sf.basedb.core.Feature;
    3232import net.sf.basedb.core.FeatureBatcher;
     33import net.sf.basedb.core.File;
     34import net.sf.basedb.core.FileSetMember;
     35import net.sf.basedb.core.FileSetMemberType;
    3336import net.sf.basedb.core.Item;
    3437import net.sf.basedb.core.Permission;
     
    3639import net.sf.basedb.core.DataResultIterator;
    3740import net.sf.basedb.core.Plate;
     41import net.sf.basedb.core.Platform;
    3842import net.sf.basedb.core.Reporter;
    3943import net.sf.basedb.core.ReporterBatcher;
    4044import net.sf.basedb.core.ItemResultList;
     45import net.sf.basedb.core.SystemItems;
    4146import net.sf.basedb.core.Well;
    4247import net.sf.basedb.core.data.FeatureData;
     
    6671    write_header();
    6772    // Standard tests: create, load, list
    68     int id = test_create(true, false);
    69     int id2 = test_create(false, false);
    70     int id3 = test_create(true, true);
    71     int id4 = test_create(false, true);
     73    int id = test_create(Platform.GENERIC, true);
     74    int id2 = test_create(Platform.GENERIC, false);
     75    int id3 = test_create(Platform.AFFYMETRIX, true);
     76    int id4 = test_create(Platform.AFFYMETRIX, false);
    7277    test_load(id);
    7378    test_list(-1);
     
    9095    int[] plateIds = TestPlate.test_import_from_file("data/test.plate96.import.txt",
    9196      "Plate\\tRow\\tColumn\\tCluster ID\\tClone ID\\tGene Symbol\\tBarcode", plateType, 0, 1, 2, 4);
    92     int id5 = test_create(false, false);
     97    int id5 = test_create(Platform.GENERIC, false);
    9398    test_add_plates(id5, plateIds);
    9499   
     
    98103    test_add_features_from_wells(id5, plateIds, 10);
    99104   
     105    // Array designs with data in files
     106    int cdfId = TestFile.test_create("data/test.affymetrix.cdf", false, false);
     107    test_set_file(id3, "affymetrix.cdf", cdfId);
     108    test_list_files(id3, 1);
     109
    100110    if (TestUtil.waitBeforeDelete()) TestUtil.waitForEnter();
    101111    // Standard test: Delete
     
    116126  }
    117127
    118   static int test_create(boolean setAll, boolean affyChip)
     128  static int test_create(String platformId, boolean setAll)
    119129  {
    120130    if (!TestUtil.hasPermission(Permission.CREATE, Item.ARRAYDESIGN)) return 0;
     
    124134    {
    125135      dc = TestUtil.getDbControl();
    126       ArrayDesign ad = ArrayDesign.getNew(dc, affyChip);
     136      Platform platform = Platform.getById(dc, SystemItems.getId(platformId));
     137      ArrayDesign ad = ArrayDesign.getNew(dc, platform);
    127138      if (setAll)
    128139      {
     
    133144      dc.commit();
    134145      id = ad.getId();
     146      dc = TestUtil.getDbControl();
     147      dc.reattachItem(ad);
    135148      write_item(0, ad);
    136149      write("--Create array design OK");
     
    260273    if (!TestUtil.getSilent())
    261274    {
    262       write(i+":\t"+ad.getId()+"\t"+ad.getName()+"\t"+ad.getDescription()+"\t"+ad.isAnnotated()+"\t"+ad.isAffyChip());
     275      write(i+":\t"+ad.getId()+"\t"+ad.getName()+"\t"+ad.getDescription()+"\t"+ad.isAnnotated()+"\t"+ad.getPlatform());
    263276    }
    264277  }
     
    282295  }
    283296
     297  static void write_item(int i, FileSetMember member)
     298    throws BaseException
     299  {
     300    if (!TestUtil.getSilent())
     301    {
     302      System.out.println(i+":\t"+member.getId()+"\t"+member.getFile().getName()+"\t"+
     303        member.getMemberType().getName());
     304    }
     305  }
     306 
    284307  static void write(String message)
    285308  {
     
    363386      dc = TestUtil.getDbControl();
    364387      ArrayDesign ad = ArrayDesign.getById(dc, arrayDesignId);
    365       if (ad.isAffyChip())
     388      if (Platform.AFFYMETRIX.equals(ad.getPlatform().getSystemId()))
    366389      {
    367390        throw new BaseException("Cannot add features from wells on an affy arraydesign");
     
    434457      }
    435458      dc.commit();
    436       write_item(0, ad);
    437459      write("--Add plates to array design OK");
    438460    }
     
    574596  }
    575597
     598  static void test_set_file(int arrayDesignId, String fileType, int fileId)
     599  {
     600    if (arrayDesignId == 0 || fileId == 0) return;
     601    DbControl dc = null;
     602    try
     603    {
     604      dc = TestUtil.getDbControl();
     605      ArrayDesign ad = ArrayDesign.getById(dc, arrayDesignId);
     606      FileSetMemberType type = FileSetMemberType.getById(dc, SystemItems.getId(fileType));
     607      File file = File.getById(dc, fileId);
     608      ad.getFileSet().setMember(file, type);
     609      dc.commit();
     610      write("--Set file OK ("+fileType+")");
     611    }
     612    catch (Throwable ex)
     613    {
     614      write("--Set file FAILED ("+fileType+")");
     615      ex.printStackTrace();
     616      ok = false;
     617    }
     618    finally
     619    {
     620      if (dc != null) dc.close();
     621    }
     622  }
     623   
     624  static void test_list_files(int arrayDesignId, int expectedResults)
     625  {
     626    if (arrayDesignId == 0) return;
     627    DbControl dc = null;
     628    try
     629    {
     630      dc = TestUtil.getDbControl();
     631      ArrayDesign ad = ArrayDesign.getById(dc, arrayDesignId);
     632      ItemResultList<FileSetMember> l = ad.getFileSet().getMembers().list(dc);
     633      for (int i = 0; i<l.size(); i++)
     634      {
     635        write_item(i, l.get(i));
     636      }
     637      if (expectedResults >= 0 && expectedResults != l.size())
     638      {
     639        throw new BaseException("Expected "+expectedResults+" results, not "+l.size());
     640      }
     641      write("--List files OK ("+l.size()+")");
     642    }
     643    catch (Throwable ex)
     644    {
     645      write("--List files FAILED");
     646      ex.printStackTrace();
     647      ok = false;
     648    }
     649    finally
     650    {
     651      if (dc != null) dc.close();
     652    }
     653  }
    576654}
    577655
  • branches/filedb/src/test/TestArrayDesignBlock.java

    r3679 r3783  
    3030import net.sf.basedb.core.DbControl;
    3131import net.sf.basedb.core.ItemResultList;
     32import net.sf.basedb.core.Platform;
    3233
    3334 
     
    5556    write("++Testing array design block");
    5657    write_header();
    57     int arrayDesignId = TestArrayDesign.test_create(false, false);
     58    int arrayDesignId = TestArrayDesign.test_create(Platform.GENERIC, false);
    5859    // Standard tests: create, load, list
    5960    int nbr = 10;
  • branches/filedb/src/test/TestArraySlide.java

    r3679 r3783  
    99import net.sf.basedb.core.ItemQuery;
    1010import net.sf.basedb.core.ItemResultList;
     11import net.sf.basedb.core.Platform;
    1112
    1213/*
     
    5051    write_header();
    5152    // Standard tests: create, load, list
    52     int arraydesign_id = TestArrayDesign.test_create(true, false);
     53    int arraydesign_id = TestArrayDesign.test_create(Platform.GENERIC, true);
    5354    int arraybatch_id = TestArrayBatch.test_create(arraydesign_id, false);
    5455    int id = test_create(arraybatch_id, true);
  • branches/filedb/src/test/TestDirty.java

    r3719 r3783  
    7373   
    7474    // Test import raw data
    75     int arrayDesignId = TestArrayDesign.test_create(false, false);
     75    int arrayDesignId = TestArrayDesign.test_create(Platform.GENERIC, false);
    7676    TestArrayDesign.test_import_from_file(arrayDesignId, "data/test.import.dirty.txt",
    7777        "\"Block\"\\t\"Column\"\\t\"Row\"\\t\"Name\"\\t\"ID\".*", 0, 2, 1, 4);
    7878   
    79     int rawBioAssayId = TestRawBioAssay.test_create("genepix", 0, 0, 0, arrayDesignId, false);
     79    int rawBioAssayId = TestRawBioAssay.test_create(Platform.GENERIC, "genepix", 0, 0, 0, arrayDesignId, false);
    8080    int fileId = TestFile.test_create("data/test.import.dirty.txt", false, false);
    8181   
  • branches/filedb/src/test/TestExperiment.java

    r3679 r3783  
    7878      "\"Block\"\\t\"Column\"\\t\"Row\"\\t\"Name\"\\t\"ID\".*", "\\t", 4, 3);
    7979   
    80     int arrayDesignId = TestArrayDesign.test_create(false, false);
     80    int arrayDesignId = TestArrayDesign.test_create(Platform.GENERIC, false);
    8181    TestArrayDesign.test_import_from_file(arrayDesignId, "data/test.rawdata.import.txt",
    8282      "\"Block\"\\t\"Column\"\\t\"Row\"\\t\"Name\"\\t\"ID\".*", 0, 2, 1, 4);
    8383   
    84     int rbaId1 = TestRawBioAssay.test_create("genepix", 0, 0, 0, arrayDesignId, false);
    85     int rbaId2 = TestRawBioAssay.test_create("genepix", 0, 0, 0, arrayDesignId, false);
     84    int rbaId1 = TestRawBioAssay.test_create(Platform.GENERIC, "genepix", 0, 0, 0, arrayDesignId, false);
     85    int rbaId2 = TestRawBioAssay.test_create(Platform.GENERIC, "genepix", 0, 0, 0, arrayDesignId, false);
    8686    TestRawBioAssay.test_import_from_file(rbaId1, "data/test.rawdata.import.txt");
    8787    TestRawBioAssay.test_import_from_file(rbaId2, "data/test.rawdata.import.txt");
  • branches/filedb/src/test/TestExternalPluginInstaller.java

    r3704 r3783  
    5555 
    5656  /**
    57     Test to find jar-files in directory specified in plugin.dir
     57    Test to find jar-files in directory specified in plugins.dir
    5858      @return List with files
    5959   */
     
    6363    if (pluginDir == null || !pluginDir.exists())
    6464    {
    65       write("--'plugin.dir' has not been set properbly in base.config");
     65      write("--'plugins.dir' has not been set properbly in base.config");
    6666      ok = false;
    6767      return null;
  • branches/filedb/src/test/TestHybridization.java

    r3679 r3783  
    4848    test_load(id);
    4949
    50     int arrayDesignId = TestArrayDesign.test_create(false, false);
     50    int arrayDesignId = TestArrayDesign.test_create(Platform.GENERIC, false);
    5151    int arrayBatchId = TestArrayBatch.test_create(arrayDesignId, false);
    5252    int arraySlideId = TestArraySlide.test_create(arrayBatchId, false);
  • branches/filedb/src/test/TestPlatform.java

    r3764 r3783  
    2525import net.sf.basedb.core.BaseException;
    2626import net.sf.basedb.core.DbControl;
     27import net.sf.basedb.core.FileSetMemberType;
    2728import net.sf.basedb.core.Item;
    2829import net.sf.basedb.core.ItemResultList;
    2930import net.sf.basedb.core.Permission;
    3031import net.sf.basedb.core.Platform;
     32import net.sf.basedb.core.PlatformFileType;
     33import net.sf.basedb.core.PlatformVariant;
    3134import net.sf.basedb.core.RawDataTypes;
    3235import net.sf.basedb.core.SystemItems;
     
    5760    test_list();
    5861
     62    // Variants
     63    int idVariant1 = test_create_variant(id1, "Variant of db and file", "test.db.and.file.v1", null, 0, null);
     64    int idVariant2 = test_create_variant(id2, "Variant file-only", "test.file.only.v1", null, 0, null);
     65    int idVariant3 = test_create_variant(id3, "Locked to agilent", "test.locked.agilent", false, 0, "agilent");
     66    test_list_variants(id1, 1);
     67   
     68    // File types
     69    test_add_filetype(id2, 0, SystemItems.getId("affymetrix.cel"));
     70    test_add_filetype(id2, idVariant2, SystemItems.getId("affymetrix.cdf"));
     71    test_list_filetypes(id2, 0, 1);
     72   
    5973    // Standard test: Delete
    6074    if (TestUtil.waitBeforeDelete()) TestUtil.waitForEnter();
     75    test_delete_variant(idVariant1);
    6176    test_delete(id1);
    6277    test_delete(id2);
     
    192207  }
    193208 
     209  static void write_item(int i, PlatformVariant v)
     210    throws BaseException
     211  {
     212    if (!TestUtil.getSilent())
     213    {
     214      System.out.println(i+":\t"+v.getId()+"\t"+v.getName()+"\t"+
     215          v.getDescription() + "\t" + v.getSystemId() + "\t" + v.isFileOnly() + "\t" +
     216          v.getRawDataType() + "\t" + v.getPlatform());
     217    }
     218  }
     219 
    194220  static void write(String message)
    195221  {
    196222    System.out.println(message);
    197223  }
     224
     225  static int test_create_variant(int platformId, String name, String systemId, Boolean fileOnly, int channels, String rawDataType)
     226  {
     227    if (platformId == 0 || !TestUtil.hasPermission(Permission.CREATE, Item.PLATFORMVARIANT)) return 0;
     228    int id = 0;
     229    DbControl dc = null;
     230    try
     231    {
     232      dc = TestUtil.getDbControl();
     233     
     234      Platform p = Platform.getById(dc, platformId);
     235     
     236      PlatformVariant v = null;
     237      if (fileOnly == null)
     238      {
     239        v = PlatformVariant.getNew(dc, p, systemId);
     240      }
     241      else if (fileOnly == true)
     242      {
     243        v = PlatformVariant.getNew(dc, p, systemId, channels);
     244      }
     245      else
     246      {
     247        v = PlatformVariant.getNew(dc, p, systemId, RawDataTypes.getRawDataType(rawDataType));
     248      }
     249      v.setName(name);
     250      dc.saveItem(v);
     251      dc.commit();
     252      id = v.getId();
     253      dc = TestUtil.getDbControl();
     254      dc.reattachItem(v);
     255      write_item(0, v);
     256      write("--Create platform variant OK");
     257    }
     258    catch (Throwable ex)
     259    {
     260      write("--Create platform variant FAILED");
     261      ex.printStackTrace();
     262      ok = false;
     263    }
     264    finally
     265    {
     266      if (dc != null) dc.close();
     267    }
     268    return id;
     269  }
     270 
     271  static void test_list_variants(int platformId, int expectedResults)
     272  {
     273    if (platformId == 0) return;
     274    DbControl dc = null;
     275    try
     276    {
     277      dc = TestUtil.getDbControl();
     278      Platform p = Platform.getById(dc, platformId);
     279      ItemResultList<PlatformVariant> l = p.getVariants().list(dc);
     280      for (int i = 0; i<l.size(); i++)
     281      {
     282        write_item(i, l.get(i));
     283      }
     284      if (expectedResults >= 0 && expectedResults != l.size())
     285      {
     286        throw new BaseException("Expected "+expectedResults+" results, not "+l.size());
     287      }
     288      write("--List platform variants OK ("+l.size()+")");
     289    }
     290    catch (Throwable ex)
     291    {
     292      write("--List platform variants FAILED");
     293      ex.printStackTrace();
     294      ok = false;
     295    }
     296    finally
     297    {
     298      if (dc != null) dc.close();
     299    }
     300  }
     301
     302  static void test_delete_variant(int variantId)
     303  {
     304    if (variantId == 0) return;
     305    DbControl dc = null;
     306    try
     307    {
     308      dc = TestUtil.getDbControl();
     309      PlatformVariant v = PlatformVariant.getById(dc, variantId);
     310      dc.deleteItem(v);
     311      dc.commit();
     312      write("--Delete platform variant OK");
     313    }
     314    catch (Throwable ex)
     315    {
     316      write("--Delete platform variant FAILED");
     317      ex.printStackTrace();
     318      ok = false;
     319    }
     320    finally
     321    {
     322      if (dc != null) dc.close();
     323    }
     324  }
     325
     326  static void test_add_filetype(int platformId, int variantId, int fileTypeId)
     327  {
     328    if (platformId == 0 || fileTypeId == 0) return;
     329    DbControl dc = null;
     330    try
     331    {
     332      dc = TestUtil.getDbControl();
     333     
     334      Platform p = Platform.getById(dc, platformId);
     335      PlatformVariant v = variantId == 0 ? null : PlatformVariant.getById(dc, variantId);
     336      FileSetMemberType fileType = FileSetMemberType.getById(dc, fileTypeId);
     337     
     338      p.addFileType(fileType, v);
     339     
     340      dc.commit();
     341      write("--Add file type OK");
     342    }
     343    catch (Throwable ex)
     344    {
     345      write("--Add file type FAILED");
     346      ex.printStackTrace();
     347      ok = false;
     348    }
     349    finally
     350    {
     351      if (dc != null) dc.close();
     352    }
     353  }
     354 
     355  static void test_list_filetypes(int platformId, int variantId, int expectedResults)
     356  {
     357    if (platformId == 0) return;
     358    DbControl dc = null;
     359    try
     360    {
     361      dc = TestUtil.getDbControl();
     362      Platform p = Platform.getById(dc, platformId);
     363      PlatformVariant v = variantId == 0 ? null : PlatformVariant.getById(dc, variantId);
     364      ItemResultList<PlatformFileType> l = p.getFileTypes(v, false).list(dc);
     365      for (int i = 0; i<l.size(); i++)
     366      {
     367        write_item(i, l.get(i));
     368      }
     369      if (expectedResults >= 0 && expectedResults != l.size())
     370      {
     371        throw new BaseException("Expected "+expectedResults+" results, not "+l.size());
     372      }
     373      write("--List platform file types OK ("+l.size()+")");
     374    }
     375    catch (Throwable ex)
     376    {
     377      write("--List platform file types FAILED");
     378      ex.printStackTrace();
     379      ok = false;
     380    }
     381    finally
     382    {
     383      if (dc != null) dc.close();
     384    }
     385  }
     386
     387 
    198388}
  • branches/filedb/src/test/TestPrintMapFlatFileImporter.java

    r3719 r3783  
    99import net.sf.basedb.core.ParameterType;
    1010import net.sf.basedb.core.Permission;
     11import net.sf.basedb.core.Platform;
    1112import net.sf.basedb.core.PluginConfigurationRequest;
    1213import net.sf.basedb.core.PluginDefinition;
     
    6364   
    6465    // Create ArrayDesign needed for print map import
    65     int arrayDesignId = TestArrayDesign.test_create(false, false);
     66    int arrayDesignId = TestArrayDesign.test_create(Platform.GENERIC, false);
    6667    int plateGeometryId = TestPlateGeometry.test_create(16, 24, false);
    6768    int plateTypeId = TestPlateType.test_create(plateGeometryId, false);
  • branches/filedb/src/test/TestProject.java

    r3679 r3783  
    100100    {     
    101101      dc = TestUtil.getDbControl();     
    102       int adId = TestArrayDesign.test_create(false, false);     
     102      int adId = TestArrayDesign.test_create(Platform.GENERIC, false);     
    103103      ArrayDesign ad = ArrayDesign.getById(dc, adId);
    104104      Project p = Project.getById(dc, id);
  • branches/filedb/src/test/TestRawBioAssay.java

    r3679 r3783  
    5353    int hybridizationId = TestHybridization.test_create(0, false);
    5454    int scanId = TestScan.test_create(hybridizationId, 0, 0, false);
    55     int arrayDesignId = TestArrayDesign.test_create(false, false);
     55    int arrayDesignId = TestArrayDesign.test_create(Platform.GENERIC, false);
    5656    TestReporter.test_import_from_file("data/test.rawdata.import.txt",
    5757      "\"Block\"\\t\"Column\"\\t\"Row\"\\t\"Name\"\\t\"ID\".*", "\\t", 4, 3);
     
    6262   
    6363    // Standard tests: create, load, list
    64     int id = test_create("genepix", scanId, softwareId, protocolId, arrayDesignId, true);
    65     int id2 = test_create("genepix", 0, 0, 0, 0, false);
     64    int id = test_create(Platform.GENERIC, "genepix", scanId, softwareId, protocolId, arrayDesignId, true);
     65    int id2 = test_create(Platform.GENERIC, "genepix", 0, 0, 0, 0, false);   
     66    int id3 = test_create(Platform.AFFYMETRIX, null, 0, 0, 0, 0, false);
    6667   
    6768    test_load(id);
    6869   
    69     // Test adding raw data
    70    
     70    // Test adding raw data -- stored in database
    7171    test_add_rawdata(id2, 10);
    7272    test_import_from_file(id, "data/test.rawdata.import.txt");
    73    
    7473    test_load(id);
    75    
    7674    test_list(-1);
    7775    write_raw_data_header();
    7876    test_list_raw_data(id, 10, 5, 0, true);
    7977   
     78    // Test adding raw data -- stored in files
     79    int celId = TestFile.test_create("data/test.affymetrix.cel", false, false);
     80    test_set_file(id3, "affymetrix.cel", celId);
     81    test_list_files(id3, 1);
     82   
    8083    if (TestUtil.waitBeforeDelete()) TestUtil.waitForEnter();
    8184    test_delete_raw_data(id);
     
    8487    test_delete(id);
    8588    test_delete(id2);
    86 
     89    test_delete(id3);
     90
     91    TestFile.test_delete(celId);
    8792    TestScan.test_delete(scanId);
    8893    TestHybridization.test_delete(hybridizationId);
     
    95100  }
    96101
    97   static int test_create(String rawDataType, int scanId, int softwareId, int protocolId, int arrayDesignId, boolean setAll)
     102  static int test_create(String platformId, String rawDataType, int scanId, int softwareId, int protocolId, int arrayDesignId, boolean setAll)
    98103  {
    99104    if (!TestUtil.hasPermission(Permission.CREATE, Item.RAWBIOASSAY)) return 0;
     
    103108    {
    104109      dc = TestUtil.getDbControl();
    105       RawBioAssay rba = RawBioAssay.getNew(dc, RawDataTypes.getRawDataType(rawDataType));
     110      Platform platform = Platform.getById(dc, SystemItems.getId(platformId));
     111      RawBioAssay rba = RawBioAssay.getNew(dc, platform, RawDataTypes.getRawDataType(rawDataType));
    106112      if (setAll)
    107113      {
     
    268274    }
    269275  }
     276 
     277  static void write_item(int i, FileSetMember member)
     278    throws BaseException
     279  {
     280    if (!TestUtil.getSilent())
     281    {
     282      System.out.println(i+":\t"+member.getId()+"\t"+member.getFile().getName()+"\t"+
     283        member.getMemberType().getName());
     284    }
     285  }
     286   
    270287 
    271288  static void write(String message)
     
    500517  }
    501518
     519  static void test_set_file(int rawBioAssayId, String fileType, int fileId)
     520  {
     521    if (rawBioAssayId == 0 || fileId == 0) return;
     522    DbControl dc = null;
     523    try
     524    {
     525      dc = TestUtil.getDbControl();
     526      RawBioAssay rba = RawBioAssay.getById(dc, rawBioAssayId);
     527      FileSetMemberType type = FileSetMemberType.getById(dc, SystemItems.getId(fileType));
     528      File file = File.getById(dc, fileId);
     529      rba.getFileSet().setMember(file, type);
     530      dc.commit();
     531      write("--Set file OK ("+fileType+")");
     532    }
     533    catch (Throwable ex)
     534    {
     535      write("--Set file FAILED ("+fileType+")");
     536      ex.printStackTrace();
     537      ok = false;
     538    }
     539    finally
     540    {
     541      if (dc != null) dc.close();
     542    }
     543  }
     544 
     545  static void test_list_files(int rawBioAssayId, int expectedResults)
     546  {
     547    if (rawBioAssayId == 0) return;
     548    DbControl dc = null;
     549    try
     550    {
     551      dc = TestUtil.getDbControl();
     552      RawBioAssay rba = RawBioAssay.getById(dc, rawBioAssayId);
     553      ItemResultList<FileSetMember> l = rba.getFileSet().getMembers().list(dc);
     554      for (int i = 0; i<l.size(); i++)
     555      {
     556        write_item(i, l.get(i));
     557      }
     558      if (expectedResults >= 0 && expectedResults != l.size())
     559      {
     560        throw new BaseException("Expected "+expectedResults+" results, not "+l.size());
     561      }
     562      write("--List files OK ("+l.size()+")");
     563    }
     564    catch (Throwable ex)
     565    {
     566      write("--List files FAILED");
     567      ex.printStackTrace();
     568      ok = false;
     569    }
     570    finally
     571    {
     572      if (dc != null) dc.close();
     573    }
     574  }
    502575}
  • branches/filedb/src/test/TestRawDataFlatFileImporter.java

    r3719 r3783  
    4545    TestReporter.test_import_from_file("data/test.rawdata.import.txt", "\"Block\"\\t\"Column\"\\t\"Row\"\\t\"Name\"\\t\"ID\".*", "\\t", 4, 3);
    4646    int fileId = TestFile.test_create("data/test.rawdata.import.txt", false, false);
    47     int arrayDesignId = TestArrayDesign.test_create(false, false);
     47    int arrayDesignId = TestArrayDesign.test_create(Platform.GENERIC, false);
    4848    TestArrayDesign.test_import_from_file(arrayDesignId, "data/test.rawdata.import.txt", "\"Block\"\\t\"Column\"\\t\"Row\"\\t\"Name\"\\t\"ID\".*", 0, 2, 1, 4);
    49     int rawBioAssayId = TestRawBioAssay.test_create("genepix", 0, 0, 0, arrayDesignId, true);
     49    int rawBioAssayId = TestRawBioAssay.test_create(Platform.GENERIC, "genepix", 0, 0, 0, arrayDesignId, true);
    5050   
    5151    // Create plugin configuration and job
  • branches/filedb/src/test/TestReporterMapFlatFileImporter.java

    r3719 r3783  
    3232import net.sf.basedb.core.ParameterType;
    3333import net.sf.basedb.core.Permission;
     34import net.sf.basedb.core.Platform;
    3435import net.sf.basedb.core.PluginConfiguration;
    3536import net.sf.basedb.core.PluginDefinition;
     
    6162    // Create reporter type and upload file
    6263    int reporterTypeId = TestReporterType.test_create();
    63     int arrayDesignId = TestArrayDesign.test_create(false, false);
     64    int arrayDesignId = TestArrayDesign.test_create(Platform.GENERIC, false);
    6465    int fileId = TestFile.test_create("data/test.reportermap.import.txt", false, false);
    6566   
  • branches/filedb/src/test/TestSpotImages.java

    r3719 r3783  
    6161    write("++Testing spot images import");
    6262   
    63     int rawBioAssayId = TestRawBioAssay.test_create("genepix", 0, 0, 0, 0, false);
     63    int rawBioAssayId = TestRawBioAssay.test_create(Platform.GENERIC, "genepix", 0, 0, 0, 0, false);
    6464    TestReporter.test_import_from_file("data/test.rawdata.import.txt", "\"Block\"\\t\"Column\"\\t\"Row\"\\t\"Name\"\\t\"ID\".*", "\\t", 4, 3);
    6565    TestRawBioAssay.test_import_from_file(rawBioAssayId, "data/test.rawdata.import.txt");
  • branches/filedb/www/admin/jobagents/view_agent.jsp

    r3675 r3783  
    341341          {
    342342            PluginDefinition plugin = null;
     343            NameablePluginAdaptor nameableProxy = null;
    343344            boolean readPlugin = true;
    344345            try
    345346            {
    346347              plugin = settings.getPluginDefinition();
     348              nameableProxy = new NameablePluginAdaptor(plugin);
    347349            }
    348350            catch (PermissionDeniedException ex)
     
    354356            %>
    355357            <tbl:row>
    356               <tbl:cell column="plugin"><%=Base.getLinkedName(ID, new NameablePluginAdaptor(plugin), !readPlugin, true)%></tbl:cell>
     358              <tbl:cell column="plugin"><%=Base.getLinkedName(ID, nameableProxy, !readPlugin, true)%></tbl:cell>
    357359              <tbl:cell column="jarPath"><%=jarPath == null ? "<i>- internal -</i>" : HTML.encodeTags(jarPath)%></tbl:cell>
    358360              <tbl:cell column="trusted"><%=settings.isEffectivelyTrusted()%></tbl:cell>
  • branches/filedb/www/admin/pluginconfigurations/list_configurations.jsp

    r3679 r3783  
    429429              PluginConfiguration item = configurations.next();
    430430              PluginDefinition plugin = null;
     431              Nameable nameableProxy = null;
    431432              contexts.clear();
    432433              try
    433434              {
    434435                plugin = item.getPluginDefinition();
     436                nameableProxy = new NameablePluginAdaptor(plugin);
    435437                contexts.addAll(plugin.getGuiContexts());
    436438              }
     
    490492                <tbl:cell column="pluginType"><%=plugin == null ? "<i>- denied -</i>" : plugin.getMainType().toString()%></tbl:cell>
    491493                <tbl:cell column="contexts"><%=plugin == null ? "<i>- denied -</i>" : (contexts.isEmpty() ? "<i>- none -</i>" : Values.getString(contexts, ", ", true))%></tbl:cell>
    492                 <tbl:cell column="pluginDefinition"><%=mode.hasPropertyLink() ? Base.getLinkedName(ID, new NameablePluginAdaptor(plugin), plugin == null, mode.hasEditLink()): Base.getEncodedName(new NameablePluginAdaptor(plugin), plugin == null)%></a></tbl:cell>
     494                <tbl:cell column="pluginDefinition"><%=mode.hasPropertyLink() ? Base.getLinkedName(ID, nameableProxy, plugin == null, mode.hasEditLink()): Base.getEncodedName(nameableProxy, plugin == null)%></a></tbl:cell>
    493495                <tbl:cell column="owner"
    494496                  ><base:propertyvalue
  • branches/filedb/www/admin/pluginconfigurations/view_configuration.jsp

    r3679 r3783  
    9797  final Set<GuiContext> contexts = new TreeSet<GuiContext>(new ToStringComparator<GuiContext>(false));
    9898  PluginDefinition plugin = null;
     99  Nameable nameableProxy = null;
    99100  boolean readPlugin = true;
    100101  boolean configurable = false;
     
    102103  {
    103104    plugin = configuration.getPluginDefinition();
     105    nameableProxy = new NameablePluginAdaptor(plugin);
    104106    contexts.addAll(plugin.getGuiContexts());
    105107    configurable = plugin.isInteractive() && plugin.supportsConfigurations();
     
    265267        <td class="prompt">Plugin</td>
    266268        <td>
    267           <%=Base.getLinkedName(ID, new NameablePluginAdaptor(plugin), plugin == null, true)%>
     269          <%=Base.getLinkedName(ID, nameableProxy, plugin == null, true)%>
    268270        </td>
    269271      </tr>
  • branches/filedb/www/common/import/no_fileformat.jsp

    r3675 r3783  
    7171  "mainType", Operator.EQ, String.valueOf(Plugin.MainType.IMPORT.getValue()), Type.INT));
    7272pluginContext.setPropertyFilter(new PropertyFilter(
    73   "guiContexts.itemType", Operator.EQ, String.valueOf(itemType.getValue()), Type.INT));
     73  "$ctx.itemType", Operator.EQ, String.valueOf(itemType.getValue()), Type.INT));
    7474try
    7575{
  • branches/filedb/www/exception/exception.jsp

    r3725 r3783  
    204204    StackTraceElement[] st = ex.getStackTrace();
    205205    out.println("<pre>");
     206    out.println(exceptionClassName);
    206207    int i = 0;
    207208    for (i=0; i < st.length && i < 8; i++)
    208209    {
    209210      out.print("...at ");
    210       out.println(st[i].toString().replaceAll("net.sf.basedb.core.", ""));
     211      out.println(HTML.encodeTags(st[i].toString().replaceAll("net.sf.basedb.core.", "")));
    211212    }
    212213    out.println("</pre>");
     
    219220        {
    220221          out.print("...at ");
    221           out.println(st[j].toString().replaceAll("net.sf.basedb.core.", ""));
     222          out.println(HTML.encodeTags(st[j].toString().replaceAll("net.sf.basedb.core.", "")));
    222223        }
    223224        ex = ex.getCause();
  • branches/filedb/www/lims/arraydesigns/features/index.jsp

    r3679 r3783  
    3535  import="net.sf.basedb.core.Permission"
    3636  import="net.sf.basedb.core.PermissionDeniedException"
     37  import="net.sf.basedb.core.ArrayDesign"
     38  import="net.sf.basedb.core.data.FeatureData"
    3739  import="net.sf.basedb.clients.web.Base"
    3840  import="net.sf.basedb.clients.web.WebException"
     
    8991    forward = viewPage;
    9092  }
     93  else if ("ExportItems".equals(cmd))
     94  {
     95    // Run an export plugin in a list context
     96    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     97    dc = sc.newDbControl();   
     98    final ArrayDesign arrayDesign = ArrayDesign.getById(dc, arrayDesignId);
     99    final DataQuery<FeatureData> query = arrayDesign.getFeatures();
     100    cc.configureQuery(query, true);
     101    cc.setQuery(query);
     102    redirect = "../../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Export+features+of+array+design";
     103  }
    91104  else
    92105  {
Note: See TracChangeset for help on using the changeset viewer.