Changeset 4090
- Timestamp:
- Jan 18, 2008, 2:10:56 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 4 deleted
- 89 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/config/dist/base.config
r4078 r4090 77 77 # If the internal job queue should be enabled or not 78 78 jobqueue.internal.enabled = true 79 80 # Signal receiver class for sending signals to running jobs (to abort them)81 jobqueue.internal.signalreceiver.class = net.sf.basedb.core.signal.LocalSignalReceiver82 jobqueue.internal.signalreceiver.init = jobqueue:083 79 84 80 # If plugins with useInteralJobQueue = false should be executed or not -
trunk/config/dist/log4j.properties
r4074 r4090 54 54 #log4j.logger.net.sf.basedb.core.storage=debug 55 55 56 ### Log Signal handling events57 #log4j.logger.net.sf.basedb.core.signal=debug58 59 60 56 # ----------------- 61 57 # Migration loggers -
trunk/doc/src/docbook/appendix/base.config.xml
r4078 r4090 379 379 380 380 <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. If387 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 outside395 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 implementation406 that is used. Please see the javadoc for more information.407 </para>408 </listitem>409 </varlistentry>410 411 <varlistentry>412 381 <term><property>jobqueue.internal.checkinterval</property></term> 413 382 <listitem> -
trunk/doc/src/docbook/appendix/incompatible.xml
r4083 r4090 45 45 </para> 46 46 </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 the55 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 COORDINATES62 may no longer work if used with an array design using a different identification method.63 Code that is, directly or indirectly, using a64 <classname docapi="net.sf.basedb.core">FeatureBatcher</classname> or65 <classname docapi="net.sf.basedb.core">RawDataBatcher</classname> are66 probably affected by this. For example, a raw data importer which67 doesn't know how to set the position or the feature ID can't import data to68 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 other76 identification methods will still do that, but when using the POSITION identification77 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 between79 1 and the number of features may fail if used with an array design using80 the POSITION identification method.81 </para>82 </listitem>83 </itemizedlist>84 85 </sect1>86 47 87 48 <sect1 id="appendix.incompatible.2.5"> -
trunk/doc/src/docbook/developerdoc/api_overview.xml
r4080 r4090 730 730 731 731 <para> 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. 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. 746 735 </para> 747 736 </sect3> … … 1958 1947 from plates. In the first case the features on an array design 1959 1948 are described by a reporter map. A reporter map is a file 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. 1949 that maps a coordinate on an array design to a reporter. 1964 1950 The coordinate system on an array design is divided into blocks. 1965 1951 Each block can be identified either by a <property>blockNumber</property> … … 1968 1954 contains several <classname docapi="net.sf.basedb.core.data">FeatureData</classname> items, each 1969 1955 one identified by a row and column coordinate. Platforms that doesn't 1970 divide the array design into block s or doesn't use the coordinate system at all1971 must still create a single super-block that holds all features.1956 divide the array design into block should create a single super-block 1957 that holds all features. 1972 1958 </para> 1973 1959 … … 2809 2795 2810 2796 </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 of2817 a system. This signalling system was initially developed to be able to2818 kill plug-ins that a user for some reason wanted to abort. The signalling2819 system as such is not limited to this and it can be used for other purposes2820 as well. Signals can of course be handled internally in a single JVM but2821 also sent externally to other JVM:s running on the same or a different2822 computer. The transport mechanism for signals is decoupled from the actual2823 handling of them. If you want to, you could implement a signal transporter2824 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 and2829 transportation of signals. For more information about handling signals2830 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 <imagedata2841 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 wish2851 to receieve signals must implement the2852 <interfacename docapi="net.sf.basedb.core.signal"2853 >SignalTarget</interfacename>. It's only method2854 is <methodname>getSignalHandler()</methodname>. A2855 <interfacename docapi="net.sf.basedb.core.signal"2856 >SignalHandler</interfacename> is an object that2857 knows what to do when a signal is delivered to it. The target object2858 may implement the <interfacename>SignalHandler</interfacename> itself2859 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 usually2864 delivered by a separate thread. The target object must be aware2865 of this and know how to handle multiple threads. As an example we2866 can use the <classname docapi="net.sf.basedb.core.signal"2867 >ThreadSignalHandler</classname> which simply2868 calls <code>Thread.interrupt()</code> to deliver a signal. The target2869 object that uses this signal handler it must know that it should check2870 <code>Thread.interrupted()</code> at regular intervals from the main2871 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 as2873 soon as possible.2874 </para>2875 2876 <para>2877 Even if a signal handler could be given directly to the party2878 that may be interested in sending a signal to the target this2879 is not recommended. This would only work when sending signals2880 within the same virtual machine. The signalling system includes2881 <interfacename docapi="net.sf.basedb.core.signal"2882 >SignalTransporter</interfacename> and2883 <interfacename docapi="net.sf.basedb.core.signal"2884 >SignalReceiver</interfacename> objects that are used2885 to decouple the sending of signals with the handling of signals. The2886 implementation usually comes in pairs, for example2887 <classname docapi="net.sf.basedb.core.signal"2888 >SocketSignalTransporters</classname> and <classname2889 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 current2895 setup. Ie. should signals be delievered by TCP/IP sockets, only internally, or2896 should a delivery mechanism based on web services be implemented?2897 If a system wants to receive signals it must create an appropriate2898 <interfacename>SignalReceiver</interfacename> object. Within BASE the2899 internal job queue set up it's own signalling system that can be used to2900 send signals (eg. kill) running jobs. The job agents do the same but uses2901 a different implementation. See <xref linkend="appendix.base.config.jobqueue" />2902 for more information about how to configure the internal job queue's2903 signal receiver. In both cases, there is only one signal receiver instance2904 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 signal2915 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 can2919 be changed to a <classname docapi="net.sf.basedb.core.signal"2920 >SocketSignalReceiver</classname> or any other2921 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 if2928 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 registered2931 with the signal receiver. This is actually done by the BASE core2932 by calling <methodname>PluginExecutionRequest.registerSignalReceiver()</methodname>2933 which also makes sure that the the ID returned from the registration is2934 stored in the database together with the job item representing the2935 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-empty2942 signal transporter property, the <guilabel>Abort</guilabel>2943 button is activated. If the user clicks this button the BASE core2944 uses the information in the database to create2945 <interfacename docapi="net.sf.basedb.core.signal"2946 >SignalTransporter</interfacename> object. This2947 is simply done by calling <code>Job.getSignalTransporter()</code>.2948 The created signal transporter knows how to send a signal2949 to the signal receiver it was first registered with. When the2950 signal arrives at the receiver it will find the handler for it2951 and call <code>SignalHandler.handleSignal()</code>. This will in it's turn2952 trigger some action in the signal target which soon will abort what2953 it is doing and exit.2954 </para>2955 </listitem>2956 </itemizedlist>2957 2958 2959 </sect3>2960 2961 </sect2>2962 2963 2797 </sect1> 2964 2798 -
trunk/doc/src/docbook/developerdoc/plugin_developer.xml
r4078 r4090 4365 4365 </sect1> 4366 4366 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 send4372 signals to plug-ins. The system was primarly developed to allow a user4373 to kill a plug-in when it is executing. Therfore, the focus of this chapter4374 will be how to implement a plug-in to make it possible to kill it4375 during it's execution.4376 </para>4377 4378 <para>4379 Since we don't want to do this by brute force such as destroying the4380 process or stopping thread the plug-in executes in, cooperation is needed4381 by the plug-in. First, the plug-in must implement the4382 <interfacename docapi="net.sf.basedb.core.signal">SignalTarget</interfacename>4383 interface. From this, a <interfacename4384 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 existing4386 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 this4396 at regular intervals and if the flag is set it must cleanup, rollback4397 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, for4404 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 the4412 plug-in waiting in a non-interruptable state. In this case there4413 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 the4421 <classname>ThreadSignalHandler</classname>.4422 </para>4423 <programlisting language="java">4424 <![CDATA[4425 private ThreadSignalHandler signalHandler;4426 public SignalHandler getSignalHandler()4427 {4428 signalHandler = new ThreadSignalHandler();4429 return signalHandler;4430 }4431 4432 public 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 try4441 {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 calls4448 // a blocking method that is interruptable4449 interrupted = true;4450 }4451 }4452 if (interrupted)4453 {4454 rollbackTransaction();4455 response.setError("Aborted by user", null);4456 }4457 else4458 {4459 commitTransaction();4460 response.setDone("Done");4461 }4462 }4463 ]]>4464 </programlisting>4465 4466 <para>4467 Another signal handler implementation is the4468 <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 4476 4367 <sect1 id="plugin_developer.classload"> 4477 4368 <title>How BASE load plug-in classes</title> -
trunk/doc/src/docbook/userdoc/rawbioassays.xml
r4083 r4090 138 138 The array design can be changed after raw data has been 139 139 imported, but this triggers a new validation. If the raw data 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 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 168 143 CEL file is validated against the CDF file of the new array design. 169 144 If the validation fails, the array design is not changed. -
trunk/doc/src/docbook/userdoc/webclient.xml
r4072 r4090 1539 1539 <informalexample>Experiment A, Experiment B, etc.</informalexample> 1540 1540 </para> 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> 1541 1548 1542 <para> 1549 1543 You can also use operators to find items which has a value that … … 1577 1571 <varlistentry> 1578 1572 <term><keycap>=</keycap></term> 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> 1573 <listitem><simpara>Equal to (useful to find items with a null value)</simpara></listitem> 1585 1574 </varlistentry> 1586 1575 <varlistentry> 1587 1576 <term><keycap><></keycap></term> 1588 1577 <term><keycap>!=</keycap></term> 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> 1578 <listitem><simpara>Not equal to (useful to find items with a non-null value)</simpara></listitem> 1603 1579 </varlistentry> 1604 1580 </variablelist> -
trunk/src/clients/jobagent/net/sf/basedb/clients/jobagent/Agent.java
r4078 r4090 50 50 import net.sf.basedb.util.Values; 51 51 import net.sf.basedb.util.jobagent.JobAgentServerConnection; 52 import net.sf.basedb.util.jobagent.JobInfo;53 52 import net.sf.basedb.util.jobagent.RequestHandler; 54 53 import net.sf.basedb.util.timer.Scheduler; … … 251 250 private JobAgentServerConnection server; 252 251 private RequestHandler requestHandler; 253 private AgentSignalReceiver signalReceiver;254 252 private JobExecutor jobExecutor; 255 253 … … 275 273 private final Map<Job.ExecutionTime, Integer> priorities; 276 274 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 275 private final Set<Integer> activeJobs; 276 285 277 /** 286 278 The group were all job runners are placed. … … 352 344 runnersGroup.setDaemon(false); 353 345 354 this.activeJobs = new HashSet< JobInfo>();346 this.activeJobs = new HashSet<Integer>(); 355 347 isRunning = false; 356 348 } … … 538 530 if (server == null) 539 531 { 540 this.signalReceiver = new AgentSignalReceiver(this);541 this.signalReceiver.init(null);542 532 this.requestHandler = requestHandler == null ? new DefaultRequestHandler(this) : requestHandler; 543 533 this.server = new JobAgentServerConnection(port, this.requestHandler, logServer); … … 644 634 Get a set containing the ID:s of the jobs that are currently 645 635 beeing executed by this job agent. 646 @return A set of JobInfo objects 647 @since 2.6 648 */ 649 public Set<JobInfo> getRunningJobs() 636 @return A set of integers 637 */ 638 public Set<Integer> getRunningJobs() 650 639 { 651 640 if (log.isDebugEnabled()) log.debug("Active jobs: " + activeJobs); … … 694 683 } 695 684 return allow; 696 }697 698 /**699 Get the signal receiver that is processing signal messages700 on behalf of this job agent.701 @since 2.6702 */703 public AgentSignalReceiver getSignalReceiver()704 {705 return signalReceiver;706 685 } 707 686 … … 814 793 slotToUse = slots[i]; 815 794 usedSlots.put(slotToUse, usedSlots.get(slotToUse) + 1); 816 activeJobs.add( new JobInfo(job, slotToUse));795 activeJobs.add(job.getId()); 817 796 log.debug("Slot: " + slotToUse + "; used: " + usedSlots.get(slotToUse) + "; max: " + maxSlots.get(slotToUse)); 818 797 break; … … 851 830 { 852 831 usedSlots.put(usedSlot, usedSlots.get(usedSlot) - 1); 853 activeJobs.remove( new JobInfo(job, usedSlot));832 activeJobs.remove(job.getId()); 854 833 } 855 834 … … 936 915 937 916 /** 938 Try to stop running jobs by interrupting the threads th ey are executing in.917 Try to stop running jobs by interrupting the threads thaey are executing in. 939 918 */ 940 919 private void maybeStopRunningJobs() 941 920 { 942 921 log.info("Stopping running jobs. " + activeJobs.size() + " job(s) still active."); 943 944 // Send ABORT to all jobs, that support signals 945 signalReceiver.close(closeTimeout); 922 // Interrupt all threads. Hopefully they will do as we tell them. 923 runnersGroup.interrupt(); 946 924 } 947 925 -
trunk/src/clients/jobagent/net/sf/basedb/clients/jobagent/executors/DummyJobExecutor.java
r4078 r4090 24 24 package net.sf.basedb.clients.jobagent.executors; 25 25 26 import java.util.Collections;27 28 26 import net.sf.basedb.clients.jobagent.Agent; 29 27 import net.sf.basedb.clients.jobagent.JobExecutor; … … 32 30 import net.sf.basedb.core.JobAgentSettings; 33 31 import net.sf.basedb.core.SessionControl; 34 import net.sf.basedb.core.signal.SignalReceiver;35 import net.sf.basedb.core.signal.ThreadSignalHandler;36 32 import net.sf.basedb.util.Values; 37 33 … … 93 89 log.info("Executing job: " + job); 94 90 DbControl dc = null; 95 boolean aborted = false;96 Throwable error = null;97 91 try 98 92 { … … 102 96 if (wait > 0) 103 97 { 104 SignalReceiver signalReceiver = agent.getSignalReceiver();105 job.setSignalTransporter(signalReceiver.getSignalTransporterClass(),106 signalReceiver.registerSignalHandler(new ThreadSignalHandler()));107 98 job.setProgress(50, "Halfway; waiting " + wait + " seconds"); 108 99 dc.commit(); … … 114 105 } 115 106 } 116 catch (InterruptedException ex)117 {118 aborted = true;119 }120 107 catch (Throwable t) 121 108 { 122 109 log.error(t.getMessage(), t); 123 error = t;124 110 } 125 111 dc = sc.newDbControl(); 126 112 dc.reattachItem(job); 127 113 } 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 } 114 job.doneOk("Not really, but used for testing job agent"); 140 115 dc.commit(); 141 116 log.info("Done executing: " + job); -
trunk/src/clients/jobagent/net/sf/basedb/clients/jobagent/executors/ProcessJobExecutor.java
r4078 r4090 42 42 import net.sf.basedb.core.PluginDefinition; 43 43 import net.sf.basedb.core.SessionControl; 44 import net.sf.basedb.core.signal.Signal;45 import net.sf.basedb.core.signal.SignalHandler;46 import net.sf.basedb.core.signal.SignalReceiver;47 import net.sf.basedb.core.signal.SignalTransporter;48 import net.sf.basedb.core.signal.ThreadSignalHandler;49 44 import net.sf.basedb.util.Values; 50 45 … … 106 101 private String javaBin; 107 102 private String options; 108 private SignalReceiver signalReceiver;109 private SignalHandler signalHandler;110 103 111 104 public ProcessJobExecutor() … … 127 120 if (javaBin == null) javaBin = "java"; 128 121 options = Values.getString(agent.getProperty("agent.executor.process.options"), "-server"); 129 signalReceiver = agent.getSignalReceiver();130 122 } 131 123 … … 134 126 { 135 127 log.info("Executing job: " + job); 136 128 137 129 // Generate command for new process 138 130 List<String> cmd = new ArrayList<String>(10); … … 172 164 cmd.add("-t"); // Thread priority 173 165 cmd.add(Integer.toString(agent.getThreadPriority(job.getEstimatedExecutionTime()))); 174 cmd.add("-x"); // Port the job agent is listening on for remote control175 cmd.add(Integer.toString(agent.getPort()));176 166 177 167 Process process = null; … … 211 201 new InputStreamReader(process.getInputStream()), result)); 212 202 t.start(); 213 203 214 204 try 215 205 { 216 206 log.info("Waiting for process to end"); 217 signalHandler = new ThreadSignalHandler();218 signalReceiver.registerSignalHandler(signalHandler);219 207 int exitCode = process.waitFor(); 220 208 if (exitCode != 0) … … 236 224 { 237 225 log.info("Job was interrupted: " + job, ex); 238 // First, send ABORT to the job if it supports it 226 // Kill the process 227 process.destroy(); 239 228 dc = sc.newDbControl(); 240 229 job = Job.getById(dc, job.getId()); 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 } 230 job.doneError(ex.getMessage(), Arrays.asList(ex)); 251 231 dc.commit(); 252 }253 finally254 {255 signalReceiver.unregisterSignalHandler(signalHandler);256 232 } 257 233 } -
trunk/src/clients/jobagent/net/sf/basedb/clients/jobagent/executors/ThreadJobExecutor.java
r4078 r4090 39 39 import net.sf.basedb.core.SessionControl; 40 40 import net.sf.basedb.core.plugin.Response; 41 import net.sf.basedb.core.signal.SignalReceiver;42 import net.sf.basedb.core.signal.SocketSignalReceiver;43 41 import net.sf.basedb.util.SocketUtil; 44 42 import net.sf.basedb.util.Values; … … 67 65 org.apache.log4j.LogManager.getLogger("net.sf.basedb.clients.jobagent.executors.ThreadJobExecutor"); 68 66 69 private SignalReceiver signalReceiver;70 67 71 68 public ThreadJobExecutor() … … 77 74 */ 78 75 public void init(Agent agent) 79 { 80 this.signalReceiver = agent == null ? null : agent.getSignalReceiver(); 81 } 76 {} 82 77 83 78 public void executeJob(SessionControl sc, Agent agent, Job job, JobAgentSettings settings, … … 104 99 log.error("Error executing job: " + job, t); 105 100 } 106 exec.registerSignalReceiver(signalReceiver);107 101 dc.commit(); 108 102 … … 136 130 // ------------------------------------------- 137 131 138 private void setSignalReceiver(SignalReceiver signalReceiver)139 {140 this.signalReceiver = signalReceiver;141 }142 143 132 public static void main(String[] args) 144 133 { … … 149 138 String login = cmdLine.getOption("-u"); 150 139 String password = cmdLine.getOption("-p"); 151 String proxyPort = cmdLine.getOption("-x");152 140 int threadPriority = Values.getInt(cmdLine.getOption("-t"), Thread.NORM_PRIORITY); 153 141 … … 163 151 { 164 152 ThreadJobExecutor executor = new ThreadJobExecutor(); 165 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 153 174 154 sc = Application.newSessionControl("net.sf.basedb.clients.jobagent", … … 208 188 } 209 189 210 private static class ShutdownHook211 implements Runnable212 {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 }224 190 } -
trunk/src/clients/jobagent/net/sf/basedb/clients/jobagent/handlers/DefaultRequestHandler.java
r4078 r4090 69 69 registerHandler(new StopRequestHandler(agent), "stop"); 70 70 registerHandler(new PauseRequestHandler(agent), "pause"); 71 if (agent.getSignalReceiver() != null)72 {73 registerHandler(new SignalRequestHandler(agent), "signal");74 }75 71 } 76 72 … … 93 89 String answer = null; 94 90 RequestHandler handler = commandHandlers.get(cmd); 95 if (handler == null && cmd != null && cmd.startsWith("signal://"))96 {97 handler = commandHandlers.get("signal");98 }99 91 if (!agent.isAllowedControl(remote, cmd)) 100 92 { -
trunk/src/clients/migrate/net/sf/basedb/clients/migrate/ArrayBlockTransfer.java
r4080 r4090 33 33 import net.sf.basedb.core.DbControl; 34 34 import net.sf.basedb.core.FeatureBatcher; 35 import net.sf.basedb.core.FeatureIdentificationMethod;36 35 import net.sf.basedb.core.ItemNotFoundException; 37 36 import net.sf.basedb.core.Plate; … … 114 113 ArrayDesign arrayDesign = ArrayDesign.getById(dc, base2Id); 115 114 PreparedStatement ps = prepareStatementFromFile("selectArrayBlocksByArrayType"); 116 FeatureBatcher featureBatcher = arrayDesign.getFeatureBatcher( FeatureIdentificationMethod.COORDINATES);115 FeatureBatcher featureBatcher = arrayDesign.getFeatureBatcher(); 117 116 log.debug("Setting batch size to: " + getBatchSize()); 118 117 featureBatcher.setBatchSize(getBatchSize()); -
trunk/src/clients/migrate/net/sf/basedb/clients/migrate/RawBioAssayDataTransfer.java
r4083 r4090 168 168 */ 169 169 cleanUpMemory(); 170 RawDataBatcher batcher = rawBioAssay.getRawDataBatcher( null);170 RawDataBatcher batcher = rawBioAssay.getRawDataBatcher(); 171 171 batcher.setBatchSize(getBatchSize()); 172 172 runRawBioAssay(rawBioAssay, batcher, hasArrayDesign, rawBioAssayId); -
trunk/src/clients/web/net/sf/basedb/clients/web/fileupload/FileUpload.java
r4034 r4090 774 774 throws IOException 775 775 { 776 if (status.eof || status.atBoundary) return -1; 776 int available = end - start; 777 if (available == 0) 778 { 779 if (status.eof || status.atBoundary) return -1; 780 available = readMoreData(); 781 } 777 782 int result = -1; 778 int available = end - start;779 if (available == 0) available = readMoreData();780 783 if (available > 0) 781 784 { 782 result = buffer[start]; 785 // Important! Mask with 0xff to get values in range (0,255), NOT (-128,127) 786 result = buffer[start] & 0xff; 783 787 start++; 784 788 } -
trunk/src/clients/web/net/sf/basedb/clients/web/plugins/SimpleExport.java
r3991 r4090 468 468 template.writeHeaders(); 469 469 470 intnumExported = 0;470 long numExported = 0; 471 471 ResultIterator result = null; 472 472 try … … 506 506 if (progress != null) 507 507 { 508 int percent = (int)(100 f* numExported / totalItems);508 int percent = (int)(100L * numExported / totalItems); 509 509 progress.display(percent, numExported + " of " + totalItems + " done."); 510 510 } -
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/Head.java
r4084 r4090 90 90 91 91 /** 92 93 */94 private static final long serialVersionUID = 948719986796860767L;95 96 /**97 92 The parent <base:page> tag. 98 93 */ -
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/HideableSection.java
r4084 r4090 193 193 194 194 /** 195 196 */197 private static final long serialVersionUID = 4750788983708350436L;198 199 /**200 195 The parent <base:page> tag. 201 196 */ -
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/Note.java
r4084 r4090 155 155 { 156 156 157 /**158 159 */160 private static final long serialVersionUID = 7490498743887372136L;161 162 157 private static final int NOTE_TYPE_ERROR = 1; 163 158 -
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/Page.java
r4084 r4090 278 278 throws JspException 279 279 { 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()); 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 } 289 292 } 290 293 return EVAL_PAGE; -
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/PropertyValue.java
r4084 r4090 122 122 123 123 /** 124 125 */126 private static final long serialVersionUID = -92637960053523649L;127 128 /**129 124 The item. Should be BasicItem or BasicData. 130 125 */ -
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/Select.java
r4084 r4090 228 228 229 229 230 /**231 232 */233 private static final long serialVersionUID = -9096279950931870965L;234 235 230 /** 236 231 Optional <code>class</code> attribute -
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/menu/Menuitem.java
r4084 r4090 136 136 { 137 137 /** 138 139 */140 private static final long serialVersionUID = 1431778959423572670L;141 142 /**143 138 The parent Menu. 144 139 */ -
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/menu/Menuseparator.java
r4084 r4090 91 91 { 92 92 93 /**94 95 */96 private static final long serialVersionUID = -1758168104130104042L;97 98 93 private Menu menu; 99 94 -
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/menu/Submenu.java
r4084 r4090 135 135 { 136 136 /** 137 138 */139 private static final long serialVersionUID = -9170636903520137656L;140 141 /**142 137 The parent Menu. 143 138 */ -
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/tab/Tab.java
r4084 r4090 127 127 128 128 /** 129 130 */131 private static final long serialVersionUID = -2308568821797105775L;132 133 /**134 129 The parent TabControl object. 135 130 */ -
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/tab/TabControl.java
r4084 r4090 157 157 { 158 158 /** 159 160 */161 private static final long serialVersionUID = 1898616270560551262L;162 163 /**164 159 Optional <code>style</code> attribute 165 160 */ -
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/Button.java
r4084 r4090 167 167 168 168 /** 169 170 */171 private static final long serialVersionUID = -6294795199053088632L;172 173 /**174 169 The parent <tbl:table> tag. 175 170 */ -
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/Cell.java
r4084 r4090 111 111 112 112 /** 113 114 */115 private static final long serialVersionUID = -1992298892993613884L;116 117 /**118 113 The parent <tbl:table> tag. 119 114 */ -
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/CellValue.java
r4084 r4090 23 23 */ 24 24 package net.sf.basedb.clients.web.taglib.table; 25 26 import java.util.List; 25 27 26 28 import javax.servlet.jsp.JspException; … … 89 91 { 90 92 91 /**92 93 */94 private static final long serialVersionUID = 4068184541728474047L;95 96 93 private static final Formatter toStringFormatter = new ToStringFormatter(); 97 94 … … 100 97 */ 101 98 private Object value = null; 102 private Iterable<?> list = null;99 private List<?> list = null; 103 100 private String separator = "; "; 104 101 … … 116 113 } 117 114 118 public void setList( Iterable<?> list)115 public void setList(List<?> list) 119 116 { 120 117 this.list = list; 121 118 } 122 119 123 public Iterable<?> getList()120 public List<?> getList() 124 121 { 125 122 return list; … … 154 151 theSeparator = separator; 155 152 } 156 if (list != null )153 if (list != null && list.size() > 0) 157 154 { 158 155 for (Object o : list) -
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/ColumnDef.java
r4084 r4090 253 253 extends TagSupport 254 254 { 255 256 /**257 258 */259 private static final long serialVersionUID = -272408513116029365L;260 255 261 256 /** -
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/Columns.java
r4084 r4090 54 54 { 55 55 56 /**57 58 */59 private static final long serialVersionUID = 8857257637171219032L;60 56 private Table table; 61 57 private Data data; -
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/Data.java
r4084 r4090 100 100 101 101 /** 102 103 */104 private static final long serialVersionUID = 6633768910320305875L;105 106 /**107 102 The parent <tbl:table> tag. 108 103 */ -
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/Header.java
r4084 r4090 92 92 93 93 /** 94 95 */96 private static final long serialVersionUID = -7541520513764712983L;97 98 /**99 94 The parent <tbl:table> tag. 100 95 */ -
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/Label.java
r4084 r4090 137 137 138 138 /** 139 140 */141 private static final long serialVersionUID = 5326481772609709567L;142 143 /**144 139 The parent <tbl:table> tag. 145 140 */ -
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/Panel.java
r4084 r4090 107 107 108 108 /** 109 110 */111 private static final long serialVersionUID = 8435173953529878997L;112 113 /**114 109 The parent <tbl:table> tag. 115 110 */ -
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/PresetSelector.java
r4084 r4090 58 58 extends TagSupport 59 59 { 60 61 /**62 63 */64 private static final long serialVersionUID = 6787200020881710014L;65 60 66 61 /** -
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/Row.java
r4084 r4090 117 117 118 118 /** 119 120 */121 private static final long serialVersionUID = 1975591924471893645L;122 123 /**124 119 The parent <tbl:table> tag. 125 120 */ -
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/Rows.java
r4084 r4090 54 54 { 55 55 56 /**57 58 */59 private static final long serialVersionUID = 2099882746242865479L;60 56 private Table table; 61 57 private Data data; -
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/Table.java
r4084 r4090 203 203 204 204 /** 205 206 */207 private static final long serialVersionUID = -6717117667917148241L;208 209 /**210 205 The parent <base:page> tag. 211 206 */ -
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/Toolbar.java
r4084 r4090 115 115 116 116 /** 117 118 */119 private static final long serialVersionUID = -8719987407920036604L;120 121 /**122 117 The parent <tbl:table> tag. 123 118 */ -
trunk/src/core/common-queries.xml
r4080 r4090 524 524 SELECT s 525 525 FROM net.sf.basedb.core.data.MimeTypeData s 526 WHERE s.extension = :extension526 WHERE LOWER(s.extension) = LOWER(:extension) 527 527 </sql> 528 528 <description> -
trunk/src/core/net/sf/basedb/core/Affymetrix.java
r3820 r4090 357 357 if (hasProgress && (index % progressInterval == 0)) 358 358 { 359 int percent = 5 + 90 * index / numProbesets;359 int percent = 5 + (int)(90L * (long)index / numProbesets); 360 360 int remain = numProbesets - index; 361 361 String created = create ? "; " + numCreated + " created" : ""; -
trunk/src/core/net/sf/basedb/core/Job.java
r4078 r4090 1279 1279 private long lastUpdate; 1280 1280 1281 private int lastValue; 1282 private int offset; 1283 1281 1284 ProgressReporterImpl(Job job, String server, ProgressReporter chained) 1282 1285 throws BaseException … … 1288 1291 this.chained = chained; 1289 1292 this.lastUpdate = 0; 1293 this.lastValue = 0; 1294 this.offset = 0; 1290 1295 } 1291 1296 … … 1299 1304 if (System.currentTimeMillis() - lastUpdate > UPDATE_INTERVAL || percent == 100) 1300 1305 { 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 1301 1323 lastUpdate = System.currentTimeMillis(); 1302 1324 DbControl dc = null; -
trunk/src/core/net/sf/basedb/core/RawBioAssay.java
r4083 r4090 1164 1164 1165 1165 DataResultIterator<RawData> result = rawQuery.iterate(dc); 1166 intnumValidated = 0;1166 long numValidated = 0; 1167 1167 int numTotal = getNumDbSpots(); 1168 1168 while (result.hasNext()) … … 1221 1221 if (progress != null && numValidated % 100 == 0) 1222 1222 { 1223 int percent = 10 + ( 90 * numValidated) / numTotal;1223 int percent = 10 + ((int)(90L * numValidated) / numTotal); 1224 1224 progress.display(percent, "Validated " + numValidated + " of " + numTotal + " spots."); 1225 1225 } -
trunk/src/core/net/sf/basedb/core/SpotImages.java
r3820 r4090 472 472 if (progress != null) 473 473 { 474 intspotsDone = spotImagesPerImage*imageNumber;475 int percent = 10 + 90 * spotsDone / totalSpots;474 long spotsDone = spotImagesPerImage*imageNumber; 475 int percent = 10 + (int)(90L * spotsDone / totalSpots); 476 476 progress.display(percent, "Generating spot images ("+spotsDone+" done)..."); 477 477 } -
trunk/src/core/net/sf/basedb/util/BioAssaySetFilterUtil.java
r4017 r4090 123 123 } 124 124 125 intspotsDone = 0;125 long spotsDone = 0; 126 126 int spotsAfter = 0; 127 127 if (progress != null) progress.display(10, "Filtering spots (0 done; "+spotsTotal+" total)..."); … … 139 139 if (progress != null) 140 140 { 141 int percent = 10 + 90 * spotsDone / spotsTotal;141 int percent = 10 + (int)(90L * spotsDone / spotsTotal); 142 142 progress.display(percent, 143 143 "Filtering spot intensities ("+spotsDone+" done; "+spotsTotal+" total)..."); … … 205 205 // Prepare progress reporting 206 206 int interval = 10; // Update progress after this many spots >= 10 207 intspotsDone = 0;207 long spotsDone = 0; 208 208 int spotsAfter = 0; 209 209 if (progress != null) … … 236 236 if (spotsDone % interval == 0) 237 237 { 238 int percent = 10 + 90 * spotsDone / spotsTotal;238 int percent = 10 + (int)(90L * spotsDone / spotsTotal); 239 239 progress.display(percent, 240 240 "Filtering spot intensities ("+spotsDone+" done; "+spotsTotal+" total)..."); -
trunk/src/core/net/sf/basedb/util/IntensityCalculatorUtil.java
r4020 r4090 305 305 int maxPosition = 0; 306 306 307 intspotsDone = 0; // Number of calculated spots307 long spotsDone = 0; // Number of calculated spots 308 308 int totalSpots = 0; // Total number of spots 309 309 int interval = 0; // Interval between reporter to the progress reporter … … 426 426 if (spotsDone % interval == 0) 427 427 { 428 int percent = 10 + 90 * spotsDone / totalSpots;428 int percent = 10 + (int)((90L * spotsDone) / totalSpots); 429 429 progress.display(percent, "Calculating spot intensities ("+spotsDone+" done)..."); 430 430 } -
trunk/src/core/net/sf/basedb/util/parser/FlatFileParser.java
r4020 r4090 47 47 import net.sf.basedb.core.BaseException; 48 48 import net.sf.basedb.core.Config; 49 import net.sf.basedb.util.InputStreamTracker; 49 50 50 51 /** … … 176 177 177 178 /** 179 For keeping track of the number of bytes parsed. 180 */ 181 private InputStreamTracker tracker; 182 183 /** 178 184 The regular expression for matching a header line. 179 185 */ … … 522 528 { 523 529 Charset cs = Charset.forName(charsetName == null ? Config.getCharset() : charsetName); 524 this.reader = new BufferedReader(new InputStreamReader(in, cs)); 530 this.tracker = new InputStreamTracker(in); 531 this.reader = new BufferedReader(new InputStreamReader(tracker, cs)); 525 532 } 526 533 … … 1116 1123 correspond to the number of parsed bytes depending on the character 1117 1124 set of the file. 1125 @see #getParsedBytes() 1118 1126 */ 1119 1127 public long getParsedCharacters() 1120 1128 { 1121 1129 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(); 1122 1142 } 1123 1143 -
trunk/src/core/net/sf/basedb/util/zip/TarFilePacker.java
r3675 r4090 97 97 if (lastModified > 0) entry.setModTime(lastModified); 98 98 entry.setSize(size); 99 tar.putNextEntry(entry);99 TarUtil.putNextEntry(entry, tar); 100 100 if (!isDirectory) FileUtil.copy(in, tar); 101 101 tar.closeEntry(); -
trunk/src/plugins/core/net/sf/basedb/plugins/AbstractFlatFileImporter.java
r4078 r4090 542 542 if (section != null && section.type() == FlatFileParser.LineType.SECTION) 543 543 { 544 if (progress != null) progress.display(getProgress(ffp .getParsedCharacters()), "Parsing section "+section.name()+"...");544 if (progress != null) progress.display(getProgress(ffp), "Parsing section "+section.name()+"..."); 545 545 try 546 546 { … … 571 571 else 572 572 { 573 if (progress != null) progress.display(getProgress(ffp .getParsedCharacters()), "Parsing headers...");573 if (progress != null) progress.display(getProgress(ffp), "Parsing headers..."); 574 574 } 575 575 FlatFileParser.LineType result = ffp.parseHeaders(); … … 609 609 " on line " + (line == null ? "-1" : line.lineNo() + ": " + StringUtil.trimString(line.line(), 20)), t); 610 610 } 611 if (progress != null) progress.display(getProgress(ffp .getParsedCharacters()), "Parsing data...");611 if (progress != null) progress.display(getProgress(ffp), "Parsing data..."); 612 612 int progressLine = 0; 613 613 … … 640 640 if (progress != null) 641 641 { 642 progress.display(getProgress(ffp .getParsedCharacters()), "Parsing data... (" + ffp.getParsedLines() + " lines so far)");642 progress.display(getProgress(ffp), "Parsing data... (" + ffp.getParsedLines() + " lines so far)"); 643 643 } 644 644 } … … 685 685 // ------------------------------------------- 686 686 687 private int getProgress( long parsedCharacters)688 { 689 return (int) (100 * parsedCharacters/ fileSize);687 private int getProgress(FlatFileParser ffp) 688 { 689 return (int) (100 * ffp.getParsedBytes() / fileSize); 690 690 } 691 691 -
trunk/src/plugins/core/net/sf/basedb/plugins/Base1PluginExecuter.java
r4084 r4090 1806 1806 case STRING: 1807 1807 { 1808 StringParameterType t = new StringParameterType( 255, defaultValue, false, 1, new Integer(options), 1);1808 StringParameterType t = new StringParameterType(65535, defaultValue, false, 1, new Integer(options), 1); 1809 1809 parameter = new PluginParameter<String>(name, commonName, "", t); 1810 1810 break; … … 1827 1827 case HIDDEN_STRING: 1828 1828 { 1829 StringParameterType t = new StringParameterType( 255, defaultValue, false, 1, 0, 1);1829 StringParameterType t = new StringParameterType(65535, defaultValue, false, 1, 0, 1); 1830 1830 parameter = new PluginParameter<String>(name, null, "", t); 1831 1831 break; … … 1855 1855 enums.add(at.getName(), at.getName()); 1856 1856 } 1857 StringParameterType t = new StringParameterType( 255, null, false, 1, Values.getInt(options, 30), 1, enums);1857 StringParameterType t = new StringParameterType(65535, null, false, 1, Values.getInt(options, 30), 1, enums); 1858 1858 parameter = new PluginParameter<String>(name, commonName, "", t); 1859 1859 break; … … 1861 1861 case ENUMERATION: 1862 1862 { 1863 StringParameterType t = new StringParameterType( 255, defaultValue, false, 1, Values.getInt(options, 30), 1, enumOptions);1863 StringParameterType t = new StringParameterType(65535, defaultValue, false, 1, Values.getInt(options, 30), 1, enumOptions); 1864 1864 parameter = new PluginParameter<String>(name, commonName, "", t); 1865 1865 break; -
trunk/src/plugins/core/net/sf/basedb/plugins/BioAssaySetExporter.java
r4044 r4090 685 685 int nof_reporters=bioassayset.getNumReporters(); 686 686 int progress_report_interval=nof_reporters/10; 687 intnof_processed_reporters=0;687 long nof_processed_reporters=0; 688 688 while (spotData.hasNext()) 689 689 { 690 690 if (progress != null && (nof_processed_reporters%progress_report_interval == 0)) 691 691 { 692 progress.display( 100 * nof_processed_reporters / nof_reporters,692 progress.display((int)(100L * nof_processed_reporters / nof_reporters), 693 693 "Exporting ... " + nof_processed_reporters + " of " + 694 694 nof_reporters + " done."); … … 781 781 int nof_spots=bioassayset.getNumSpots(); 782 782 int progress_spot_interval=nof_spots/10; 783 intnof_processed_spots=0;783 long nof_processed_spots=0; 784 784 while (spotData.hasNext()) 785 785 { … … 791 791 (nof_processed_spots%progress_spot_interval == 0)) 792 792 { 793 progress.display( 100 * nof_processed_spots / nof_spots,793 progress.display((int)(100L * nof_processed_spots / nof_spots), 794 794 "Exporting ..." + nof_processed_spots + " of " + 795 795 nof_spots + " done."); -
trunk/src/plugins/core/net/sf/basedb/plugins/LowessNormalization.java
r4078 r4090 408 408 query.restrict(intensityRestriction); 409 409 long numSpots = query.count(dc); 410 intnormalizedSpots = 0;410 long normalizedSpots = 0; 411 411 if (progress != null) progress.display((int)(normalizedSpots / numSpots * 100), normalizedSpots + " spots normalized"); 412 412 … … 504 504 } 505 505 normalizedSpots += smoothCurve.size(); 506 if (progress != null) progress.display((int)((normalizedSpots * 100 ) / numSpots), normalizedSpots + " spots normalized");506 if (progress != null) progress.display((int)((normalizedSpots * 100L) / numSpots), normalizedSpots + " spots normalized"); 507 507 } 508 508 fromBlock = toBlock + 1; -
trunk/src/plugins/core/net/sf/basedb/plugins/MedianRatioNormalization.java
r4040 r4090 349 349 query.restrict(intensityRestriction); 350 350 long numSpots = query.count(dc); 351 intnormalizedSpots = 0;351 long normalizedSpots = 0; 352 352 if (progress != null) progress.display((int)(normalizedSpots / numSpots * 100), normalizedSpots + " spots normalized"); 353 353 … … 441 441 } 442 442 normalizedSpots += toIndex - fromIndex; 443 if (progress != null) progress.display((int)((normalizedSpots * 100 ) / numSpots), normalizedSpots + " spots normalized");443 if (progress != null) progress.display((int)((normalizedSpots * 100L) / numSpots), normalizedSpots + " spots normalized"); 444 444 } 445 445 fromBlock = toBlock + 1; -
trunk/src/plugins/core/net/sf/basedb/plugins/PackedFileExporter.java
r3857 r4090 356 356 // Get parameters 357 357 Directory rootDir = (Directory)job.getValue("root"); 358 rootDir = Directory.getById(dc, rootDir.getId()); 358 359 List<Integer> files = (List<Integer>)job.getValues("files"); 359 360 List<Integer> directories = (List<Integer>)job.getValues("directories"); -
trunk/src/plugins/core/net/sf/basedb/plugins/TarFileUnpacker.java
r3675 r4090 24 24 package net.sf.basedb.plugins; 25 25 26 import java.io.BufferedInputStream; 26 27 import java.io.IOException; 27 28 import java.io.InputStream; … … 53 54 import net.sf.basedb.util.Values; 54 55 import net.sf.basedb.util.zip.AbstractFileUnpacker; 56 import net.sf.basedb.util.zip.TarUtil; 55 57 56 58 /** … … 138 140 if (isGzip) 139 141 { 140 tarStream = new TarInputStream(new GZIPInputStream( pin));142 tarStream = new TarInputStream(new GZIPInputStream(new BufferedInputStream(pin))); 141 143 } 142 144 else if (isBzip) … … 145 147 pin.read(); 146 148 pin.read(); 147 tarStream = new TarInputStream(new CBZip2InputStream( pin));149 tarStream = new TarInputStream(new CBZip2InputStream(new BufferedInputStream(pin))); 148 150 } 149 151 else … … 160 162 long totalUnpacked = 0; 161 163 int numFiles = 0; 162 163 while ((entry = tarStream.getNextEntry()) != null) 164 while ((entry = TarUtil.getNextEntry(tarStream)) != null) 164 165 { 165 166 String subPath = entry.getName(); -
trunk/src/test/TestAnalyzePluginUtil.java
r4083 r4090 72 72 rba.setName("TestAnalyzePluginUtil"+i); 73 73 rba.setDescription("RawBioAssay created by TestAnalyzePluginUtil. Number of spots should be "+spots); 74 RawDataBatcher rawDataBatcher = rba.getRawDataBatcher( null);74 RawDataBatcher rawDataBatcher = rba.getRawDataBatcher(); 75 75 for (int j = 0; parser.hasMoreData() && j < spots; j++) 76 76 { -
trunk/src/test/TestArrayDesign.java
r4083 r4090 31 31 import net.sf.basedb.core.Feature; 32 32 import net.sf.basedb.core.FeatureBatcher; 33 import net.sf.basedb.core.FeatureIdentificationMethod;34 33 import net.sf.basedb.core.File; 35 34 import net.sf.basedb.core.FileSetMember; … … 75 74 int id3 = test_create(Platform.AFFYMETRIX, true); 76 75 int id4 = test_create(Platform.AFFYMETRIX, false); 77 int id6 = test_create(Platform.GENERIC, false);78 76 test_load(id); 79 77 test_list(-1); … … 83 81 test_import_from_file(id2, "data/test.reportermap.import.txt", 84 82 "\"Block\"\\t\"Column\"\\t\"Row\"\\t\"ID\"\\t\"Name\".*", 0, 2, 1, 3); 85 test_add_features(id, FeatureIdentificationMethod.COORDINATES, 10); 86 test_add_features(id6, FeatureIdentificationMethod.FEATURE_ID, 10); 83 test_add_features(id, 10); 87 84 88 85 write_feature_header(); … … 117 114 test_delete(id4); 118 115 test_delete(id5); 119 test_delete(id6);120 116 121 117 TestPlate.test_delete_all(); … … 313 309 } 314 310 315 static void test_add_features(int arrayDesignId, FeatureIdentificationMethod fiMethod,int numFeatures)311 static void test_add_features(int arrayDesignId, int numFeatures) 316 312 { 317 313 if (arrayDesignId == 0) return; … … 332 328 } 333 329 334 FeatureBatcher batcher = ad.getFeatureBatcher( fiMethod);330 FeatureBatcher batcher = ad.getFeatureBatcher(); 335 331 int block = 1; 336 332 int row = 1; 337 333 int column = 1; 338 int position = 1;339 334 ArrayDesignBlock adBlock = ad.addArrayDesignBlock(new BlockInfo(block, (int)Math.ceil(block/4F), ((block-1)%4)+1)); 340 335 time = System.currentTimeMillis(); … … 349 344 data.setRow(row); 350 345 data.setColumn(column); 351 data.setPosition(position);352 data.setExternalId(reporter.getExternalId() + "." + position);353 346 354 347 batcher.insert(data); 355 348 row++; 356 position++;357 349 if (row == 11) 358 350 { … … 403 395 wells.addAll(plate.getWells().list(dc)); 404 396 } 405 FeatureBatcher batcher = ad.getFeatureBatcher( FeatureIdentificationMethod.COORDINATES);397 FeatureBatcher batcher = ad.getFeatureBatcher(); 406 398 int block = 1; 407 399 int row = 1; … … 557 549 dc = TestUtil.getDbControl(); 558 550 ArrayDesign ad = ArrayDesign.getById(dc, arrayDesignId); 559 FeatureBatcher featureBatcher = ad.getFeatureBatcher( FeatureIdentificationMethod.COORDINATES);551 FeatureBatcher featureBatcher = ad.getFeatureBatcher(); 560 552 ReporterBatcher reporterBatcher = ReporterBatcher.getNew(dc); 561 553 -
trunk/src/test/TestBioAsssaySetExporter.java
r4083 r4090 171 171 ReporterData r2 = Reporter.getById(dc, r2Id); 172 172 ReporterData r3 = Reporter.getById(dc, r3Id); 173 RawDataBatcher rdb = rba.getRawDataBatcher( null);173 RawDataBatcher rdb = rba.getRawDataBatcher(); 174 174 for (int i=0; i < 4; ++i) 175 175 { -
trunk/src/test/TestRawBioAssay.java
r4083 r4090 315 315 RawDataType rdt = rba.getRawDataType(); 316 316 List<RawDataProperty> extraProperties = rdt.getProperties(); 317 RawDataBatcher rdb = rba.getRawDataBatcher( null);317 RawDataBatcher rdb = rba.getRawDataBatcher(); 318 318 int block = 1; 319 319 int row = 1; … … 459 459 dc = TestUtil.getDbControl(); 460 460 RawBioAssay rba = RawBioAssay.getById(dc, rawBioAssayId); 461 RawDataBatcher rawDataBatcher = rba.getRawDataBatcher( null);461 RawDataBatcher rawDataBatcher = rba.getRawDataBatcher(); 462 462 ReporterBatcher reporterBatcher = ReporterBatcher.getNew(dc); 463 463 -
trunk/src/test/net/sf/basedb/test/FileUtil.java
r4025 r4090 27 27 28 28 import org.apache.tools.bzip2.CBZip2InputStream; 29 30 import com.ice.tar.TarInputStream; 29 31 30 32 import net.sf.basedb.core.DbControl; … … 66 68 67 69 boolean isBzip = false; 70 boolean isTar = false; 68 71 if (filename.endsWith(".bz2")) 69 72 { 70 73 isBzip = true; 71 74 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); 72 80 } 73 81 … … 96 104 toUpload = new CBZip2InputStream(toUpload); 97 105 } 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 } 98 113 file.upload(toUpload, false, true); 99 114 } -
trunk/src/test/net/sf/basedb/test/merge/MergeTest.java
r4083 r4090 42 42 import net.sf.basedb.core.Experiment; 43 43 import net.sf.basedb.core.FeatureBatcher; 44 import net.sf.basedb.core.FeatureIdentificationMethod;45 44 import net.sf.basedb.core.Formula; 46 45 import net.sf.basedb.core.ItemParameterType; … … 201 200 TestUtil.write("--Creating features for array design: " + design.getName() + "\n"); 202 201 dc.reattachItem(design); 203 FeatureBatcher batcher = design.getFeatureBatcher( FeatureIdentificationMethod.COORDINATES);202 FeatureBatcher batcher = design.getFeatureBatcher(); 204 203 ReporterBatcher reporterBatcher = ReporterBatcher.getNew(dc); 205 204 for (int block = 1; block <= 10; block++) … … 238 237 TestUtil.write("--Creating data for raw bioassay: " + rba.getName() + "\n"); 239 238 dc.reattachItem(rba); 240 RawDataBatcher batcher = rba.getRawDataBatcher( null);239 RawDataBatcher batcher = rba.getRawDataBatcher(); 241 240 for (int block = 1; block <= 10; block++) 242 241 { … … 253 252 rawData.setExtended("ch1FgMean", ch1 + noise); 254 253 rawData.setExtended("ch2FgMean", ch1 * ratio - noise); 255 batcher.insert(rawData, externalId , null);254 batcher.insert(rawData, externalId); 256 255 } 257 256 } -
trunk/src/test/net/sf/basedb/test/roles/AdminTest.java
r4025 r4090 120 120 dc = TestUtil.getDbControl(); 121 121 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. bz2", FileType.REPORTER);122 File affyReporters = FileUtil.uploadFile(dc, "/affymetrix/annotations", "MG_U74Av2_annot.csv.tar.bz2", FileType.REPORTER); 123 123 dc.commit(); 124 124 -
trunk/src/test/net/sf/basedb/test/roles/PowerUserTest.java
r4025 r4090 161 161 File plates = FileUtil.uploadFile(dc, "/mouse", "plates_and_reporters.mouse.v4.37k.txt", FileType.PLATE); 162 162 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. bz2", FileType.REPORTER_MAP);163 File cdfFile = FileUtil.uploadFile(dc, "/affymetrix/cdf", "MG_U74Av2.cdf.tar.bz2", FileType.REPORTER_MAP); 164 164 dc.commit(); 165 165 -
trunk/src/test/net/sf/basedb/test/roles/UserTest.java
r4025 r4090 142 142 File rawData2DyeSwap = FileUtil.uploadFile(dc, "/mouse", "genepix.mouse.v4.37k.24h.dyeswap.gpr", FileType.RAW_DATA); 143 143 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);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); 147 147 dc.commit(); 148 148 -
trunk/www/admin/jobagents/view_agent.jsp
r4070 r4090 38 38 import="net.sf.basedb.core.JobAgentSettings" 39 39 import="net.sf.basedb.util.jobagent.JobAgentInfo" 40 import="net.sf.basedb.util.jobagent.JobInfo"41 40 import="net.sf.basedb.core.User" 42 41 import="net.sf.basedb.core.PermissionDeniedException" … … 414 413 415 414 <% 416 Set< JobInfo> jobs = agent.getInfo().getJobInfo();415 Set<Integer> jobs = agent.getInfo().getJobs(); 417 416 if (jobs == null || jobs.size() == 0) 418 417 { … … 451 450 /> 452 451 <tbl:columndef 453 id="slot"454 title="Used slot"455 />456 <tbl:columndef457 452 id="started" 458 453 title="Started" … … 471 466 <tbl:rows> 472 467 <% 473 for ( JobInfo jobInfo: jobs)468 for (int jobId : jobs) 474 469 { 475 470 Job job = null; … … 477 472 try 478 473 { 479 job = Job.getById(dc, jobI nfo.getJobId());474 job = Job.getById(dc, jobId); 480 475 } 481 476 catch (Throwable t) … … 488 483 <tbl:cell column="plugin"><base:propertyvalue item="<%=job%>" property="pluginDefinition"/></tbl:cell> 489 484 <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>491 485 <tbl:cell column="percentComplete"> 492 486 <% -
trunk/www/common/annotations/list_annotations.jsp
r3979 r4090 389 389 } 390 390 %> 391 </div>392 391 393 392 </base:body> -
trunk/www/lims/arraydesigns/features/index.jsp
r4083 r4090 46 46 <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> 47 47 <%! 48 private static final ItemContext defaultContext = Base.createDefaultContext("position", 49 "position,externalId,block,row,column,reporter.name,reporter.externalId"); 48 private static final ItemContext defaultContext = Base.createDefaultContext("position", "position,block,row,column,reporter.name,reporter.externalId"); 50 49 private static final Item itemType = Item.FEATURE; 51 50 %> -
trunk/www/lims/arraydesigns/features/list_features.jsp
r4083 r4090 36 36 import="net.sf.basedb.core.ArrayDesignBlock" 37 37 import="net.sf.basedb.core.Feature" 38 import="net.sf.basedb.core.FeatureIdentificationMethod"39 38 import="net.sf.basedb.core.ReporterType" 40 39 import="net.sf.basedb.core.Reporter" … … 89 88 final ArrayDesign design = ArrayDesign.getById(dc, arrayDesignId); 90 89 final boolean isAffy = design.isAffyChip(); 91 final FeatureIdentificationMethod fiMethod = design.getFeatureIdentificationMethod();92 90 Formatter<Date> dateFormatter = FormatterFactory.getDateTimeFormatter(sc); 93 91 … … 114 112 int numListed = 0; 115 113 %> 116 <base:page title="<%=title%>">114 <base:page title="<%=title%>"> 117 115 <base:head scripts="table.js,tabcontrol.js" styles="table.css,headertabcontrol.css,path.css"> 118 116 <script language="JavaScript"> … … 212 210 filterable="true" 213 211 exportable="true" 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"%>" 212 show="always" 225 213 /> 226 214 <tbl:columndef … … 552 540 <tbl:cell column="position"><div class="link" onclick="itemOnClick(event, <%=itemId%>)" 553 541 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>556 542 <tbl:cell column="block"><%=block.getBlockNumber()%></tbl:cell> 557 543 <tbl:cell column="row"><%=item.getRow()%></tbl:cell> -
trunk/www/lims/arraydesigns/features/view_feature.jsp
r4083 r4090 79 79 80 80 final ArrayDesign design = ArrayDesign.getById(dc, arrayDesignId); 81 82 81 final boolean isAffy = design.isAffyChip(); 83 82 FeatureData feature = design.getFeatureById(itemId); … … 108 107 </tr> 109 108 <tr> 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> 109 <td class="prompt">Affy chip</td> 110 <td><%=isAffy ? " yes" : "no"%></td> 116 111 </tr> 117 112 </table> … … 119 114 <h4>Feature / block</h4> 120 115 <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>125 116 <tr> 126 117 <td class="prompt">Position</td> -
trunk/www/lims/arraydesigns/list_designs.jsp
r4083 r4090 48 48 import="net.sf.basedb.core.PermissionDeniedException" 49 49 import="net.sf.basedb.core.PluginDefinition" 50 import="net.sf.basedb.core.FeatureIdentificationMethod"51 50 import="net.sf.basedb.core.query.Hql" 52 51 import="net.sf.basedb.core.query.Restrictions" … … 73 72 private static final Item itemType = Item.ARRAYDESIGN; 74 73 private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.LIST); 75 private static final Enumeration<String, String> fiMethods = new Enumeration<String, String>();76 static77 {78 for (FeatureIdentificationMethod fim : FeatureIdentificationMethod.values())79 {80 fiMethods.add(Integer.toString(fim.getValue()), fim.toString());81 }82 fiMethods.lock();83 }84 74 %> 85 75 <% … … 315 305 filterable="true" 316 306 exportable="true" 317 />318 <tbl:columndef319 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%>"328 307 /> 329 308 <tbl:columndef … … 568 547 <tbl:cell column="numDbFeatures"><%=item.getNumDbFeatures()%></tbl:cell> 569 548 <tbl:cell column="numFileFeatures"><%=item.getNumFileFeatures()%></tbl:cell> 570 <tbl:cell column="featureIdentificationMethod"><%=item.getFeatureIdentificationMethod()%></tbl:cell>571 549 <tbl:cell column="batches"> 572 550 <% -
trunk/www/lims/arraydesigns/view_design.jsp
r4083 r4090 303 303 <td class="prompt">Features</td> 304 304 <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>309 305 </tr> 310 306 <tr> -
trunk/www/views/experiments/bioassays/list_bioassays.jsp
r4057 r4090 88 88 ItemResultIterator<BioAssay> bioAssays = null; 89 89 ItemResultList<AnnotationType> annotationTypes = null; 90 ItemResultList<AnnotationType> experimentalFactors = null;91 90 try 92 91 { … … 94 93 final BioAssaySet bioAssaySet = BioAssaySet.getById(dc, bioAssaySetId); 95 94 final Experiment experiment = bioAssaySet.getExperiment(); 96 final ItemQuery<AnnotationType> experimentalFactorQuery = experiment.getExperimentalFactors();97 experimentalFactorQuery.include(Include.MINE, Include.SHARED, Include.IN_PROJECT, Include.OTHERS);98 95 final int experimentId = experiment.getId(); 99 96 final RawDataType rawDataType = experiment.getRawDataType(); … … 111 108 Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext); 112 109 annotationTypes = annotationTypeQuery.list(dc); 113 experimentalFactors = experimentalFactorQuery.list(dc);114 110 try 115 111 { 116 112 final ItemQuery<BioAssay> query = Base.getConfiguredQuery(cc, true, bioAssaySet.getBioAssays(), mode); 117 query.join(Hql.leftJoin("rawParents", "rba"));118 113 bioAssays = query.iterate(dc); 119 114 } 120 115 catch (Throwable t) 121 116 { 122 t.printStackTrace();123 117 cc.setMessage(t.getMessage()); 124 118 } 125 119 int numListed = 0; 126 120 %> 127 <%@page import="net.sf.basedb.util.BioAssaySetUtil"%> 128 <base:page title="<%=title%>" type="<%=mode.getPageType()%>"> 121 <base:page title="<%=title%>" type="<%=mode.getPageType()%>"> 129 122 <base:head scripts="table.js,tabcontrol.js" styles="table.css,headertabcontrol.css,path.css"> 130 123 <script language="JavaScript"> … … 299 292 title="<%=HTML.encodeTags(at.getName())+" [A]"%>" 300 293 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:columndef329 id="<%="ef"+at.getId()%>"330 title="<%=HTML.encodeTags(at.getName())+" [EF]"%>"331 property="<%="$rba.##"+at.getId()%>"332 294 annotation="true" 333 295 datatype="<%=at.getValueType().getStringValue()%>" … … 522 484 } 523 485 } 524 for (AnnotationType at : experimentalFactors)525 {526 %>527 <tbl:cell column="<%="ef"+at.getId()%>"528 ><tbl:cellvalue529 list="<%=BioAssaySetUtil.getAnnotationValues(dc, item, at)%>"530 /></tbl:cell>531 <%532 }533 486 %> 534 487 <tbl:cell column="tools"> -
trunk/www/views/experiments/bioassays/view_bioassay.jsp
r4057 r4090 36 36 import="net.sf.basedb.core.BioAssay" 37 37 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"42 38 import="net.sf.basedb.core.ItemQuery" 43 39 import="net.sf.basedb.core.ItemResultList" … … 49 45 import="net.sf.basedb.core.query.Orders" 50 46 import="net.sf.basedb.core.query.Hql" 51 import="net.sf.basedb.util.formatter.Formatter"52 import="net.sf.basedb.clients.web.formatter.FormatterFactory"53 47 import="net.sf.basedb.clients.web.Base" 54 48 import="net.sf.basedb.clients.web.PermissionUtil" … … 56 50 import="net.sf.basedb.util.Values" 57 51 import="java.util.Map" 58 import="java.util.List"59 import="java.util.HashMap"60 import="java.util.LinkedList"61 52 %> 62 53 <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> … … 223 214 title="Description" 224 215 /> 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:columndef235 id="<%="at"+at.getId()%>"236 title="<%=HTML.encodeTags(at.getName())%>"237 formatter="<%=formatter%>"238 />239 <%240 }241 %>242 216 <tbl:data> 243 217 <tbl:columns> … … 252 226 <tbl:cell column="spots"><%=item.getSpots()%></tbl:cell> 253 227 <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 try268 {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 %>306 228 </tbl:row> 307 229 <% -
trunk/www/views/experiments/bioassaysets/view_bioassayset.jsp
r3679 r4090 174 174 } 175 175 } 176 function changeImage(imageId, url) 177 { 176 function runItemPlugin(cmd) 177 { 178 Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&experiment_id=<%=experimentId%>&item_id=<%=itemId%>', 'RunPlugin'+cmd, 740, 540); 179 } 180 var imageQueue = new Array(); 181 var nextImage = 0; 182 function addImage(imageId, url) 183 { 184 imageQueue[imageQueue.length] = imageId; 178 185 var img = document.getElementById(imageId); 179 img.src = url; 180 } 181 function runItemPlugin(cmd) 182 { 183 Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&experiment_id=<%=experimentId%>&item_id=<%=itemId%>', 'RunPlugin'+cmd, 740, 540); 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 } 184 212 } 185 213 </script> 214 <style> 215 .plot { 216 border: 1px solid #666666; 217 background-image: url('../../../images/plot_empty_400x300.png'); 218 } 219 </style> 186 220 </base:head> 187 <base:body >221 <base:body onload="loadNextImage()"> 188 222 <p> 189 223 <p:path> … … 481 515 ItemQuery<BioAssay> bioAssayQuery = bioAssaySet.getBioAssays(); 482 516 bioAssayQuery.order(Orders.asc(Hql.property("name"))); 517 StringBuilder script = new StringBuilder(); 483 518 for (BioAssay bioAssay : bioAssayQuery.list(dc)) 484 519 { … … 488 523 url += "&filter="+filter; 489 524 url += "&title="+HTML.urlEncode(bioAssay.getName()); 525 script.append("addImage('MA").append(bioAssay.getId()).append("','"). 526 append(url).append("');\n"); 490 527 %> 491 528 <img id="MA<%=bioAssay.getId()%>" 492 src="../../../images/ plot_generating_400x300.gif"493 width="400" height="300" 529 src="../../../images/transparent_pixel.gif" 530 width="400" height="300" 494 531 alt="MA-plot for bioassay <%=HTML.encodeTags(bioAssay.getName())%>" 495 style="border: 1px solid #666666;"> 496 <script language="JavaScript"> 497 setTimeout("changeImage('MA<%=bioAssay.getId()%>', '<%=url%>')", 100); 498 </script> 532 class="plot" 533 > 499 534 <% 500 535 } 536 %> 537 <script language="JavaScript"> 538 <%=script%> 539 </script> 540 <% 501 541 } 502 542 %> … … 513 553 String xLabel = HTML.urlEncode("A, log10(ch1 * ch2) / 2"); 514 554 String yLabel = HTML.urlEncode("M, log2(ch1 / ch2)"); 555 StringBuilder script = new StringBuilder(); 515 556 for (BioAssay bioAssay : bioAssayQuery.list(dc)) 516 557 { … … 519 560 url += "&xLabel="+xLabel+"&yLabel="+yLabel; 520 561 url += "&title="+HTML.urlEncode(bioAssay.getName()); 562 script.append("addImage('CF").append(bioAssay.getId()).append("','"). 563 append(url).append("');\n"); 521 564 %> 522 565 <img id="CF<%=bioAssay.getId()%>" 523 src="../../../images/ plot_generating_400x300.gif"524 width="400" height="300" 566 src="../../../images/transparent_pixel.gif" 567 width="400" height="300" 525 568 alt="Correction factor plot for bioassay <%=HTML.encodeTags(bioAssay.getName())%>" 526 style="border: 1px solid #666666;"> 527 <script language="JavaScript"> 528 setTimeout("changeImage('CF<%=bioAssay.getId()%>', '<%=url%>')", 100); 529 </script> 569 class="plot" 570 > 530 571 <% 531 572 } 573 %> 574 <script language="JavaScript"> 575 <%=script%> 576 </script> 577 <% 532 578 } 533 579 %> -
trunk/www/views/jobs/index.jsp
r4074 r4090 39 39 import="net.sf.basedb.core.PermissionDeniedException" 40 40 import="net.sf.basedb.core.ItemAlreadyExistsException" 41 import="net.sf.basedb.core.signal.SignalTransporter"42 import="net.sf.basedb.core.signal.Signal"43 41 import="net.sf.basedb.util.RemovableUtil" 44 42 import="net.sf.basedb.util.ShareableUtil" … … 240 238 redirect = viewPage; 241 239 } 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 else252 {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 }260 240 else 261 241 { -
trunk/www/views/jobs/view_job.jsp
r4078 r4090 47 47 import="net.sf.basedb.core.plugin.GuiContext" 48 48 import="net.sf.basedb.core.plugin.Plugin" 49 import="net.sf.basedb.core.signal.SignalTransporter"50 import="net.sf.basedb.core.signal.Signal"51 49 import="net.sf.basedb.clients.web.Base" 52 50 import="net.sf.basedb.clients.web.util.HTML" … … 59 57 import="java.util.List" 60 58 import="java.util.Collections" 61 import="java.util.Collection"62 59 %> 63 60 <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> … … 106 103 Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc); 107 104 Formatter<Date> dateTimeFormatter = FormatterFactory.getDateTimeFormatter(sc); 108 109 // Check if the plug-in supports the "Abort" signal110 boolean supportsAbort = status == Job.Status.WAITING && writePermission;111 if (status == Job.Status.EXECUTING && writePermission)112 {113 try114 {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 }124 105 %> 125 106 … … 133 114 { 134 115 setTimeout('location.reload()', 10000); 135 }136 }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 116 } 143 117 } … … 173 147 </base:head> 174 148 <base:body onload="autoUpdate()"> 149 175 150 <h3 class="docked"><%=title%> <base:help tabcontrol="main" /></h3> 176 151 <t:tabcontrol id="main" active="<%=tab%>" position="bottom" contentstyle="<%="height: "+(int)(scale*320)+"px;"%>"> … … 314 289 </table> 315 290 </t:tab> 291 316 292 <% 317 293 if (job.getStackTrace() != null) … … 498 474 %> 499 475 <% 500 if (supportsAbort)501 {502 %>503 <base:button onclick="abortJob()" title="Abort…" image="abort.png" />504 <%505 }506 %>507 <%508 476 if (job.getStatus() == Job.Status.ERROR && job.getJobType() == Job.Type.RUN_PLUGIN) 509 477 { -
trunk/www/views/rawbioassays/edit_rawbioassay.jsp
r4083 r4090 509 509 { 510 510 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 else523 {524 Main.hide('fiMethod');525 }526 <%527 }528 %>529 511 } 530 512 function selectArrayDesignOnClick() … … 553 535 list.selectedIndex = 1; 554 536 parentsChanged = true; 555 arrayDesignOnChange();556 537 } 557 538 … … 672 653 </td> 673 654 </tr> 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> 655 689 656 <tr> 690 657 <td class="prompt">Protocol</td> -
trunk/www/views/rawbioassays/index.jsp
r4083 r4090 1 <%@page import="net.sf.basedb.core.FeatureIdentificationMethod"%>2 1 <%-- $Id$ 3 2 ------------------------------------------------------------------ … … 91 90 private final int arrayDesignId; 92 91 private final SessionControl sc; 93 private final FeatureIdentificationMethod fiMethod; 94 95 private UpdateArrayDesign(Job job, RawBioAssay rba, ArrayDesign design, FeatureIdentificationMethod fiMethod) 92 93 private UpdateArrayDesign(Job job, RawBioAssay rba, ArrayDesign design) 96 94 { 97 95 this.jobId = job.getId(); … … 99 97 this.arrayDesignId = design.getId(); 100 98 this.sc = job.getSessionControl(); 101 this.fiMethod = fiMethod;102 99 } 103 100 … … 116 113 try 117 114 { 118 rba.updateArrayDesign(design, fiMethod,progress);115 rba.updateArrayDesign(design, progress); 119 116 progress.display(99, "Committing changes to database..."); 120 117 dc.commit(); … … 127 124 catch (Throwable t) 128 125 { 129 if (dc != null) dc.close();130 126 dc = sc.newDbControl(); 131 127 j = Job.getById(dc, jobId); … … 288 284 Job job = null; 289 285 ArrayDesign ad = null; 290 FeatureIdentificationMethod fiMethod = null;291 286 int arrayDesignId = Values.getInt(request.getParameter("arraydesign_id"), -1); 292 287 if (arrayDesignId >= 0) // < 0 = denied or unchanged … … 295 290 if (rba.hasData()) 296 291 { 297 try298 {299 fiMethod = FeatureIdentificationMethod.valueOf(request.getParameter("fiMethod"));300 }301 catch (Exception ex)302 {}303 292 if (rba.getRawDataType().isStoredInDb() && ad != null && ad.hasFeatures()) 304 293 { … … 312 301 else 313 302 { 314 rba.updateArrayDesign(ad, fiMethod,null);303 rba.updateArrayDesign(ad, null); 315 304 } 316 305 } … … 334 323 { 335 324 redirect = "../jobs/index.jsp?ID="+ID+"&cmd=ViewItem&item_id="+job.getId(); 336 Thread updateThread = new Thread(new UpdateArrayDesign(job, rba, ad , fiMethod));325 Thread updateThread = new Thread(new UpdateArrayDesign(job, rba, ad)); 337 326 updateThread.setPriority(Thread.currentThread().getPriority() - 1); 338 327 updateThread.start(); -
trunk/www/views/rawbioassays/rawdata/list_rawdata.jsp
r4083 r4090 95 95 96 96 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));100 97 cc.configureQuery(query, true); 101 98 if (!"row".equals(cc.getSortProperty())) query.order(Orders.asc(Hql.property("row"))); … … 400 397 datatype="int" 401 398 title="[Feat] Position" 402 sortable="true"403 filterable="true"404 exportable="true"405 />406 <tbl:columndef407 id="feature.externalId"408 property="feature.externalId"409 datatype="string"410 title="[Feat] Feature ID"411 399 sortable="true" 412 400 filterable="true" … … 716 704 %> 717 705 <tbl:cell column="feature.position"><i>- none -</i></tbl:cell> 718 <tbl:cell column="feature.externalId"><i>- none -</i></tbl:cell>719 706 <tbl:cell column="feature.row"><i>- none -</i></tbl:cell> 720 707 <tbl:cell column="feature.column"><i>- none -</i></tbl:cell> … … 734 721 %> 735 722 <tbl:cell column="feature.position"><%=feature.getPosition()%></tbl:cell> 736 <tbl:cell column="feature.externalId"><%=HTML.encodeTags(feature.getExternalId())%></tbl:cell>737 723 <tbl:cell column="feature.row"><%=feature.getRow()%></tbl:cell> 738 724 <tbl:cell column="feature.column"><%=feature.getColumn()%></tbl:cell> -
trunk/www/views/reporters/index.jsp
r4076 r4090 42 42 import="net.sf.basedb.core.PermissionDeniedException" 43 43 import="net.sf.basedb.core.BaseException" 44 import="net.sf.basedb.core.User"45 44 import="net.sf.basedb.util.RemovableUtil" 46 45 import="net.sf.basedb.util.ShareableUtil" -
trunk/www/views/reporters/list_reporters.jsp
r4076 r4090 243 243 exportable="true" 244 244 formatter="<%=timeFormatter%>" 245 />246 <tbl:columndef247 id="lastSource"248 property="lastSource"249 datatype="string"250 title="Last source"251 sortable="true"252 filterable="true"253 exportable="true"254 245 /> 255 246 <% … … 433 424 <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell> 434 425 <tbl:cell column="lastUpdate" value="<%=item.getLastUpdate()%>" /> 435 <tbl:cell column="lastSource"><%=HTML.encodeTags(item.getLastSource())%></tbl:cell>436 426 <tbl:cell column="reporterType" 437 427 ><base:propertyvalue -
trunk/www/views/reporters/view_reporter.jsp
r4076 r4090 191 191 <td><%=dateFormatter.format(reporter.getLastUpdate())%></td> 192 192 </tr> 193 <tr>194 <td class="prompt">Last source</td>195 <td><%=HTML.niceFormat(reporter.getLastSource())%></td>196 </tr>197 193 </table> 198 194
Note: See TracChangeset
for help on using the changeset viewer.