Changeset 5680


Ignore:
Timestamp:
Jun 29, 2011, 3:04:28 PM (10 years ago)
Author:
Nicklas Nordborg
Message:

References #1590: Documentation cleanup

  • base.config reference.
  • Removed support for "export.max.items" since it was only needed with older MySQL versions and only the table exporter used it anyway.
Location:
trunk
Files:
3 edited

Legend:

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

    r5608 r5680  
    4444#db.dynamic.schema   = dynamic
    4545#db.queries          = /postgres-queries.xml
    46 #export.max.items    = 0
    4746
    4847# -------------
  • trunk/doc/src/docbook/appendix/base.config.xml

    r5442 r5680  
    3232    The <filename>base.config</filename> file is the main configuration file
    3333    for BASE. It is located in the <filename>&lt;basedir&gt;/www/WEB-INF/classes</filename>
    34     directory.
     34    directory. Most configuration properties have sensible defaults or are only used
     35    for advanced features. However, a few are required and may need to be specified
     36    or changed:
    3537  </para>
     38 
     39  <itemizedlist>
     40    <listitem>
     41      <property>db.dialect</property>, <property>db.driver</property>,
     42      <property>db.url</property>, <property>db.username</property>,
     43      <property>db.password</property>:
     44      Settings for connecting to the database.
     45    </listitem>
     46    <listitem>
     47      <property>userfiles</property>: Setting that specify where uploaded files are stored
     48      on the BASE server.
     49    </listitem>
     50    <listitem>
     51      <property>plugins.dir</property>: Settings that specify where plug-ins and extensions
     52      are installed.
     53    </listitem>
     54  </itemizedlist>
    3655 
    3756  <simplesect id="appendix.base.config.dbdriver">
     
    5271          <itemizedlist>
    5372          <listitem>
    54             <userinput>org.hibernate.dialect.MySQLInnoDBDialect</userinput>
     73            <userinput>org.hibernate.dialect.MySQL5InnoDBDialect</userinput>
    5574            for MySQL
    5675          </listitem>
     
    94113          <itemizedlist>
    95114          <listitem>
    96             <userinput>jdbc:mysql://localhost/base2</userinput>
     115            <userinput>jdbc:mysql://localhost/basedb</userinput>
    97116            for MySQL
    98117          </listitem>
    99118          <listitem>
    100             <userinput>jdbc:postgresql:base2</userinput>
     119            <userinput>jdbc:postgresql:basedb</userinput>
    101120            for PostgreSQL
    102121          </listitem>
     
    105124          You can get more information about the parameters that are supported on the
    106125          connection URL by reading the documentation from
    107           <ulink url="http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-configuration-properties.html"
     126          <ulink url="http://dev.mysql.com/doc/refman/5.1/en/connector-j-reference-configuration-properties.html"
    108127            >MySQL</ulink> and
    109128          <ulink url="http://jdbc.postgresql.org/documentation/81/connect.html"
     
    118137            load all data into memory. The value below should go into one line
    119138            <userinput>
    120             jdbc:mysql://localhost/base2?characterEncoding=UTF-8&amp;
    121               useCursorFetch=true&amp;defaultFetchSize=100&amp;useServerPrepStmts=true
     139            jdbc:mysql://localhost/basedb?characterEncoding=UTF-8&amp;useCursorFetch=true&amp;defaultFetchSize=100&amp;useServerPrepStmts=true
    122140            </userinput>
    123             </para>
    124            
    125             <para>
    126             Some MySQL versions (for example, 5.0.27) contains a bug that causes some
    127             queries to fail if <userinput>useCursorFetch=true</userinput>. If you experience
    128             this problem, you have to set it to false. For more information
    129             see <ulink url="http://base.thep.lu.se/ticket/509">http://base.thep.lu.se/ticket/509</ulink>.
    130141            </para>
    131142          </note>
     
    241252        Interval in hours between database cleanups. Set this to
    242253        0 to disable (recommened for job agents). The default value
    243         is 24.
    244           </para>
    245       </listitem>
    246     </varlistentry>
    247    
    248     <varlistentry>
    249       <term><property>export.max.items</property></term>
    250       <listitem>
    251         <para>
    252         The maximum number of items the export function should try to load in a single
    253         query. This setting exists because MySQL prior to 5.0.2 does not support scrollable
    254         result sets, but loads all data into memory. This will result in out of memory
    255         exception if exporting too many items at the same time. PostgreSQL does not have
    256         this problem. Use:
    257        
    258         <itemizedlist>
    259         <listitem><para>0 for PostgreSQL</para></listitem>
    260         <listitem>
    261           <para>
    262             0 for MySQL version 5.0.2 or above.
    263             Requires that <userinput>useCursorFetch=true</userinput> is specified in
    264             the connection url and  that <userinput>defaultFetchSize=xxx</userinput>
    265             is set to a value &gt; 0.
    266           </para>
    267         </listitem>
    268         <listitem>
    269           <para>
    270             As large as possible value for other MySQL versions.
    271             A low value results in more queries and slower performance when
    272             exporting data.
    273           </para>
    274         </listitem>
    275         </itemizedlist>
    276         </para>
     254        is 24. The cleanup will remove entries in the database that
     255        have been orphaned due to other information that has been removed.
     256        For example, change history entries, any-to-any links and
     257        permission keys.
     258          </para>
    277259      </listitem>
    278260    </varlistentry>
     
    542524        <para>
    543525        Interval in seconds between each execution of the secondary storage
    544         controller plug-in. It must be a value greater than zero or the secondary
    545         storage feature will be disabled.
     526        controller plug-in. If this property is not specified, <property>secondary.storage.time</property>
     527        should be set, or the secondary storage feature will be disabled.
    546528          </para>
    547529      </listitem>
     
    698680  </simplesect>
    699681 
    700  
    701   <simplesect id="appendix.base.config.secondary.other">
     682  <simplesect id="appendix.base.config.plugin">
     683    <title>Plug-ins and extensions</title>
     684    <variablelist>
     685    <varlistentry>
     686      <term><property>plugins.dir</property></term>
     687      <listitem>
     688        <para>
     689          The path to the directory where jar-files for external plug-ins and extensions
     690          are located. All new plug-ins and extensions found in this directory, can be selected
     691          for installation, see <xref linkend="plugins.installation" />.
     692        </para>
     693      </listitem>
     694    </varlistentry>
     695   
     696    <varlistentry>
     697      <term><property>plugins.autounload</property></term>
     698      <listitem>
     699        <para>
     700          Enable this setting to let BASE detect if a plug-in JAR file is changed
     701          and automatically load and use the new code instead of the old code.
     702          This setting is useful for plug-in developers since they don't have to
     703          restart the web server each time the plug-in is recompiled.
     704          <itemizedlist>
     705            <listitem>
     706              <simpara>
     707                <userinput>true,yes,1</userinput>
     708                to enable
     709              </simpara>
     710            </listitem>
     711            <listitem>
     712              <simpara>
     713                <userinput>false,no,0</userinput>
     714                to disable (default if no value is specified)
     715              </simpara>
     716            </listitem>
     717          </itemizedlist>
     718          Note that extensions doesn't support this feature. Use the installation
     719          wizard to update an extension.
     720        </para>
     721      </listitem>
     722    </varlistentry>
     723   
     724    <varlistentry>
     725      <term><property>extensions.disabled</property></term>
     726      <listitem>
     727        <para>
     728          A boolean flag that, if set, disables all external extensions.
     729          Plug-ins or core extensions will never be disabled.
     730        </para>
     731      </listitem>
     732    </varlistentry>
     733   
     734    </variablelist>
     735  </simplesect>
     736 
     737  <simplesect id="appendix.base.config.other">
    702738    <title>Other settings</title>
    703739   
     
    788824      </listitem>
    789825    </varlistentry>
    790     <varlistentry>
    791       <term><property>plugins.autounload</property></term>
    792       <listitem>
    793         <para>
    794           Enable this setting to let BASE detect if a plug-in JAR file is changed
    795           and automatically load and use the new code instead of the old code.
    796           This setting is useful for plug-in developers since they don't have to
    797           restart the web server each time the plug-in is recompiled.
    798           <itemizedlist>
    799             <listitem>
    800               <simpara>
    801                 <userinput>true,yes,1</userinput>
    802                 to enable
    803               </simpara>
    804             </listitem>
    805             <listitem>
    806               <simpara>
    807                 <userinput>false,no,0</userinput>
    808                 to disable (default if no value is specified)
    809               </simpara>
    810             </listitem>
    811           </itemizedlist>
    812         </para>
    813       </listitem>
    814     </varlistentry>
    815     <varlistentry>
    816       <term><property>plugins.dir</property></term>
    817       <listitem>
    818         <para>
    819           The path to the directory where jar-files for external plugins should be located
    820           if they should be used with the auto-installer. All new plugins found in this directory,
    821           or in any of it's sub-directories, can be selected for installation, see
    822           <xref linkend="plugins.installation" />.
    823           The plugging auto-installer will not be available if this property isn't defined.
    824         </para>
    825 
    826         <para>
    827           Another benefit is that all plug-ins inside this directory are registered
    828           with relative paths. This means that there is a lot less hassle when
    829           using job agents to run plug-ins. Just change this setting for the job
    830           agent installation and all plug-ins will work. For plug-ins that are outside
    831           of this directory you may have to manually register the path if it is different from
    832           the main path. It will also be a lot easier if you plan to move all plug-ins to
    833           a different directory. Just move the JAR files and change this setting. There is
    834           no need to change the paths for each plug-in in the database.
    835         </para>
    836            
    837       </listitem>
    838     </varlistentry>
    839826   
    840827    <varlistentry>
     
    868855          Most of the default texts are found in property files in the
    869856          <filename>/net/sf/basedb/clients/web/resources</filename>
    870           directory inside the <filename>BASE2Webclient.jar</filename>
     857          directory inside the <filename>base-webclient-3.x.jar</filename>
    871858          file. Translations should be located in the same relative path
    872859          either inside their own JAR file or in the <filename>WEB-INF/classes</filename>
     
    904891    <para>
    905892      This section is for global configuration of SSL (HTTPS) connection
    906       settings. Note that users can re-configure SSL connections per-file
     893      settings used when BASE need to access external file items. Note that
     894      users can re-configure SSL connections per-file
    907895      basis by setting up File-server items, so there is usually no need
    908896      to change anything in this section. If the majority of users on the
  • trunk/src/clients/web/net/sf/basedb/clients/web/plugins/SimpleExport.java

    r5612 r5680  
    2727import net.sf.basedb.core.BasicItem;
    2828import net.sf.basedb.core.BooleanParameterType;
    29 import net.sf.basedb.core.Config;
    3029import net.sf.basedb.core.DataQuery;
    3130import net.sf.basedb.core.DbControl;
     
    301300    // Configure the query with additional filters depending on which items should be exported
    302301    query.setReturnTotalCount(false);
    303     //boolean needToStep = false;
    304     int itemsPerStep = Config.getInt("export.max.items", 0);
    305302    // Which of "all", "current page", or "selected" is selected?
    306303    if ("all".equals(whichItems))
    307304    {
    308305      query.setFirstResult(0);
    309       query.setMaxResults(itemsPerStep);
     306      query.setMaxResults(0);
    310307    }
    311308    else if ("selected".equals(whichItems))
     
    500497    this.dc = dc;
    501498    boolean hasAnnotations = false;
    502     int itemsPerStep = Config.getInt("export.max.items", 0);
    503     boolean needToStep = query.getMaxResults() > 0 ? (itemsPerStep > 0) : false;
    504499    long totalItems = query.getMaxResults() == 0 ? query.count(dc) : query.getMaxResults();
    505500   
     
    546541    try
    547542    {
    548       do
     543      ThreadSignalHandler.checkInterrupted();
     544      result = queryWrapper.iterate();
     545      while (result.hasNext())
    549546      {
    550547        ThreadSignalHandler.checkInterrupted();
    551         result = queryWrapper.iterate();
    552         while (result.hasNext())
     548        numExported++;
     549        Object item = result.next();
     550       
     551        int id = queryWrapper.getId(item);
     552        AnnotationSet as = null;
     553        if (hasAnnotations)
    553554        {
    554           ThreadSignalHandler.checkInterrupted();
    555           numExported++;
    556           Object item = result.next();
    557          
    558           int id = queryWrapper.getId(item);
    559           AnnotationSet as = null;
    560           if (hasAnnotations)
     555          Annotatable a = (Annotatable)item;
     556          if (a.isAnnotated()) as = a.getAnnotationSet();
     557        }
     558       
     559        template.beginItem(id);
     560        for (ExportedProperty ep : exportedProperties)
     561        {
     562          if (ep.annotationType != null)
    561563          {
    562             Annotatable a = (Annotatable)item;
    563             if (a.isAnnotated()) as = a.getAnnotationSet();
    564           }
    565          
    566           template.beginItem(id);
    567           for (ExportedProperty ep : exportedProperties)
    568           {
    569             if (ep.annotationType != null)
     564            List<?> values = null;
     565            String unitSymbol = null;
     566            if (ep.dataloader == null)
    570567            {
    571               List<?> values = null;
    572               String unitSymbol = null;
    573               if (ep.dataloader == null)
     568              Annotation a = as != null && as.hasAnnotation(ep.annotationType) ?
     569                  as.getAnnotation(ep.annotationType) : null;
     570              if (a != null)
    574571              {
    575                 Annotation a = as != null && as.hasAnnotation(ep.annotationType) ?
    576                     as.getAnnotation(ep.annotationType) : null;
    577                 if (a != null)
    578                 {
    579                   values = a.getValues(ep.unit);
    580                   if (ep.unit == null) unitSymbol = a.getUnitSymbol(null);
    581                 }
     572                values = a.getValues(ep.unit);
     573                if (ep.unit == null) unitSymbol = a.getUnitSymbol(null);
     574              }
     575            }
     576            else
     577            {
     578              Object data = ep.dataloader.getData(ep, item);
     579              if (data instanceof Collection)
     580              {
     581                values = new ArrayList<Object>((Collection)data);
    582582              }
    583583              else
    584584              {
    585                 Object data = ep.dataloader.getData(ep, item);
    586                 if (data instanceof Collection)
    587                 {
    588                   values = new ArrayList<Object>((Collection)data);
    589                 }
    590                 else
    591                 {
    592                   values = Arrays.asList(data);
    593                 }
    594                 if (ep.unit == null && ep.annotationType.supportUnits())
    595                 {
    596                   Unit unit = ep.annotationType.getDefaultUnit();
    597                   if (unit != null) unitSymbol = unit.getDisplaySymbol();
    598                 }
     585                values = Arrays.asList(data);
    599586              }
    600               template.writeAnnotations(ep, values, unitSymbol);
     587              if (ep.unit == null && ep.annotationType.supportUnits())
     588              {
     589                Unit unit = ep.annotationType.getDefaultUnit();
     590                if (unit != null) unitSymbol = unit.getDisplaySymbol();
     591              }
     592            }
     593            template.writeAnnotations(ep, values, unitSymbol);
     594          }
     595          else
     596          {
     597            Object data = ep.dataloader == null ?
     598                queryWrapper.getData(ep, item) : ep.dataloader.getData(ep, item);
     599           
     600            if (data instanceof Collection)
     601            {
     602              template.writeCollection(ep, (Collection)data);
    601603            }
    602604            else
    603605            {
    604               Object data = ep.dataloader == null ?
    605                   queryWrapper.getData(ep, item) : ep.dataloader.getData(ep, item);
    606              
    607               if (data instanceof Collection)
    608               {
    609                 template.writeCollection(ep, (Collection)data);
    610               }
    611               else
    612               {
    613                 template.writeProperty(ep, data);
    614               }
     606              template.writeProperty(ep, data);
    615607            }
    616608          }
    617           template.endItem();
    618           if (progress != null)
    619           {
    620             int percent = (int)(100L * numExported / totalItems);
    621             progress.display(percent, numExported + " of " + totalItems + " done.");
    622           }
    623         }
    624         if (needToStep)
     609        }
     610        template.endItem();
     611        if (progress != null)
    625612        {
    626           query.setFirstResult(query.getFirstResult() + itemsPerStep);
     613          int percent = (int)(100L * numExported / totalItems);
     614          progress.display(percent, numExported + " of " + totalItems + " done.");
    627615        }
    628616      }
    629       while (needToStep && (numExported % itemsPerStep == 0));
     617     
    630618      template.endDocument();
    631619      successMessage = numExported + " items were exported successfully";
Note: See TracChangeset for help on using the changeset viewer.