Changeset 3857


Ignore:
Timestamp:
Oct 17, 2007, 12:41:17 PM (14 years ago)
Author:
Jari Häkkinen
Message:

Merged patch release 2.4.4 to the trunk. Delta 2.4.4 - 2.4.3

Location:
trunk
Files:
35 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/doc/specifications/technical.html

    r3679 r3857  
    163163    <li>
    164164    Possible to add support for other import and export file formats, including
    165     very cryptic ones (i.e. everyting else than tab-separated text files).
     165    very cryptic ones (i.e. everything else than tab-separated text files).
    166166    </li>
    167167    <li>
  • trunk/doc/src/docbook/admindoc/installation_upgrade.xml

    r3775 r3857  
    6767    <title>Upgrade instructions</title>
    6868
    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>
     90cd &lt;basedir&gt;/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>
    8098    </important>
    8199
     
    876894            properties are defined in
    877895            <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
    879898            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.
    881905          </para>
    882906        </listitem>
     
    10641088      changes to the BASE 1.2 schema you need to patch the BASE 2
    10651089      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).
    10661094    </para>
    10671095
     
    11661194        <listitem>
    11671195          <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>
    11681212            Migration done! Happy BASEing.
    11691213          </para>
  • trunk/src/clients/jobagent/net/sf/basedb/clients/jobagent/JobRunner.java

    r3675 r3857  
    2626import java.util.Arrays;
    2727
     28import net.sf.basedb.core.Application;
    2829import net.sf.basedb.core.DbControl;
    2930import net.sf.basedb.core.ItemModifiedException;
     
    119120      }
    120121     
     122      // To protect the session control from timeouts
     123      Application.Pinger pinger = Application.newPinger(sc);
    121124      try
    122125      {
     
    131134        dc.commit();
    132135        throw t;
     136      }
     137      finally
     138      {
     139        if (pinger != null) pinger.stop();
    133140      }
    134141     
  • trunk/src/clients/jobagent/net/sf/basedb/clients/jobagent/executors/DummyJobExecutor.java

    r3675 r3857  
    8181  public void init(Agent agent)
    8282  {
    83     wait = Values.getInt(agent.getProperty("agent.executor.wait"), -1);
     83    wait = Values.getInt(agent.getProperty("agent.executor.dummy.wait"), -1);
    8484  }
    8585 
  • trunk/src/clients/jobagent/net/sf/basedb/clients/jobagent/executors/ThreadJobExecutor.java

    r3675 r3857  
    147147    SessionControl sc = null;
    148148    SessionControl impersonated = null;
     149    Application.Pinger pinger = null;
    149150    try
    150151    {
     
    169170     
    170171      Thread.currentThread().setPriority(threadPriority);
     172      pinger = Application.newPinger(sc);
    171173      executor.executeJob(impersonated, null, job, settings, null);
    172174    }
     
    178180    finally
    179181    {
     182      if (pinger != null) pinger.stop();
    180183      if (dc != null) dc.close();
    181184      if (impersonated != null && impersonated.isLoggedIn()) impersonated.logout();
  • trunk/src/clients/web/net/sf/basedb/clients/web/Base.java

    r3820 r3857  
    401401     
    402402      // Current item
    403       String itemId = request.getParameter("item_id");
     403      String itemId = Values.getStringOrNull(request.getParameter("item_id"));
    404404      cc.setId(Values.getInt(itemId, cc.getId()));
    405405     
  • trunk/src/core/net/sf/basedb/core/AnnotationRestriction.java

    r3679 r3857  
    105105    throws BaseException
    106106  {
     107    SessionControl sc = dc.getSessionControl();
    107108    String valueTable = null;
    108109    if (valueType == Type.INT)
     
    168169    {
    169170      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);
    171172      StringBuilder annotationSets = new StringBuilder("0");
    172173      StringBuilder annotations = new StringBuilder("0");
     
    192193        sqlQuery.addScalar("annotationset_id", org.hibernate.Hibernate.INTEGER);
    193194        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);
    195196        annotationSets = new StringBuilder(annotationSetIds);
    196197        for (Integer id : ids)
     
    204205    {
    205206      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);
    207208      StringBuilder annotationSets = new StringBuilder("0");
    208209      for (Integer id : ids)
  • trunk/src/core/net/sf/basedb/core/Application.java

    r3846 r3857  
    3333import java.util.Calendar;
    3434import java.util.GregorianCalendar;
     35import java.util.HashSet;
    3536import java.util.Map;
    3637import java.util.HashMap;
     
    3839import java.util.Iterator;
    3940import java.util.Random;
     41import java.util.Set;
    4042import java.util.Timer;
    4143import java.util.TimerTask;
     
    471473 
    472474        // Adding a task that cleans the session control cache at regular intervale
    473         long milliSeconds = 60*1000*sessionCacheTimeout;
     475        long milliSeconds = 60 * 1000 * sessionCacheTimeout;
    474476        getScheduler().schedule(new SessionControlCacheCleaner(), milliSeconds, milliSeconds, false);
    475477       
    476478        if (useInternalJobQueue == null) useInternalJobQueue = Config.getBoolean("jobqueue.internal.enabled");
     479        log.info("jobqueue.internal.enabled = " + useInternalJobQueue);
    477480        if (useInternalJobQueue)
    478481        {
     
    892895  private static void cleanSessionControlCache(boolean force)
    893896  {
     897    if (!force)
     898    {
     899      // Ping all sessioncontrols in the pingers set
     900      for (Pinger p : pingers)
     901      {
     902        p.ping();
     903      }
     904    }
     905   
    894906    synchronized(sessionCache)
    895907    {
    896908      Iterator<SessionControl> i = sessionCache.values().iterator();
    897909      long now = System.currentTimeMillis();
     910      long timout = 60 * 1000 * sessionCacheTimeout;
    898911      while (i.hasNext())
    899912      {
    900913        SessionControl sc = i.next();
    901         if (force || ((now - sc.getLastAccess()) > 60*1000*sessionCacheTimeout))
     914        if (force || ((now - sc.getLastAccess()) > timout))
    902915        {
    903916          log.info("cleanSessionControlCache: Remove[ID="+sc.getId()+"]");
     
    906919            if (sc.isLoggedIn()) sc.logout();
    907920          }
    908           catch (BaseException ex)
     921          catch (Throwable t)
    909922          {
    910             log.error("Exception during cleanSessionControlCache", ex);
     923            log.error("Exception during cleanSessionControlCache", t);
    911924          }
    912925          finally
    913926          {
     927            sc.close();
    914928            i.remove();
    915929          }
     
    10051019  }
    10061020 
     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 
    10071076}
  • trunk/src/core/net/sf/basedb/core/BasicItem.java

    r3679 r3857  
    251251    query.setInteger("toType", this.getType().getValue());
    252252    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()))
    254254    {
    255255      using.add(new ItemProxy((Integer)u[0], Item.fromValue((Integer)u[1])));
     
    268268  protected void addUsingItems(Set<ItemProxy> using, Item itemType, org.hibernate.Query query)
    269269  {
    270     for (Integer itemId : HibernateUtil.loadList(Integer.class, query))
     270    for (Integer itemId : HibernateUtil.loadList(Integer.class, query, getSessionControl()))
    271271    {
    272272      using.add(new ItemProxy(itemId, itemType));
     
    282282  protected void addUsingItems(Set<ItemProxy> using, org.hibernate.Query query)
    283283  {
    284     for (BasicData item : HibernateUtil.loadList(BasicData.class, query))
     284    for (BasicData item : HibernateUtil.loadList(BasicData.class, query, getSessionControl()))
    285285    {
    286286      using.add(new ItemProxy(item.getId(), Item.fromDataClass(item.getClass())));
  • trunk/src/core/net/sf/basedb/core/BioAssaySet.java

    r3679 r3857  
    635635    }
    636636   
    637     // Everyting is ok, create the new bioassay
     637    // Everything is ok, create the new bioassay
    638638    BioAssay ba = newBioAssay(parent.getDataCubeColumn(), Collections.singleton(parent));
    639639    ba.setName(parent.getName());
     
    12091209  {
    12101210    DbControl dc = getDbControl();
     1211    SessionControl sc = dc.getSessionControl();
    12111212   
    12121213    // 1. Find all child bioassaysets recursively
     
    12271228    */
    12281229    query.setParameterList("basList", all);
    1229     List<DataCubeData> possibleCubes = HibernateUtil.loadList(DataCubeData.class, query);
     1230    List<DataCubeData> possibleCubes = HibernateUtil.loadList(DataCubeData.class, query, sc);
    12301231   
    12311232    // 2b. Among the found data cubes, find those that are also used by other bioassaysets
     
    12421243      query.setParameterList("basList", all);
    12431244      query.setParameterList("possibleCubes", possibleCubes);
    1244       possibleCubes.removeAll(HibernateUtil.loadList(DataCubeData.class, query));
     1245      possibleCubes.removeAll(HibernateUtil.loadList(DataCubeData.class, query, sc));
    12451246     
    12461247 
     
    12791280      query.setParameterList("deletedCubes", possibleCubes);
    12801281    }
    1281     List<DataCubeLayerData> possibleLayers = HibernateUtil.loadList(DataCubeLayerData.class, query);
     1282    List<DataCubeLayerData> possibleLayers = HibernateUtil.loadList(DataCubeLayerData.class, query, sc);
    12821283   
    12831284    if (possibleLayers.size() > 0)
     
    12941295      query.setParameterList("basList", all);
    12951296      query.setParameterList("possibleLayers", possibleLayers);
    1296       possibleLayers.removeAll(HibernateUtil.loadList(DataCubeLayerData.class, query));
     1297      possibleLayers.removeAll(HibernateUtil.loadList(DataCubeLayerData.class, query, sc));
    12971298     
    12981299      // 3c. Delete data from the remaining layers
     
    13301331      query.setParameterList("deletedCubes", possibleCubes);
    13311332    }
    1332     List<DataCubeFilterData> possibleFilters = HibernateUtil.loadList(DataCubeFilterData.class, query);
     1333    List<DataCubeFilterData> possibleFilters = HibernateUtil.loadList(DataCubeFilterData.class, query, sc);
    13331334   
    13341335    if (possibleFilters.size() > 0)
     
    13451346      query.setParameterList("basList", all);
    13461347      query.setParameterList("possibleFilters", possibleFilters);
    1347       possibleFilters.removeAll(HibernateUtil.loadList(DataCubeFilterData.class, query));
     1348      possibleFilters.removeAll(HibernateUtil.loadList(DataCubeFilterData.class, query, sc));
    13481349
    13491350      // 4c. Delete data from the remaining layers
     
    13811382      query.setParameterList("deletedCubes", possibleCubes);
    13821383    }
    1383     List<DataCubeExtraValueData> possibleExtraValues = HibernateUtil.loadList(DataCubeExtraValueData.class, query);
     1384    List<DataCubeExtraValueData> possibleExtraValues = HibernateUtil.loadList(DataCubeExtraValueData.class, query, sc);
    13841385   
    13851386    if (possibleExtraValues.size() > 0)
     
    13961397      query.setParameterList("basList", all);
    13971398      query.setParameterList("possibleExtraValues", possibleExtraValues);
    1398       possibleExtraValues.removeAll(HibernateUtil.loadList(DataCubeExtraValueData.class, query));
     1399      possibleExtraValues.removeAll(HibernateUtil.loadList(DataCubeExtraValueData.class, query, sc));
    13991400     
    14001401      // 5c. Delete data from the remaining extra values
     
    14301431    }
    14311432    findChildren.setEntity("parent", parent);
    1432     List<BioAssaySetData> children = HibernateUtil.loadList(BioAssaySetData.class, findChildren);
     1433    List<BioAssaySetData> children = HibernateUtil.loadList(BioAssaySetData.class, findChildren, null);
    14331434    for (BioAssaySetData child : children)
    14341435    {
  • trunk/src/core/net/sf/basedb/core/DataQuery.java

    r3679 r3857  
    8282    enableFilters(dc);
    8383    long totalCount = -1;
     84    SessionControl sc = dc.getSessionControl();
    8485
    8586    // Load the total count if it is requested
     
    9091   
    9192    // Load the results
    92     ScrollIterator<I> result = HibernateUtil.loadIterator(dataClass,  getMainHqlQuery(dc));
     93    ScrollIterator<I> result =
     94      HibernateUtil.loadIterator(dataClass,  getMainHqlQuery(dc), sc);
    9395    disableFilters(dc);
    9496    return new DataResultIterator<I>(result, dc.getSessionControl(),
  • trunk/src/core/net/sf/basedb/core/DiskUsageStatistics.java

    r3675 r3857  
    237237    private void loadDiskUsage(org.hibernate.Query query)
    238238    {
    239       List<Object[]> du = HibernateUtil.loadList(Object[].class, query);
     239      List<Object[]> du = HibernateUtil.loadList(Object[].class, query, null);
    240240      for (Object[] row : du)
    241241      {
  • trunk/src/core/net/sf/basedb/core/Group.java

    r3679 r3857  
    147147      {
    148148        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)));
    150150    }
    151151    return allGroups;
  • trunk/src/core/net/sf/basedb/core/HibernateUtil.java

    r3679 r3857  
    4646import java.util.HashMap;
    4747import java.util.HashSet;
     48import java.util.LinkedList;
    4849import java.util.List;
    4950import java.util.Iterator;
     
    14491450    @param clazz The list should contain objects of this class
    14501451    @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
    14511454  */
    14521455  @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)
    14541457    throws BaseException
    14551458  {
    14561459    assert query != null : "query == null";
    1457     try
    1458     {
     1460    Application.Pinger pinger = null;
     1461    try
     1462    {
     1463      if (sc != null) pinger = Application.newPinger(sc);
    14591464      return (List<T>)query.list();
    14601465    }
     
    14621467    {
    14631468      throw new BaseException(ex);
     1469    }
     1470    finally
     1471    {
     1472      if (pinger != null) pinger.stop();
    14641473    }
    14651474  }
     
    14691478    @param clazz The iterator returns objects of this class
    14701479    @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)
    14731484    throws BaseException
    14741485  {
    14751486    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);
    14781492      ScrollableResults result = query.scroll(ScrollMode.FORWARD_ONLY);
    14791493      return new ScrollIterator<T>(clazz, result);
     
    14821496    {
    14831497      throw new BaseException(ex);
     1498    }
     1499    finally
     1500    {
     1501      if (pinger != null) pinger.stop();
    14841502    }
    14851503  }
     
    16751693 
    16761694  /**
     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  /**
    16771869    Prints a lot of useful stuff about the database to standard output.
    16781870    For each table the output includes information about columns, indexes,
     
    17161908        System.out.println("Schema  : " + table.getSchema());
    17171909      }
    1718 
     1910 
    17191911      Map<Set<String>, String> indexedColumns = new HashMap<Set<String>, String>();
    17201912      Map<Set<String>, String> uniqueColumns = new HashMap<Set<String>, String>();
     
    17221914      String pkName = null;
    17231915      Set<String> fkNames = new HashSet<String>();
    1724 
     1916 
    17251917      if (verbose)
    17261918      {
     
    17381930        throw new BaseException(ex);
    17391931      }
    1740 
     1932 
    17411933      if (verbose && tiDb != null)
    17421934      {
     
    17951987        }
    17961988      }
    1797 
     1989 
    17981990      // Write indexes and unique constraints
    17991991      for (IndexInfo ii : tiHib.getIndexes())
     
    18142006        boolean exists = dbName != null;
    18152007        boolean safeToDrop = exists && tiDb.safeToDrop(ii);
    1816 
     2008 
    18172009        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()) : "";
    18192012        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(),
    18212015          ii.getColumns(), ii.isUnique());
    18222016        boolean actionDrop = dropIndexes && exists && safeToDrop;
     
    18822076    }
    18832077  }
    1884  
     2078
    18852079
    18862080}
  • trunk/src/core/net/sf/basedb/core/Install.java

    r3820 r3857  
    196196      if (progress != null) progress.display((int)(3*progress_factor), "--Creating roles...");
    197197      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 everyting in BASE.");
     198      RoleData roleSuper = createRole(Role.SUPERVISOR, "Supervisor", false, "Users with this role get full READ permission to everything in BASE.");
    199199      RoleData rolePower = createRole(Role.POWER_USER, "Power user", false, "Users with this role may do some things that an ordinary user may not.");
    200200      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  
    253253      query.setInteger("status", Job.Status.WAITING.getValue());
    254254      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);
    256256     
    257257      log.info("Found " + jobs.size() + " jobs waiting for execution");
     
    485485    */
    486486    /**
    487       Never reload since everyting is static.
     487      Never reload since everything is static.
    488488    */
    489489    boolean getReload()
  • trunk/src/core/net/sf/basedb/core/InternalStorageController.java

    r3679 r3857  
    339339    */
    340340    /**
    341       Never reload since everyting is static.
     341      Never reload since everything is static.
    342342    */
    343343    boolean getReload()
  • trunk/src/core/net/sf/basedb/core/ItemKey.java

    r3679 r3857  
    157157        WHERE NOT sd.itemKey IS NULL
    158158      */
    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));
    160160      if (used.size() == 0) used.add(0);
    161161      query = HibernateUtil.getPredefinedQuery(session, "SELECT_UNUSED_ITEMKEYS");
     
    165165      */
    166166      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);
    168168      for (ItemKeyData ik : unused)
    169169      {
     
    363363      */
    364364      query.setInteger("numPermissions", numPermissions);
    365       List<Integer> candidates = HibernateUtil.loadList(Integer.class, query);
     365      List<Integer> candidates = HibernateUtil.loadList(Integer.class, query, null);
    366366      if (candidates.size() > 0 && numPermissions > 0 && userPermissions != null)
    367367      {
     
    385385        query.setParameterList("candidates", candidates, org.hibernate.Hibernate.INTEGER);
    386386        query.setInteger("numPermissions", numPermissions);
    387         candidates = HibernateUtil.loadList(Integer.class, query);
     387        candidates = HibernateUtil.loadList(Integer.class, query, null);
    388388      }
    389389     
     
    403403        query.setInteger("numPermissions", numPermissions);
    404404        query.setParameterList("candidates", candidates, org.hibernate.Hibernate.INTEGER);
    405         candidates = HibernateUtil.loadList(Integer.class, query);       
     405        candidates = HibernateUtil.loadList(Integer.class, query, null);       
    406406      }
    407407
     
    428428        query.setParameterList("candidates", candidates, org.hibernate.Hibernate.INTEGER);
    429429        query.setInteger("numPermissions", numPermissions);
    430         candidates = HibernateUtil.loadList(Integer.class, query);
     430        candidates = HibernateUtil.loadList(Integer.class, query, null);
    431431      }
    432432 
  • trunk/src/core/net/sf/basedb/core/ItemQuery.java

    r3679 r3857  
    9090  {
    9191    enableFilters(dc);
     92    SessionControl sc = dc.getSessionControl();
    9293   
    93     List<? extends BasicData> result = HibernateUtil.loadList(dataClass, getMainHqlQuery(dc));
     94    List<? extends BasicData> result = HibernateUtil.loadList(dataClass, getMainHqlQuery(dc), sc);
    9495    long totalCount = result.size();
    9596   
     
    115116    enableFilters(dc);
    116117    long totalCount = -1;
     118    SessionControl sc = dc.getSessionControl();
    117119   
    118120    // Load the total count if it is requested
     
    122124    }
    123125
    124     ScrollIterator<? extends BasicData> result = HibernateUtil.loadIterator(dataClass, getMainHqlQuery(dc));
     126    ScrollIterator<? extends BasicData> result =
     127      HibernateUtil.loadIterator(dataClass, getMainHqlQuery(dc), sc);
    125128    disableFilters(dc);
    126129    return new ItemResultIterator<I>(result, dc, itemClass, totalCount);
  • trunk/src/core/net/sf/basedb/core/Keyring.java

    r3679 r3857  
    323323      */
    324324      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));
    326326      roles = Collections.unmodifiableSet(temp);
    327327    }
     
    350350      */
    351351      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));
    353353     
    354354      query = HibernateUtil.getPredefinedQuery(session, "GET_QUOTA_GROUP_ID_FOR_USER");
     
    375375        {
    376376          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)));
    378378        // repeat until no more new groups are found
    379379      }
     
    406406      */
    407407      query.setInteger("userId", userId);
    408       for (Integer i : HibernateUtil.loadList(Integer.class, query))
     408      for (Integer i : HibernateUtil.loadList(Integer.class, query, null))
    409409      {
    410410        temp.put(i, ALL_ITEM);
     
    419419      */
    420420      query.setInteger("userId", userId);
    421       for (UserProjects up : HibernateUtil.loadList(UserProjects.class, query))
     421      for (UserProjects up : HibernateUtil.loadList(UserProjects.class, query, null))
    422422      {
    423423        Integer i = temp.get(up.getProjectId());
     
    435435        */
    436436        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))
    438438        {
    439439          Integer i = temp.get(gp.getProjectId());
     
    471471        */
    472472        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));
    474474       
    475475        // Get the users that have a quota group among the same groups
     
    481481        */
    482482        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));
    484484      }
    485485     
     
    498498        */
    499499        query.setInteger("projectId", projectId);
    500         temp.addAll(HibernateUtil.loadList(Integer.class, query));
     500        temp.addAll(HibernateUtil.loadList(Integer.class, query, null));
    501501       
    502502        // Get groups that are direct members of the active project
     
    509509        query.setInteger("projectId", projectId);
    510510        // 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));
    512512
    513513        // Load users that are members of the project groups
     
    541541      */
    542542      query.setInteger("userId", userId);
    543       List<KeyPermission> keys = HibernateUtil.loadList(KeyPermission.class, query);
     543      List<KeyPermission> keys = HibernateUtil.loadList(KeyPermission.class, query, null);
    544544
    545545      // Load keys shared to any of the groups where the user is a member
     
    553553        */
    554554        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));
    556556      }
    557557
     
    612612      */
    613613      query.setInteger("userId", userId);
    614       List<RoleKeys> roleKeys = HibernateUtil.loadList(RoleKeys.class, query);
     614      List<RoleKeys> roleKeys = HibernateUtil.loadList(RoleKeys.class, query, null);
    615615     
    616616      // Copy the permission from the list to the array
     
    665665      */
    666666      query.setInteger("pluginId", pluginId);
    667       List<PluginKeys> keys = HibernateUtil.loadList(PluginKeys.class, query);
     667      List<PluginKeys> keys = HibernateUtil.loadList(PluginKeys.class, query, null);
    668668     
    669669      // Copy the permissions from the list to the array
     
    701701      */
    702702      query.setInteger("projectId", projectId);
    703       List<ProjectKeys> keys = HibernateUtil.loadList(ProjectKeys.class, query);
     703      List<ProjectKeys> keys = HibernateUtil.loadList(ProjectKeys.class, query, null);
    704704
    705705      // Copy the permissions from the List to the array
  • trunk/src/core/net/sf/basedb/core/PluginDefinition.java

    r3820 r3857  
    317317    query.setParameterList("projectKeys", projectKeys, org.hibernate.Hibernate.INTEGER);
    318318 
    319     List<Object> pluginCount = HibernateUtil.loadList(Object.class, query);
     319    List<Object> pluginCount = HibernateUtil.loadList(Object.class, query, dc.getSessionControl());
    320320    Map<Plugin.MainType, Integer> result = new HashMap<Plugin.MainType, Integer>(5);
    321321    for (Object cnt : pluginCount)
     
    11251125    org.hibernate.Query query = HibernateUtil.createQuery(
    11261126      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);
    11281128
    11291129    for (PluginTypeData pt : types)
  • trunk/src/core/net/sf/basedb/core/Project.java

    r3847 r3857  
    393393      */
    394394      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));
    396396     
    397397      include.remove(Include.OTHERS);
     
    458458      FROM net.sf.basedb.core.data.ShareableData item
    459459    */
    460     List<ShareableData> inProject = HibernateUtil.loadList(ShareableData.class, query);
     460    List<ShareableData> inProject = HibernateUtil.loadList(ShareableData.class, query, sc);
    461461    List<Shareable> items = new ArrayList<Shareable>(inProject.size());
    462462
  • trunk/src/core/net/sf/basedb/core/ProjectKey.java

    r3679 r3857  
    142142        WHERE NOT sd.projectKey IS NULL
    143143      */
    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));
    145145      if (used.size() == 0) used.add(0);
    146146      query = HibernateUtil.getPredefinedQuery(session, "SELECT_UNUSED_PROJECTKEYS");
     
    150150      */
    151151      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);
    153153      for (ProjectKeyData pk : unused)
    154154      {
     
    307307      */
    308308      query.setInteger("numPermissions", numPermissions);
    309       List<Integer> candidates = HibernateUtil.loadList(Integer.class, query);
     309      List<Integer> candidates = HibernateUtil.loadList(Integer.class, query, null);
    310310      if (candidates.size() > 0)
    311311      {
     
    330330        query.setParameterList("candidates", candidates, org.hibernate.Hibernate.INTEGER);
    331331        query.setInteger("numPermissions", numPermissions);
    332         candidates = HibernateUtil.loadList(Integer.class, query);
     332        candidates = HibernateUtil.loadList(Integer.class, query, null);
    333333      }
    334334      if (candidates.size() == 0)
  • trunk/src/core/net/sf/basedb/core/RawBioAssay.java

    r3820 r3857  
    10871087      */
    10881088      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());
    10901091      while (si.hasNext())
    10911092      {
  • trunk/src/core/net/sf/basedb/core/RawDataBatcher.java

    r3820 r3857  
    192192      */
    193193      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());
    195196      while (si.hasNext())
    196197      {
  • trunk/src/core/net/sf/basedb/core/ReporterScoreQuery.java

    r2474 r3857  
    5858    enableFilters(dc);
    5959    long totalCount = -1;
     60    SessionControl sc = dc.getSessionControl();
    6061   
    6162    // Load the total count if it is requested
     
    6566    }
    6667
    67     ScrollIterator<ReporterListScoreData> result = HibernateUtil.loadIterator(ReporterListScoreData.class, getMainHqlQuery(dc));
     68    ScrollIterator<ReporterListScoreData> result =
     69      HibernateUtil.loadIterator(ReporterListScoreData.class, getMainHqlQuery(dc), sc);
    6870    disableFilters(dc);
    6971    return new ReporterScoreResultIterator(result, dc, totalCount);
  • trunk/src/core/net/sf/basedb/core/SessionControl.java

    r3679 r3857  
    112112 
    113113  /**
     114    If the session control has been closed it can no longer be used.
     115  */
     116  private boolean closed;
     117 
     118  /**
    114119    Stores name and value from {@link ClientDefaultSettingData}.
    115120  */
     
    192197    Get the time this object last was accessed. Used by the cleanup timer
    193198    in {@link Application#cleanSessionControlCache(boolean)}
    194   */
    195   long getLastAccess()
     199    @since 2.4.5
     200  */
     201  public long getLastAccess()
    196202  {
    197203    return lastAccess;
     
    204210  public void updateLastAccess()
    205211  {
     212    if (closed) throw new PermissionDeniedException("SessonControl is closed");
    206213    lastAccess = System.currentTimeMillis();
    207214  }
     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 
    208237 
    209238  /**
     
    693722  public boolean isLoggedIn()
    694723  {
    695     updateLastAccess();
    696724    return loginInfo != null;
    697725  }
     
    14051433      query.setInteger("itemType", item.getValue());
    14061434      query.setString("subContext", subContext);
    1407       for (Object ctx : HibernateUtil.loadList(Object.class, query))
     1435      for (Object ctx : HibernateUtil.loadList(Object.class, query, null))
    14081436      {
    14091437        Object[] o = (Object[])ctx;
     
    16651693    */
    16661694    query.setInteger("client", clientId);
    1667     return listToMap(HibernateUtil.loadList(ClientDefaultSettingData.class, query));
     1695    return listToMap(HibernateUtil.loadList(ClientDefaultSettingData.class, query, null));
    16681696  }
    16691697
     
    16801708    */
    16811709    query.setInteger("user", userId);
    1682     return listToMap(HibernateUtil.loadList(UserDefaultSettingData.class, query));
     1710    return listToMap(HibernateUtil.loadList(UserDefaultSettingData.class, query, null));
    16831711  }
    16841712
     
    16961724    query.setInteger("user", userId);
    16971725    query.setInteger("client", clientId);
    1698     return listToMap(HibernateUtil.loadList(UserClientSettingData.class, query));
     1726    return listToMap(HibernateUtil.loadList(UserClientSettingData.class, query, null));
    16991727  }
    17001728 
     
    17161744  {
    17171745    // Load the existing settings from the database
    1718     List<I> dbSettings = HibernateUtil.loadList(dataClass, query);
     1746    List<I> dbSettings = HibernateUtil.loadList(dataClass, query, null);
    17191747    // Iterator the existing settings and check what has happened to them
    17201748    for (SettingData s : dbSettings)
     
    17861814  protected void cleanUp()
    17871815  {
    1788     if (isLoggedIn()) logout();
     1816    if (!isClosed() && isLoggedIn()) logout();
    17891817  }
    17901818 
     
    17991827      cleanUp();
    18001828    }
    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);
    18041832    }
    18051833    super.finalize();
    18061834  }
    1807 
     1835 
    18081836  /**
    18091837    Internal class to hold information about the logged in user.
  • trunk/src/core/net/sf/basedb/core/Trashcan.java

    r3675 r3857  
    7373    {
    7474      org.hibernate.Session session = dc.getHibernateSession();
     75      SessionControl sc = dc.getSessionControl();
    7576      org.hibernate.Query query = HibernateUtil.getPredefinedQuery(session, "GET_REMOVED_ITEMS");
    7677      /*
     
    8283      filter.setParameter("owner", dc.getSessionControl().getLoggedInUserId());
    8384     
    84       List<RemovableData> removed = HibernateUtil.loadList(RemovableData.class, query);
     85      List<RemovableData> removed = HibernateUtil.loadList(RemovableData.class, query, sc);
    8586      List<Removable> items = new ArrayList<Removable>(removed.size());
    8687     
  • trunk/src/core/net/sf/basedb/core/Update.java

    r3850 r3857  
    950950      // Delete all affymetrix formulas
    951951      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);
    953953      for (FormulaData affyFormula : affyFormulas)
    954954      {
     
    11891189        FROM FileData f
    11901190      */
    1191       List<Integer> ids = HibernateUtil.loadList(Integer.class, query);
     1191      List<Integer> ids = HibernateUtil.loadList(Integer.class, query, null);
    11921192      if (ids.size() > 0)
    11931193      {
     
    12041204        FROM ExperimentData xp
    12051205      */
    1206       ids = HibernateUtil.loadList(Integer.class, query);
     1206      ids = HibernateUtil.loadList(Integer.class, query, null);
    12071207      if (ids.size() > 0)
    12081208      {
     
    12191219        FROM RawBioAssayData rba
    12201220      */
    1221       ids = HibernateUtil.loadList(Integer.class, query);
     1221      ids = HibernateUtil.loadList(Integer.class, query, null);
    12221222      if (ids.size() > 0)
    12231223      {
     
    12681268        WHERE dcd.id = :dataCube
    12691269      */
    1270       for (DataCubeData cubeData : HibernateUtil.loadList(DataCubeData.class, query))
     1270      for (DataCubeData cubeData : HibernateUtil.loadList(DataCubeData.class, query, null))
    12711271      {
    12721272        DataCube cube = dc.getItem(DataCube.class, cubeData);
     
    13291329          JOIN evt.sources src         
    13301330         */
    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));
    13331333     
    13341334      // Calculate the remaining quantity for each biomaterial
     
    14101410        WHERE f.lastUpdate IS NULL AND NOT f.internalName IS NULL
    14111411      */
    1412       List<FileData> files = HibernateUtil.loadList(FileData.class, query);
     1412      List<FileData> files = HibernateUtil.loadList(FileData.class, query, null);
    14131413      for (FileData fData : files)
    14141414      {
     
    14531453        "SELECT f FROM FileData f");
    14541454     
    1455       List<FileData> files = HibernateUtil.loadList(FileData.class, query);
     1455      List<FileData> files = HibernateUtil.loadList(FileData.class, query, null);
    14561456      for (FileData fData : files)
    14571457      {
     
    15051505        "SELECT t FROM TransformationData t");
    15061506     
    1507       List<TransformationData> transformations = HibernateUtil.loadList(TransformationData.class, query);
     1507      List<TransformationData> transformations = HibernateUtil.loadList(TransformationData.class, query, null);
    15081508      Map<JobData, Set<ExperimentData>> experiments = new HashMap<JobData, Set<ExperimentData>>();
    15091509      for (TransformationData transformation : transformations)
     
    15791579      query.setEntity("pluginDefinition", base1Executer);
    15801580      List<PluginConfigurationData> configurations =
    1581         HibernateUtil.loadList(PluginConfigurationData.class, query);
     1581        HibernateUtil.loadList(PluginConfigurationData.class, query, null);
    15821582
    15831583      // Delete AnyToAny for each configuration
     
    19481948            )
    19491949          */
    1950           List<PlateMappingData> mappings = HibernateUtil.loadList(PlateMappingData.class, pmQuery);
     1950          List<PlateMappingData> mappings = HibernateUtil.loadList(PlateMappingData.class, pmQuery, null);
    19511951          if (mappings != null && mappings.size() > 0)
    19521952          {
     
    19671967            {
    19681968              pQuery.setEntity("plateMapping", mapping);
    1969               List<PlateData> plates = HibernateUtil.loadList(PlateData.class, pQuery);
     1969              List<PlateData> plates = HibernateUtil.loadList(PlateData.class, pQuery, null);
    19701970              if (plates != null && plates.size() > 0)
    19711971              {
  • trunk/src/core/net/sf/basedb/core/User.java

    r3679 r3857  
    146146      */
    147147      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));
    149149     
    150150      // Get the users that have a quota group among the same groups
     
    156156      */
    157157      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));
    159159    }
    160160    return userIds;
     
    174174      WHERE grp.default = true
    175175    */
    176     List<GroupData> defaultGroups = HibernateUtil.loadList(GroupData.class, query);
     176    List<GroupData> defaultGroups = HibernateUtil.loadList(GroupData.class, query, null);
    177177    for (GroupData group : defaultGroups)
    178178    {
     
    185185      WHERE rle.default = true
    186186    */
    187     List<RoleData> defaultRoles = HibernateUtil.loadList(RoleData.class, query);
     187    List<RoleData> defaultRoles = HibernateUtil.loadList(RoleData.class, query, null);
    188188    for (RoleData role : defaultRoles)
    189189    {
     
    10901090    query.setEntity("user", this.getData());
    10911091
    1092     List<OwnableData> ownedBy = HibernateUtil.loadList(OwnableData.class, query);
     1092    List<OwnableData> ownedBy = HibernateUtil.loadList(OwnableData.class, query, sc);
    10931093    List<Ownable> items = new ArrayList<Ownable>(ownedBy.size());
    10941094
  • trunk/src/core/net/sf/basedb/core/VirtualColumn.java

    r3679 r3857  
    6868  */
    6969  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);
    7172   
    7273  /**
     
    7576  */
    7677  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);
    7880
    7981  /**
     
    8284  */
    8385  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);
    8588 
    8689  /**
     
    8891  */
    8992  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);
    9195 
    9296  /**
     
    9599  */
    96100  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);
    98103
    99104  /**
     
    102107  */
    103108  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);
    105111
    106112  /**
     
    110116  */
    111117  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);
    113120
    114121  /**
     
    118125  */
    119126  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);
    121129 
    122130  /**
     
    126134  */
    127135  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);
    129138
    130139  /**
     
    132141  */
    133142  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);
    135145
    136146  /**
     
    138148  */
    139149  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);
    141152
    142153  /**
     
    144155  */
    145156  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);
    147159
    148160  /**
    149161    A cache of virtual column objects for channels.
    150162  */
    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>();
    152165 
    153166  /**
    154167    A cache of virtual column objects for extra value types.
    155168  */
    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>();
    157171 
    158172  // Initialise the cache
     
    173187    if (ch == null)
    174188    {
    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);
    176191      synchronized (channels)
    177192      {
  • trunk/src/core/net/sf/basedb/util/overview/ExperimentOverview.java

    r3789 r3857  
    15001500      {
    15011501        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()))
    15031504        {
    15041505          failures.add(new Failure(Validator.INCORRECT_PROTOCOLTYPE, parentNode, null,
  • trunk/src/install/net/sf/basedb/install/InitDB.java

    r3679 r3857  
    2424*/
    2525package net.sf.basedb.install;
     26
     27import java.util.Arrays;
     28import java.util.List;
    2629
    2730import net.sf.basedb.core.Application;
     
    9497        Application.stop();
    9598      }
     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      }
    96108      else
    97109      {
    98110        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");
    101116      }
    102117    }
  • trunk/src/plugins/core/net/sf/basedb/plugins/PackedFileExporter.java

    r3789 r3857  
    9696    (
    9797        "Packed file exporter",
    98         "This plugin is used to packed one or more files/directories " +
     98        "This plugin is used to pack one or more files/directories " +
    9999        "into a single file. Items should be selected before starting the plug-in and " +
    100100        "they must all be located in the same parent directory. " +
  • trunk/www/include/menu.jsp

    r3820 r3857  
    106106        for (String recent : recentlyViewed)
    107107        {
    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
    112109          {
    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)
    116114            {
    117               try
     115              String shortName = "";
     116              String fullName = "";
     117              if (loadNames)
    118118              {
    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                }
    122129              }
    123               catch (Throwable t)
     130              else
    124131              {
    125                 continue;
     132                fullName = itemType.toString() + "; id=" + itemId;
     133                shortName = itemType + " (id=" + itemId + ")";
    126134              }
     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              <%
    127143            }
    128             else
    129             {
    130               fullName = itemType.toString() + "; id=" + itemId;
    131               shortName = itemType + " (id=" + itemId + ")";
    132             }
    133             numItems++;
    134             %>
    135             <m:menuitem
    136               title="<%=numItems + ". " + shortName%>"
    137               onclick="<%="Main.viewOrEditItem('" + ID + "', '" + itemType.name() + "', " + itemId + ")"%>"
    138               tooltip="<%="Go to " + HTML.encodeTags(fullName) + " (" + itemType + ")"%>"
    139             />
    140             <%
    141144          }
     145          catch (Throwable t)
     146          {}
    142147        }
    143148      }
     
    162167        for (String recentItem : stickyItems.split(":"))
    163168        {
    164           Item itemType = Item.valueOf(recentItem);
    165           ItemContext cc = sc.getCurrentContext(itemType);
    166           if (cc.getId() != 0)
     169          try
    167170          {
    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)
    171174            {
    172               try
     175              String shortName = "";
     176              String fullName = "";
     177              if (loadNames)
    173178              {
    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                }
    177189              }
    178               catch (Throwable t)
     190              else
    179191              {
    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                <%
    181214              }
    182215            }
    183             else
    184             {
    185               fullName = itemType.toString() + "; id=" + cc.getId();
    186               shortName = " (id=" + cc.getId() + ")";
    187             }
    188             numItems++;
    189             numSticky++;
    190             %>
    191             <m:menuitem
    192               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 well
    200               %>
    201               <m:menuitem
    202                 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             }
    208216          }
     217          catch (Throwable t)
     218          {}
    209219        }
    210220        if (numSticky == 0)
Note: See TracChangeset for help on using the changeset viewer.