Changeset 5680
- Timestamp:
- Jun 29, 2011, 3:04:28 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/config/dist/base.config
r5608 r5680 44 44 #db.dynamic.schema = dynamic 45 45 #db.queries = /postgres-queries.xml 46 #export.max.items = 047 46 48 47 # ------------- -
trunk/doc/src/docbook/appendix/base.config.xml
r5442 r5680 32 32 The <filename>base.config</filename> file is the main configuration file 33 33 for BASE. It is located in the <filename><basedir>/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: 35 37 </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> 36 55 37 56 <simplesect id="appendix.base.config.dbdriver"> … … 52 71 <itemizedlist> 53 72 <listitem> 54 <userinput>org.hibernate.dialect.MySQL InnoDBDialect</userinput>73 <userinput>org.hibernate.dialect.MySQL5InnoDBDialect</userinput> 55 74 for MySQL 56 75 </listitem> … … 94 113 <itemizedlist> 95 114 <listitem> 96 <userinput>jdbc:mysql://localhost/base 2</userinput>115 <userinput>jdbc:mysql://localhost/basedb</userinput> 97 116 for MySQL 98 117 </listitem> 99 118 <listitem> 100 <userinput>jdbc:postgresql:base 2</userinput>119 <userinput>jdbc:postgresql:basedb</userinput> 101 120 for PostgreSQL 102 121 </listitem> … … 105 124 You can get more information about the parameters that are supported on the 106 125 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" 108 127 >MySQL</ulink> and 109 128 <ulink url="http://jdbc.postgresql.org/documentation/81/connect.html" … … 118 137 load all data into memory. The value below should go into one line 119 138 <userinput> 120 jdbc:mysql://localhost/base2?characterEncoding=UTF-8& 121 useCursorFetch=true&defaultFetchSize=100&useServerPrepStmts=true 139 jdbc:mysql://localhost/basedb?characterEncoding=UTF-8&useCursorFetch=true&defaultFetchSize=100&useServerPrepStmts=true 122 140 </userinput> 123 </para>124 125 <para>126 Some MySQL versions (for example, 5.0.27) contains a bug that causes some127 queries to fail if <userinput>useCursorFetch=true</userinput>. If you experience128 this problem, you have to set it to false. For more information129 see <ulink url="http://base.thep.lu.se/ticket/509">http://base.thep.lu.se/ticket/509</ulink>.130 141 </para> 131 142 </note> … … 241 252 Interval in hours between database cleanups. Set this to 242 253 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 > 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> 277 259 </listitem> 278 260 </varlistentry> … … 542 524 <para> 543 525 Interval in seconds between each execution of the secondary storage 544 controller plug-in. I t must be a value greater than zero or the secondary545 s torage 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. 546 528 </para> 547 529 </listitem> … … 698 680 </simplesect> 699 681 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"> 702 738 <title>Other settings</title> 703 739 … … 788 824 </listitem> 789 825 </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 changed795 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 to797 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 enable803 </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 located820 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, see822 <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 registered828 with relative paths. This means that there is a lot less hassle when829 using job agents to run plug-ins. Just change this setting for the job830 agent installation and all plug-ins will work. For plug-ins that are outside831 of this directory you may have to manually register the path if it is different from832 the main path. It will also be a lot easier if you plan to move all plug-ins to833 a different directory. Just move the JAR files and change this setting. There is834 no need to change the paths for each plug-in in the database.835 </para>836 837 </listitem>838 </varlistentry>839 826 840 827 <varlistentry> … … 868 855 Most of the default texts are found in property files in the 869 856 <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> 871 858 file. Translations should be located in the same relative path 872 859 either inside their own JAR file or in the <filename>WEB-INF/classes</filename> … … 904 891 <para> 905 892 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 907 895 basis by setting up File-server items, so there is usually no need 908 896 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 27 27 import net.sf.basedb.core.BasicItem; 28 28 import net.sf.basedb.core.BooleanParameterType; 29 import net.sf.basedb.core.Config;30 29 import net.sf.basedb.core.DataQuery; 31 30 import net.sf.basedb.core.DbControl; … … 301 300 // Configure the query with additional filters depending on which items should be exported 302 301 query.setReturnTotalCount(false); 303 //boolean needToStep = false;304 int itemsPerStep = Config.getInt("export.max.items", 0);305 302 // Which of "all", "current page", or "selected" is selected? 306 303 if ("all".equals(whichItems)) 307 304 { 308 305 query.setFirstResult(0); 309 query.setMaxResults( itemsPerStep);306 query.setMaxResults(0); 310 307 } 311 308 else if ("selected".equals(whichItems)) … … 500 497 this.dc = dc; 501 498 boolean hasAnnotations = false; 502 int itemsPerStep = Config.getInt("export.max.items", 0);503 boolean needToStep = query.getMaxResults() > 0 ? (itemsPerStep > 0) : false;504 499 long totalItems = query.getMaxResults() == 0 ? query.count(dc) : query.getMaxResults(); 505 500 … … 546 541 try 547 542 { 548 do 543 ThreadSignalHandler.checkInterrupted(); 544 result = queryWrapper.iterate(); 545 while (result.hasNext()) 549 546 { 550 547 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) 553 554 { 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) 561 563 { 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) 570 567 { 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) 574 571 { 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); 582 582 } 583 583 else 584 584 { 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); 599 586 } 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); 601 603 } 602 604 else 603 605 { 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); 615 607 } 616 608 } 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) 625 612 { 626 query.setFirstResult(query.getFirstResult() + itemsPerStep); 613 int percent = (int)(100L * numExported / totalItems); 614 progress.display(percent, numExported + " of " + totalItems + " done."); 627 615 } 628 616 } 629 while (needToStep && (numExported % itemsPerStep == 0));617 630 618 template.endDocument(); 631 619 successMessage = numExported + " items were exported successfully";
Note: See TracChangeset
for help on using the changeset viewer.