Changeset 3871


Ignore:
Timestamp:
Oct 22, 2007, 2:21:37 PM (15 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #595: Add option to stop a plug-in from beeing executed by the internal job queue
References #746: Moved plugins/jobs section to docbook

Location:
trunk
Files:
1 added
20 edited

Legend:

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

    r3765 r3871  
    7777# If the internal job queue should be enabled or not
    7878jobqueue.internal.enabled            = true
     79
     80# If plugins with useInteralJobQueue = false should be executed or not
     81jobqueue.internal.runallplugins      = false
     82
     83# The maximum thread priority for any thread executing a plug-in
    7984#jobqueue.internal.maxthreadpriority  = 4
    8085
  • trunk/doc/src/docbook/admindoc/installation_upgrade.xml

    r3857 r3871  
    204204          <para>
    205205            In the main BASE configuration file,
    206             <filename>/path/to/base/www/WEB-INF/classes/base.config</filename>,
     206            <filename>&lt;base-dir&gt;/www/WEB-INF/classes/base.config</filename>,
    207207            fields that needs to be transferred are usually
    208208            <emphasis>db.username</emphasis>,
     
    212212          <para>
    213213            Local settings in the raw data
    214             tables, <filename>/path/to/base/www/WEB-INF/classes/raw-data-types.xml</filename>,
     214            tables, <filename>&lt;base-dir&gt;/www/WEB-INF/classes/raw-data-types.xml</filename>,
    215215            may need to be transferred.
    216216          </para>
     
    228228            need to run them. Change directory
    229229            to <filename
    230             class="directory">/path/to/base/bin/</filename> and issue
     230            class="directory">&lt;base-dir&gt;/bin/</filename> and issue
    231231<programlisting>sh ./updatedb.sh <emphasis>base_root_password</emphasis>
    232232sh ./updateindexes.sh <emphasis>base_root_password</emphasis></programlisting>
     
    289289      checking the BASE job queue for jobs awaiting execution. When
    290290      the job agent finds a job that it is enabled to execute, it
    291       loads the plugin and executes it. Job agents will in this way
     291      loads the plug-in and executes it. Job agents will in this way
    292292      free up resources on the BASE application server, and thus allow
    293293      the BASE server to concentrate on serving web pages. Job agents
     
    303303        <listitem>
    304304          <para>
    305             Specify exactly which plugins each job agent should be
     305            Specify exactly which plug-ins each job agent should be
    306306            able to execute.
    307307          </para>
     
    309309        <listitem>
    310310          <para>
    311             Give some plugins higher priority than other plugins.
     311            Give some plug-ins higher priority than other plug-ins.
    312312          </para>
    313313        </listitem>
     
    320320        <listitem>
    321321          <para>
    322             Override memory settings and more for each plugin.
    323           </para>
    324         </listitem>
    325         <listitem>
    326           <para>
    327             Execute plugins in separate processes. Thus, a misbehaving
    328             plugin cannot bring the main application server down.
     322            Override memory settings and more for each plug-in.
     323          </para>
     324        </listitem>
     325        <listitem>
     326          <para>
     327            Execute plug-ins in separate processes. Thus, a misbehaving
     328            plug-in cannot bring the main application server down.
    329329          </para>
    330330        </listitem>
     
    338338      setup. For example one job agent can be assigned for importing
    339339      data only, another job agent can be assigned for running
    340       analysis plugins for specific project only, and a third may be a
     340      analysis plug-ins for specific project only, and a third may be a
    341341      catch-all job agent that performs all low-priority jobs.
    342342    </para>
     
    347347        <variablelist>
    348348          <varlistentry>
    349             <term>Disable the internal job queue</term>
     349            <term>Make sure the internal job queue doesn't execute all plug-ins</term>
    350350            <listitem>
    351351              <para>
    352                 It is not recommended to use the internal job queue
    353                 when job agents are used. The
    354                 setting <command>jobqueue.internal.enabled</command>
    355                 should be changed to <command>false</command> for the
     352                The setting <command>jobqueue.internal.runallplugins</command>
     353                should be set to <command>false</command> for the
    356354                BASE server. This setting is found in
    357                 the <filename>/path/to/base/www/WEB-INF/classes/base.config</filename>
     355                the <filename>&lt;base-dir&gt;/www/WEB-INF/classes/base.config</filename>
    358356                file. The changes will not take effect until the
    359357                application server is restarted.
    360358              </para>
     359             
     360              <note>
     361                Prior to BASE 2.5 the internal job queue had to be disabled
     362                completely. This is no longer the case since it is possible to
     363                enable/disable the internal job queue separately for
     364                each plug-in.
     365              </note>
     366             
    361367            </listitem>
    362368          </varlistentry>
     
    435441            <listitem>
    436442              <para>
    437                 The <filename>/path/to/base/www/WEB-INF/classes/base.config</filename>
     443                The <filename>&lt;base-dir&gt;/www/WEB-INF/classes/base.config</filename>
    438444                file must be configured as in regular BASE
    439445                installation, cf.
     
    485491            <listitem>
    486492              <para>
    487                 The <filename>/path/to/base/www/WEB-INF/classes/jobagent.properties</filename>
     493                The <filename>&lt;base-dir&gt;/www/WEB-INF/classes/jobagent.properties</filename>
    488494                file contains settings for the job agent. The most
    489495                important ones to specify value for are
     
    557563        Before the job agent starts executing jobs for you it must be
    558564        configured. The configuration is done through the BASE web
    559         interface.
     565        interface. See <xref linkend="plugins.jobagents" />
    560566        <variablelist>
    561567          <varlistentry>
    562             <term>Configure the plugins the job agent should handle</term>
     568            <term>Configure the plug-ins the job agent should handle</term>
    563569            <listitem>
    564570              <para>
     
    583589                    <para>
    584590                      On the <guilabel>Plugins</guilabel> tab you can
    585                       specify which plugins the job agent should
     591                      specify which plug-ins the job agent should
    586592                      handle. Note that if you have installed external
    587                       plugins on the web server, those plugins must be
     593                      plug-ins on the web server, those plug-ins must be
    588594                      installed on the job agent as well. It is
    589595                      possible to specify different paths to the JAR
     
    706712                  <ulink url="http://www.postgresql.org/" />. you must
    707713                  edit
    708                   your <filename>/path/to/base/www/WEB-INF/classes/base.config</filename>
     714                  your <filename>&lt;base-dir&gt;/www/WEB-INF/classes/base.config</filename>
    709715                  file. Uncomment the settings for Postgres and
    710716                  comment out the settings for MySQL.
     
    803809                </para>
    804810                <para>
    805                   The <filename>/path/to/base/misc/sql/createdb.mysql.sql</filename>
     811                  The <filename>&lt;base-dir&gt;/misc/sql/createdb.mysql.sql</filename>
    806812                  file contains the above statements and can be used
    807813                  by the <filename>mysql</filename> command-line tool
     
    833839  # within the tool and quit with a '\q'.
    834840CREATE SCHEMA "dynamic" AUTHORIZATION "db_user";</programlisting>
    835                   The <filename>/path/to/base/misc/sql/createdb.postgresql.sql</filename>
     841                  The <filename>&lt;base-dir&gt;/misc/sql/createdb.postgresql.sql</filename>
    836842                  file contains the above statements and can be used
    837843                  by the <filename>psql</filename> command-line tool:
     
    864870          <para>
    865871            Basic BASE configuration is done in
    866             <filename>/path/to/base/www/WEB-INF/classes/base.config</filename>:
     872            <filename>&lt;base-dir&gt;/www/WEB-INF/classes/base.config</filename>:
    867873            <itemizedlist>
    868874              <listitem>
     
    893899            to modify extended properties to fit your needs. Extended
    894900            properties are defined in
    895             <filename>/path/to/base/www/WEB-INF/classes/extended-properties.xml</filename>.
     901            <filename>&lt;base-dir&gt;/www/WEB-INF/classes/extended-properties.xml</filename>.
    896902            There is an
    897903            administrator <ulink
     
    912918          <para>
    913919            Change directory to
    914             <filename class="directory">/path/to/base/bin</filename>
     920            <filename class="directory">&lt;base-dir&gt;/bin</filename>
    915921            and run <filename>initdb.sh</filename> as
    916922<programlisting>./initdb.sh base_root_password</programlisting>
     
    934940          <para>
    935941            Either move the <filename
    936             class="directory">/path/to/base/www</filename> directory
     942            class="directory">&lt;base-dir&gt;/www</filename> directory
    937943            to the tomcat <filename class="directory">webapps</filename>
    938944            directory or create a symbolic link from the tomcat
    939945            <filename class="directory">webapps</filename> directory to
    940             the <filename class="directory">/path/to/base/www</filename>
     946            the <filename class="directory">&lt;base-dir&gt;/www</filename>
    941947            directory
    942948<programlisting>cd /path/to/tomcat/webapps
     
    11181124            behaviour), you must have file system access to BASE 1.2
    11191125            files, <emphasis>i.e.,</emphasis> the <filename
    1120             class="directory">/path/to/base1.2/data</filename>
     1126            class="directory">/ 1.2/data</filename>
    11211127            directory containing directories
    11221128            <filename class="directory">rawdata</filename>,
     
    11291135          <para>
    11301136            Change settings in the file
    1131             <filename>/path/to/base/dist/www/WEB-INF/classes/migrate.properties</filename>.
     1137            <filename>&lt;base-dir&gt;/dist/www/WEB-INF/classes/migrate.properties</filename>.
    11321138            The available options are commented:
    11331139            <itemizedlist>
  • trunk/doc/src/docbook/admindoc/plugin_installation.xml

    r3866 r3871  
    693693        <listitem>
    694694          <para>
     695            You may select if the internal job queue should execute the
     696            plug-in or not.
     697          </para>
     698        </listitem>
     699      </varlistentry>
     700      <varlistentry>
     701        <term><guilabel>Job agents</guilabel></term>
     702        <listitem>
     703          <para>
    695704            A list with the job agents where the plug-in is installed and
    696705            allowed to be executed. Select a plug-in in this list to display
  • trunk/doc/src/docbook/appendix/base.config.xml

    r3765 r3871  
    360360        <para>
    361361         If <userinput>0</userinput> or <userinput>FALSE</userinput> the internal
    362          job queue will be disabled. If you are using job agents to execute jobs,
    363          the recommendation is to disable the internal job queue. Otherwise you must
    364          leave it enabled.
     362         job queue will be disabled.
     363         </para>
     364      </listitem>
     365    </varlistentry>
     366   
     367    <varlistentry>
     368      <term><property>jobqueue.internal.runallplugins</property></term>
     369      <listitem>
     370        <para>
     371         If <userinput>1</userinput> or <userinput>TRUE</userinput> the internal
     372         job queue will ignore the <property>useInternalJobQueue</property>
     373         flag specified on plug-ins. If <userinput>0</userinput> or <userinput>FALSE</userinput>
     374         the internal job queue will only execute plug-ins which has
     375         <property>useInternalJobQueue=true</property>
    365376         </para>
    366377      </listitem>
  • trunk/doc/src/docbook/developerdoc/api_overview.xml

    r3869 r3871  
    894894    <sect2 id="data_api.plugins">
    895895      <title>Plug-ins, jobs and job agents</title>
     896     
     897      <para>
     898         This section gives an overview of plug-ins, jobs and job agents.
     899      </para>
     900     
     901      <itemizedlist>
     902        <title>See also</title>
     903        <listitem><xref linkend="plugins.installation" /></listitem>
     904        <listitem><xref linkend="installation_upgrade.jobagents" /></listitem>
     905      </itemizedlist>
     906     
     907      <sect3 id="data_api.plugins.uml">
     908        <title>UML diagram</title>
     909       
     910        <figure id="data_api.figures.plugins">
     911          <title>Plug-ins, jobs and job agents</title>
     912          <screenshot>
     913            <mediaobject>
     914              <imageobject>
     915                <imagedata
     916                  fileref="figures/uml/datalayer.plugins.png" format="PNG" />
     917              </imageobject>
     918            </mediaobject>
     919          </screenshot>
     920        </figure>
     921      </sect3>
     922
     923      <sect3 id="data_api.plugins.plugins">
     924        <title>Plug-ins</title>
     925       
     926        <para>
     927          The <classname>PluginDefinitionData</classname> holds information of the
     928          installed plugin classes. Much of the information is copied from the
     929          plug-in itself from the <classname>About</classname> object and by checking
     930          which interfaces it implements.
     931        </para>
     932       
     933        <para>
     934          There are five main types of plug-ins:
     935        </para>
     936       
     937        <itemizedlist>
     938        <listitem>
     939          <para>
     940          IMPORT (mainType = 1): A plug-in that imports data to BASE.
     941          </para>
     942        </listitem>
     943        <listitem>
     944          <para>
     945          EXPORT (mainType = 2): A plug-in that exports data from BASE.
     946          </para>
     947        </listitem>
     948        <listitem>
     949          <para>
     950          INTENSITY (mainType = 3): A plug-in that calculates intensity values
     951          from raw data.
     952          </para>
     953        </listitem>
     954        <listitem>
     955          <para>
     956          ANALYZE (mainType = 4): A plug-in that analyses data.
     957          </para>
     958        </listitem>
     959        <listitem>
     960          <para>
     961          OTHER (mainType = 5): Any other plug-in.
     962          </para>
     963        </listitem>
     964        </itemizedlist>
     965       
     966        <para>
     967          A plug-in may have different configurations. The flags <property>supportsConfigurations</property>
     968          and <property>requiresConfiguration</property> are used to specify if a plug-in
     969          must have or can't have any configurations. Configuration parameter values are
     970          versioned. Each time anyone updates a configuration the version number
     971          is increased and the parameter values are stored as a new entity.
     972          This is required because we want to be able to know exactly which
     973          parameters a job were using when it was executed. When a job is
     974          created we also store the parameter version number
     975          (<property>JobData.parameterVersion</property>). This means that even if
     976          someone changes the configuration later we will always know which
     977          parameters the job used.
     978        </para>
     979       
     980        <para>
     981          The <classname>PluginTypeData</classname> class is ued to group
     982          plug-ins that share some common functionality, by implementing
     983          additional (optional) interfaces. For example, the
     984          <interfacename>AutoDetectingImporter</interfacename> should be implemented
     985          by import plug-ins that supports automatic detection of file formats.
     986          Another example is the <interfacename>AnalysisFilterPlugin</interfacename>
     987          interface which should be implemented by all analysis plug-ins that
     988          only filters data.
     989        </para>
     990
     991      </sect3>
     992     
     993      <sect3 id="data_api.plugins.jobs">
     994        <title>Jobs</title>
     995       
     996        <para>
     997          A job represents a single invokation of a plug-in to do some work.
     998          The <classname>JobData</classname> class holds information about this.
     999          A job is usuallu executed by a plug-in, but doesn't have to be. The
     1000          <property>status</property> property holds the current state of a job.
     1001        </para>
     1002       
     1003        <itemizedlist>
     1004        <listitem>
     1005          <para>
     1006            UNCONFIGURED (status = 0): The job is not yet ready to be executed.
     1007          </para>
     1008        </listitem>
     1009        <listitem>
     1010          <para>
     1011            WAITING (status = 1): The job is waiting to be executed.
     1012          </para>
     1013        </listitem>
     1014        <listitem>
     1015          <para>
     1016            PREPARING (status = 5): The job is about to be executed but hasn't started yet.
     1017          </para>
     1018        </listitem>
     1019        <listitem>
     1020          <para>
     1021            EXECUTING (status = 2): The job is currently executing.
     1022          </para>
     1023        </listitem>
     1024        <listitem>
     1025          <para>
     1026            DONE (status = 3): The job finished successfully.
     1027          </para>
     1028        </listitem>
     1029        <listitem>
     1030          <para>
     1031            ERROR (status = 4): The job finished with an error.
     1032          </para>
     1033        </listitem>
     1034        </itemizedlist>
     1035      </sect3>
     1036
     1037      <sect3 id="data_api.plugins.agents">
     1038        <title>Job agents</title>
     1039       
     1040        <para>
     1041          A job agent is a program running on the same or a different server that
     1042          is regularly checking for jobs that are waiting to be executed. The
     1043          <classname>JobAgentData</classname> holds information about a job agent
     1044          and the <classname>JobAgentSettingsData</classname> links the agent
     1045          with the plug-ins the agent is able to execute. The job agent will only
     1046          execute jobs that are owner by users or projects that the job agent has
     1047          been shared to with at least use permission. The <property>priorityBoost</property>
     1048          property can be used to give specific plug-ins higher priority.
     1049          Thus, for a job agent it is possible to:
     1050        </para>
     1051       
     1052        <itemizedlist>
     1053        <listitem>
     1054          <para>
     1055          Specify exactly which plug-ins it will execute. For example, it is possible
     1056          to dedicate one agent to only run one plug-in.
     1057          </para>
     1058        </listitem>
     1059        <listitem>
     1060          <para>
     1061          Give some plug-ins higher priority. For example a job agent that is mainly
     1062          used for importing data should give higher priority to all import plug-ins.
     1063          Other types of jobs will have to wait until there are no more data to be
     1064          imported.
     1065          </para>
     1066        </listitem>
     1067        <listitem>
     1068          <para>
     1069          Specify exactly which users/groups/projects that may use the agent. For
     1070          example, it is possible to dedicate one agent to only run jobs for a certain
     1071          project.
     1072          </para>
     1073        </listitem>
     1074        </itemizedlist>
     1075       
     1076      </sect3>
     1077
     1078
    8961079    </sect2>
    8971080   
  • trunk/src/core/common-queries.xml

    r3850 r3871  
    14011401      A Hibernate query that loads plugin jobs in the job queue waiting to be
    14021402      executed sorted by priority and waiting type.
     1403    </description>
     1404  </query>
     1405 
     1406  <query id="FIND_INTERNAL_JOBS_IN_QUEUE" type="HQL">
     1407    <sql>
     1408      SELECT job
     1409      FROM JobData job
     1410      WHERE job.status = :status
     1411      AND job.type = :type
     1412      AND job.pluginDefinition.useInternalJobQueue = true
     1413      ORDER BY job.priority ASC, job.created ASC
     1414    </sql>
     1415    <description>
     1416      A Hibernate query that loads plugin jobs in the job queue waiting to be
     1417      executed sorted by priority and waiting type. It should only return
     1418      jobs where the plug-in setting useInternalJobQueue=true
    14031419    </description>
    14041420  </query>
     
    29552971  </query>
    29562972
     2973  <query id="SET_USEJOBQUEUE_ON_PLUGINS" type="HQL">
     2974    <sql>
     2975      UPDATE PluginDefinitionData pld
     2976      SET pld.useInternalJobQueue = true
     2977      WHERE pld.useInternalJobQueue IS NULL
     2978    </sql>
     2979    <description>
     2980      A HQL query that set the useInternalJobQueue property to true
     2981      for all plug-ins.
     2982    </description>
     2983  </query>
    29572984
    29582985</predefined-queries>
  • trunk/src/core/net/sf/basedb/core/Install.java

    r3857 r3871  
    107107    method.
    108108  */
    109   public static final int NEW_SCHEMA_VERSION = Integer.valueOf(44).intValue();
     109  public static final int NEW_SCHEMA_VERSION = Integer.valueOf(45).intValue();
    110110 
    111111  public static synchronized void createTables(boolean update, final ProgressReporter progress)
  • trunk/src/core/net/sf/basedb/core/InternalJobQueue.java

    r3857 r3871  
    2727import net.sf.basedb.core.plugin.Response;
    2828import net.sf.basedb.core.data.JobData;
     29import net.sf.basedb.core.data.PluginDefinitionData;
    2930import net.sf.basedb.core.data.ShareableData;
    3031import net.sf.basedb.core.data.UserData;
     
    196197 
    197198  /**
     199    If the {@link PluginDefinitionData#getUseInternalJobQueue()} setting
     200    should be ignored or not.
     201  */
     202  private boolean ignoreUseInternalJobQueueFlag = false;
     203 
     204  /**
    198205    Create the job queue. The one and only instance is created
    199206    by Application.start
     
    204211    maxSlots = Collections.synchronizedMap(new HashMap<Job.ExecutionTime, Integer>());
    205212    priorities = Collections.synchronizedMap(new HashMap<Job.ExecutionTime, Integer>());
    206    
    207     // Read configuration values
     213
     214    // If we should execute all jobs or only jobs for plug-ins which may use the internal queue
     215    ignoreUseInternalJobQueueFlag = Config.getBoolean("jobqueue.internal.runallplugins");
     216
     217    // Number of execution slots and thread priorities
    208218    for (Job.ExecutionTime et : Job.ExecutionTime.values())
    209219    {
     
    232242    Check the database for jobs that are waiting to be executed.
    233243    We sort the jobs by priority and creation time and try to execute
    234     them in that order. Each job is encapuslated in a {@link JobRunner}
     244    them in that order. Each job is encapsulated in a {@link JobRunner}
    235245    object which is started in it's own thread.
    236246  */
     
    242252    {
    243253      dc = sc.newDbControl();
     254      String hqlName = ignoreUseInternalJobQueueFlag ?
     255        "FIND_JOBS_IN_QUEUE" : "FIND_INTERNAL_JOBS_IN_QUEUE";
     256     
    244257      org.hibernate.Query query =
    245         HibernateUtil.getPredefinedQuery(dc.getHibernateSession(), "FIND_JOBS_IN_QUEUE");
     258        HibernateUtil.getPredefinedQuery(dc.getHibernateSession(), hqlName);
    246259      /*
    247260        SELECT job
     
    249262        WHERE job.status = :status
    250263        AND job.type = :type
     264        [AND job.pluginDefinition.useInternalJobQueue = true]
    251265        ORDER BY job.priority ASC, job.created ASC
    252266      */
  • trunk/src/core/net/sf/basedb/core/PluginDefinition.java

    r3857 r3871  
    775775 
    776776  /**
     777    If this plug-in can be executed by the internal job queue or
     778    not. If not, the plug-in must be configured to be executed by a
     779    job agent. NOTE! The plug-in can always be excuted by job agents,
     780    they ignore this value.
     781   
     782    @return TRUE if the internal job queue is used, FALSE if not
     783    @since 2.5
     784  */
     785  public boolean getUseInternalJobQueue()
     786  {
     787    return getData().getUseInternalJobQueue();
     788  }
     789  /**
     790    Set if the plug-in can use the internal job queue or not.
     791    @param use TRUE to use the internal job queue, FALSE to only use
     792      job agents
     793    @since 2.5
     794  */
     795  public void setUseInternalJobQueue(boolean use)
     796  {
     797    checkPermission(Permission.WRITE);
     798    getData().setUseInternalJobQueue(use);
     799  }
     800 
     801  /**
    777802    Check if it makes sense to use this plugin in the context
    778803    of the specified item. For example, a plugin that imports
  • trunk/src/core/net/sf/basedb/core/Update.java

    r3858 r3871  
    522522  </tr>
    523523
    524 
     524  <tr>
     525    <td>45</td>
     526    <td>
     527      <ul>
     528      <li>Added {@link net.sf.basedb.core.data.PluginDefinitionData#getUseInternalJobQueue()}
     529      </ul>
     530      The update sets all values on existing items to true (if no job agent has been
     531      configured for the plug-in) or false (if a job agent is configured).
     532    </td>
     533  </tr>
    525534  </table>
    526535
     
    741750        if (progress != null) progress.display((int)(43*progress_factor), "--Updating schema version: " + schemaVersion + " -> 44...");
    742751        schemaVersion = updateToSchemaVersion44(sc);
     752      }
     753     
     754      if (schemaVersion < 45)
     755      {
     756        if (progress != null) progress.display((int)(44*progress_factor), "--Updating schema version: " + schemaVersion + " -> 45...");
     757        schemaVersion = updateToSchemaVersion45(session);
    743758      }
    744759
     
    16491664      // Commit the changes
    16501665      HibernateUtil.commit(tx);
    1651       log.info("updateToSchemaVersion40: OK");
     1666      log.info("updateToSchemaVersion43: OK");
    16521667    }
    16531668    catch (BaseException ex)
    16541669    {
    16551670      if (tx != null) HibernateUtil.rollback(tx);
    1656       log.error("updateToSchemaVersion40: FAILED", ex);
     1671      log.error("updateToSchemaVersion43: FAILED", ex);
    16571672      throw ex;
    16581673    }
     
    18661881      session.save(pk);
    18671882    }
     1883  }
     1884 
     1885  /**
     1886    Update useInternalJobQueue for plug-ins.
     1887    @return The new schema version (=45)
     1888  */
     1889  private static int updateToSchemaVersion45(org.hibernate.Session session)
     1890  {
     1891    final int schemaVersion = 45;
     1892    org.hibernate.Transaction tx = null;
     1893    try
     1894    {
     1895      tx = HibernateUtil.newTransaction(session);
     1896 
     1897      // Change property values
     1898      org.hibernate.Query query = HibernateUtil.createQuery(session,
     1899        "SELECT DISTINCT jas.pluginDefinition FROM JobAgentSettingsData jas");
     1900      List<PluginDefinitionData> plugins =
     1901        HibernateUtil.loadList(PluginDefinitionData.class, query, null);
     1902     
     1903      for (PluginDefinitionData pd : plugins)
     1904      {
     1905        pd.setUseInternalJobQueue(false);
     1906      }
     1907 
     1908      // Update the schema version number
     1909      setSchemaVersion(session, schemaVersion);
     1910 
     1911      // Commit the changes
     1912      HibernateUtil.commit(tx);
     1913      log.info("updateToSchemaVersion45: OK");
     1914    }
     1915    catch (BaseException ex)
     1916    {
     1917      if (tx != null) HibernateUtil.rollback(tx);
     1918      log.error("updateToSchemaVersion45: FAILED", ex);
     1919      throw ex;
     1920    }
     1921    return schemaVersion;   
    18681922  }
    18691923 
     
    22272281        }
    22282282     
     2283        if (schemaVersion < 45)
     2284        {
     2285          // Set useInternalJobQueue to true for all plug-ins
     2286          org.hibernate.Query query = HibernateUtil.getPredefinedQuery(session,
     2287            "SET_USEJOBQUEUE_ON_PLUGINS");
     2288          /*
     2289            UPDATE PluginDefinitionData pld
     2290            SET pld.useInternalJobQueue = true
     2291            WHERE pld.useInternalJobQueue IS NULL
     2292          */
     2293          HibernateUtil.executeUpdate(query);
     2294        }       
     2295       
    22292296        //  Commit the changes
    22302297        HibernateUtil.commit(tx);
  • trunk/src/core/net/sf/basedb/core/data/PluginDefinitionData.java

    r3679 r3871  
    449449  }
    450450 
    451  
    452 
     451  private boolean useInternalJobQueue = true;
     452  /**
     453    If the plug-in can be executed with the internal job queue or
     454    not. If FALSE is used, the plug-in can only be executed by a
     455    job agent or other external tool.
     456    @since 2.5
     457    @hibernate.property column="`use_internal_queue`" type="boolean" not-null="true"
     458  */
     459  public boolean getUseInternalJobQueue()
     460  {
     461    return useInternalJobQueue;
     462  }
     463  public void setUseInternalJobQueue(boolean useInternalJobQueue)
     464  {
     465    this.useInternalJobQueue = useInternalJobQueue;
     466  }
     467 
    453468}
  • trunk/www/admin/jobagents/index.jsp

    r3675 r3871  
    165165      if (pluginId != -1)
    166166      {
    167         JobAgentSettings settings = agent.getSettings(PluginDefinition.getById(dc, pluginId), true);
     167        PluginDefinition plugin = PluginDefinition.getById(dc, pluginId);
     168        if (plugin.hasPermission(Permission.WRITE) && plugin.getUseInternalJobQueue())
     169        {
     170          plugin.setUseInternalJobQueue(false);
     171        }
     172        JobAgentSettings settings = agent.getSettings(plugin, true);
    168173        if (!settings.isInDatabase())
    169174        {
  • trunk/www/admin/plugindefinitions/edit_plugin.jsp

    r3679 r3871  
    239239        new AgentSetting(agentId, '', '', '', '0');
    240240      }
     241      var numBefore = document.forms['plugin'].agents.length;
    241242      Link.addItem(document.forms['plugin'].agents, item);
     243      var numAfter = document.forms['plugin'].agents.length;
     244      if (numBefore == 0 && numAfter > 0)
     245      {
     246        document.forms['plugin'].use_internal_jobqueue.checked = false;
     247      }
    242248      agentsOnClick();
    243249    }
     
    276282    {
    277283      var agents = document.forms['plugin'].agents;
     284      Link.addNewSection(agents, new Section('A', 'Job agents'));
    278285      <%
    279286      if (agentQuery != null)
     
    715722
    716723    <h3 class="docked"><%=title%> <base:help tabcontrol="settings" /></h3>
    717     <t:tabcontrol id="settings" contentstyle="<%="height: "+(int)(scale*260)+"px;"%>"
     724    <t:tabcontrol id="settings" contentstyle="<%="height: "+(int)(scale*300)+"px;"%>"
    718725      position="bottom" remember="<%=plugin != null%>" active="<%=selectedAgentId == -1 ? null : "agents" %>">
    719726    <t:tab id="info" title="Plugin" validate="validatePlugin()" helpid="plugindefinition.edit">
     
    910917   
    911918    <t:tab id="agents" title="Job agents" helpid="plugindefinition.jobagents">
    912       <table >
     919      <table class="form">
    913920      <tr valign="top">
     921      <td class="prompt">Run this plugin on</td>
    914922      <td>
    915         <b>Run this plugin on</b><br>
    916         <select name="agents" size="15" multiple style="width: 15em;"
     923        <input type="checkbox" name="use_internal_jobqueue" value="1"
     924          <%=plugin == null || plugin.getUseInternalJobQueue() ? "checked" : "" %>>
     925          internal job queue
     926      </td>
     927      </tr>
     928      <tr>
     929      <td>
     930        <select name="agents" size="12" multiple style="width: 15em;"
    917931          onclick="agentsOnClick()">
    918932        </select>
     
    921935      </td>
    922936      <td>
    923         <br>
    924937        <table width="150">
    925938        <tr><td><base:button
     
    937950        <br>
    938951        <div id="agentsettings" style="display: none;">
     952        <b>Settings for the selected job agent</b>
    939953        <table border="0" cellspacing="0" class="form">
    940954        <tr>
  • trunk/www/admin/plugindefinitions/index.jsp

    r3832 r3871  
    283283    plugin.setMaxMemory(Values.parseBytes(request.getParameter("maxMemory"), null));
    284284    plugin.setTrusted(Values.getBoolean(request.getParameter("trusted")));
     285    plugin.setUseInternalJobQueue(Values.getBoolean(request.getParameter("use_internal_jobqueue")));
    285286    String aie = Values.getStringOrNull(request.getParameter("allow_immediate_execution"));
    286287    plugin.setAllowImmediateExecution(aie == null ?
  • trunk/www/admin/plugindefinitions/list_plugins.jsp

    r3679 r3871  
    410410        datatype="boolean"
    411411        title="Trusted"
     412        sortable="true"
     413        filterable="true"
     414        exportable="true"
     415      />
     416      <tbl:columndef
     417        id="useInternalJobQueue"
     418        property="useInternalJobQueue"
     419        datatype="boolean"
     420        title="Use internal job queue"
    412421        sortable="true"
    413422        filterable="true"
     
    666675                <tbl:cell column="maxMemory"><%=Values.formatBytes(item.getMaxMemory())%></tbl:cell>
    667676                <tbl:cell column="trusted"><%=item.isTrusted() ? "yes" : "no"%></tbl:cell>
     677                <tbl:cell column="useInternalJobQueue"><%=item.getUseInternalJobQueue() ? "yes" : "no"%></tbl:cell>
    668678                <tbl:cell column="allowImmediateExecution"><%=item.getAllowImmediateExecution() ? "yes" : "no"%></tbl:cell>
    669679                <tbl:cell column="owner"
  • trunk/www/admin/plugindefinitions/view_plugin.jsp

    r3679 r3871  
    319319      </tr>     
    320320      <tr>
     321        <td class="prompt">Use internal job queue</td>
     322        <td><%=plugin.getUseInternalJobQueue() ? "yes" : "no"%></td>
     323      </tr>     
     324      <tr>
    321325        <td class="prompt" valign="baseline">Items</td>
    322326        <td><%=Values.getString(contexts, ", ", true)%></td>
  • trunk/www/include/scripts/main.js

    r3847 r3871  
    422422    this.controllers['NEWS'] = { url:'admin/news/index.jsp', width:540, height:400 };
    423423    this.controllers['PLUGINCONFIGURATION'] = { url:'admin/pluginconfigurations/index.jsp', width:500, height:340 };
    424     this.controllers['PLUGINDEFINITION'] = { url:'admin/plugindefinitions/index.jsp', width:700, height:400 };
     424    this.controllers['PLUGINDEFINITION'] = { url:'admin/plugindefinitions/index.jsp', width:720, height:440 };
    425425    this.controllers['PLUGINTYPE'] = { url:'admin/plugintypes/index.jsp', width:700, height:400 };
    426426    this.controllers['JOBAGENT'] = { url:'admin/jobagents/index.jsp', width:700, height:400 };
Note: See TracChangeset for help on using the changeset viewer.