Changeset 4093


Ignore:
Timestamp:
Jan 18, 2008, 4:05:29 PM (14 years ago)
Author:
Johan Enell
Message:

Reverted to revision r4089

Location:
trunk
Files:
3 deleted
90 edited
4 copied

Legend:

Unmodified
Added
Removed
  • trunk/config/dist/base.config

    r4090 r4093  
    7777# If the internal job queue should be enabled or not
    7878jobqueue.internal.enabled            = true
     79
     80# Signal receiver class for sending signals to running jobs (to abort them)
     81jobqueue.internal.signalreceiver.class = net.sf.basedb.core.signal.LocalSignalReceiver
     82jobqueue.internal.signalreceiver.init  = jobqueue:0
    7983
    8084# If plugins with useInteralJobQueue = false should be executed or not
  • trunk/config/dist/log4j.properties

    r4090 r4093  
    5454#log4j.logger.net.sf.basedb.core.storage=debug
    5555
     56### Log Signal handling events
     57#log4j.logger.net.sf.basedb.core.signal=debug
     58
     59
    5660# -----------------
    5761# Migration loggers
  • trunk/doc/src/docbook/appendix/base.config.xml

    r4090 r4093  
    379379
    380380    <varlistentry>
     381      <term><property>jobqueue.internal.signalreceiver.class</property></term>
     382      <listitem>
     383        <para>
     384         A class implementing the <interfacename docapi="net.sf.basedb.core.signal"
     385         >SignalReceiver</interfacename>
     386         interface. The class must have a public no-argument constructor. If
     387         no value is specified the default setting is:
     388         <classname docapi="net.sf.basedb.core.signal"
     389         >net.sf.basedb.core.signal.LocalSignalReceiver</classname>.
     390         </para>
     391         <para>
     392         Change to <classname docapi="net.sf.basedb.core.signal"
     393         >net.sf.basedb.core.signal.SocketSignalReceiver</classname>
     394         if the internal job queue must be able to receive signals from outside
     395         this JVM.
     396         </para>
     397      </listitem>
     398    </varlistentry>
     399   
     400    <varlistentry>
     401      <term><property>jobqueue.internal.signalreceiver.init</property></term>
     402      <listitem>
     403        <para>
     404        Initialisation string sent to <methodname>SignalReceiver.init()</methodname>.
     405        The syntax and meaning of the string depends on the actual implementation
     406        that is used. Please see the javadoc for more information.
     407         </para>
     408      </listitem>
     409    </varlistentry>
     410
     411    <varlistentry>
    381412      <term><property>jobqueue.internal.checkinterval</property></term>
    382413      <listitem>
  • trunk/doc/src/docbook/appendix/incompatible.xml

    r4090 r4093  
    4545    </para>
    4646  </note>
     47 
     48  <sect1 id="appendix.incompatible.2.6">
     49    <title>BASE 2.6 release</title>
     50   
     51    <bridgehead>Feature identification methods</bridgehead>
     52    <para>
     53      Array design features can now be identified by three different methods:
     54      COORDINATES, POSITION and FEATURE_ID. The coordinates method was the
     55      only one supported earlier.
     56    </para>
     57   
     58    <itemizedlist>
     59    <listitem>
     60      <para>
     61      Client and plug-in code that depends on features having unique COORDINATES
     62      may no longer work if used with an array design using a different identification method.
     63      Code that is, directly or indirectly, using a
     64      <classname docapi="net.sf.basedb.core">FeatureBatcher</classname> or
     65      <classname docapi="net.sf.basedb.core">RawDataBatcher</classname> are
     66      probably affected by this. For example, a raw data importer which
     67      doesn't know how to set the position or the feature ID can't import data to
     68      an array design that is using one of the new identification methods.
     69      </para>
     70    </listitem>
     71   
     72    <listitem>
     73      <para>
     74      The POSITION identification method will require a unqiue position number.
     75      This value used to be an auto-generated sequence starting at 1. The other
     76      identification methods will still do that, but when using the POSITION identification
     77      method the only requirement is that the position value is a unique positive integer.
     78      Client or plug-in code that depends on the position beeing a number between
     79      1 and the number of features may fail if used with an array design using
     80      the POSITION identification method.
     81      </para>
     82    </listitem>   
     83    </itemizedlist>
     84
     85  </sect1> 
    4786 
    4887  <sect1 id="appendix.incompatible.2.5">
  • trunk/doc/src/docbook/developerdoc/api_overview.xml

    r4090 r4093  
    730730       
    731731        <para>
    732           The <property>lastUpdate</property> property holds the data and time
    733           the reporter information was last updated. The value is managed automatically
    734           by the <classname>ReporterBatcher</classname> class.
     732          The
     733          <property>lastUpdate</property>
     734          property holds the data and time the reporter information was last updated. The
     735          value is managed automatically by the
     736          <classname>ReporterBatcher</classname>
     737          class. That goes for
     738          <property>lastSource</property>
     739          property too, which holds information about where the last update comes from. By
     740          default this is set to the name of the logged in user, but it can be changed by
     741          calling
     742          <methodname>ReporterBatcher.setUpdateSource(String source)</methodname>
     743          before the batcher commits the updates to the database. The source-string
     744          should have the format: <synopsis>[ITEM_TYPE]:[ITEM_NAME]</synopsis> where,in
     745          the file-case, ITEM_TYPE is File and ITEM_NAME is the file's name.
    735746        </para>
    736747      </sect3>
     
    19471958          from plates. In the first case the features on an array design
    19481959          are described by a reporter map. A reporter map is a file
    1949           that maps a coordinate on an array design to a reporter.
     1960          that maps a coordinate (block, meta-grid, row, column),
     1961          position or an external ID on an array design to a
     1962          reporter. Which method to use is given by the
     1963          <property>ArrayDesign.featureIdentificationMethod</property> property.
    19501964          The coordinate system on an array design is divided into blocks.
    19511965          Each block can be identified either by a <property>blockNumber</property>
     
    19541968          contains several <classname docapi="net.sf.basedb.core.data">FeatureData</classname> items, each
    19551969          one identified by a row and column coordinate. Platforms that doesn't
    1956           divide the array design into block should create a single super-block
    1957           that holds all features.
     1970          divide the array design into blocks or doesn't use the coordinate system at all
     1971          must still create a single super-block that holds all features.
    19581972        </para>
    19591973       
     
    27952809     
    27962810    </sect2>
     2811   
     2812    <sect2 id="core_api.signals">
     2813      <title>Sending signals (to plug-ins)</title>
     2814   
     2815      <para>
     2816        BASE has a simple system for sending signals between different parts of
     2817        a system. This signalling system was initially developed to be able to
     2818        kill plug-ins that a user for some reason wanted to abort. The signalling
     2819        system as such is not limited to this and it can be used for other purposes
     2820        as well. Signals can of course be handled internally in a single JVM but
     2821        also sent externally to other JVM:s running on the same or a different
     2822        computer. The transport mechanism for signals is decoupled from the actual
     2823        handling of them. If you want to, you could implement a signal transporter
     2824        that sends signal as emails and the target plug-in would never know.
     2825      </para>
     2826     
     2827      <para>
     2828        The remainder of this section will focus mainly on the sending and
     2829        transportation of signals. For more information about handling signals
     2830        on the receiving end, see <xref linkend="plugin_developer.signals" />.
     2831      </para>
     2832     
     2833      <sect3 id="core_api.signals.diagram">
     2834        <title>Diagram of classes and methods</title>
     2835        <figure id="core_api.figures.signals">
     2836          <title>The signalling system</title>
     2837          <screenshot>
     2838            <mediaobject>
     2839              <imageobject>
     2840                <imagedata
     2841                  align="center"
     2842                  scalefit="1" width="100%"
     2843                  fileref="figures/uml/corelayer.signals.png" format="PNG" />
     2844              </imageobject>
     2845            </mediaobject>
     2846          </screenshot>
     2847        </figure>
     2848     
     2849        <para>
     2850          The signalling system is rather simple. An object that wish
     2851          to receieve signals must implement the
     2852          <interfacename docapi="net.sf.basedb.core.signal"
     2853          >SignalTarget</interfacename>. It's only method
     2854          is <methodname>getSignalHandler()</methodname>. A
     2855          <interfacename docapi="net.sf.basedb.core.signal"
     2856          >SignalHandler</interfacename> is an object that
     2857          knows what to do when a signal is delivered to it. The target object
     2858          may implement the <interfacename>SignalHandler</interfacename> itself
     2859          or use one of the existing handlers.
     2860        </para>
     2861       
     2862        <para>
     2863          The difficult part here is to be aware that a signal is usually
     2864          delivered by a separate thread. The target object must be aware
     2865          of this and know how to handle multiple threads. As an example we
     2866          can use the <classname docapi="net.sf.basedb.core.signal"
     2867          >ThreadSignalHandler</classname> which simply
     2868          calls <code>Thread.interrupt()</code> to deliver a signal. The target
     2869          object that uses this signal handler it must know that it should check
     2870          <code>Thread.interrupted()</code> at regular intervals from the main
     2871          thread. If that method returns true, it means that the <constant>ABORT</constant>
     2872          signal has been delivered and the main thread should clean up and exit as
     2873          soon as possible.
     2874        </para>
     2875       
     2876        <para>
     2877          Even if a signal handler could be given directly to the party
     2878          that may be interested in sending a signal to the target this
     2879          is not recommended. This would only work when sending signals
     2880          within the same virtual machine. The signalling system includes
     2881          <interfacename docapi="net.sf.basedb.core.signal"
     2882          >SignalTransporter</interfacename> and
     2883          <interfacename docapi="net.sf.basedb.core.signal"
     2884          >SignalReceiver</interfacename> objects that are used
     2885          to decouple the sending of signals with the handling of signals. The
     2886          implementation usually comes in pairs, for example
     2887          <classname docapi="net.sf.basedb.core.signal"
     2888          >SocketSignalTransporters</classname> and <classname
     2889          docapi="net.sf.basedb.core.signal">SocketSignalReceiver</classname>.
     2890        </para>
     2891       
     2892        <para>
     2893          Setting up the transport mechanism is usually a system responsibility.
     2894          Only the system know what kind of transport that is appropriate for it's current
     2895          setup. Ie. should signals be delievered by TCP/IP sockets, only internally, or
     2896          should a delivery mechanism based on web services be implemented?
     2897          If a system wants to receive signals it must create an appropriate
     2898          <interfacename>SignalReceiver</interfacename> object. Within BASE the
     2899          internal job queue set up it's own signalling system that can be used to
     2900          send signals (eg. kill) running jobs. The job agents do the same but uses
     2901          a different implementation. See <xref linkend="appendix.base.config.jobqueue" />
     2902          for more information about how to configure the internal job queue's
     2903          signal receiver. In both cases, there is only one signal receiver instance
     2904          active in the system.
     2905        </para>
     2906       
     2907        <para>
     2908          Let's take the internal job queue as an example. Here is how it works:
     2909        </para>
     2910       
     2911        <itemizedlist>
     2912        <listitem>
     2913          <para>
     2914          When the internal job queue is started, it will also create a signal
     2915          receiver instance according to the settings in <filename>base.config</filename>.
     2916          The default is to create <classname docapi="net.sf.basedb.core.signal"
     2917          >LocalSignalReceiver</classname>
     2918          which can only be used inside the same JVM. If needed, this can
     2919          be changed to a <classname docapi="net.sf.basedb.core.signal"
     2920          >SocketSignalReceiver</classname> or any other
     2921          user-provided implementation.
     2922          </para>
     2923        </listitem>
     2924       
     2925        <listitem>
     2926          <para>
     2927          When the job queue has found a plug-in to execute it will check if
     2928          it also implements the <interfacename docapi="net.sf.basedb.core.signal"
     2929          >SignalTarget</interfacename>
     2930          interface. If it does, a signal handler is created and registered
     2931          with the signal receiver. This is actually done by the BASE core
     2932          by calling <methodname>PluginExecutionRequest.registerSignalReceiver()</methodname>
     2933          which also makes sure that the the ID returned from the registration is
     2934          stored in the database together with the job item representing the
     2935          plug-in to execute.
     2936          </para>
     2937        </listitem>
     2938       
     2939        <listitem>
     2940          <para>
     2941          Now, when the web client see's a running job which has a non-empty
     2942          signal transporter property, the <guilabel>Abort</guilabel>
     2943          button is activated. If the user clicks this button the BASE core
     2944          uses the information in the database to create
     2945          <interfacename docapi="net.sf.basedb.core.signal"
     2946          >SignalTransporter</interfacename> object. This
     2947          is simply done by calling <code>Job.getSignalTransporter()</code>.
     2948          The created signal transporter knows how to send a signal
     2949          to the signal receiver it was first registered with. When the
     2950          signal arrives at the receiver it will find the handler for it
     2951          and call <code>SignalHandler.handleSignal()</code>. This will in it's turn
     2952          trigger some action in the signal target which soon will abort what
     2953          it is doing and exit.
     2954          </para>
     2955        </listitem>
     2956        </itemizedlist>
     2957       
     2958       
     2959      </sect3>
     2960   
     2961    </sect2>
     2962   
    27972963  </sect1>
    27982964
  • trunk/doc/src/docbook/developerdoc/plugin_developer.xml

    r4090 r4093  
    43654365  </sect1>
    43664366 
     4367  <sect1 id="plugin_developer.signals">
     4368    <title>Enable support for aborting a running a plug-in</title>
     4369   
     4370    <para>
     4371      BASE includes a simple signalling system that can be used to send
     4372      signals to plug-ins. The system was primarly developed to allow a user
     4373      to kill a plug-in when it is executing. Therfore, the focus of this chapter
     4374      will be how to implement a plug-in to make it possible to kill it
     4375      during it's execution.
     4376    </para>
     4377   
     4378    <para>
     4379      Since we don't want to do this by brute force such as destroying the
     4380      process or stopping thread the plug-in executes in, cooperation is needed
     4381      by the plug-in. First, the plug-in must implement the
     4382      <interfacename docapi="net.sf.basedb.core.signal">SignalTarget</interfacename>
     4383      interface. From this, a <interfacename
     4384      docapi="net.sf.basedb.core.signal">SignalHandler</interfacename> can be created.
     4385      A plug-in may choose to implement it's own signal handler or use an existing
     4386      implementation. BASE, for example, provides the <classname docapi="net.sf.basedb.core.signal"
     4387      >ThreadSignalHandler</classname> implementation that supports the <constant>ABORT</constant> signal.
     4388      This is a simple implementation that just calls <code>Thread.interrupt()</code>
     4389      on the plug-in worker thread. This may cause two different effects:
     4390    </para>
     4391   
     4392    <itemizedlist>
     4393    <listitem>
     4394      <para>
     4395      The <code>Thread.interrupted()</code> flag is set. The plug-in must check this
     4396      at regular intervals and if the flag is set it must cleanup, rollback
     4397      open transactions and exit as soon as possible.
     4398      </para>
     4399    </listitem>
     4400   
     4401    <listitem>
     4402      <para>
     4403      If the plug-in is waiting in a blocking call that is interruptable, for
     4404      example <code>Thread.sleep()</code>, an <classname>InterruptedException</classname>
     4405      is thrown. This should cause the same actions as if the flag was set to happen.
     4406      </para>
     4407     
     4408      <warning>
     4409        <title>Not all blocking calls are interruptable</title>
     4410        <para>
     4411        For example calling <code>InputStream.read()</code> may leave the
     4412        plug-in waiting in a non-interruptable state. In this case there
     4413        is nothing BASE can do to wake it up again.
     4414        </para>
     4415      </warning>
     4416    </listitem>
     4417    </itemizedlist>
     4418   
     4419    <para>
     4420      Here is a general outline for a plug-in that uses the
     4421      <classname>ThreadSignalHandler</classname>.
     4422    </para>
     4423    <programlisting language="java">
     4424<![CDATA[
     4425private ThreadSignalHandler signalHandler;
     4426public SignalHandler getSignalHandler()
     4427{
     4428   signalHandler = new ThreadSignalHandler();
     4429   return signalHandler;
     4430}
     4431
     4432public void run(Request request, Response response, ProgressReporter progress)
     4433{
     4434   if (signalHandler != null) signalHandler.setWorkerThread(null);
     4435   beginTransaction();
     4436   boolean done = false;
     4437   boolean interrupted = false;
     4438   while (!done && !interrupted)
     4439   {
     4440      try
     4441      {
     4442         done = doSomeWork(); // NOTE! This must not take forever!
     4443         interrupted = Thread.interrupted();
     4444      }
     4445      catch (InterruptedException ex)
     4446      {
     4447         // NOTE! Try-catch is only needed if thread calls
     4448         // a blocking method that is interruptable
     4449         interrupted = true;
     4450      }
     4451   }
     4452   if (interrupted)
     4453   {
     4454      rollbackTransaction();
     4455      response.setError("Aborted by user", null);
     4456   }
     4457   else
     4458   {
     4459      commitTransaction();
     4460      response.setDone("Done");
     4461   }
     4462}
     4463]]>
     4464</programlisting>
     4465   
     4466    <para>
     4467      Another signal handler implementation is the
     4468      <classname docapi="net.sf.basedb.core.signal">ProgressReporterSignalHandler</classname>.
     4469      See that javadoc for information about how to use it.
     4470      For more information about the signalling system as a whole,
     4471      see <xref linkend="core_api.signals" />.
     4472    </para>
     4473   
     4474  </sect1>
     4475 
    43674476  <sect1 id="plugin_developer.classload">
    43684477    <title>How BASE load plug-in classes</title>
  • trunk/doc/src/docbook/userdoc/rawbioassays.xml

    r4090 r4093  
    138138            The array design can be changed after raw data has been
    139139            imported, but this triggers a new validation. If the raw data
    140             is stored in the database, the position, coordinates and reporter of all features
    141             on the new array design must exactly match the position,
    142             coordinates and reporter of the raw data. For Affymetrix data, the
     140            is stored in the database, the features on the new array design must
     141            match the the raw data. The verification can use three different methods:
     142          </para>
     143         
     144          <itemizedlist>
     145          <listitem>
     146            <para>
     147            Coordinates: Verify block, meta-grid, row and column coordinates.
     148            </para>
     149          </listitem>
     150          <listitem>
     151            <para>Position: Verify the position number.</para>
     152          </listitem>
     153          <listitem>
     154            <para>
     155            Feature ID: Verify the feature ID. This option can only be used
     156            if the raw bioassay is currently connected to an array design that
     157            has feature ID values already.
     158            </para>
     159          </listitem>
     160          </itemizedlist>
     161          <para>
     162            In all three cases it is also verified that the reporter of the raw
     163            data matches the reporter of the features.
     164          </para>
     165
     166          <para>
     167            For Affymetrix data, the
    143168            CEL file is validated against the CDF file of the new array design.
    144169            If the validation fails, the array design is not changed.
  • trunk/doc/src/docbook/userdoc/webclient.xml

    r4090 r4093  
    15391539          <informalexample>Experiment A, Experiment B, etc.</informalexample>
    15401540        </para>
    1541        
     1541        <para>
     1542          If you want to filter on several values at the same time, separate the
     1543          values in the filter input box with the <quote>|</quote> character.
     1544          For example, a filter text like <informalexample>Experiment A|C%</informalexample>
     1545          matches both <quote>Experiment A</quote> and values 
     1546          that begin with <quote>C</quote>.
     1547        </para>       
    15421548        <para>
    15431549          You can also use operators to find items which has a value that
     
    15711577          <varlistentry>
    15721578            <term><keycap>=</keycap></term>
    1573             <listitem><simpara>Equal to (useful to find items with a null value)</simpara></listitem>
     1579            <listitem>
     1580              <simpara>
     1581                Equal to (useful to find items with a null value). Supports
     1582                filtering on more then one value.
     1583              </simpara>
     1584            </listitem>
    15741585          </varlistentry>
    15751586          <varlistentry>
    15761587            <term><keycap>&lt;&gt;</keycap></term>
    15771588            <term><keycap>!=</keycap></term>
    1578             <listitem><simpara>Not equal to (useful to find items with a non-null value)</simpara></listitem>
     1589            <listitem>
     1590              <simpara>
     1591                Not equal to (useful to find items with a non-null value). Supports
     1592                filtering on more then one value.
     1593              </simpara>
     1594            </listitem>
     1595          </varlistentry>
     1596          <varlistentry>
     1597            <term><keycap>==</keycap></term>
     1598            <listitem>
     1599              <simpara>
     1600                Same as <keycap>=</keycap> but this will ignore <quote>|</quote> as a value separator.
     1601              </simpara>
     1602            </listitem>
    15791603          </varlistentry>
    15801604        </variablelist>
  • trunk/src/clients/jobagent/net/sf/basedb/clients/jobagent/Agent.java

    r4090 r4093  
    5050import net.sf.basedb.util.Values;
    5151import net.sf.basedb.util.jobagent.JobAgentServerConnection;
     52import net.sf.basedb.util.jobagent.JobInfo;
    5253import net.sf.basedb.util.jobagent.RequestHandler;
    5354import net.sf.basedb.util.timer.Scheduler;
     
    250251  private JobAgentServerConnection server;
    251252  private RequestHandler requestHandler;
     253  private AgentSignalReceiver signalReceiver;
    252254  private JobExecutor jobExecutor;
    253255
     
    273275  private final Map<Job.ExecutionTime, Integer> priorities;
    274276 
    275   private final Set<Integer> activeJobs;
    276  
     277  private final Set<JobInfo> activeJobs;
     278
     279  /**
     280    Timeout to wait for jobs to act on the ABORT signal when stopping.
     281    Default value is 20 seconds.
     282  */
     283  private int closeTimeout = 20000;
     284
    277285  /**
    278286    The group were all job runners are placed.
     
    344352    runnersGroup.setDaemon(false);
    345353
    346     this.activeJobs = new HashSet<Integer>();
     354    this.activeJobs = new HashSet<JobInfo>();
    347355    isRunning = false;
    348356  }
     
    530538    if (server == null)
    531539    {
     540      this.signalReceiver = new AgentSignalReceiver(this);
     541      this.signalReceiver.init(null);
    532542      this.requestHandler = requestHandler == null ? new DefaultRequestHandler(this) : requestHandler;
    533543      this.server = new JobAgentServerConnection(port, this.requestHandler, logServer);
     
    634644    Get a set containing the ID:s of the jobs that are currently
    635645    beeing executed by this job agent.
    636     @return A set of integers
    637   */
    638   public Set<Integer> getRunningJobs()
     646    @return A set of JobInfo objects
     647    @since 2.6
     648  */
     649  public Set<JobInfo> getRunningJobs()
    639650  {
    640651    if (log.isDebugEnabled()) log.debug("Active jobs: " + activeJobs);
     
    683694    }
    684695    return allow;
     696  }
     697 
     698  /**
     699    Get the signal receiver that is processing signal messages
     700    on behalf of this job agent.
     701    @since 2.6
     702  */
     703  public AgentSignalReceiver getSignalReceiver()
     704  {
     705    return signalReceiver;
    685706  }
    686707 
     
    793814        slotToUse = slots[i];
    794815        usedSlots.put(slotToUse, usedSlots.get(slotToUse) + 1);
    795         activeJobs.add(job.getId());
     816        activeJobs.add(new JobInfo(job, slotToUse));
    796817        log.debug("Slot: " + slotToUse + "; used: " + usedSlots.get(slotToUse) + "; max: " + maxSlots.get(slotToUse));
    797818        break;
     
    830851  {
    831852    usedSlots.put(usedSlot, usedSlots.get(usedSlot) - 1);
    832     activeJobs.remove(job.getId());
     853    activeJobs.remove(new JobInfo(job, usedSlot));
    833854  }
    834855 
     
    915936 
    916937  /**
    917     Try to stop running jobs by interrupting the threads thaey are executing in.
     938    Try to stop running jobs by interrupting the threads they are executing in.
    918939  */
    919940  private void maybeStopRunningJobs()
    920941  {
    921942    log.info("Stopping running jobs. " + activeJobs.size() + " job(s) still active.");
    922     // Interrupt all threads. Hopefully they will do as we tell them.
    923     runnersGroup.interrupt();
     943   
     944    // Send ABORT to all jobs, that support signals
     945    signalReceiver.close(closeTimeout);
    924946  }
    925947 
  • trunk/src/clients/jobagent/net/sf/basedb/clients/jobagent/executors/DummyJobExecutor.java

    r4090 r4093  
    2424package net.sf.basedb.clients.jobagent.executors;
    2525
     26import java.util.Collections;
     27
    2628import net.sf.basedb.clients.jobagent.Agent;
    2729import net.sf.basedb.clients.jobagent.JobExecutor;
     
    3032import net.sf.basedb.core.JobAgentSettings;
    3133import net.sf.basedb.core.SessionControl;
     34import net.sf.basedb.core.signal.SignalReceiver;
     35import net.sf.basedb.core.signal.ThreadSignalHandler;
    3236import net.sf.basedb.util.Values;
    3337
     
    8993    log.info("Executing job: " + job);
    9094    DbControl dc = null;
     95    boolean aborted = false;
     96    Throwable error = null;
    9197    try
    9298    {
     
    96102      if (wait > 0)
    97103      {
     104        SignalReceiver signalReceiver = agent.getSignalReceiver();
     105        job.setSignalTransporter(signalReceiver.getSignalTransporterClass(),
     106          signalReceiver.registerSignalHandler(new ThreadSignalHandler()));
    98107        job.setProgress(50, "Halfway; waiting " + wait + " seconds");
    99108        dc.commit();
     
    105114          }
    106115        }
     116        catch (InterruptedException ex)
     117        {
     118          aborted = true;
     119        }
    107120        catch (Throwable t)
    108121        {
    109122          log.error(t.getMessage(), t);
     123          error = t;
    110124        }
    111125        dc  = sc.newDbControl();
    112126        dc.reattachItem(job);
    113127      }
    114       job.doneOk("Not really, but used for testing job agent");
     128      if (aborted)
     129      {
     130        job.doneError("Aborted by user");
     131      }
     132      else if (error != null)
     133      {
     134        job.doneError(error.getMessage(), Collections.singleton(error));
     135      }
     136      else
     137      {
     138        job.doneOk("Not really, but used for testing job agent");
     139      }
    115140      dc.commit();
    116141      log.info("Done executing: " + job);
  • trunk/src/clients/jobagent/net/sf/basedb/clients/jobagent/executors/ProcessJobExecutor.java

    r4090 r4093  
    4242import net.sf.basedb.core.PluginDefinition;
    4343import net.sf.basedb.core.SessionControl;
     44import net.sf.basedb.core.signal.Signal;
     45import net.sf.basedb.core.signal.SignalHandler;
     46import net.sf.basedb.core.signal.SignalReceiver;
     47import net.sf.basedb.core.signal.SignalTransporter;
     48import net.sf.basedb.core.signal.ThreadSignalHandler;
    4449import net.sf.basedb.util.Values;
    4550
     
    101106  private String javaBin;
    102107  private String options;
     108  private SignalReceiver signalReceiver;
     109  private SignalHandler signalHandler;
    103110 
    104111  public ProcessJobExecutor()
     
    120127    if (javaBin == null) javaBin = "java";
    121128    options = Values.getString(agent.getProperty("agent.executor.process.options"), "-server");
     129    signalReceiver = agent.getSignalReceiver();
    122130  }
    123131 
     
    126134  {
    127135    log.info("Executing job: " + job);
    128    
     136
    129137    // Generate command for new process
    130138    List<String> cmd = new ArrayList<String>(10);
     
    164172    cmd.add("-t"); // Thread priority
    165173    cmd.add(Integer.toString(agent.getThreadPriority(job.getEstimatedExecutionTime())));
     174    cmd.add("-x"); // Port the job agent is listening on for remote control
     175    cmd.add(Integer.toString(agent.getPort()));
    166176   
    167177    Process process = null;
     
    201211        new InputStreamReader(process.getInputStream()), result));
    202212      t.start();
    203 
     213     
    204214      try
    205215      {
    206216        log.info("Waiting for process to end");
     217        signalHandler = new ThreadSignalHandler();
     218        signalReceiver.registerSignalHandler(signalHandler);
    207219        int exitCode = process.waitFor();
    208220        if (exitCode != 0)
     
    224236      {
    225237        log.info("Job was interrupted: " + job, ex);
    226         // Kill the process
    227         process.destroy();
     238        // First, send ABORT to the job if it supports it
    228239        dc = sc.newDbControl();
    229240        job = Job.getById(dc, job.getId());
    230         job.doneError(ex.getMessage(), Arrays.asList(ex));
     241        SignalTransporter signalTransporter = job.getSignalTransporter();
     242        if (signalTransporter != null)
     243        {
     244          signalTransporter.send(Signal.ABORT);
     245        }
     246        else
     247        {
     248          job.doneError("Aborted by user", Arrays.asList(ex));
     249          process.destroy();
     250        }
    231251        dc.commit();
     252      }
     253      finally
     254      {
     255        signalReceiver.unregisterSignalHandler(signalHandler);         
    232256      }
    233257    }
  • trunk/src/clients/jobagent/net/sf/basedb/clients/jobagent/executors/ThreadJobExecutor.java

    r4090 r4093  
    3939import net.sf.basedb.core.SessionControl;
    4040import net.sf.basedb.core.plugin.Response;
     41import net.sf.basedb.core.signal.SignalReceiver;
     42import net.sf.basedb.core.signal.SocketSignalReceiver;
    4143import net.sf.basedb.util.SocketUtil;
    4244import net.sf.basedb.util.Values;
     
    6567    org.apache.log4j.LogManager.getLogger("net.sf.basedb.clients.jobagent.executors.ThreadJobExecutor");
    6668 
     69  private SignalReceiver signalReceiver;
    6770 
    6871  public ThreadJobExecutor()
     
    7477  */
    7578  public void init(Agent agent)
    76   {}
     79  {
     80    this.signalReceiver = agent == null ? null : agent.getSignalReceiver();
     81  }
    7782 
    7883  public void executeJob(SessionControl sc, Agent agent, Job job, JobAgentSettings settings,
     
    99104        log.error("Error executing job: " + job, t);
    100105      }
     106      exec.registerSignalReceiver(signalReceiver);
    101107      dc.commit();
    102108
     
    130136  // -------------------------------------------
    131137 
     138  private void setSignalReceiver(SignalReceiver signalReceiver)
     139  {
     140    this.signalReceiver = signalReceiver;
     141  }
     142 
    132143  public static void main(String[] args)
    133144  {
     
    138149    String login = cmdLine.getOption("-u");
    139150    String password = cmdLine.getOption("-p");
     151    String proxyPort = cmdLine.getOption("-x");
    140152    int threadPriority = Values.getInt(cmdLine.getOption("-t"), Thread.NORM_PRIORITY);
    141153
     
    152164      ThreadJobExecutor executor = new ThreadJobExecutor();
    153165     
     166      if (proxyPort != null)
     167      {
     168        SocketSignalReceiver signalReceiver = new SocketSignalReceiver();
     169        signalReceiver.init("proxy=" + Application.getHostName() + ":" + proxyPort);
     170        executor.setSignalReceiver(signalReceiver);
     171        Runtime.getRuntime().addShutdownHook(new Thread(new ShutdownHook(signalReceiver)));
     172      }
     173     
    154174      sc = Application.newSessionControl("net.sf.basedb.clients.jobagent",
    155175        SocketUtil.getLocalHost().toString(), null);
     
    188208  }
    189209 
     210  private static class ShutdownHook
     211    implements Runnable
     212  {
     213    private SignalReceiver signalReceiver;
     214   
     215    private ShutdownHook(SignalReceiver signalReceiver)
     216    {
     217      this.signalReceiver = signalReceiver;
     218    }
     219    public void run()
     220    {
     221      signalReceiver.close(5000);
     222    }
     223  }
    190224}
  • trunk/src/clients/jobagent/net/sf/basedb/clients/jobagent/handlers/DefaultRequestHandler.java

    r4090 r4093  
    6969    registerHandler(new StopRequestHandler(agent), "stop");
    7070    registerHandler(new PauseRequestHandler(agent), "pause");
     71    if (agent.getSignalReceiver() != null)
     72    {
     73      registerHandler(new SignalRequestHandler(agent), "signal");
     74    }
    7175  }
    7276 
     
    8993    String answer = null;
    9094    RequestHandler handler = commandHandlers.get(cmd);
     95    if (handler == null && cmd != null && cmd.startsWith("signal://"))
     96    {
     97      handler = commandHandlers.get("signal");
     98    }
    9199    if (!agent.isAllowedControl(remote, cmd))
    92100    {
  • trunk/src/clients/migrate/net/sf/basedb/clients/migrate/ArrayBlockTransfer.java

    r4090 r4093  
    3333import net.sf.basedb.core.DbControl;
    3434import net.sf.basedb.core.FeatureBatcher;
     35import net.sf.basedb.core.FeatureIdentificationMethod;
    3536import net.sf.basedb.core.ItemNotFoundException;
    3637import net.sf.basedb.core.Plate;
     
    113114          ArrayDesign arrayDesign = ArrayDesign.getById(dc, base2Id);
    114115          PreparedStatement ps = prepareStatementFromFile("selectArrayBlocksByArrayType");
    115           FeatureBatcher featureBatcher = arrayDesign.getFeatureBatcher();
     116          FeatureBatcher featureBatcher = arrayDesign.getFeatureBatcher(FeatureIdentificationMethod.COORDINATES);
    116117          log.debug("Setting batch size to: " + getBatchSize());
    117118          featureBatcher.setBatchSize(getBatchSize());
  • trunk/src/clients/migrate/net/sf/basedb/clients/migrate/RawBioAssayDataTransfer.java

    r4090 r4093  
    168168     */
    169169    cleanUpMemory();
    170     RawDataBatcher batcher = rawBioAssay.getRawDataBatcher();
     170    RawDataBatcher batcher = rawBioAssay.getRawDataBatcher(null);
    171171    batcher.setBatchSize(getBatchSize());
    172172    runRawBioAssay(rawBioAssay, batcher, hasArrayDesign, rawBioAssayId);
  • trunk/src/clients/web/net/sf/basedb/clients/web/fileupload/FileUpload.java

    r4090 r4093  
    774774      throws IOException
    775775    {
     776      if (status.eof || status.atBoundary) return -1;
     777      int result = -1;
    776778      int available = end - start;
    777       if (available == 0)
    778       {
    779         if (status.eof || status.atBoundary) return -1;
    780         available = readMoreData();
    781       }
    782       int result = -1;
     779      if (available == 0) available = readMoreData();
    783780      if (available > 0)
    784781      {
    785         // Important! Mask with 0xff to get values in range (0,255), NOT (-128,127)
    786         result = buffer[start] & 0xff;
     782        result = buffer[start];
    787783        start++;
    788784      }
  • trunk/src/clients/web/net/sf/basedb/clients/web/plugins/SimpleExport.java

    r4090 r4093  
    468468    template.writeHeaders();
    469469   
    470     long numExported = 0;
     470    int numExported = 0;
    471471    ResultIterator result = null;
    472472    try
     
    506506          if (progress != null)
    507507          {
    508             int percent = (int)(100L * numExported / totalItems);
     508            int percent = (int)(100f * numExported / totalItems);
    509509            progress.display(percent, numExported + " of " + totalItems + " done.");
    510510          }
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/Head.java

    r4090 r4093  
    9090
    9191  /**
     92   
     93  */
     94  private static final long serialVersionUID = 948719986796860767L;
     95
     96  /**
    9297    The parent &lt;base:page&gt; tag.
    9398  */
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/HideableSection.java

    r4090 r4093  
    193193
    194194  /**
     195   
     196  */
     197  private static final long serialVersionUID = 4750788983708350436L;
     198
     199  /**
    195200    The parent &lt;base:page&gt; tag.
    196201  */
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/Note.java

    r4090 r4093  
    155155{
    156156
     157  /**
     158   
     159  */
     160  private static final long serialVersionUID = 7490498743887372136L;
     161
    157162  private static final int NOTE_TYPE_ERROR = 1;
    158163 
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/Page.java

    r4090 r4093  
    278278    throws JspException
    279279  {
    280     if (type != PAGE_TYPE_INCLUDE)
    281     {
    282       StringBuilder sb = new StringBuilder();
    283       sb.append("</html>\n");
    284       try
    285       {
    286         pageContext.getOut().print(sb.toString());
    287       }
    288       catch (Exception ex)
    289       {
    290         throw new JspTagException(ex.getMessage());
    291       }
     280    StringBuilder sb = new StringBuilder();
     281    sb.append("</html>\n");
     282    try
     283    {
     284      pageContext.getOut().print(sb.toString());
     285    }
     286    catch (Exception ex)
     287    {
     288      throw new JspTagException(ex.getMessage());
    292289    }
    293290    return EVAL_PAGE;
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/PropertyValue.java

    r4090 r4093  
    122122
    123123  /**
     124   
     125  */
     126  private static final long serialVersionUID = -92637960053523649L;
     127
     128  /**
    124129    The item. Should be BasicItem or BasicData.
    125130  */
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/Select.java

    r4090 r4093  
    228228
    229229 
     230  /**
     231   
     232  */
     233  private static final long serialVersionUID = -9096279950931870965L;
     234
    230235  /**
    231236    Optional <code>class</code> attribute
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/menu/Menuitem.java

    r4090 r4093  
    136136{
    137137  /**
     138   
     139  */
     140  private static final long serialVersionUID = 1431778959423572670L;
     141
     142  /**
    138143    The parent Menu.
    139144  */
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/menu/Menuseparator.java

    r4090 r4093  
    9191{
    9292
     93  /**
     94   
     95  */
     96  private static final long serialVersionUID = -1758168104130104042L;
     97
    9398  private Menu menu;
    9499 
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/menu/Submenu.java

    r4090 r4093  
    135135{
    136136  /**
     137   
     138  */
     139  private static final long serialVersionUID = -9170636903520137656L;
     140
     141  /**
    137142    The parent Menu.
    138143  */
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/tab/Tab.java

    r4090 r4093  
    127127
    128128  /**
     129   
     130  */
     131  private static final long serialVersionUID = -2308568821797105775L;
     132
     133  /**
    129134    The parent TabControl object.
    130135  */
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/tab/TabControl.java

    r4090 r4093  
    157157{
    158158  /**
     159   
     160  */
     161  private static final long serialVersionUID = 1898616270560551262L;
     162
     163  /**
    159164    Optional <code>style</code> attribute
    160165  */
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/Button.java

    r4090 r4093  
    167167
    168168  /**
     169   
     170  */
     171  private static final long serialVersionUID = -6294795199053088632L;
     172
     173  /**
    169174    The parent &lt;tbl:table&gt; tag.
    170175  */
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/Cell.java

    r4090 r4093  
    111111
    112112  /**
     113   
     114  */
     115  private static final long serialVersionUID = -1992298892993613884L;
     116
     117  /**
    113118    The parent &lt;tbl:table&gt; tag.
    114119  */
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/CellValue.java

    r4090 r4093  
    2323*/
    2424package net.sf.basedb.clients.web.taglib.table;
    25 
    26 import java.util.List;
    2725
    2826import javax.servlet.jsp.JspException;
     
    9189{
    9290
     91  /**
     92   
     93  */
     94  private static final long serialVersionUID = 4068184541728474047L;
     95
    9396  private static final Formatter toStringFormatter = new ToStringFormatter();
    9497 
     
    97100  */
    98101  private Object value = null;
    99   private List<?> list = null;
     102  private Iterable<?> list = null;
    100103  private String separator = "; ";
    101104
     
    113116  }
    114117 
    115   public void setList(List<?> list)
     118  public void setList(Iterable<?> list)
    116119  {
    117120    this.list = list;
    118121  }
    119122 
    120   public List<?> getList()
     123  public Iterable<?> getList()
    121124  {
    122125    return list;
     
    151154      theSeparator = separator;
    152155    }
    153     if (list != null && list.size() > 0)
     156    if (list != null)
    154157    {
    155158      for (Object o : list)
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/ColumnDef.java

    r4090 r4093  
    253253  extends TagSupport
    254254{
     255
     256  /**
     257   
     258  */
     259  private static final long serialVersionUID = -272408513116029365L;
    255260
    256261  /**
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/Columns.java

    r4090 r4093  
    5454{
    5555
     56  /**
     57   
     58  */
     59  private static final long serialVersionUID = 8857257637171219032L;
    5660  private Table table;
    5761  private Data data;
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/Data.java

    r4090 r4093  
    100100
    101101  /**
     102   
     103  */
     104  private static final long serialVersionUID = 6633768910320305875L;
     105
     106  /**
    102107    The parent &lt;tbl:table&gt; tag.
    103108  */
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/Header.java

    r4090 r4093  
    9292
    9393  /**
     94   
     95  */
     96  private static final long serialVersionUID = -7541520513764712983L;
     97
     98  /**
    9499    The parent &lt;tbl:table&gt; tag.
    95100  */
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/Label.java

    r4090 r4093  
    137137
    138138  /**
     139   
     140  */
     141  private static final long serialVersionUID = 5326481772609709567L;
     142
     143  /**
    139144    The parent &lt;tbl:table&gt; tag.
    140145  */
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/Panel.java

    r4090 r4093  
    107107
    108108  /**
     109   
     110  */
     111  private static final long serialVersionUID = 8435173953529878997L;
     112
     113  /**
    109114    The parent &lt;tbl:table&gt; tag.
    110115  */
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/PresetSelector.java

    r4090 r4093  
    5858  extends TagSupport
    5959{
     60
     61  /**
     62   
     63  */
     64  private static final long serialVersionUID = 6787200020881710014L;
    6065
    6166  /**
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/Row.java

    r4090 r4093  
    117117
    118118  /**
     119   
     120  */
     121  private static final long serialVersionUID = 1975591924471893645L;
     122
     123  /**
    119124    The parent &lt;tbl:table&gt; tag.
    120125  */
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/Rows.java

    r4090 r4093  
    5454{
    5555
     56  /**
     57   
     58  */
     59  private static final long serialVersionUID = 2099882746242865479L;
    5660  private Table table;
    5761  private Data data;
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/Table.java

    r4090 r4093  
    203203
    204204  /**
     205   
     206  */
     207  private static final long serialVersionUID = -6717117667917148241L;
     208
     209  /**
    205210    The parent &lt;base:page&gt; tag.
    206211  */
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/Toolbar.java

    r4090 r4093  
    115115
    116116  /**
     117   
     118  */
     119  private static final long serialVersionUID = -8719987407920036604L;
     120
     121  /**
    117122    The parent &lt;tbl:table&gt; tag.
    118123  */
  • trunk/src/core/common-queries.xml

    r4090 r4093  
    524524      SELECT s
    525525      FROM net.sf.basedb.core.data.MimeTypeData s
    526       WHERE LOWER(s.extension) = LOWER(:extension)
     526      WHERE s.extension = :extension
    527527    </sql>
    528528    <description>
  • trunk/src/core/net/sf/basedb/core/Affymetrix.java

    r4090 r4093  
    357357      if (hasProgress && (index % progressInterval == 0))
    358358      {
    359         int percent = 5 + (int)(90L * (long)index / numProbesets);
     359        int percent = 5 + 90 * index / numProbesets;
    360360        int remain = numProbesets - index;
    361361        String created = create ? "; " + numCreated + " created" : "";
  • trunk/src/core/net/sf/basedb/core/Job.java

    r4090 r4093  
    12791279    private long lastUpdate;
    12801280   
    1281     private int lastValue;
    1282     private int offset;
    1283    
    12841281    ProgressReporterImpl(Job job, String server, ProgressReporter chained)
    12851282      throws BaseException
     
    12911288      this.chained = chained;
    12921289      this.lastUpdate = 0;
    1293       this.lastValue = 0;
    1294       this.offset = 0;
    12951290    }
    12961291   
     
    13041299      if (System.currentTimeMillis() - lastUpdate > UPDATE_INTERVAL || percent == 100)
    13051300      {
    1306         // If the percent is negative and less then the last value, an offset will be calculated.
    1307         // This will adjust the percent to a realistic value.
    1308         //Notice: It is only possible to give a value close to what expected.
    1309         if (percent < lastValue && percent < 0)
    1310         {
    1311           if (Math.abs(percent) < Math.abs(lastValue))
    1312           {
    1313             offset = offset + 2*Math.abs(lastValue);
    1314           }
    1315           else
    1316           {
    1317             offset = offset + 2*Math.abs(percent);
    1318           }
    1319         }
    1320         lastValue = percent;   
    1321         percent = percent + offset;
    1322        
    13231301        lastUpdate = System.currentTimeMillis();
    13241302        DbControl dc = null;
  • trunk/src/core/net/sf/basedb/core/RawBioAssay.java

    r4090 r4093  
    11641164
    11651165      DataResultIterator<RawData> result = rawQuery.iterate(dc);
    1166       long numValidated = 0;
     1166      int numValidated = 0;
    11671167      int numTotal = getNumDbSpots();
    11681168      while (result.hasNext())
     
    12211221        if (progress != null && numValidated % 100 == 0)
    12221222        {
    1223           int percent = 10 + ((int)(90L * numValidated) / numTotal);
     1223          int percent = 10 + (90 * numValidated) / numTotal;
    12241224          progress.display(percent, "Validated " + numValidated + " of " + numTotal + " spots.");
    12251225        }
  • trunk/src/core/net/sf/basedb/core/SpotImages.java

    r4090 r4093  
    472472          if (progress != null)
    473473          {
    474             long spotsDone = spotImagesPerImage*imageNumber;
    475             int percent = 10 + (int)(90L * spotsDone / totalSpots);
     474            int spotsDone = spotImagesPerImage*imageNumber;
     475            int percent = 10 + 90 * spotsDone / totalSpots;
    476476            progress.display(percent, "Generating spot images ("+spotsDone+" done)...");
    477477          }
  • trunk/src/core/net/sf/basedb/util/BioAssaySetFilterUtil.java

    r4090 r4093  
    123123    }
    124124   
    125     long spotsDone = 0;
     125    int spotsDone = 0;
    126126    int spotsAfter = 0;
    127127    if (progress != null) progress.display(10, "Filtering spots (0 done; "+spotsTotal+" total)...");
     
    139139      if (progress != null)
    140140      {
    141         int percent = 10 + (int)(90L * spotsDone / spotsTotal);
     141        int percent = 10 + 90 * spotsDone / spotsTotal;
    142142        progress.display(percent,
    143143          "Filtering spot intensities ("+spotsDone+" done; "+spotsTotal+" total)...");
     
    205205    // Prepare progress reporting
    206206    int interval = 10;  // Update progress after this many spots >= 10
    207     long spotsDone = 0;
     207    int spotsDone = 0;
    208208    int spotsAfter = 0;
    209209    if (progress != null)
     
    236236            if (spotsDone % interval == 0)
    237237            {
    238               int percent = 10 + (int)(90L * spotsDone / spotsTotal);
     238              int percent = 10 + 90 * spotsDone / spotsTotal;
    239239              progress.display(percent,
    240240                "Filtering spot intensities ("+spotsDone+" done; "+spotsTotal+" total)...");
  • trunk/src/core/net/sf/basedb/util/IntensityCalculatorUtil.java

    r4090 r4093  
    305305    int maxPosition = 0;
    306306   
    307     long spotsDone = 0; // Number of calculated spots
     307    int spotsDone = 0; // Number of calculated spots
    308308    int totalSpots = 0; // Total number of spots
    309309    int interval = 0; // Interval between reporter to the progress reporter
     
    426426          if (spotsDone % interval == 0)
    427427          {
    428             int percent = 10 + (int)((90L * spotsDone) / totalSpots);
     428            int percent = 10 + 90 * spotsDone / totalSpots;
    429429            progress.display(percent, "Calculating spot intensities ("+spotsDone+" done)...");
    430430          }
  • trunk/src/core/net/sf/basedb/util/parser/FlatFileParser.java

    r4090 r4093  
    4747import net.sf.basedb.core.BaseException;
    4848import net.sf.basedb.core.Config;
    49 import net.sf.basedb.util.InputStreamTracker;
    5049
    5150/**
     
    177176
    178177  /**
    179     For keeping track of the number of bytes parsed.
    180   */
    181   private InputStreamTracker tracker;
    182  
    183   /**
    184178    The regular expression for matching a header line.
    185179  */
     
    528522  {
    529523    Charset cs = Charset.forName(charsetName == null ? Config.getCharset() : charsetName);
    530     this.tracker = new InputStreamTracker(in);
    531     this.reader = new BufferedReader(new InputStreamReader(tracker, cs));
     524    this.reader = new BufferedReader(new InputStreamReader(in, cs));
    532525  }
    533526
     
    11231116    correspond to the number of parsed bytes depending on the character
    11241117    set of the file.
    1125     @see #getParsedBytes()
    11261118  */
    11271119  public long getParsedCharacters()
    11281120  {
    11291121    return parsedCharacters;
    1130   }
    1131  
    1132   /**
    1133     Get the number of parsed bytes so far. This value may or may not
    1134     correspond to the number of parsed characters depending on the character
    1135     set of the file.
    1136     @since 2.5.1
    1137     @see #getParsedCharacters()
    1138   */
    1139   public long getParsedBytes()
    1140   {
    1141     return tracker == null ? 0 : tracker.getNumRead();
    11421122  }
    11431123 
  • trunk/src/core/net/sf/basedb/util/zip/TarFilePacker.java

    r4090 r4093  
    9797    if (lastModified > 0) entry.setModTime(lastModified);
    9898    entry.setSize(size);
    99     TarUtil.putNextEntry(entry, tar);
     99    tar.putNextEntry(entry);
    100100    if (!isDirectory) FileUtil.copy(in, tar);
    101101    tar.closeEntry();
  • trunk/src/plugins/core/net/sf/basedb/plugins/AbstractFlatFileImporter.java

    r4090 r4093  
    542542        if (section != null && section.type() == FlatFileParser.LineType.SECTION)
    543543        {
    544           if (progress != null) progress.display(getProgress(ffp), "Parsing section "+section.name()+"...");
     544          if (progress != null) progress.display(getProgress(ffp.getParsedCharacters()), "Parsing section "+section.name()+"...");
    545545          try
    546546          {
     
    571571        else
    572572        {
    573           if (progress != null) progress.display(getProgress(ffp), "Parsing headers...");
     573          if (progress != null) progress.display(getProgress(ffp.getParsedCharacters()), "Parsing headers...");
    574574        }
    575575        FlatFileParser.LineType result = ffp.parseHeaders();
     
    609609            " on line " + (line == null ? "-1" : line.lineNo() + ": " + StringUtil.trimString(line.line(), 20)), t);     
    610610        }
    611         if (progress != null) progress.display(getProgress(ffp), "Parsing data...");
     611        if (progress != null) progress.display(getProgress(ffp.getParsedCharacters()), "Parsing data...");
    612612        int progressLine = 0;
    613613       
     
    640640              if (progress != null)
    641641              {
    642                 progress.display(getProgress(ffp), "Parsing data... (" + ffp.getParsedLines() + " lines so far)");
     642                progress.display(getProgress(ffp.getParsedCharacters()), "Parsing data... (" + ffp.getParsedLines() + " lines so far)");
    643643              }
    644644            }
     
    685685  // -------------------------------------------
    686686
    687   private int getProgress(FlatFileParser ffp)
    688   {
    689     return (int) (100 * ffp.getParsedBytes() / fileSize);
     687  private int getProgress(long parsedCharacters)
     688  {
     689    return (int) (100 * parsedCharacters / fileSize);
    690690  }
    691691
  • trunk/src/plugins/core/net/sf/basedb/plugins/Base1PluginExecuter.java

    r4090 r4093  
    18061806        case STRING:
    18071807        {
    1808           StringParameterType t = new StringParameterType(65535, defaultValue, false, 1, new Integer(options), 1);
     1808          StringParameterType t = new StringParameterType(255, defaultValue, false, 1, new Integer(options), 1);
    18091809          parameter = new PluginParameter<String>(name, commonName, "", t);
    18101810          break;
     
    18271827        case HIDDEN_STRING:
    18281828        {
    1829           StringParameterType t = new StringParameterType(65535, defaultValue, false, 1, 0, 1);
     1829          StringParameterType t = new StringParameterType(255, defaultValue, false, 1, 0, 1);
    18301830          parameter = new PluginParameter<String>(name, null, "", t);
    18311831          break;
     
    18551855            enums.add(at.getName(), at.getName());
    18561856          }
    1857           StringParameterType t = new StringParameterType(65535, null, false, 1, Values.getInt(options, 30), 1, enums);
     1857          StringParameterType t = new StringParameterType(255, null, false, 1, Values.getInt(options, 30), 1, enums);
    18581858          parameter = new PluginParameter<String>(name, commonName, "", t);
    18591859          break;
     
    18611861        case ENUMERATION:
    18621862        {
    1863           StringParameterType t = new StringParameterType(65535, defaultValue, false, 1, Values.getInt(options, 30), 1, enumOptions);
     1863          StringParameterType t = new StringParameterType(255, defaultValue, false, 1, Values.getInt(options, 30), 1, enumOptions);
    18641864          parameter = new PluginParameter<String>(name, commonName, "", t);
    18651865          break;
  • trunk/src/plugins/core/net/sf/basedb/plugins/BioAssaySetExporter.java

    r4090 r4093  
    685685    int nof_reporters=bioassayset.getNumReporters();
    686686    int progress_report_interval=nof_reporters/10;
    687     long nof_processed_reporters=0;
     687    int nof_processed_reporters=0;
    688688    while (spotData.hasNext())
    689689    {
    690690      if (progress != null && (nof_processed_reporters%progress_report_interval == 0))
    691691      {
    692         progress.display((int)(100L * nof_processed_reporters / nof_reporters),
     692        progress.display(100 * nof_processed_reporters / nof_reporters,
    693693                         "Exporting ... " + nof_processed_reporters + " of " +
    694694                         nof_reporters + " done.");
     
    781781    int nof_spots=bioassayset.getNumSpots();
    782782    int progress_spot_interval=nof_spots/10;
    783     long nof_processed_spots=0;
     783    int nof_processed_spots=0;
    784784    while (spotData.hasNext())
    785785    {
     
    791791          (nof_processed_spots%progress_spot_interval == 0))
    792792        {
    793           progress.display((int)(100L * nof_processed_spots / nof_spots),
     793          progress.display(100 * nof_processed_spots / nof_spots,
    794794                           "Exporting ..." + nof_processed_spots + " of " +
    795795                           nof_spots + " done.");
  • trunk/src/plugins/core/net/sf/basedb/plugins/IlluminaRawDataImporter.java

    r4092 r4093  
    4444import net.sf.basedb.core.DbControl;
    4545import net.sf.basedb.core.Experiment;
     46import net.sf.basedb.core.FeatureIdentificationMethod;
    4647import net.sf.basedb.core.File;
    4748import net.sf.basedb.core.Include;
     
    8788import net.sf.basedb.util.parser.FlatFileParser.Data;
    8889import net.sf.basedb.util.parser.FlatFileParser.Line;
    89 import net.sf.basedb.util.parser.FlatFileParser.LineType;
    9090
    9191/**
     
    167167
    168168 
    169  
    170169  private static final PluginParameter<String> invalidColumnsErrorParameter = new PluginParameter<String>(
    171170      "invalidColumnsError",
     
    291290        storeValue(job, request, fileParameter);
    292291        storeValue(job, request, ri.getParameter(CHARSET));
    293         storeValue(job, request, ri.getParameter(DECIMAL_SEPARATOR));
    294292       
    295293        // Associations
     
    345343    Create a FlatFileParser that can parse Illumina data files:
    346344    <ul>
    347     <li>Data splitter: (,|\t)
     345    <li>Data splitter: ,
    348346    <li>Header regexp: (.+)=(.*?),*
    349     <li>Data header: TargetID(,|\t).*
     347    <li>Data header: TargetId,.*
    350348    </ul>
    351     NOTE! To begin with we support both comma and tab as column splitter but
    352     later on (in {@link #isImportable(FlatFileParser)}) when we know which one is actually
    353     used, we change this in the parser. We need to do this since numbers may
    354     use comma as decimal separator.
    355349  */
    356350  @Override
     
    358352    throws BaseException
    359353  {
    360     String separator = "(,|\\t)";
    361354    FlatFileParser ffp = new FlatFileParser();
    362     ffp.setDataSplitterRegexp(Pattern.compile(separator));
    363     ffp.setDataHeaderRegexp(Pattern.compile("TargetID"+separator + ".*"));
     355    ffp.setDataSplitterRegexp(Pattern.compile(","));
     356    ffp.setDataHeaderRegexp(Pattern.compile("TargetID,.*"));
    364357    ffp.setHeaderRegexp(Pattern.compile("(.+)=(.*?),*"));
    365358    return ffp;
    366359  }
    367360  /**
    368     @return As specified by job parameter or "dot" if not
     361    @return Always "dot"
    369362  */
    370363  @Override
    371364  protected String getDecimalSeparator()
    372365  {
    373     String separator = super.getDecimalSeparator();
    374     if (separator == null) separator = "dot";
    375     return separator;
     366    return "dot";
    376367  }
    377368
     
    385376  {
    386377    String firstLine = ffp.getLineCount() >= 1 ? ffp.getLine(0).line() : null;
    387     boolean isIllumina = firstLine != null && firstLine.contains("Illumina");
    388     if (isIllumina)
    389     {
    390       String separator = ",";
    391       FlatFileParser.Line lastLine = ffp.getLine(ffp.getLineCount()-1);
    392       if (lastLine.type() == LineType.DATA_HEADER)
    393       {
    394         int firstTab = lastLine.line().indexOf("\t");
    395         if (firstTab > 0 && firstTab < lastLine.line().indexOf(","))
    396         {
    397           separator = "\\t";
    398         }
    399         ffp.setDataSplitterRegexp(Pattern.compile(separator));
    400       }
    401     }
    402     return isIllumina;
     378    return firstLine != null && firstLine.contains("Illumina") ;
    403379  }
    404380 
     
    495471  {
    496472    String externalId = reporterMapper.getValue(data);
     473    int lineNo = data.dataLineNo();
    497474    for (BatchAndMapHolder holder : holders)
    498475    {
    499476      RawData raw = holder.batcher.newRawData();
     477      raw.setPosition(lineNo);
    500478      raw.setBlock(1);
    501479      raw.setColumn(1);
    502       raw.setRow(data.dataLineNo());
     480      raw.setRow(lineNo);
    503481      for (Map.Entry<RawDataProperty, Mapper> entry : holder.mappers.entrySet())
    504482      {
     
    507485        raw.setExtended(ep.getName(), ep.parseString(m.getValue(data), numberFormat, nullIfException));
    508486      }
    509       holder.batcher.insert(raw, externalId);
     487      holder.batcher.insert(raw, externalId, externalId);
    510488    }
    511489    numInserted++;
     
    671649        parameters.add(fileParameter);
    672650        parameters.add(getCharsetParameter(null, null, null));
    673         parameters.add(getDecimalSeparatorParameter(null, null, (String)job.getValue(DECIMAL_SEPARATOR)));
    674651 
    675652        // parameters for scan, protocol, software and array design
  • trunk/src/plugins/core/net/sf/basedb/plugins/LowessNormalization.java

    r4090 r4093  
    408408    query.restrict(intensityRestriction);
    409409    long numSpots = query.count(dc);
    410     long normalizedSpots = 0;
     410    int normalizedSpots = 0;
    411411    if (progress != null) progress.display((int)(normalizedSpots / numSpots * 100), normalizedSpots + " spots normalized");
    412412   
     
    504504            }
    505505            normalizedSpots += smoothCurve.size();
    506             if (progress != null) progress.display((int)((normalizedSpots * 100L) / numSpots), normalizedSpots + " spots normalized");
     506            if (progress != null) progress.display((int)((normalizedSpots * 100) / numSpots), normalizedSpots + " spots normalized");
    507507          }
    508508          fromBlock = toBlock + 1;
  • trunk/src/plugins/core/net/sf/basedb/plugins/MedianRatioNormalization.java

    r4090 r4093  
    349349    query.restrict(intensityRestriction);
    350350    long numSpots = query.count(dc);
    351     long normalizedSpots = 0;
     351    int normalizedSpots = 0;
    352352    if (progress != null) progress.display((int)(normalizedSpots / numSpots * 100), normalizedSpots + " spots normalized");
    353353   
     
    441441            }
    442442            normalizedSpots += toIndex - fromIndex;
    443             if (progress != null) progress.display((int)((normalizedSpots * 100L) / numSpots), normalizedSpots + " spots normalized");
     443            if (progress != null) progress.display((int)((normalizedSpots * 100) / numSpots), normalizedSpots + " spots normalized");
    444444          }
    445445          fromBlock = toBlock + 1;
  • trunk/src/plugins/core/net/sf/basedb/plugins/PackedFileExporter.java

    r4090 r4093  
    356356    // Get parameters
    357357    Directory rootDir = (Directory)job.getValue("root");
    358     rootDir = Directory.getById(dc, rootDir.getId());
    359358    List<Integer> files = (List<Integer>)job.getValues("files");       
    360359    List<Integer> directories = (List<Integer>)job.getValues("directories");
  • trunk/src/plugins/core/net/sf/basedb/plugins/TarFileUnpacker.java

    r4090 r4093  
    2424package net.sf.basedb.plugins;
    2525
    26 import java.io.BufferedInputStream;
    2726import java.io.IOException;
    2827import java.io.InputStream;
     
    5453import net.sf.basedb.util.Values;
    5554import net.sf.basedb.util.zip.AbstractFileUnpacker;
    56 import net.sf.basedb.util.zip.TarUtil;
    5755
    5856/**
     
    140138    if (isGzip)
    141139    {
    142       tarStream = new TarInputStream(new GZIPInputStream(new BufferedInputStream(pin)));
     140      tarStream = new TarInputStream(new GZIPInputStream(pin));
    143141    }
    144142    else if (isBzip)
     
    147145      pin.read();
    148146      pin.read();
    149       tarStream = new TarInputStream(new CBZip2InputStream(new BufferedInputStream(pin)));
     147      tarStream = new TarInputStream(new CBZip2InputStream(pin));
    150148    }
    151149    else
     
    162160    long totalUnpacked = 0;
    163161    int numFiles = 0;
    164     while ((entry = TarUtil.getNextEntry(tarStream)) != null)
     162   
     163    while ((entry = tarStream.getNextEntry()) != null)
    165164    {
    166165      String subPath = entry.getName();
  • trunk/src/test/TestAnalyzePluginUtil.java

    r4090 r4093  
    7272        rba.setName("TestAnalyzePluginUtil"+i);
    7373        rba.setDescription("RawBioAssay created by TestAnalyzePluginUtil. Number of spots should be "+spots);
    74         RawDataBatcher rawDataBatcher = rba.getRawDataBatcher();
     74        RawDataBatcher rawDataBatcher = rba.getRawDataBatcher(null);
    7575        for (int j = 0; parser.hasMoreData() && j < spots; j++)
    7676        {
  • trunk/src/test/TestArrayDesign.java

    r4090 r4093  
    3131import net.sf.basedb.core.Feature;
    3232import net.sf.basedb.core.FeatureBatcher;
     33import net.sf.basedb.core.FeatureIdentificationMethod;
    3334import net.sf.basedb.core.File;
    3435import net.sf.basedb.core.FileSetMember;
     
    7475    int id3 = test_create(Platform.AFFYMETRIX, true);
    7576    int id4 = test_create(Platform.AFFYMETRIX, false);
     77    int id6 = test_create(Platform.GENERIC, false);
    7678    test_load(id);
    7779    test_list(-1);
     
    8183    test_import_from_file(id2, "data/test.reportermap.import.txt",
    8284      "\"Block\"\\t\"Column\"\\t\"Row\"\\t\"ID\"\\t\"Name\".*", 0, 2, 1, 3);
    83     test_add_features(id, 10);
     85    test_add_features(id, FeatureIdentificationMethod.COORDINATES, 10);
     86    test_add_features(id6, FeatureIdentificationMethod.FEATURE_ID, 10);
    8487
    8588    write_feature_header();
     
    114117    test_delete(id4);
    115118    test_delete(id5);
     119    test_delete(id6);
    116120   
    117121    TestPlate.test_delete_all();
     
    309313  }
    310314
    311   static void test_add_features(int arrayDesignId, int numFeatures)
     315  static void test_add_features(int arrayDesignId, FeatureIdentificationMethod fiMethod, int numFeatures)
    312316  {
    313317    if (arrayDesignId == 0) return;
     
    328332      }
    329333     
    330       FeatureBatcher batcher = ad.getFeatureBatcher();
     334      FeatureBatcher batcher = ad.getFeatureBatcher(fiMethod);
    331335      int block = 1;
    332336      int row = 1;
    333337      int column = 1;
     338      int position = 1;
    334339      ArrayDesignBlock adBlock = ad.addArrayDesignBlock(new BlockInfo(block, (int)Math.ceil(block/4F), ((block-1)%4)+1));
    335340      time = System.currentTimeMillis();
     
    344349        data.setRow(row);
    345350        data.setColumn(column);
     351        data.setPosition(position);
     352        data.setExternalId(reporter.getExternalId() + "." + position);
    346353
    347354        batcher.insert(data);
    348355        row++;
     356        position++;
    349357        if (row == 11)
    350358        {
     
    395403        wells.addAll(plate.getWells().list(dc));
    396404      }
    397       FeatureBatcher batcher = ad.getFeatureBatcher();
     405      FeatureBatcher batcher = ad.getFeatureBatcher(FeatureIdentificationMethod.COORDINATES);
    398406      int block = 1;
    399407      int row = 1;
     
    549557      dc = TestUtil.getDbControl();
    550558      ArrayDesign ad = ArrayDesign.getById(dc, arrayDesignId);
    551       FeatureBatcher featureBatcher = ad.getFeatureBatcher();
     559      FeatureBatcher featureBatcher = ad.getFeatureBatcher(FeatureIdentificationMethod.COORDINATES);
    552560      ReporterBatcher reporterBatcher = ReporterBatcher.getNew(dc);
    553561   
  • trunk/src/test/TestBioAsssaySetExporter.java

    r4090 r4093  
    171171      ReporterData r2 = Reporter.getById(dc, r2Id);
    172172      ReporterData r3 = Reporter.getById(dc, r3Id);
    173       RawDataBatcher rdb = rba.getRawDataBatcher();
     173      RawDataBatcher rdb = rba.getRawDataBatcher(null);
    174174      for (int i=0; i < 4; ++i)
    175175      {
  • trunk/src/test/TestRawBioAssay.java

    r4090 r4093  
    315315      RawDataType rdt = rba.getRawDataType();
    316316      List<RawDataProperty> extraProperties = rdt.getProperties();
    317       RawDataBatcher rdb = rba.getRawDataBatcher();
     317      RawDataBatcher rdb = rba.getRawDataBatcher(null);
    318318      int block = 1;
    319319      int row = 1;
     
    459459      dc = TestUtil.getDbControl();
    460460      RawBioAssay rba = RawBioAssay.getById(dc, rawBioAssayId);
    461       RawDataBatcher rawDataBatcher = rba.getRawDataBatcher();
     461      RawDataBatcher rawDataBatcher = rba.getRawDataBatcher(null);
    462462      ReporterBatcher reporterBatcher = ReporterBatcher.getNew(dc);
    463463   
  • trunk/src/test/net/sf/basedb/test/FileUtil.java

    r4090 r4093  
    2727
    2828import org.apache.tools.bzip2.CBZip2InputStream;
    29 
    30 import com.ice.tar.TarInputStream;
    3129
    3230import net.sf.basedb.core.DbControl;
     
    6866   
    6967    boolean isBzip = false;
    70     boolean isTar = false;
    7168    if (filename.endsWith(".bz2"))
    7269    {
    7370      isBzip = true;
    7471      filename = filename.substring(0, filename.length()-4);
    75     }
    76     if (filename.endsWith(".tar"))
    77     {
    78       isTar = true;
    79       filename = filename.substring(0, filename.length() - 4);
    8072    }
    8173 
     
    10496          toUpload = new CBZip2InputStream(toUpload);
    10597        }
    106         if (isTar)
    107         {
    108           // Assume that the TAR only contains a single file
    109           TarInputStream tar = new TarInputStream(toUpload);
    110           tar.getNextEntry();
    111           toUpload = tar;
    112         }
    11398        file.upload(toUpload, false, true);
    11499      }
  • trunk/src/test/net/sf/basedb/test/merge/MergeTest.java

    r4090 r4093  
    4242import net.sf.basedb.core.Experiment;
    4343import net.sf.basedb.core.FeatureBatcher;
     44import net.sf.basedb.core.FeatureIdentificationMethod;
    4445import net.sf.basedb.core.Formula;
    4546import net.sf.basedb.core.ItemParameterType;
     
    200201    TestUtil.write("--Creating features for array design: " + design.getName() + "\n");
    201202    dc.reattachItem(design);
    202     FeatureBatcher batcher = design.getFeatureBatcher();
     203    FeatureBatcher batcher = design.getFeatureBatcher(FeatureIdentificationMethod.COORDINATES);
    203204    ReporterBatcher reporterBatcher = ReporterBatcher.getNew(dc);
    204205    for (int block = 1; block <= 10; block++)
     
    237238    TestUtil.write("--Creating data for raw bioassay: " + rba.getName() + "\n");
    238239    dc.reattachItem(rba);
    239     RawDataBatcher batcher = rba.getRawDataBatcher();
     240    RawDataBatcher batcher = rba.getRawDataBatcher(null);
    240241    for (int block = 1; block <= 10; block++)
    241242    {
     
    252253        rawData.setExtended("ch1FgMean", ch1 + noise);
    253254        rawData.setExtended("ch2FgMean", ch1 * ratio - noise);
    254         batcher.insert(rawData, externalId);
     255        batcher.insert(rawData, externalId, null);
    255256      }
    256257    }
  • trunk/src/test/net/sf/basedb/test/roles/AdminTest.java

    r4090 r4093  
    120120      dc = TestUtil.getDbControl();
    121121      File reporters = FileUtil.uploadFile(dc, "/mouse", "plates_and_reporters.mouse.v4.37k.txt", FileType.PLATE);
    122       File affyReporters = FileUtil.uploadFile(dc, "/affymetrix/annotations", "MG_U74Av2_annot.csv.tar.bz2", FileType.REPORTER);
     122      File affyReporters = FileUtil.uploadFile(dc, "/affymetrix/annotations", "MG_U74Av2_annot.csv.bz2", FileType.REPORTER);
    123123      dc.commit();
    124124     
  • trunk/src/test/net/sf/basedb/test/roles/PowerUserTest.java

    r4090 r4093  
    161161      File plates = FileUtil.uploadFile(dc, "/mouse", "plates_and_reporters.mouse.v4.37k.txt", FileType.PLATE);     
    162162      File printMap = FileUtil.uploadFile(dc, "/mouse", "printmap.mouse.v4.37k.tam", FileType.PRINT_MAP);
    163       File cdfFile = FileUtil.uploadFile(dc, "/affymetrix/cdf", "MG_U74Av2.cdf.tar.bz2", FileType.REPORTER_MAP);
     163      File cdfFile = FileUtil.uploadFile(dc, "/affymetrix/cdf", "MG_U74Av2.cdf.bz2", FileType.REPORTER_MAP);
    164164      dc.commit();
    165165     
  • trunk/src/test/net/sf/basedb/test/roles/UserTest.java

    r4090 r4093  
    142142      File rawData2DyeSwap = FileUtil.uploadFile(dc, "/mouse", "genepix.mouse.v4.37k.24h.dyeswap.gpr", FileType.RAW_DATA);
    143143     
    144       File affy1 = FileUtil.uploadFile(dc, "/affymetrix/E-TEST-1.ebi.ac.uk", "jos1761.cel.tar.bz2", FileType.RAW_DATA);
    145       File affy2 = FileUtil.uploadFile(dc, "/affymetrix/E-TEST-1.ebi.ac.uk", "jos1762.cel.tar.bz2", FileType.RAW_DATA);
    146       File affy3 = FileUtil.uploadFile(dc, "/affymetrix/E-TEST-1.ebi.ac.uk", "jos1763.cel.tar.bz2", FileType.RAW_DATA);
     144      File affy1 = FileUtil.uploadFile(dc, "/affymetrix/E-TEST-1.ebi.ac.uk", "jos1761.cel.bz2", FileType.RAW_DATA);
     145      File affy2 = FileUtil.uploadFile(dc, "/affymetrix/E-TEST-1.ebi.ac.uk", "jos1762.cel.bz2", FileType.RAW_DATA);
     146      File affy3 = FileUtil.uploadFile(dc, "/affymetrix/E-TEST-1.ebi.ac.uk", "jos1763.cel.bz2", FileType.RAW_DATA);
    147147      dc.commit();
    148148     
  • trunk/www/admin/jobagents/view_agent.jsp

    r4090 r4093  
    3838  import="net.sf.basedb.core.JobAgentSettings"
    3939  import="net.sf.basedb.util.jobagent.JobAgentInfo"
     40  import="net.sf.basedb.util.jobagent.JobInfo"
    4041  import="net.sf.basedb.core.User"
    4142  import="net.sf.basedb.core.PermissionDeniedException"
     
    413414
    414415      <%
    415       Set<Integer> jobs = agent.getInfo().getJobs();
     416      Set<JobInfo> jobs = agent.getInfo().getJobInfo();
    416417      if (jobs == null || jobs.size() == 0)
    417418      {
     
    450451          />
    451452          <tbl:columndef
     453            id="slot"
     454            title="Used slot"
     455          />
     456          <tbl:columndef
    452457            id="started"
    453458            title="Started"
     
    466471            <tbl:rows>
    467472            <%
    468             for (int jobId : jobs)
     473            for (JobInfo jobInfo : jobs)
    469474            {
    470475              Job job = null;
     
    472477              try
    473478              {
    474                 job = Job.getById(dc, jobId);
     479                job = Job.getById(dc, jobInfo.getJobId());
    475480              }
    476481              catch (Throwable t)
     
    483488                <tbl:cell column="plugin"><base:propertyvalue item="<%=job%>" property="pluginDefinition"/></tbl:cell>
    484489                <tbl:cell column="started"><%=job == null ? "" : dateFormatter.format(job.getStarted())%></tbl:cell>
     490                <tbl:cell column="slot"><%=jobInfo.getSlot() == null ? "" : jobInfo.getSlot().toString()%></tbl:cell>
    485491                <tbl:cell column="percentComplete">
    486492                  <%
  • trunk/www/common/annotations/list_annotations.jsp

    r4090 r4093  
    389389      }
    390390      %>
     391      </div>
    391392
    392393  </base:body>
  • trunk/www/lims/arraydesigns/features/index.jsp

    r4090 r4093  
    4646<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %>
    4747<%!
    48   private static final ItemContext defaultContext = Base.createDefaultContext("position", "position,block,row,column,reporter.name,reporter.externalId");
     48  private static final ItemContext defaultContext = Base.createDefaultContext("position",
     49    "position,externalId,block,row,column,reporter.name,reporter.externalId");
    4950  private static final Item itemType = Item.FEATURE;
    5051%>
  • trunk/www/lims/arraydesigns/features/list_features.jsp

    r4090 r4093  
    3636  import="net.sf.basedb.core.ArrayDesignBlock"
    3737  import="net.sf.basedb.core.Feature"
     38  import="net.sf.basedb.core.FeatureIdentificationMethod"
    3839  import="net.sf.basedb.core.ReporterType"
    3940  import="net.sf.basedb.core.Reporter"
     
    8889  final ArrayDesign design = ArrayDesign.getById(dc, arrayDesignId);
    8990  final boolean isAffy = design.isAffyChip();
     91  final FeatureIdentificationMethod fiMethod = design.getFeatureIdentificationMethod();
    9092  Formatter<Date> dateFormatter = FormatterFactory.getDateTimeFormatter(sc);
    9193 
     
    112114  int numListed = 0;
    113115  %>
    114   <base:page title="<%=title%>">
     116<base:page title="<%=title%>">
    115117  <base:head scripts="table.js,tabcontrol.js" styles="table.css,headertabcontrol.css,path.css">
    116118    <script language="JavaScript">
     
    210212        filterable="true"
    211213        exportable="true"
    212         show="always"
     214        show="<%=fiMethod == FeatureIdentificationMethod.EXTERNAL_ID ? "auto" : "always"%>"
     215      />
     216      <tbl:columndef
     217        id="externalId"
     218        property="externalId"
     219        datatype="string"
     220        title="Feature ID"
     221        sortable="true"
     222        filterable="true"
     223        exportable="true"
     224        show="<%=fiMethod == FeatureIdentificationMethod.EXTERNAL_ID ? "always" : "auto"%>"
    213225      />
    214226      <tbl:columndef
     
    540552                <tbl:cell column="position"><div class="link" onclick="itemOnClick(event, <%=itemId%>)"
    541553                  title="<%=tooltip%>"><%=item.getPosition()%></div></tbl:cell>
     554                <tbl:cell column="externalId"><div class="link" onclick="itemOnClick(event, <%=itemId%>)"
     555                  title="<%=tooltip%>"><%=HTML.encodeTags(item.getExternalId())%></div></tbl:cell>
    542556                <tbl:cell column="block"><%=block.getBlockNumber()%></tbl:cell>
    543557                <tbl:cell column="row"><%=item.getRow()%></tbl:cell>
  • trunk/www/lims/arraydesigns/features/view_feature.jsp

    r4090 r4093  
    7979
    8080  final ArrayDesign design = ArrayDesign.getById(dc, arrayDesignId);
     81 
    8182  final boolean isAffy = design.isAffyChip();
    8283  FeatureData feature = design.getFeatureById(itemId);
     
    107108      </tr>
    108109      <tr>
    109         <td class="prompt">Affy chip</td>
    110         <td><%=isAffy ? " yes" : "no"%></td>
     110        <td class="prompt">Platform / Variant</td>
     111        <td><base:propertyvalue item="<%=design%>" property="platform" /> / <base:propertyvalue item="<%=design%>" property="variant" /></td>
     112      </tr>
     113      <tr>
     114        <td class="prompt">Feature identification method</td>
     115        <td><%=design.getFeatureIdentificationMethod()%></td>
    111116      </tr>
    112117      </table>
     
    114119      <h4>Feature / block</h4>
    115120      <table class="form" cellspacing=0>
     121      <tr>
     122        <td class="prompt">Feature ID</td>
     123        <td colspan="7"><%=HTML.encodeTags(feature.getExternalId())%></td>
     124      </tr>
    116125      <tr>
    117126        <td class="prompt">Position</td>
  • trunk/www/lims/arraydesigns/list_designs.jsp

    r4090 r4093  
    4848  import="net.sf.basedb.core.PermissionDeniedException"
    4949  import="net.sf.basedb.core.PluginDefinition"
     50  import="net.sf.basedb.core.FeatureIdentificationMethod"
    5051  import="net.sf.basedb.core.query.Hql"
    5152  import="net.sf.basedb.core.query.Restrictions"
     
    7273  private static final Item itemType = Item.ARRAYDESIGN;
    7374  private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.LIST);
     75  private static final Enumeration<String, String> fiMethods = new Enumeration<String, String>();
     76  static
     77  {
     78    for (FeatureIdentificationMethod fim : FeatureIdentificationMethod.values())
     79    {
     80      fiMethods.add(Integer.toString(fim.getValue()), fim.toString());
     81    }
     82    fiMethods.lock();
     83  }
    7484%>
    7585<%
     
    305315        filterable="true"
    306316        exportable="true"
     317      /> 
     318      <tbl:columndef
     319        id="featureIdentificationMethod"
     320        property="featureIdentificationMethod"
     321        datatype="int"
     322        title="Feature ID meth."
     323        tooltip="Feature identification method"
     324        sortable="true"
     325        filterable="true"
     326        exportable="true"
     327        enumeration="<%=fiMethods%>"
    307328      /> 
    308329      <tbl:columndef
     
    547568                <tbl:cell column="numDbFeatures"><%=item.getNumDbFeatures()%></tbl:cell>
    548569                <tbl:cell column="numFileFeatures"><%=item.getNumFileFeatures()%></tbl:cell>
     570                <tbl:cell column="featureIdentificationMethod"><%=item.getFeatureIdentificationMethod()%></tbl:cell>
    549571                <tbl:cell column="batches">
    550572                  <%
  • trunk/www/lims/arraydesigns/view_design.jsp

    r4090 r4093  
    303303        <td class="prompt">Features</td>
    304304        <td><%=design.hasFeatures() ? "yes (db: " + design.getNumDbFeatures() + "; file: " + design.getNumFileFeatures() + ")" : "no"%></td>
     305      </tr>
     306      <tr>
     307        <td class="prompt">Feature identification method</td>
     308        <td><%=design.getFeatureIdentificationMethod()%></td>
    305309      </tr>
    306310      <tr>
  • trunk/www/views/experiments/bioassays/list_bioassays.jsp

    r4090 r4093  
    8888ItemResultIterator<BioAssay> bioAssays = null;
    8989ItemResultList<AnnotationType> annotationTypes = null;
     90ItemResultList<AnnotationType> experimentalFactors = null;
    9091try
    9192{
     
    9394  final BioAssaySet bioAssaySet = BioAssaySet.getById(dc, bioAssaySetId);
    9495  final Experiment experiment = bioAssaySet.getExperiment();
     96  final ItemQuery<AnnotationType> experimentalFactorQuery = experiment.getExperimentalFactors();
     97  experimentalFactorQuery.include(Include.MINE, Include.SHARED, Include.IN_PROJECT, Include.OTHERS);
    9598  final int experimentId = experiment.getId();
    9699  final RawDataType rawDataType = experiment.getRawDataType();
     
    108111  Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext);
    109112  annotationTypes = annotationTypeQuery.list(dc);
     113  experimentalFactors = experimentalFactorQuery.list(dc);
    110114  try
    111115  {
    112116    final ItemQuery<BioAssay> query = Base.getConfiguredQuery(cc, true, bioAssaySet.getBioAssays(), mode);
     117    query.join(Hql.leftJoin("rawParents", "rba"));
    113118    bioAssays = query.iterate(dc);
    114119  }
    115120  catch (Throwable t)
    116121  {
     122    t.printStackTrace();
    117123    cc.setMessage(t.getMessage());
    118124  }
    119125  int numListed = 0;
    120126  %>
    121   <base:page title="<%=title%>" type="<%=mode.getPageType()%>">
     127  <%@page import="net.sf.basedb.util.BioAssaySetUtil"%>
     128<base:page title="<%=title%>" type="<%=mode.getPageType()%>">
    122129  <base:head scripts="table.js,tabcontrol.js" styles="table.css,headertabcontrol.css,path.css">
    123130    <script language="JavaScript">
     
    292299          title="<%=HTML.encodeTags(at.getName())+" [A]"%>"
    293300          property="<%="#"+at.getId()%>"
     301          annotation="true"
     302          datatype="<%=at.getValueType().getStringValue()%>"
     303          enumeration="<%=annotationEnum%>"
     304          sortable="false"
     305          filterable="true"
     306          exportable="true"
     307          formatter="<%=formatter%>"
     308        />
     309        <%
     310      }
     311      %>
     312      <%
     313      for (AnnotationType at : experimentalFactors)
     314      {
     315        Enumeration<String, String> annotationEnum = null;
     316        Formatter formatter = FormatterFactory.getTypeFormatter(sc, at.getValueType());
     317        if (at.isEnumeration())
     318        {
     319          annotationEnum = new Enumeration<String, String>();
     320          List<?> values = at.getValues();
     321          for (Object value : values)
     322          {
     323            String encoded = formatter.format(value);
     324            annotationEnum.add(encoded, encoded);
     325          }
     326        }
     327        %>
     328        <tbl:columndef
     329          id="<%="ef"+at.getId()%>"
     330          title="<%=HTML.encodeTags(at.getName())+" [EF]"%>"
     331          property="<%="$rba.##"+at.getId()%>"
    294332          annotation="true"
    295333          datatype="<%=at.getValueType().getStringValue()%>"
     
    484522                  }
    485523                }
     524                for (AnnotationType at : experimentalFactors)
     525                {
     526                  %>
     527                  <tbl:cell column="<%="ef"+at.getId()%>"
     528                    ><tbl:cellvalue
     529                    list="<%=BioAssaySetUtil.getAnnotationValues(dc, item, at)%>"
     530                  /></tbl:cell>
     531                  <%
     532                }               
    486533                %>
    487534                <tbl:cell column="tools">
  • trunk/www/views/experiments/bioassays/view_bioassay.jsp

    r4090 r4093  
    3636  import="net.sf.basedb.core.BioAssay"
    3737  import="net.sf.basedb.core.RawBioAssay"
     38  import="net.sf.basedb.core.Annotatable"
     39  import="net.sf.basedb.core.AnnotationSet"
     40  import="net.sf.basedb.core.AnnotationType"
     41  import="net.sf.basedb.core.Annotation"
    3842  import="net.sf.basedb.core.ItemQuery"
    3943  import="net.sf.basedb.core.ItemResultList"
     
    4549  import="net.sf.basedb.core.query.Orders"
    4650  import="net.sf.basedb.core.query.Hql"
     51  import="net.sf.basedb.util.formatter.Formatter"
     52  import="net.sf.basedb.clients.web.formatter.FormatterFactory"
    4753  import="net.sf.basedb.clients.web.Base"
    4854  import="net.sf.basedb.clients.web.PermissionUtil"
     
    5056  import="net.sf.basedb.util.Values"
    5157  import="java.util.Map"
     58  import="java.util.List"
     59  import="java.util.HashMap"
     60  import="java.util.LinkedList"
    5261%>
    5362<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
     
    214223          title="Description"
    215224        />
     225        <%
     226        ItemQuery<AnnotationType> efQuery = experiment.getExperimentalFactors();
     227        efQuery.include(Include.ALL);
     228        efQuery.order(Orders.asc(Hql.property("name")));
     229        ItemResultList<AnnotationType> experimentalFactors = efQuery.list(dc);
     230        for (AnnotationType at : experimentalFactors)
     231        {
     232          Formatter formatter = FormatterFactory.getTypeFormatter(sc, at.getValueType());
     233          %>
     234          <tbl:columndef
     235            id="<%="at"+at.getId()%>"
     236            title="<%=HTML.encodeTags(at.getName())%>"
     237            formatter="<%=formatter%>"
     238          />
     239          <%
     240        }
     241        %>
    216242        <tbl:data>
    217243          <tbl:columns>
     
    226252              <tbl:cell column="spots"><%=item.getSpots()%></tbl:cell>
    227253              <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell>
     254              <%
     255              AnnotationSet as = item.isAnnotated() ? item.getAnnotationSet() : null;
     256              for (AnnotationType at : experimentalFactors)
     257              {
     258                String value = "<i>- none -</i>";
     259                List<Annotation> all = as == null ? null : as.findAnnotations(dc, at, true);
     260                Map<Annotatable, List> factorValues = new HashMap<Annotatable, List>();
     261                if (all != null && all.size() > 0)
     262                {
     263                  for (Annotation a : all)
     264                  {
     265                    List values = a.getValues();
     266                    Annotatable aItem = null;
     267                    try
     268                    {
     269                      aItem = a.getAnnotationSet().getItem();
     270                    }
     271                    catch (Throwable t)
     272                    {}
     273                    List toAdd = factorValues.get(aItem);
     274                    if (toAdd == null)
     275                    {
     276                      toAdd = new LinkedList();
     277                      factorValues.put(aItem, toAdd);
     278                    }
     279                    toAdd.addAll(values);
     280                  }
     281                }
     282                %>
     283                <tbl:cell column="<%="at"+at.getId()%>"
     284                  >
     285                  <%
     286                  for (Map.Entry<Annotatable, List> entry : factorValues.entrySet())
     287                  {
     288                    Annotatable aItem = entry.getKey();
     289                    List values = entry.getValue();
     290                    %>
     291                    <tbl:cellvalue list="<%=values%>" />
     292                    <%
     293                    if (aItem != null && aItem.hasPermission(Permission.WRITE))
     294                    {
     295                      %>: <base:icon image="edit.gif"
     296                        onclick="<%="editInheritedAnnotation('"+aItem.getType().name()+"',"+aItem.getId()+","+at.getId()+")"%>"
     297                        tooltip="Modify the values of this experimental factor" />
     298                      <%
     299                    }
     300                  }
     301                  %>
     302                </tbl:cell>
     303                <%
     304              }
     305              %>
    228306            </tbl:row>
    229307            <%
  • trunk/www/views/experiments/bioassaysets/view_bioassayset.jsp

    r4090 r4093  
    174174      }
    175175    }
     176    function changeImage(imageId, url)
     177    {
     178      var img = document.getElementById(imageId);
     179      img.src = url;
     180    }
    176181    function runItemPlugin(cmd)
    177182    {
    178183      Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&experiment_id=<%=experimentId%>&item_id=<%=itemId%>', 'RunPlugin'+cmd, 740, 540);
    179184    }
    180     var imageQueue = new Array();
    181     var nextImage = 0;
    182     function addImage(imageId, url)
    183     {
    184       imageQueue[imageQueue.length] = imageId;
    185       var img = document.getElementById(imageId);
    186       img.realSrc = url;
    187     }
    188     function imageLoaded()
    189     {
    190       nextImage++;
    191       prepareNextImage();
    192     }
    193     function prepareNextImage()
    194     {
    195       if (imageQueue.length > nextImage)
    196       {
    197         var imageId = imageQueue[nextImage];
    198         var img = document.getElementById(imageId);
    199         img.src = '../../../images/plot_generating_400x300.gif';
    200         setTimeout('loadNextImage()', 100);
    201       }
    202     }
    203     function loadNextImage()
    204     {
    205       if (imageQueue.length > nextImage)
    206       {
    207         var imageId = imageQueue[nextImage];
    208         var img = document.getElementById(imageId);
    209         img.onload = imageLoaded;
    210         img.src = img.realSrc;
    211       }
    212     }
    213185    </script>
    214     <style>
    215     .plot {
    216       border: 1px solid #666666;
    217       background-image: url('../../../images/plot_empty_400x300.png');
    218     }
    219     </style>
    220186  </base:head>
    221   <base:body onload="loadNextImage()">
     187  <base:body>
    222188    <p>
    223189    <p:path>
     
    515481        ItemQuery<BioAssay> bioAssayQuery = bioAssaySet.getBioAssays();
    516482        bioAssayQuery.order(Orders.asc(Hql.property("name")));
    517         StringBuilder script = new StringBuilder();
    518483        for (BioAssay bioAssay : bioAssayQuery.list(dc))
    519484        {
     
    523488          url += "&filter="+filter;
    524489          url += "&title="+HTML.urlEncode(bioAssay.getName());
    525           script.append("addImage('MA").append(bioAssay.getId()).append("','").
    526               append(url).append("');\n");
    527490          %>
    528491          <img id="MA<%=bioAssay.getId()%>"
    529             src="../../../images/transparent_pixel.gif"
    530             width="400" height="300"
     492            src="../../../images/plot_generating_400x300.gif"
     493            width="400" height="300" 
    531494            alt="MA-plot for bioassay <%=HTML.encodeTags(bioAssay.getName())%>"
    532             class="plot"
    533             >
     495            style="border: 1px solid #666666;">
     496          <script language="JavaScript">
     497          setTimeout("changeImage('MA<%=bioAssay.getId()%>', '<%=url%>')", 100);
     498          </script>
    534499          <%
    535500        }
    536         %>
    537         <script language="JavaScript">
    538         <%=script%>
    539         </script>
    540         <%
    541501      }
    542502      %>
     
    553513        String xLabel = HTML.urlEncode("A, log10(ch1 * ch2) / 2");
    554514        String yLabel = HTML.urlEncode("M, log2(ch1 / ch2)");
    555         StringBuilder script = new StringBuilder();
    556515        for (BioAssay bioAssay : bioAssayQuery.list(dc))
    557516        {
     
    560519          url += "&xLabel="+xLabel+"&yLabel="+yLabel;
    561520          url += "&title="+HTML.urlEncode(bioAssay.getName());
    562           script.append("addImage('CF").append(bioAssay.getId()).append("','").
    563           append(url).append("');\n");
    564521          %>
    565522          <img id="CF<%=bioAssay.getId()%>"
    566             src="../../../images/transparent_pixel.gif"
    567             width="400" height="300"
     523            src="../../../images/plot_generating_400x300.gif"
     524            width="400" height="300" 
    568525            alt="Correction factor plot for bioassay <%=HTML.encodeTags(bioAssay.getName())%>"
    569             class="plot"
    570             >
     526            style="border: 1px solid #666666;">
     527          <script language="JavaScript">
     528          setTimeout("changeImage('CF<%=bioAssay.getId()%>', '<%=url%>')", 100);
     529          </script>
    571530          <%
    572531        }
    573         %>
    574         <script language="JavaScript">
    575         <%=script%>
    576         </script>
    577         <%
    578532      }
    579533      %>
  • trunk/www/views/jobs/index.jsp

    r4090 r4093  
    3939  import="net.sf.basedb.core.PermissionDeniedException"
    4040  import="net.sf.basedb.core.ItemAlreadyExistsException"
     41  import="net.sf.basedb.core.signal.SignalTransporter"
     42  import="net.sf.basedb.core.signal.Signal"
    4143  import="net.sf.basedb.util.RemovableUtil"
    4244  import="net.sf.basedb.util.ShareableUtil"
     
    238240    redirect = viewPage;
    239241  }
     242  else if ("AbortJob".equals(cmd))
     243  {
     244    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     245    dc = sc.newDbControl();
     246    Job job = Job.getById(dc, cc.getId());
     247    if (job.getStatus() == Job.Status.WAITING)
     248    {
     249      job.doneError("Aborted by user");
     250    }
     251    else
     252    {
     253      SignalTransporter signalTransporter = job.getSignalTransporter();
     254      if (signalTransporter != null) signalTransporter.send(Signal.ABORT);
     255    }
     256    dc.commit();
     257    Thread.sleep(500);
     258    redirect = viewPage;
     259  }
    240260  else
    241261  {
  • trunk/www/views/jobs/view_job.jsp

    r4090 r4093  
    4747  import="net.sf.basedb.core.plugin.GuiContext"
    4848  import="net.sf.basedb.core.plugin.Plugin"
     49  import="net.sf.basedb.core.signal.SignalTransporter"
     50  import="net.sf.basedb.core.signal.Signal"
    4951  import="net.sf.basedb.clients.web.Base"
    5052  import="net.sf.basedb.clients.web.util.HTML"
     
    5759  import="java.util.List"
    5860  import="java.util.Collections"
     61  import="java.util.Collection"
    5962%>
    6063<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
     
    103106  Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc);
    104107  Formatter<Date> dateTimeFormatter = FormatterFactory.getDateTimeFormatter(sc);
     108 
     109  // Check if the plug-in supports the "Abort" signal
     110  boolean supportsAbort = status == Job.Status.WAITING && writePermission;
     111  if (status == Job.Status.EXECUTING && writePermission)
     112  {
     113    try
     114    {
     115      SignalTransporter signalTransporter = job.getSignalTransporter();
     116      Collection<Signal> supportedSignals = signalTransporter != null ?
     117        signalTransporter.getSupportedSignals() : null;
     118      supportsAbort = signalTransporter != null &&
     119        (supportedSignals == null || supportedSignals.contains(Signal.ABORT));
     120    }
     121    catch (Exception ex)
     122    {}
     123  }
    105124  %>
    106125
     
    116135    }
    117136  }
     137  function abortJob()
     138  {
     139    if (confirm('Are you sure? This action may not be undone'))
     140    {
     141      location.href = 'index.jsp?ID=<%=ID%>&cmd=AbortJob&item_id=<%=itemId%>';
     142    }
     143  }
    118144  function restartJob()
    119145  {
     
    147173  </base:head>
    148174  <base:body onload="autoUpdate()">
    149    
    150175    <h3 class="docked"><%=title%> <base:help tabcontrol="main" /></h3>
    151176    <t:tabcontrol id="main" active="<%=tab%>" position="bottom" contentstyle="<%="height: "+(int)(scale*320)+"px;"%>">
     
    289314      </table>
    290315      </t:tab>
    291      
    292316      <%
    293317      if (job.getStackTrace() != null)
     
    474498      %>
    475499      <%
     500      if (supportsAbort)
     501      {
     502        %>
     503        <base:button onclick="abortJob()" title="Abort&hellip;" image="abort.png" />
     504        <%
     505      }
     506      %>
     507      <%
    476508      if (job.getStatus() == Job.Status.ERROR && job.getJobType() == Job.Type.RUN_PLUGIN)
    477509      {
  • trunk/www/views/rawbioassays/edit_rawbioassay.jsp

    r4090 r4093  
    509509    {
    510510      parentsChanged = true;
     511      <%
     512      if (rawBioAssay != null && rawBioAssay.getNumDbSpots() > 0)
     513      {
     514        %>
     515        var frm = document.forms['rawbioassay'];
     516        var selectedId = frm.arraydesign_id[frm.arraydesign_id.selectedIndex].value;
     517        var showFiMethod = (selectedId > 0 && selectedId != <%=currentArrayDesign == null ? 0 : currentArrayDesign.getId()%>);
     518        if (showFiMethod)
     519        {
     520          Main.show('fiMethod');
     521        }
     522        else
     523        {
     524          Main.hide('fiMethod');
     525        }
     526        <%
     527      }
     528      %>
    511529    }
    512530    function selectArrayDesignOnClick()
     
    535553      list.selectedIndex = 1;
    536554      parentsChanged = true;
     555      arrayDesignOnChange();
    537556    }
    538557   
     
    653672        </td>
    654673      </tr>
    655 
     674      <tr id="fiMethod" style="display: none;">
     675        <td></td>
     676        <td>
     677        <select name="fiMethod">
     678        <option value="">-auto- (array design decides)
     679        <option value="COORDINATES">Coordinates
     680        <option value="POSITION">Position
     681        <option value="FEATURE_ID">Feature ID (*)
     682        </select>
     683        <br>
     684        Select a method for feature identification. <br>
     685        (*) The Feature ID method only works if the raw data is currently
     686        connected to an array design which has Feature ID values.
     687        </td>
     688      </tr>
    656689      <tr>
    657690        <td class="prompt">Protocol</td>
  • trunk/www/views/rawbioassays/index.jsp

    r4090 r4093  
     1<%@page import="net.sf.basedb.core.FeatureIdentificationMethod"%>
    12<%-- $Id$
    23  ------------------------------------------------------------------
     
    9091    private final int arrayDesignId;
    9192    private final SessionControl sc;
    92    
    93     private UpdateArrayDesign(Job job, RawBioAssay rba, ArrayDesign design)
     93    private final FeatureIdentificationMethod fiMethod;
     94   
     95    private UpdateArrayDesign(Job job, RawBioAssay rba, ArrayDesign design, FeatureIdentificationMethod fiMethod)
    9496    {
    9597      this.jobId = job.getId();
     
    9799      this.arrayDesignId = design.getId();
    98100      this.sc = job.getSessionControl();
     101      this.fiMethod = fiMethod;
    99102    }
    100103   
     
    113116        try
    114117        {
    115           rba.updateArrayDesign(design, progress);
     118          rba.updateArrayDesign(design, fiMethod, progress);
    116119          progress.display(99, "Committing changes to database...");
    117120          dc.commit();
     
    124127        catch (Throwable t)
    125128        {
     129          if (dc != null) dc.close();
    126130          dc = sc.newDbControl();
    127131          j = Job.getById(dc, jobId);
     
    284288    Job job = null;
    285289    ArrayDesign ad = null;
     290    FeatureIdentificationMethod fiMethod = null;
    286291    int arrayDesignId = Values.getInt(request.getParameter("arraydesign_id"), -1);
    287292    if (arrayDesignId >= 0) // < 0 = denied or unchanged
     
    290295      if (rba.hasData())
    291296      {
     297        try
     298        {
     299          fiMethod = FeatureIdentificationMethod.valueOf(request.getParameter("fiMethod"));
     300        }
     301        catch (Exception ex)
     302        {}
    292303        if (rba.getRawDataType().isStoredInDb() && ad != null && ad.hasFeatures())
    293304        {
     
    301312        else
    302313        {
    303           rba.updateArrayDesign(ad, null);
     314          rba.updateArrayDesign(ad, fiMethod, null);
    304315        }
    305316      }
     
    323334    {
    324335      redirect = "../jobs/index.jsp?ID="+ID+"&cmd=ViewItem&item_id="+job.getId();
    325       Thread updateThread = new Thread(new UpdateArrayDesign(job, rba, ad));
     336      Thread updateThread = new Thread(new UpdateArrayDesign(job, rba, ad, fiMethod));
    326337      updateThread.setPriority(Thread.currentThread().getPriority() - 1);
    327338      updateThread.start();
  • trunk/www/views/rawbioassays/rawdata/list_rawdata.jsp

    r4090 r4093  
    9595
    9696  final DataQuery<RawData> query = rawBioAssay.getRawData();
     97  query.join(Hql.leftJoin(null, "reporter", "r", null, true));
     98  query.join(Hql.leftJoin(null, "feature", "f", null, true));
     99  query.join(Hql.leftJoin("f", "arrayDesignBlock", "b", null, true));
    97100  cc.configureQuery(query, true);
    98101  if (!"row".equals(cc.getSortProperty())) query.order(Orders.asc(Hql.property("row")));
     
    397400        datatype="int"
    398401        title="[Feat] Position"
     402        sortable="true"
     403        filterable="true"
     404        exportable="true"
     405      />
     406      <tbl:columndef
     407        id="feature.externalId"
     408        property="feature.externalId"
     409        datatype="string"
     410        title="[Feat] Feature ID"
    399411        sortable="true"
    400412        filterable="true"
     
    704716                  %>
    705717                  <tbl:cell column="feature.position"><i>- none -</i></tbl:cell>
     718                  <tbl:cell column="feature.externalId"><i>- none -</i></tbl:cell>
    706719                  <tbl:cell column="feature.row"><i>- none -</i></tbl:cell>
    707720                  <tbl:cell column="feature.column"><i>- none -</i></tbl:cell>
     
    721734                  %>
    722735                  <tbl:cell column="feature.position"><%=feature.getPosition()%></tbl:cell>
     736                  <tbl:cell column="feature.externalId"><%=HTML.encodeTags(feature.getExternalId())%></tbl:cell>
    723737                  <tbl:cell column="feature.row"><%=feature.getRow()%></tbl:cell>
    724738                  <tbl:cell column="feature.column"><%=feature.getColumn()%></tbl:cell>
  • trunk/www/views/reporters/index.jsp

    r4090 r4093  
    4242  import="net.sf.basedb.core.PermissionDeniedException"
    4343  import="net.sf.basedb.core.BaseException"
     44  import="net.sf.basedb.core.User"
    4445  import="net.sf.basedb.util.RemovableUtil"
    4546  import="net.sf.basedb.util.ShareableUtil"
  • trunk/www/views/reporters/list_reporters.jsp

    r4090 r4093  
    243243        exportable="true"
    244244        formatter="<%=timeFormatter%>"
     245      />
     246      <tbl:columndef
     247        id="lastSource"
     248        property="lastSource"
     249        datatype="string"
     250        title="Last source"
     251        sortable="true"
     252        filterable="true"
     253        exportable="true"
    245254      />
    246255      <%
     
    424433                <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell>
    425434                <tbl:cell column="lastUpdate" value="<%=item.getLastUpdate()%>" />
     435                <tbl:cell column="lastSource"><%=HTML.encodeTags(item.getLastSource())%></tbl:cell>
    426436                <tbl:cell column="reporterType"
    427437                  ><base:propertyvalue
  • trunk/www/views/reporters/view_reporter.jsp

    r4090 r4093  
    191191        <td><%=dateFormatter.format(reporter.getLastUpdate())%></td>
    192192      </tr>
     193      <tr>
     194        <td class="prompt">Last source</td>
     195        <td><%=HTML.niceFormat(reporter.getLastSource())%></td>
     196      </tr>
    193197      </table>
    194198     
Note: See TracChangeset for help on using the changeset viewer.