Changeset 3857
- Timestamp:
- Oct 17, 2007, 12:41:17 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 35 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/specifications/technical.html
r3679 r3857 163 163 <li> 164 164 Possible to add support for other import and export file formats, including 165 very cryptic ones (i.e. everyt ing else than tab-separated text files).165 very cryptic ones (i.e. everything else than tab-separated text files). 166 166 </li> 167 167 <li> -
trunk/doc/src/docbook/admindoc/installation_upgrade.xml
r3775 r3857 67 67 <title>Upgrade instructions</title> 68 68 69 <important> 70 <title>Note to PostgreSQL users</title> 71 Upgrading BASE to versions earlier 72 than v2.2 is not be safe with an PostgreSQL database engine due 73 to a bug in Hibernate. The problem is reported to Hibernate 74 developers. There now exists a workaround for this problem. Read 75 more about the workaround on 76 the <ulink 77 url="http://base.thep.lu.se/wiki/UpgradePostgres">Upgrading a 78 Postgres database prior to BASE 2.2</ulink> page. This fix is 79 not needed for the release which this document is a part of. 69 <important id="dropindexes"> 70 <title>Upgrading from BASE 2.4.3 or lower to 2.4.4 or higher</title> 71 <para> 72 Older releases of BASE 2 used to create indexes for many columns 73 in the dynamic database. The same columns are part of the primary 74 key for the tables so the indexes are not really needed. The 75 result is very bad performance since the database engine sometimes 76 get stuck in "index update" mode making the entire server 77 very slow. BASE 2.4.4 no longer creates the indexes. Indexes on 78 existing tables should be dropped to increase the performance. 79 Tests have shown a 50-90% decrease in execution time for some 80 plug-ins 81 (<ulink url="http://base.thep.lu.se/ticket/294">http://base.thep.lu.se/ticket/294</ulink>). 82 </para> 83 <para> 84 Removing the indexes is very simple. <emphasis>After the server 85 has been upgraded</emphasis> following the usual instructions below, issue the 86 the following commands: 87 </para> 88 89 <programlisting> 90 cd <basedir>/bin 91 ./dynamicdb.sh -v -dropindexes 92 </programlisting> 93 94 <para> 95 Skip the <option>-dropindexes</option> option to do a dry 96 run without actually deleting the indexes. 97 </para> 80 98 </important> 81 99 … … 876 894 properties are defined in 877 895 <filename>/path/to/base/www/WEB-INF/classes/extended-properties.xml</filename>. 878 There is an administrator <ulink 896 There is an 897 administrator <ulink 879 898 url="http://base.thep.lu.se/chrome/site/doc/admin/extended-properties.html">document 880 discussing extended properties</ulink> available. 899 discussing extended properties</ulink> available. If you 900 plan to perform a migration of a BASE 1.2 database you 901 should probably not remove any extended properties 902 columns (this is not tested so the outcome is currently 903 undefined). However, adding columns does not affect 904 migration. 881 905 </para> 882 906 </listitem> … … 1064 1088 changes to the BASE 1.2 schema you need to patch the BASE 2 1065 1089 schema as well as make proper changes to the migration program. 1090 If there are added columns to the reporter table in your BASE 1091 1.2 database you need to transfer the additional information 1092 after migration (even if you modified the BASE 1093 2 <filename>extended-properties.xml</filename> file). 1066 1094 </para> 1067 1095 … … 1166 1194 <listitem> 1167 1195 <para> 1196 <emphasis>Optional, depends on your BASE 1.2 reporter 1197 table.</emphasis> Additional columns (as compared with a 1198 pristine database schema) in the reporter table in the 1199 BASE 1.2 schema are not transferred during migration. You 1200 have to perform the transfer manually after 1201 migration. Simply export the reporter information from 1202 BASE 1.2, and import the data into BASE 2. In BASE 1.2: i) 1203 View the reporters, ii) Use `Get as tab-separated text` to 1204 create a tab separated file (right click and save). In 1205 BASE 2, to import the file follow the instructions in 1206 <xref linkend="reporters.import"/>. 1207 </para> 1208 </listitem> 1209 1210 <listitem> 1211 <para> 1168 1212 Migration done! Happy BASEing. 1169 1213 </para> -
trunk/src/clients/jobagent/net/sf/basedb/clients/jobagent/JobRunner.java
r3675 r3857 26 26 import java.util.Arrays; 27 27 28 import net.sf.basedb.core.Application; 28 29 import net.sf.basedb.core.DbControl; 29 30 import net.sf.basedb.core.ItemModifiedException; … … 119 120 } 120 121 122 // To protect the session control from timeouts 123 Application.Pinger pinger = Application.newPinger(sc); 121 124 try 122 125 { … … 131 134 dc.commit(); 132 135 throw t; 136 } 137 finally 138 { 139 if (pinger != null) pinger.stop(); 133 140 } 134 141 -
trunk/src/clients/jobagent/net/sf/basedb/clients/jobagent/executors/DummyJobExecutor.java
r3675 r3857 81 81 public void init(Agent agent) 82 82 { 83 wait = Values.getInt(agent.getProperty("agent.executor. wait"), -1);83 wait = Values.getInt(agent.getProperty("agent.executor.dummy.wait"), -1); 84 84 } 85 85 -
trunk/src/clients/jobagent/net/sf/basedb/clients/jobagent/executors/ThreadJobExecutor.java
r3675 r3857 147 147 SessionControl sc = null; 148 148 SessionControl impersonated = null; 149 Application.Pinger pinger = null; 149 150 try 150 151 { … … 169 170 170 171 Thread.currentThread().setPriority(threadPriority); 172 pinger = Application.newPinger(sc); 171 173 executor.executeJob(impersonated, null, job, settings, null); 172 174 } … … 178 180 finally 179 181 { 182 if (pinger != null) pinger.stop(); 180 183 if (dc != null) dc.close(); 181 184 if (impersonated != null && impersonated.isLoggedIn()) impersonated.logout(); -
trunk/src/clients/web/net/sf/basedb/clients/web/Base.java
r3820 r3857 401 401 402 402 // Current item 403 String itemId = request.getParameter("item_id");403 String itemId = Values.getStringOrNull(request.getParameter("item_id")); 404 404 cc.setId(Values.getInt(itemId, cc.getId())); 405 405 -
trunk/src/core/net/sf/basedb/core/AnnotationRestriction.java
r3679 r3857 105 105 throws BaseException 106 106 { 107 SessionControl sc = dc.getSessionControl(); 107 108 String valueTable = null; 108 109 if (valueType == Type.INT) … … 168 169 { 169 170 if (debugSqlEnabled) logSql.debug("Executing annotation query: " + sql); 170 List<Object[]> twoIds = HibernateUtil.loadList(Object[].class, sqlQuery );171 List<Object[]> twoIds = HibernateUtil.loadList(Object[].class, sqlQuery, sc); 171 172 StringBuilder annotationSets = new StringBuilder("0"); 172 173 StringBuilder annotations = new StringBuilder("0"); … … 192 193 sqlQuery.addScalar("annotationset_id", org.hibernate.Hibernate.INTEGER); 193 194 if (debugSqlEnabled) logSql.debug("Executing annotation query: " + sql); 194 List<Integer> ids = HibernateUtil.loadList(Integer.class, sqlQuery );195 List<Integer> ids = HibernateUtil.loadList(Integer.class, sqlQuery, sc); 195 196 annotationSets = new StringBuilder(annotationSetIds); 196 197 for (Integer id : ids) … … 204 205 { 205 206 if (debugSqlEnabled) logSql.debug("Executing annotation query: " + sql); 206 List<Integer> ids = HibernateUtil.loadList(Integer.class, sqlQuery );207 List<Integer> ids = HibernateUtil.loadList(Integer.class, sqlQuery, sc); 207 208 StringBuilder annotationSets = new StringBuilder("0"); 208 209 for (Integer id : ids) -
trunk/src/core/net/sf/basedb/core/Application.java
r3846 r3857 33 33 import java.util.Calendar; 34 34 import java.util.GregorianCalendar; 35 import java.util.HashSet; 35 36 import java.util.Map; 36 37 import java.util.HashMap; … … 38 39 import java.util.Iterator; 39 40 import java.util.Random; 41 import java.util.Set; 40 42 import java.util.Timer; 41 43 import java.util.TimerTask; … … 471 473 472 474 // Adding a task that cleans the session control cache at regular intervale 473 long milliSeconds = 60 *1000*sessionCacheTimeout;475 long milliSeconds = 60 * 1000 * sessionCacheTimeout; 474 476 getScheduler().schedule(new SessionControlCacheCleaner(), milliSeconds, milliSeconds, false); 475 477 476 478 if (useInternalJobQueue == null) useInternalJobQueue = Config.getBoolean("jobqueue.internal.enabled"); 479 log.info("jobqueue.internal.enabled = " + useInternalJobQueue); 477 480 if (useInternalJobQueue) 478 481 { … … 892 895 private static void cleanSessionControlCache(boolean force) 893 896 { 897 if (!force) 898 { 899 // Ping all sessioncontrols in the pingers set 900 for (Pinger p : pingers) 901 { 902 p.ping(); 903 } 904 } 905 894 906 synchronized(sessionCache) 895 907 { 896 908 Iterator<SessionControl> i = sessionCache.values().iterator(); 897 909 long now = System.currentTimeMillis(); 910 long timout = 60 * 1000 * sessionCacheTimeout; 898 911 while (i.hasNext()) 899 912 { 900 913 SessionControl sc = i.next(); 901 if (force || ((now - sc.getLastAccess()) > 60*1000*sessionCacheTimeout))914 if (force || ((now - sc.getLastAccess()) > timout)) 902 915 { 903 916 log.info("cleanSessionControlCache: Remove[ID="+sc.getId()+"]"); … … 906 919 if (sc.isLoggedIn()) sc.logout(); 907 920 } 908 catch ( BaseException ex)921 catch (Throwable t) 909 922 { 910 log.error("Exception during cleanSessionControlCache", ex);923 log.error("Exception during cleanSessionControlCache", t); 911 924 } 912 925 finally 913 926 { 927 sc.close(); 914 928 i.remove(); 915 929 } … … 1005 1019 } 1006 1020 1021 private static Set<Pinger> pingers = 1022 Collections.synchronizedSet(new HashSet<Pinger>()); 1023 1024 /** 1025 Create a new <code>Pinger</code> object that is used 1026 to keep a session control alive. 1027 1028 @param sc The SessionControl that the pinger should protect 1029 @return A pinger object 1030 @since 2.4.5 1031 */ 1032 public static Pinger newPinger(SessionControl sc) 1033 { 1034 Pinger p = new Pinger(sc); 1035 pingers.add(p); 1036 return p; 1037 } 1038 1039 private static void stopPinger(Pinger p) 1040 { 1041 pingers.remove(p); 1042 } 1043 1044 /** 1045 A <code>Pinger</code> is an object that is used to protect another 1046 object from timing out by automatically pinging it. This can for 1047 example be used by a client to override the timeout for SessionControl 1048 items. 1049 1050 @since 2.4.5 1051 */ 1052 public static class Pinger 1053 { 1054 private final SessionControl sc; 1055 private Pinger(SessionControl sc) 1056 { 1057 this.sc = sc; 1058 } 1059 /** 1060 Ping the SessionControl by updating the last access time: 1061 {@link SessionControl#updateLastAccess()} 1062 */ 1063 public void ping() 1064 { 1065 if (!sc.isClosed()) sc.updateLastAccess(); 1066 } 1067 /** 1068 Stop this pinger. 1069 */ 1070 public void stop() 1071 { 1072 Application.stopPinger(this); 1073 } 1074 } 1075 1007 1076 } -
trunk/src/core/net/sf/basedb/core/BasicItem.java
r3679 r3857 251 251 query.setInteger("toType", this.getType().getValue()); 252 252 Set<ItemProxy> using = new TreeSet<ItemProxy>(); 253 for (Object[] u : HibernateUtil.loadList(Object[].class, query ))253 for (Object[] u : HibernateUtil.loadList(Object[].class, query, getSessionControl())) 254 254 { 255 255 using.add(new ItemProxy((Integer)u[0], Item.fromValue((Integer)u[1]))); … … 268 268 protected void addUsingItems(Set<ItemProxy> using, Item itemType, org.hibernate.Query query) 269 269 { 270 for (Integer itemId : HibernateUtil.loadList(Integer.class, query ))270 for (Integer itemId : HibernateUtil.loadList(Integer.class, query, getSessionControl())) 271 271 { 272 272 using.add(new ItemProxy(itemId, itemType)); … … 282 282 protected void addUsingItems(Set<ItemProxy> using, org.hibernate.Query query) 283 283 { 284 for (BasicData item : HibernateUtil.loadList(BasicData.class, query ))284 for (BasicData item : HibernateUtil.loadList(BasicData.class, query, getSessionControl())) 285 285 { 286 286 using.add(new ItemProxy(item.getId(), Item.fromDataClass(item.getClass()))); -
trunk/src/core/net/sf/basedb/core/BioAssaySet.java
r3679 r3857 635 635 } 636 636 637 // Everyt ing is ok, create the new bioassay637 // Everything is ok, create the new bioassay 638 638 BioAssay ba = newBioAssay(parent.getDataCubeColumn(), Collections.singleton(parent)); 639 639 ba.setName(parent.getName()); … … 1209 1209 { 1210 1210 DbControl dc = getDbControl(); 1211 SessionControl sc = dc.getSessionControl(); 1211 1212 1212 1213 // 1. Find all child bioassaysets recursively … … 1227 1228 */ 1228 1229 query.setParameterList("basList", all); 1229 List<DataCubeData> possibleCubes = HibernateUtil.loadList(DataCubeData.class, query );1230 List<DataCubeData> possibleCubes = HibernateUtil.loadList(DataCubeData.class, query, sc); 1230 1231 1231 1232 // 2b. Among the found data cubes, find those that are also used by other bioassaysets … … 1242 1243 query.setParameterList("basList", all); 1243 1244 query.setParameterList("possibleCubes", possibleCubes); 1244 possibleCubes.removeAll(HibernateUtil.loadList(DataCubeData.class, query ));1245 possibleCubes.removeAll(HibernateUtil.loadList(DataCubeData.class, query, sc)); 1245 1246 1246 1247 … … 1279 1280 query.setParameterList("deletedCubes", possibleCubes); 1280 1281 } 1281 List<DataCubeLayerData> possibleLayers = HibernateUtil.loadList(DataCubeLayerData.class, query );1282 List<DataCubeLayerData> possibleLayers = HibernateUtil.loadList(DataCubeLayerData.class, query, sc); 1282 1283 1283 1284 if (possibleLayers.size() > 0) … … 1294 1295 query.setParameterList("basList", all); 1295 1296 query.setParameterList("possibleLayers", possibleLayers); 1296 possibleLayers.removeAll(HibernateUtil.loadList(DataCubeLayerData.class, query ));1297 possibleLayers.removeAll(HibernateUtil.loadList(DataCubeLayerData.class, query, sc)); 1297 1298 1298 1299 // 3c. Delete data from the remaining layers … … 1330 1331 query.setParameterList("deletedCubes", possibleCubes); 1331 1332 } 1332 List<DataCubeFilterData> possibleFilters = HibernateUtil.loadList(DataCubeFilterData.class, query );1333 List<DataCubeFilterData> possibleFilters = HibernateUtil.loadList(DataCubeFilterData.class, query, sc); 1333 1334 1334 1335 if (possibleFilters.size() > 0) … … 1345 1346 query.setParameterList("basList", all); 1346 1347 query.setParameterList("possibleFilters", possibleFilters); 1347 possibleFilters.removeAll(HibernateUtil.loadList(DataCubeFilterData.class, query ));1348 possibleFilters.removeAll(HibernateUtil.loadList(DataCubeFilterData.class, query, sc)); 1348 1349 1349 1350 // 4c. Delete data from the remaining layers … … 1381 1382 query.setParameterList("deletedCubes", possibleCubes); 1382 1383 } 1383 List<DataCubeExtraValueData> possibleExtraValues = HibernateUtil.loadList(DataCubeExtraValueData.class, query );1384 List<DataCubeExtraValueData> possibleExtraValues = HibernateUtil.loadList(DataCubeExtraValueData.class, query, sc); 1384 1385 1385 1386 if (possibleExtraValues.size() > 0) … … 1396 1397 query.setParameterList("basList", all); 1397 1398 query.setParameterList("possibleExtraValues", possibleExtraValues); 1398 possibleExtraValues.removeAll(HibernateUtil.loadList(DataCubeExtraValueData.class, query ));1399 possibleExtraValues.removeAll(HibernateUtil.loadList(DataCubeExtraValueData.class, query, sc)); 1399 1400 1400 1401 // 5c. Delete data from the remaining extra values … … 1430 1431 } 1431 1432 findChildren.setEntity("parent", parent); 1432 List<BioAssaySetData> children = HibernateUtil.loadList(BioAssaySetData.class, findChildren );1433 List<BioAssaySetData> children = HibernateUtil.loadList(BioAssaySetData.class, findChildren, null); 1433 1434 for (BioAssaySetData child : children) 1434 1435 { -
trunk/src/core/net/sf/basedb/core/DataQuery.java
r3679 r3857 82 82 enableFilters(dc); 83 83 long totalCount = -1; 84 SessionControl sc = dc.getSessionControl(); 84 85 85 86 // Load the total count if it is requested … … 90 91 91 92 // Load the results 92 ScrollIterator<I> result = HibernateUtil.loadIterator(dataClass, getMainHqlQuery(dc)); 93 ScrollIterator<I> result = 94 HibernateUtil.loadIterator(dataClass, getMainHqlQuery(dc), sc); 93 95 disableFilters(dc); 94 96 return new DataResultIterator<I>(result, dc.getSessionControl(), -
trunk/src/core/net/sf/basedb/core/DiskUsageStatistics.java
r3675 r3857 237 237 private void loadDiskUsage(org.hibernate.Query query) 238 238 { 239 List<Object[]> du = HibernateUtil.loadList(Object[].class, query );239 List<Object[]> du = HibernateUtil.loadList(Object[].class, query, null); 240 240 for (Object[] row : du) 241 241 { -
trunk/src/core/net/sf/basedb/core/Group.java
r3679 r3857 147 147 { 148 148 query.setParameterList("groups", allGroups, org.hibernate.Hibernate.INTEGER); 149 } while (allGroups.addAll(HibernateUtil.loadList(Integer.class, query )));149 } while (allGroups.addAll(HibernateUtil.loadList(Integer.class, query, null))); 150 150 } 151 151 return allGroups; -
trunk/src/core/net/sf/basedb/core/HibernateUtil.java
r3679 r3857 46 46 import java.util.HashMap; 47 47 import java.util.HashSet; 48 import java.util.LinkedList; 48 49 import java.util.List; 49 50 import java.util.Iterator; … … 1449 1450 @param clazz The list should contain objects of this class 1450 1451 @param query The query to execute 1452 @param sc A optional SessionControl that is automatically protected from 1453 timeouts during the time the query is running 1451 1454 */ 1452 1455 @SuppressWarnings({"unchecked"}) 1453 static <T> List<T> loadList(Class<T> clazz, Query query )1456 static <T> List<T> loadList(Class<T> clazz, Query query, SessionControl sc) 1454 1457 throws BaseException 1455 1458 { 1456 1459 assert query != null : "query == null"; 1457 try 1458 { 1460 Application.Pinger pinger = null; 1461 try 1462 { 1463 if (sc != null) pinger = Application.newPinger(sc); 1459 1464 return (List<T>)query.list(); 1460 1465 } … … 1462 1467 { 1463 1468 throw new BaseException(ex); 1469 } 1470 finally 1471 { 1472 if (pinger != null) pinger.stop(); 1464 1473 } 1465 1474 } … … 1469 1478 @param clazz The iterator returns objects of this class 1470 1479 @param query The query to execute 1471 */ 1472 static <T> ScrollIterator<T> loadIterator(Class<T> clazz, Query query) 1480 @param sc A optional SessionControl that is automatically protected from 1481 timeouts during the time the query is running 1482 */ 1483 static <T> ScrollIterator<T> loadIterator(Class<T> clazz, Query query, SessionControl sc) 1473 1484 throws BaseException 1474 1485 { 1475 1486 assert query != null : "query == null"; 1476 try 1477 { 1487 Application.Pinger pinger = null; 1488 try 1489 { 1490 if (sc != null) pinger = Application.newPinger(sc); 1491 Thread.sleep(5000); 1478 1492 ScrollableResults result = query.scroll(ScrollMode.FORWARD_ONLY); 1479 1493 return new ScrollIterator<T>(clazz, result); … … 1482 1496 { 1483 1497 throw new BaseException(ex); 1498 } 1499 finally 1500 { 1501 if (pinger != null) pinger.stop(); 1484 1502 } 1485 1503 } … … 1675 1693 1676 1694 /** 1695 Prints a lot of useful stuff about the dynamic database to standard output. 1696 For each table the output includes information about columns, indexes, 1697 primary keys and foreign keys as found in the current database. 1698 1699 @param verbose If true, lots of information will be printed 1700 @param silent If true, no information will be printed 1701 @param dropIndexes If true, all indexes will be dropped 1702 */ 1703 @SuppressWarnings("unchecked") 1704 public static void dynamicDbIndexes(boolean verbose, boolean silent, boolean dropIndexes) 1705 { 1706 if (silent) verbose = false; 1707 Session session = newSession(); 1708 Connection connection = HibernateUtil.getConnection(session); 1709 DatabaseMetaData metaData = null; 1710 List<Table> tables = new LinkedList<Table>(); 1711 1712 try 1713 { 1714 metaData = connection.getMetaData(); 1715 ResultSet result = metaData.getTables(Application.getDynamicCatalog(), 1716 Application.getDynamicSchema(), null, null); 1717 1718 while (result.next()) 1719 { 1720 String tableName = result.getString("TABLE_NAME"); 1721 String tableCatalog = result.getString("TABLE_CAT"); 1722 String tableSchema = result.getString("TABLE_SCHEM"); 1723 Table table = new Table(); 1724 table.setName(tableName); 1725 table.setCatalog(tableCatalog); 1726 table.setSchema(tableSchema); 1727 tables.add(table); 1728 } 1729 } 1730 catch (SQLException ex) 1731 { 1732 throw new BaseException(ex); 1733 } 1734 1735 for (Table table : tables) 1736 { 1737 1738 if (!silent) 1739 { 1740 System.out.println("================="); 1741 System.out.println("Table : " + table.getName()); 1742 } 1743 if (verbose) 1744 { 1745 System.out.println("Catalog : " + table.getCatalog()); 1746 System.out.println("Schema : " + table.getSchema()); 1747 } 1748 1749 Map<Set<String>, String> indexedColumns = new HashMap<Set<String>, String>(); 1750 Map<Set<String>, String> uniqueColumns = new HashMap<Set<String>, String>(); 1751 1752 String pkName = null; 1753 Set<String> fkNames = new HashSet<String>(); 1754 1755 if (verbose) 1756 { 1757 System.out.println("Database information"); 1758 System.out.println("--------------------"); 1759 } 1760 1761 TableInfo tiDb = null; 1762 try 1763 { 1764 tiDb = new TableInfo(table, metaData); 1765 } 1766 catch (SQLException ex) 1767 { 1768 throw new BaseException(ex); 1769 } 1770 1771 if (tiDb != null) 1772 { 1773 if (verbose) 1774 { 1775 // Write all columns 1776 for (ColumnInfo ci : tiDb.getColumns()) 1777 { 1778 System.out.println(" Column : " + ci); 1779 } 1780 1781 // Write primary key 1782 System.out.println(" Primary key : " + tiDb.getPrimaryKey()); 1783 1784 // Write foreign keys 1785 for (ForeignKeyInfo fk : tiDb.getForeignKeys()) 1786 { 1787 System.out.println(" Foreign key : " + fk); 1788 } 1789 } 1790 1791 // Write indexes and unique constraints 1792 for (IndexInfo ii : tiDb.getIndexes()) 1793 { 1794 if (!silent) 1795 { 1796 if (ii.isUnique()) 1797 { 1798 System.out.println(" Unique : " + ii); 1799 } 1800 else 1801 { 1802 System.out.println(" Index : " + ii); 1803 } 1804 } 1805 1806 boolean safeToDrop = tiDb.safeToDrop(ii); 1807 1808 String dropSql = dbEngine.getDropIndexSql( 1809 table.getCatalog(), table.getSchema(), table.getName(), 1810 ii.getName(), ii.isUnique()); 1811 boolean actionDrop = dropIndexes && safeToDrop; 1812 1813 if (!silent) 1814 { 1815 System.out.println(" Safe drop : " + safeToDrop); 1816 System.out.println(" DROP-SQL : " + dropSql); 1817 System.out.println(" Actions : " + (actionDrop ? "DROP " : "")); 1818 } 1819 1820 if (actionDrop ) 1821 { 1822 Statement st = null; 1823 try 1824 { 1825 st = connection.createStatement(); 1826 if (actionDrop) 1827 { 1828 log.info("Dropping index: + " + dropSql); 1829 st.executeUpdate(dropSql); 1830 } 1831 connection.commit(); 1832 st.close(); 1833 st = null; 1834 } 1835 catch (SQLException ex) 1836 { 1837 log.error("Exception", ex); 1838 throw new BaseException(ex); 1839 } 1840 finally 1841 { 1842 if (st != null) 1843 { 1844 try 1845 { 1846 st.close(); 1847 } 1848 catch (Throwable t) 1849 { 1850 log.error("Exception", t); 1851 } 1852 } 1853 } 1854 } 1855 1856 } 1857 } 1858 1859 if (!silent) 1860 { 1861 System.out.println("================="); 1862 System.out.println(""); 1863 } 1864 } 1865 } 1866 1867 1868 /** 1677 1869 Prints a lot of useful stuff about the database to standard output. 1678 1870 For each table the output includes information about columns, indexes, … … 1716 1908 System.out.println("Schema : " + table.getSchema()); 1717 1909 } 1718 1910 1719 1911 Map<Set<String>, String> indexedColumns = new HashMap<Set<String>, String>(); 1720 1912 Map<Set<String>, String> uniqueColumns = new HashMap<Set<String>, String>(); … … 1722 1914 String pkName = null; 1723 1915 Set<String> fkNames = new HashSet<String>(); 1724 1916 1725 1917 if (verbose) 1726 1918 { … … 1738 1930 throw new BaseException(ex); 1739 1931 } 1740 1932 1741 1933 if (verbose && tiDb != null) 1742 1934 { … … 1795 1987 } 1796 1988 } 1797 1989 1798 1990 // Write indexes and unique constraints 1799 1991 for (IndexInfo ii : tiHib.getIndexes()) … … 1814 2006 boolean exists = dbName != null; 1815 2007 boolean safeToDrop = exists && tiDb.safeToDrop(ii); 1816 2008 1817 2009 String dropSql = exists ? 1818 dbEngine.getDropIndexSql(null, null, table.getName(), dbName, ii.isUnique()) : ""; 2010 dbEngine.getDropIndexSql(table.getCatalog(), table.getSchema(), 2011 table.getName(), dbName, ii.isUnique()) : ""; 1819 2012 String createSql = 1820 dbEngine.getCreateIndexSql(null, null, table.getName(), table.getName() + "_" + ii.getName(), 2013 dbEngine.getCreateIndexSql(table.getCatalog(), table.getSchema(), 2014 table.getName(), table.getName() + "_" + ii.getName(), 1821 2015 ii.getColumns(), ii.isUnique()); 1822 2016 boolean actionDrop = dropIndexes && exists && safeToDrop; … … 1882 2076 } 1883 2077 } 1884 2078 1885 2079 1886 2080 } -
trunk/src/core/net/sf/basedb/core/Install.java
r3820 r3857 196 196 if (progress != null) progress.display((int)(3*progress_factor), "--Creating roles..."); 197 197 RoleData roleAdmin = createRole(Role.ADMINISTRATOR, "Administrator", false, "Users with this role get full permission to BASE."); 198 RoleData roleSuper = createRole(Role.SUPERVISOR, "Supervisor", false, "Users with this role get full READ permission to everyt ing in BASE.");198 RoleData roleSuper = createRole(Role.SUPERVISOR, "Supervisor", false, "Users with this role get full READ permission to everything in BASE."); 199 199 RoleData rolePower = createRole(Role.POWER_USER, "Power user", false, "Users with this role may do some things that an ordinary user may not."); 200 200 RoleData roleUser = createRole(Role.USER, "User", true, "This permissions in this role should be sufficient for most regular users."); -
trunk/src/core/net/sf/basedb/core/InternalJobQueue.java
r3679 r3857 253 253 query.setInteger("status", Job.Status.WAITING.getValue()); 254 254 query.setInteger("type", Job.Type.RUN_PLUGIN.getValue()); 255 List<JobData> jobs = HibernateUtil.loadList(JobData.class, query );255 List<JobData> jobs = HibernateUtil.loadList(JobData.class, query, null); 256 256 257 257 log.info("Found " + jobs.size() + " jobs waiting for execution"); … … 485 485 */ 486 486 /** 487 Never reload since everyt ing is static.487 Never reload since everything is static. 488 488 */ 489 489 boolean getReload() -
trunk/src/core/net/sf/basedb/core/InternalStorageController.java
r3679 r3857 339 339 */ 340 340 /** 341 Never reload since everyt ing is static.341 Never reload since everything is static. 342 342 */ 343 343 boolean getReload() -
trunk/src/core/net/sf/basedb/core/ItemKey.java
r3679 r3857 157 157 WHERE NOT sd.itemKey IS NULL 158 158 */ 159 Set<Integer> used = new HashSet<Integer>(HibernateUtil.loadList(Integer.class, query ));159 Set<Integer> used = new HashSet<Integer>(HibernateUtil.loadList(Integer.class, query, null)); 160 160 if (used.size() == 0) used.add(0); 161 161 query = HibernateUtil.getPredefinedQuery(session, "SELECT_UNUSED_ITEMKEYS"); … … 165 165 */ 166 166 query.setParameterList("used", used, org.hibernate.Hibernate.INTEGER); 167 List<ItemKeyData> unused = HibernateUtil.loadList(ItemKeyData.class, query );167 List<ItemKeyData> unused = HibernateUtil.loadList(ItemKeyData.class, query, null); 168 168 for (ItemKeyData ik : unused) 169 169 { … … 363 363 */ 364 364 query.setInteger("numPermissions", numPermissions); 365 List<Integer> candidates = HibernateUtil.loadList(Integer.class, query );365 List<Integer> candidates = HibernateUtil.loadList(Integer.class, query, null); 366 366 if (candidates.size() > 0 && numPermissions > 0 && userPermissions != null) 367 367 { … … 385 385 query.setParameterList("candidates", candidates, org.hibernate.Hibernate.INTEGER); 386 386 query.setInteger("numPermissions", numPermissions); 387 candidates = HibernateUtil.loadList(Integer.class, query );387 candidates = HibernateUtil.loadList(Integer.class, query, null); 388 388 } 389 389 … … 403 403 query.setInteger("numPermissions", numPermissions); 404 404 query.setParameterList("candidates", candidates, org.hibernate.Hibernate.INTEGER); 405 candidates = HibernateUtil.loadList(Integer.class, query );405 candidates = HibernateUtil.loadList(Integer.class, query, null); 406 406 } 407 407 … … 428 428 query.setParameterList("candidates", candidates, org.hibernate.Hibernate.INTEGER); 429 429 query.setInteger("numPermissions", numPermissions); 430 candidates = HibernateUtil.loadList(Integer.class, query );430 candidates = HibernateUtil.loadList(Integer.class, query, null); 431 431 } 432 432 -
trunk/src/core/net/sf/basedb/core/ItemQuery.java
r3679 r3857 90 90 { 91 91 enableFilters(dc); 92 SessionControl sc = dc.getSessionControl(); 92 93 93 List<? extends BasicData> result = HibernateUtil.loadList(dataClass, getMainHqlQuery(dc) );94 List<? extends BasicData> result = HibernateUtil.loadList(dataClass, getMainHqlQuery(dc), sc); 94 95 long totalCount = result.size(); 95 96 … … 115 116 enableFilters(dc); 116 117 long totalCount = -1; 118 SessionControl sc = dc.getSessionControl(); 117 119 118 120 // Load the total count if it is requested … … 122 124 } 123 125 124 ScrollIterator<? extends BasicData> result = HibernateUtil.loadIterator(dataClass, getMainHqlQuery(dc)); 126 ScrollIterator<? extends BasicData> result = 127 HibernateUtil.loadIterator(dataClass, getMainHqlQuery(dc), sc); 125 128 disableFilters(dc); 126 129 return new ItemResultIterator<I>(result, dc, itemClass, totalCount); -
trunk/src/core/net/sf/basedb/core/Keyring.java
r3679 r3857 323 323 */ 324 324 query.setInteger("userId", userId); 325 temp = new HashSet<Integer>(HibernateUtil.loadList(Integer.class, query ));325 temp = new HashSet<Integer>(HibernateUtil.loadList(Integer.class, query, null)); 326 326 roles = Collections.unmodifiableSet(temp); 327 327 } … … 350 350 */ 351 351 query.setInteger("userId", userId); 352 temp = new HashSet<Integer>(HibernateUtil.loadList(Integer.class, query ));352 temp = new HashSet<Integer>(HibernateUtil.loadList(Integer.class, query, null)); 353 353 354 354 query = HibernateUtil.getPredefinedQuery(session, "GET_QUOTA_GROUP_ID_FOR_USER"); … … 375 375 { 376 376 query.setParameterList("groups", temp, org.hibernate.Hibernate.INTEGER); 377 } while (temp.addAll(HibernateUtil.loadList(Integer.class, query )));377 } while (temp.addAll(HibernateUtil.loadList(Integer.class, query, null))); 378 378 // repeat until no more new groups are found 379 379 } … … 406 406 */ 407 407 query.setInteger("userId", userId); 408 for (Integer i : HibernateUtil.loadList(Integer.class, query ))408 for (Integer i : HibernateUtil.loadList(Integer.class, query, null)) 409 409 { 410 410 temp.put(i, ALL_ITEM); … … 419 419 */ 420 420 query.setInteger("userId", userId); 421 for (UserProjects up : HibernateUtil.loadList(UserProjects.class, query ))421 for (UserProjects up : HibernateUtil.loadList(UserProjects.class, query, null)) 422 422 { 423 423 Integer i = temp.get(up.getProjectId()); … … 435 435 */ 436 436 query.setParameterList("groups", groups, org.hibernate.Hibernate.INTEGER); 437 for (GroupProjects gp : HibernateUtil.loadList(GroupProjects.class, query ))437 for (GroupProjects gp : HibernateUtil.loadList(GroupProjects.class, query, null)) 438 438 { 439 439 Integer i = temp.get(gp.getProjectId()); … … 471 471 */ 472 472 query.setParameterList("groups", groups, org.hibernate.Hibernate.INTEGER); 473 temp.addAll(HibernateUtil.loadList(Integer.class, query ));473 temp.addAll(HibernateUtil.loadList(Integer.class, query, null)); 474 474 475 475 // Get the users that have a quota group among the same groups … … 481 481 */ 482 482 query.setParameterList("groups", groups, org.hibernate.Hibernate.INTEGER); 483 temp.addAll(HibernateUtil.loadList(Integer.class, query ));483 temp.addAll(HibernateUtil.loadList(Integer.class, query, null)); 484 484 } 485 485 … … 498 498 */ 499 499 query.setInteger("projectId", projectId); 500 temp.addAll(HibernateUtil.loadList(Integer.class, query ));500 temp.addAll(HibernateUtil.loadList(Integer.class, query, null)); 501 501 502 502 // Get groups that are direct members of the active project … … 509 509 query.setInteger("projectId", projectId); 510 510 // Load the direct groups and subgroups 511 Set<Integer> projectGroups = Group.getGroupsRecursive(session, HibernateUtil.loadList(Integer.class, query ));511 Set<Integer> projectGroups = Group.getGroupsRecursive(session, HibernateUtil.loadList(Integer.class, query, null)); 512 512 513 513 // Load users that are members of the project groups … … 541 541 */ 542 542 query.setInteger("userId", userId); 543 List<KeyPermission> keys = HibernateUtil.loadList(KeyPermission.class, query );543 List<KeyPermission> keys = HibernateUtil.loadList(KeyPermission.class, query, null); 544 544 545 545 // Load keys shared to any of the groups where the user is a member … … 553 553 */ 554 554 query.setParameterList("groups", groups, org.hibernate.Hibernate.INTEGER); 555 keys.addAll(HibernateUtil.loadList(KeyPermission.class, query ));555 keys.addAll(HibernateUtil.loadList(KeyPermission.class, query, null)); 556 556 } 557 557 … … 612 612 */ 613 613 query.setInteger("userId", userId); 614 List<RoleKeys> roleKeys = HibernateUtil.loadList(RoleKeys.class, query );614 List<RoleKeys> roleKeys = HibernateUtil.loadList(RoleKeys.class, query, null); 615 615 616 616 // Copy the permission from the list to the array … … 665 665 */ 666 666 query.setInteger("pluginId", pluginId); 667 List<PluginKeys> keys = HibernateUtil.loadList(PluginKeys.class, query );667 List<PluginKeys> keys = HibernateUtil.loadList(PluginKeys.class, query, null); 668 668 669 669 // Copy the permissions from the list to the array … … 701 701 */ 702 702 query.setInteger("projectId", projectId); 703 List<ProjectKeys> keys = HibernateUtil.loadList(ProjectKeys.class, query );703 List<ProjectKeys> keys = HibernateUtil.loadList(ProjectKeys.class, query, null); 704 704 705 705 // Copy the permissions from the List to the array -
trunk/src/core/net/sf/basedb/core/PluginDefinition.java
r3820 r3857 317 317 query.setParameterList("projectKeys", projectKeys, org.hibernate.Hibernate.INTEGER); 318 318 319 List<Object> pluginCount = HibernateUtil.loadList(Object.class, query );319 List<Object> pluginCount = HibernateUtil.loadList(Object.class, query, dc.getSessionControl()); 320 320 Map<Plugin.MainType, Integer> result = new HashMap<Plugin.MainType, Integer>(5); 321 321 for (Object cnt : pluginCount) … … 1125 1125 org.hibernate.Query query = HibernateUtil.createQuery( 1126 1126 getDbControl().getHibernateSession(), "SELECT pt FROM PluginTypeData pt"); 1127 List<PluginTypeData> types = HibernateUtil.loadList(PluginTypeData.class, query );1127 List<PluginTypeData> types = HibernateUtil.loadList(PluginTypeData.class, query, null); 1128 1128 1129 1129 for (PluginTypeData pt : types) -
trunk/src/core/net/sf/basedb/core/Project.java
r3847 r3857 393 393 */ 394 394 query.setInteger("projectId", this.getId()); 395 projectKeys = new HashSet<Integer>(HibernateUtil.loadList(Integer.class, query ));395 projectKeys = new HashSet<Integer>(HibernateUtil.loadList(Integer.class, query, sc)); 396 396 397 397 include.remove(Include.OTHERS); … … 458 458 FROM net.sf.basedb.core.data.ShareableData item 459 459 */ 460 List<ShareableData> inProject = HibernateUtil.loadList(ShareableData.class, query );460 List<ShareableData> inProject = HibernateUtil.loadList(ShareableData.class, query, sc); 461 461 List<Shareable> items = new ArrayList<Shareable>(inProject.size()); 462 462 -
trunk/src/core/net/sf/basedb/core/ProjectKey.java
r3679 r3857 142 142 WHERE NOT sd.projectKey IS NULL 143 143 */ 144 Set<Integer> used = new HashSet<Integer>(HibernateUtil.loadList(Integer.class, query ));144 Set<Integer> used = new HashSet<Integer>(HibernateUtil.loadList(Integer.class, query, null)); 145 145 if (used.size() == 0) used.add(0); 146 146 query = HibernateUtil.getPredefinedQuery(session, "SELECT_UNUSED_PROJECTKEYS"); … … 150 150 */ 151 151 query.setParameterList("used", used, org.hibernate.Hibernate.INTEGER); 152 List<ProjectKeyData> unused = HibernateUtil.loadList(ProjectKeyData.class, query );152 List<ProjectKeyData> unused = HibernateUtil.loadList(ProjectKeyData.class, query, null); 153 153 for (ProjectKeyData pk : unused) 154 154 { … … 307 307 */ 308 308 query.setInteger("numPermissions", numPermissions); 309 List<Integer> candidates = HibernateUtil.loadList(Integer.class, query );309 List<Integer> candidates = HibernateUtil.loadList(Integer.class, query, null); 310 310 if (candidates.size() > 0) 311 311 { … … 330 330 query.setParameterList("candidates", candidates, org.hibernate.Hibernate.INTEGER); 331 331 query.setInteger("numPermissions", numPermissions); 332 candidates = HibernateUtil.loadList(Integer.class, query );332 candidates = HibernateUtil.loadList(Integer.class, query, null); 333 333 } 334 334 if (candidates.size() == 0) -
trunk/src/core/net/sf/basedb/core/RawBioAssay.java
r3820 r3857 1087 1087 */ 1088 1088 query.setInteger("arrayDesign", design.getId()); 1089 ScrollIterator<FeatureData> si = HibernateUtil.loadIterator(FeatureData.class, query); 1089 ScrollIterator<FeatureData> si = 1090 HibernateUtil.loadIterator(FeatureData.class, query, dc.getSessionControl()); 1090 1091 while (si.hasNext()) 1091 1092 { -
trunk/src/core/net/sf/basedb/core/RawDataBatcher.java
r3820 r3857 192 192 */ 193 193 query.setInteger("arrayDesign", arrayDesign.getId()); 194 ScrollIterator<FeatureData> si = HibernateUtil.loadIterator(FeatureData.class, query); 194 ScrollIterator<FeatureData> si = 195 HibernateUtil.loadIterator(FeatureData.class, query, dc.getSessionControl()); 195 196 while (si.hasNext()) 196 197 { -
trunk/src/core/net/sf/basedb/core/ReporterScoreQuery.java
r2474 r3857 58 58 enableFilters(dc); 59 59 long totalCount = -1; 60 SessionControl sc = dc.getSessionControl(); 60 61 61 62 // Load the total count if it is requested … … 65 66 } 66 67 67 ScrollIterator<ReporterListScoreData> result = HibernateUtil.loadIterator(ReporterListScoreData.class, getMainHqlQuery(dc)); 68 ScrollIterator<ReporterListScoreData> result = 69 HibernateUtil.loadIterator(ReporterListScoreData.class, getMainHqlQuery(dc), sc); 68 70 disableFilters(dc); 69 71 return new ReporterScoreResultIterator(result, dc, totalCount); -
trunk/src/core/net/sf/basedb/core/SessionControl.java
r3679 r3857 112 112 113 113 /** 114 If the session control has been closed it can no longer be used. 115 */ 116 private boolean closed; 117 118 /** 114 119 Stores name and value from {@link ClientDefaultSettingData}. 115 120 */ … … 192 197 Get the time this object last was accessed. Used by the cleanup timer 193 198 in {@link Application#cleanSessionControlCache(boolean)} 194 */ 195 long getLastAccess() 199 @since 2.4.5 200 */ 201 public long getLastAccess() 196 202 { 197 203 return lastAccess; … … 204 210 public void updateLastAccess() 205 211 { 212 if (closed) throw new PermissionDeniedException("SessonControl is closed"); 206 213 lastAccess = System.currentTimeMillis(); 207 214 } 215 216 /** 217 If this session control has been closed or not. A closed session 218 control can't be used. 219 @return TRUE if the session control is closed 220 @since 2.4.5 221 */ 222 public boolean isClosed() 223 { 224 return closed; 225 } 226 227 /** 228 Close this session control so it can't be used again. 229 @since 2.4.5 230 */ 231 public void close() 232 { 233 if (isLoggedIn()) logout(); 234 closed = true; 235 } 236 208 237 209 238 /** … … 693 722 public boolean isLoggedIn() 694 723 { 695 updateLastAccess();696 724 return loginInfo != null; 697 725 } … … 1405 1433 query.setInteger("itemType", item.getValue()); 1406 1434 query.setString("subContext", subContext); 1407 for (Object ctx : HibernateUtil.loadList(Object.class, query ))1435 for (Object ctx : HibernateUtil.loadList(Object.class, query, null)) 1408 1436 { 1409 1437 Object[] o = (Object[])ctx; … … 1665 1693 */ 1666 1694 query.setInteger("client", clientId); 1667 return listToMap(HibernateUtil.loadList(ClientDefaultSettingData.class, query ));1695 return listToMap(HibernateUtil.loadList(ClientDefaultSettingData.class, query, null)); 1668 1696 } 1669 1697 … … 1680 1708 */ 1681 1709 query.setInteger("user", userId); 1682 return listToMap(HibernateUtil.loadList(UserDefaultSettingData.class, query ));1710 return listToMap(HibernateUtil.loadList(UserDefaultSettingData.class, query, null)); 1683 1711 } 1684 1712 … … 1696 1724 query.setInteger("user", userId); 1697 1725 query.setInteger("client", clientId); 1698 return listToMap(HibernateUtil.loadList(UserClientSettingData.class, query ));1726 return listToMap(HibernateUtil.loadList(UserClientSettingData.class, query, null)); 1699 1727 } 1700 1728 … … 1716 1744 { 1717 1745 // Load the existing settings from the database 1718 List<I> dbSettings = HibernateUtil.loadList(dataClass, query );1746 List<I> dbSettings = HibernateUtil.loadList(dataClass, query, null); 1719 1747 // Iterator the existing settings and check what has happened to them 1720 1748 for (SettingData s : dbSettings) … … 1786 1814 protected void cleanUp() 1787 1815 { 1788 if ( isLoggedIn()) logout();1816 if (!isClosed() && isLoggedIn()) logout(); 1789 1817 } 1790 1818 … … 1799 1827 cleanUp(); 1800 1828 } 1801 catch ( BaseException ex)1802 { 1803 log.warn("Exception during SessionControl.finalize()", ex);1829 catch (Throwable t) 1830 { 1831 log.warn("Exception during SessionControl.finalize()", t); 1804 1832 } 1805 1833 super.finalize(); 1806 1834 } 1807 1835 1808 1836 /** 1809 1837 Internal class to hold information about the logged in user. -
trunk/src/core/net/sf/basedb/core/Trashcan.java
r3675 r3857 73 73 { 74 74 org.hibernate.Session session = dc.getHibernateSession(); 75 SessionControl sc = dc.getSessionControl(); 75 76 org.hibernate.Query query = HibernateUtil.getPredefinedQuery(session, "GET_REMOVED_ITEMS"); 76 77 /* … … 82 83 filter.setParameter("owner", dc.getSessionControl().getLoggedInUserId()); 83 84 84 List<RemovableData> removed = HibernateUtil.loadList(RemovableData.class, query );85 List<RemovableData> removed = HibernateUtil.loadList(RemovableData.class, query, sc); 85 86 List<Removable> items = new ArrayList<Removable>(removed.size()); 86 87 -
trunk/src/core/net/sf/basedb/core/Update.java
r3850 r3857 950 950 // Delete all affymetrix formulas 951 951 query = HibernateUtil.createQuery(session, "SELECT frm FROM FormulaData frm WHERE frm.rawDataType = 'affymetrix'"); 952 List<FormulaData> affyFormulas = HibernateUtil.loadList(FormulaData.class, query );952 List<FormulaData> affyFormulas = HibernateUtil.loadList(FormulaData.class, query, null); 953 953 for (FormulaData affyFormula : affyFormulas) 954 954 { … … 1189 1189 FROM FileData f 1190 1190 */ 1191 List<Integer> ids = HibernateUtil.loadList(Integer.class, query );1191 List<Integer> ids = HibernateUtil.loadList(Integer.class, query, null); 1192 1192 if (ids.size() > 0) 1193 1193 { … … 1204 1204 FROM ExperimentData xp 1205 1205 */ 1206 ids = HibernateUtil.loadList(Integer.class, query );1206 ids = HibernateUtil.loadList(Integer.class, query, null); 1207 1207 if (ids.size() > 0) 1208 1208 { … … 1219 1219 FROM RawBioAssayData rba 1220 1220 */ 1221 ids = HibernateUtil.loadList(Integer.class, query );1221 ids = HibernateUtil.loadList(Integer.class, query, null); 1222 1222 if (ids.size() > 0) 1223 1223 { … … 1268 1268 WHERE dcd.id = :dataCube 1269 1269 */ 1270 for (DataCubeData cubeData : HibernateUtil.loadList(DataCubeData.class, query ))1270 for (DataCubeData cubeData : HibernateUtil.loadList(DataCubeData.class, query, null)) 1271 1271 { 1272 1272 DataCube cube = dc.getItem(DataCube.class, cubeData); … … 1329 1329 JOIN evt.sources src 1330 1330 */ 1331 List<Object[]> events = HibernateUtil.loadList(Object[].class, eventQuery );1332 events.addAll(HibernateUtil.loadList(Object[].class, sourcesQuery ));1331 List<Object[]> events = HibernateUtil.loadList(Object[].class, eventQuery, null); 1332 events.addAll(HibernateUtil.loadList(Object[].class, sourcesQuery, null)); 1333 1333 1334 1334 // Calculate the remaining quantity for each biomaterial … … 1410 1410 WHERE f.lastUpdate IS NULL AND NOT f.internalName IS NULL 1411 1411 */ 1412 List<FileData> files = HibernateUtil.loadList(FileData.class, query );1412 List<FileData> files = HibernateUtil.loadList(FileData.class, query, null); 1413 1413 for (FileData fData : files) 1414 1414 { … … 1453 1453 "SELECT f FROM FileData f"); 1454 1454 1455 List<FileData> files = HibernateUtil.loadList(FileData.class, query );1455 List<FileData> files = HibernateUtil.loadList(FileData.class, query, null); 1456 1456 for (FileData fData : files) 1457 1457 { … … 1505 1505 "SELECT t FROM TransformationData t"); 1506 1506 1507 List<TransformationData> transformations = HibernateUtil.loadList(TransformationData.class, query );1507 List<TransformationData> transformations = HibernateUtil.loadList(TransformationData.class, query, null); 1508 1508 Map<JobData, Set<ExperimentData>> experiments = new HashMap<JobData, Set<ExperimentData>>(); 1509 1509 for (TransformationData transformation : transformations) … … 1579 1579 query.setEntity("pluginDefinition", base1Executer); 1580 1580 List<PluginConfigurationData> configurations = 1581 HibernateUtil.loadList(PluginConfigurationData.class, query );1581 HibernateUtil.loadList(PluginConfigurationData.class, query, null); 1582 1582 1583 1583 // Delete AnyToAny for each configuration … … 1948 1948 ) 1949 1949 */ 1950 List<PlateMappingData> mappings = HibernateUtil.loadList(PlateMappingData.class, pmQuery );1950 List<PlateMappingData> mappings = HibernateUtil.loadList(PlateMappingData.class, pmQuery, null); 1951 1951 if (mappings != null && mappings.size() > 0) 1952 1952 { … … 1967 1967 { 1968 1968 pQuery.setEntity("plateMapping", mapping); 1969 List<PlateData> plates = HibernateUtil.loadList(PlateData.class, pQuery );1969 List<PlateData> plates = HibernateUtil.loadList(PlateData.class, pQuery, null); 1970 1970 if (plates != null && plates.size() > 0) 1971 1971 { -
trunk/src/core/net/sf/basedb/core/User.java
r3679 r3857 146 146 */ 147 147 query.setParameterList("groups", groupIds, org.hibernate.Hibernate.INTEGER); 148 userIds.addAll(HibernateUtil.loadList(Integer.class, query ));148 userIds.addAll(HibernateUtil.loadList(Integer.class, query, null)); 149 149 150 150 // Get the users that have a quota group among the same groups … … 156 156 */ 157 157 query.setParameterList("groups", groupIds, org.hibernate.Hibernate.INTEGER); 158 userIds.addAll(HibernateUtil.loadList(Integer.class, query ));158 userIds.addAll(HibernateUtil.loadList(Integer.class, query, null)); 159 159 } 160 160 return userIds; … … 174 174 WHERE grp.default = true 175 175 */ 176 List<GroupData> defaultGroups = HibernateUtil.loadList(GroupData.class, query );176 List<GroupData> defaultGroups = HibernateUtil.loadList(GroupData.class, query, null); 177 177 for (GroupData group : defaultGroups) 178 178 { … … 185 185 WHERE rle.default = true 186 186 */ 187 List<RoleData> defaultRoles = HibernateUtil.loadList(RoleData.class, query );187 List<RoleData> defaultRoles = HibernateUtil.loadList(RoleData.class, query, null); 188 188 for (RoleData role : defaultRoles) 189 189 { … … 1090 1090 query.setEntity("user", this.getData()); 1091 1091 1092 List<OwnableData> ownedBy = HibernateUtil.loadList(OwnableData.class, query );1092 List<OwnableData> ownedBy = HibernateUtil.loadList(OwnableData.class, query, sc); 1093 1093 List<Ownable> items = new ArrayList<Ownable>(ownedBy.size()); 1094 1094 -
trunk/src/core/net/sf/basedb/core/VirtualColumn.java
r3679 r3857 68 68 */ 69 69 public static final VirtualColumn CUBE = 70 new VirtualColumn("cube", "cube", Hibernate.SHORT, 0, INDEXED, !NULLABLE, PRIMARY_KEY); 70 new VirtualColumn("cube", "cube", Hibernate.SHORT, 0, 71 !INDEXED, !NULLABLE, PRIMARY_KEY); 71 72 72 73 /** … … 75 76 */ 76 77 public static final VirtualColumn LAYER = 77 new VirtualColumn("layer", "layer", Hibernate.SHORT, 0, INDEXED, !NULLABLE, PRIMARY_KEY); 78 new VirtualColumn("layer", "layer", Hibernate.SHORT, 0, 79 !INDEXED, !NULLABLE, PRIMARY_KEY); 78 80 79 81 /** … … 82 84 */ 83 85 public static final VirtualColumn COLUMN = 84 new VirtualColumn("column", "column", Hibernate.SHORT, 0, INDEXED, !NULLABLE, PRIMARY_KEY); 86 new VirtualColumn("column", "column", Hibernate.SHORT, 0, 87 !INDEXED, !NULLABLE, PRIMARY_KEY); 85 88 86 89 /** … … 88 91 */ 89 92 public static final VirtualColumn POSITION = 90 new VirtualColumn("position", "position", Hibernate.INTEGER, 0, INDEXED, !NULLABLE, PRIMARY_KEY); 93 new VirtualColumn("position", "position", Hibernate.INTEGER, 0, 94 !INDEXED, !NULLABLE, PRIMARY_KEY); 91 95 92 96 /** … … 95 99 */ 96 100 public static final VirtualColumn FILTER = 97 new VirtualColumn("filter", "filter", Hibernate.SHORT, 0, INDEXED, !NULLABLE, PRIMARY_KEY); 101 new VirtualColumn("filter", "filter", Hibernate.SHORT, 0, 102 !INDEXED, !NULLABLE, PRIMARY_KEY); 98 103 99 104 /** … … 102 107 */ 103 108 public static final VirtualColumn EXTRA = 104 new VirtualColumn("extra", "extra", Hibernate.SHORT, 0, INDEXED, !NULLABLE, PRIMARY_KEY); 109 new VirtualColumn("extra", "extra", Hibernate.SHORT, 0, 110 !INDEXED, !NULLABLE, PRIMARY_KEY); 105 111 106 112 /** … … 110 116 */ 111 117 public static final VirtualColumn REPORTER_ID = 112 new VirtualColumn("reporterId", "reporter_id", Hibernate.INTEGER, 0, INDEXED, NULLABLE, !PRIMARY_KEY); 118 new VirtualColumn("reporterId", "reporter_id", Hibernate.INTEGER, 0, 119 !INDEXED, NULLABLE, !PRIMARY_KEY); 113 120 114 121 /** … … 118 125 */ 119 126 public static final VirtualColumn RAWDATA_ID = 120 new VirtualColumn("rawDataId", "rawdata_id", Hibernate.INTEGER, 0, INDEXED, !NULLABLE, PRIMARY_KEY); 127 new VirtualColumn("rawDataId", "rawdata_id", Hibernate.INTEGER, 0, 128 !INDEXED, !NULLABLE, PRIMARY_KEY); 121 129 122 130 /** … … 126 134 */ 127 135 public static final VirtualColumn RAWBIOASSAY_ID = 128 new VirtualColumn("rawBioAssayId", "rawbioassay_id", Hibernate.INTEGER, 0, INDEXED, !NULLABLE, PRIMARY_KEY); 136 new VirtualColumn("rawBioAssayId", "rawbioassay_id", Hibernate.INTEGER, 0, 137 !INDEXED, !NULLABLE, PRIMARY_KEY); 129 138 130 139 /** … … 132 141 */ 133 142 public static final VirtualColumn EXTRA_INT = 134 new VirtualColumn("extraInt", "value", Hibernate.INTEGER, 0, !INDEXED, NULLABLE, !PRIMARY_KEY); 143 new VirtualColumn("extraInt", "value", Hibernate.INTEGER, 0, 144 !INDEXED, NULLABLE, !PRIMARY_KEY); 135 145 136 146 /** … … 138 148 */ 139 149 public static final VirtualColumn EXTRA_FLOAT = 140 new VirtualColumn("extraFloat", "value", Hibernate.FLOAT, 0, !INDEXED, NULLABLE, !PRIMARY_KEY); 150 new VirtualColumn("extraFloat", "value", Hibernate.FLOAT, 0, 151 !INDEXED, NULLABLE, !PRIMARY_KEY); 141 152 142 153 /** … … 144 155 */ 145 156 public static final VirtualColumn EXTRA_STRING = 146 new VirtualColumn("extraString", "value", Hibernate.STRING, 255, !INDEXED, NULLABLE, !PRIMARY_KEY); 157 new VirtualColumn("extraString", "value", Hibernate.STRING, 255, 158 !INDEXED, NULLABLE, !PRIMARY_KEY); 147 159 148 160 /** 149 161 A cache of virtual column objects for channels. 150 162 */ 151 private static final Map<Integer, VirtualColumn> channels = new HashMap<Integer, VirtualColumn>(); 163 private static final Map<Integer, VirtualColumn> channels = 164 new HashMap<Integer, VirtualColumn>(); 152 165 153 166 /** 154 167 A cache of virtual column objects for extra value types. 155 168 */ 156 private static final Map<Type, VirtualColumn> extraValueColumns = new HashMap<Type, VirtualColumn>(); 169 private static final Map<Type, VirtualColumn> extraValueColumns = 170 new HashMap<Type, VirtualColumn>(); 157 171 158 172 // Initialise the cache … … 173 187 if (ch == null) 174 188 { 175 ch = new VirtualColumn("ch"+channel, "ch"+channel, Hibernate.FLOAT, 0, !INDEXED, NULLABLE, !PRIMARY_KEY); 189 ch = new VirtualColumn("ch"+channel, "ch"+channel, Hibernate.FLOAT, 0, 190 !INDEXED, NULLABLE, !PRIMARY_KEY); 176 191 synchronized (channels) 177 192 { -
trunk/src/core/net/sf/basedb/util/overview/ExperimentOverview.java
r3789 r3857 1500 1500 { 1501 1501 ProtocolType pt = protocol.getProtocolType(); 1502 if (!pt.getSystemId().equals(defaultProtocol.getType())) 1502 String requiredId = defaultProtocol == null ? null : defaultProtocol.getType(); 1503 if (requiredId != null && !requiredId.equals(pt.getSystemId())) 1503 1504 { 1504 1505 failures.add(new Failure(Validator.INCORRECT_PROTOCOLTYPE, parentNode, null, -
trunk/src/install/net/sf/basedb/install/InitDB.java
r3679 r3857 24 24 */ 25 25 package net.sf.basedb.install; 26 27 import java.util.Arrays; 28 import java.util.List; 26 29 27 30 import net.sf.basedb.core.Application; … … 94 97 Application.stop(); 95 98 } 99 else if ("dynamicdb".equals(cmd)) 100 { 101 List<String> opt = Arrays.asList(args); 102 boolean verbose = opt.contains("-v"); 103 boolean drop = opt.contains("-dropindexes"); 104 Application.start(false); 105 HibernateUtil.dynamicDbIndexes(verbose, false, drop); 106 Application.stop(); 107 } 96 108 else 97 109 { 98 110 System.out.println("Unknown command: " + cmd); 99 System.out.println("Usage: InitDB cmd"); 100 System.out.println(" cmd: install | update | info | updateindexes | dropindexes"); 111 System.out.println("Usage: InitDB cmd <options>"); 112 System.out.println(" cmd: install | update | info | updateindexes | dropindexes | dynamicdb"); 113 System.out.println("options: "); 114 System.out.println(" -v : Verbose output (if cmd = updateindexes, dropindexs or dynamicdb)"); 115 System.out.println(" -dropindexes : Drop indexes when cmd = dynamicdb"); 101 116 } 102 117 } -
trunk/src/plugins/core/net/sf/basedb/plugins/PackedFileExporter.java
r3789 r3857 96 96 ( 97 97 "Packed file exporter", 98 "This plugin is used to pack edone or more files/directories " +98 "This plugin is used to pack one or more files/directories " + 99 99 "into a single file. Items should be selected before starting the plug-in and " + 100 100 "they must all be located in the same parent directory. " + -
trunk/www/include/menu.jsp
r3820 r3857 106 106 for (String recent : recentlyViewed) 107 107 { 108 String[] tmp = recent.split("="); 109 Item itemType = Item.valueOf(tmp[0]); 110 int itemId = Values.getInt(tmp[1], 0); 111 if (itemId != 0) 108 try 112 109 { 113 String shortName = ""; 114 String fullName = ""; 115 if (loadNames) 110 String[] tmp = recent.split("="); 111 Item itemType = Item.valueOf(tmp[0]); 112 int itemId = Values.getInt(tmp[1], 0); 113 if (itemId != 0) 116 114 { 117 try 115 String shortName = ""; 116 String fullName = ""; 117 if (loadNames) 118 118 { 119 BasicItem item = itemType.getById(dc, itemId); 120 fullName = ((Nameable)item).getName(); 121 shortName = HTML.encodeTags(StringUtil.trimString(fullName, 35)); 119 try 120 { 121 BasicItem item = itemType.getById(dc, itemId); 122 fullName = ((Nameable)item).getName(); 123 shortName = HTML.encodeTags(StringUtil.trimString(fullName, 35)); 124 } 125 catch (Throwable t) 126 { 127 continue; 128 } 122 129 } 123 catch (Throwable t)130 else 124 131 { 125 continue; 132 fullName = itemType.toString() + "; id=" + itemId; 133 shortName = itemType + " (id=" + itemId + ")"; 126 134 } 135 numItems++; 136 %> 137 <m:menuitem 138 title="<%=numItems + ". " + shortName%>" 139 onclick="<%="Main.viewOrEditItem('" + ID + "', '" + itemType.name() + "', " + itemId + ")"%>" 140 tooltip="<%="Go to " + HTML.encodeTags(fullName) + " (" + itemType + ")"%>" 141 /> 142 <% 127 143 } 128 else129 {130 fullName = itemType.toString() + "; id=" + itemId;131 shortName = itemType + " (id=" + itemId + ")";132 }133 numItems++;134 %>135 <m:menuitem136 title="<%=numItems + ". " + shortName%>"137 onclick="<%="Main.viewOrEditItem('" + ID + "', '" + itemType.name() + "', " + itemId + ")"%>"138 tooltip="<%="Go to " + HTML.encodeTags(fullName) + " (" + itemType + ")"%>"139 />140 <%141 144 } 145 catch (Throwable t) 146 {} 142 147 } 143 148 } … … 162 167 for (String recentItem : stickyItems.split(":")) 163 168 { 164 Item itemType = Item.valueOf(recentItem); 165 ItemContext cc = sc.getCurrentContext(itemType); 166 if (cc.getId() != 0) 169 try 167 170 { 168 String shortName = "";169 String fullName = "";170 if ( loadNames)171 Item itemType = Item.valueOf(recentItem); 172 ItemContext cc = sc.getCurrentContext(itemType); 173 if (cc.getId() != 0) 171 174 { 172 try 175 String shortName = ""; 176 String fullName = ""; 177 if (loadNames) 173 178 { 174 BasicItem item = itemType.getById(dc, cc.getId()); 175 fullName = ((Nameable)item).getName(); 176 shortName = ": " + HTML.encodeTags(StringUtil.trimString(fullName, 30)); 179 try 180 { 181 BasicItem item = itemType.getById(dc, cc.getId()); 182 fullName = ((Nameable)item).getName(); 183 shortName = ": " + HTML.encodeTags(StringUtil.trimString(fullName, 30)); 184 } 185 catch (Throwable t) 186 { 187 continue; 188 } 177 189 } 178 catch (Throwable t)190 else 179 191 { 180 continue; 192 fullName = itemType.toString() + "; id=" + cc.getId(); 193 shortName = " (id=" + cc.getId() + ")"; 194 } 195 numItems++; 196 numSticky++; 197 %> 198 <m:menuitem 199 title="<%=itemType + shortName%>" 200 onclick="<%="Main.viewOrEditItem('" + ID + "', '" + itemType.name() + "', " + cc.getId() + ")"%>" 201 tooltip="<%="Go to " + HTML.encodeTags(fullName) + " (" + itemType + ")"%>" 202 /> 203 <% 204 if (itemType == Item.BIOASSAYSET) 205 { 206 // Add menu for Experiment explorer as well 207 %> 208 <m:menuitem 209 title="<%="Experiment explorer"+HTML.encodeTags(shortName)%>" 210 onclick="<%="location.href = '"+root+"views/experiments/explorer/view/index.jsp?ID=" + ID + "&bioassayset_id="+cc.getId()+"'"%>" 211 tooltip="Go to experiment explorer" 212 /> 213 <% 181 214 } 182 215 } 183 else184 {185 fullName = itemType.toString() + "; id=" + cc.getId();186 shortName = " (id=" + cc.getId() + ")";187 }188 numItems++;189 numSticky++;190 %>191 <m:menuitem192 title="<%=itemType + shortName%>"193 onclick="<%="Main.viewOrEditItem('" + ID + "', '" + itemType.name() + "', " + cc.getId() + ")"%>"194 tooltip="<%="Go to " + HTML.encodeTags(fullName) + " (" + itemType + ")"%>"195 />196 <%197 if (itemType == Item.BIOASSAYSET)198 {199 // Add menu for Experiment explorer as well200 %>201 <m:menuitem202 title="<%="Experiment explorer"+HTML.encodeTags(shortName)%>"203 onclick="<%="location.href = '"+root+"views/experiments/explorer/view/index.jsp?ID=" + ID + "&bioassayset_id="+cc.getId()+"'"%>"204 tooltip="Go to experiment explorer"205 />206 <%207 }208 216 } 217 catch (Throwable t) 218 {} 209 219 } 210 220 if (numSticky == 0)
Note: See TracChangeset
for help on using the changeset viewer.