Changeset 7595


Ignore:
Timestamp:
Feb 22, 2019, 8:21:20 AM (5 years ago)
Author:
Nicklas Nordborg
Message:

References #2135: Remove support for secondary storage

Removed Location.SECONDARY. Updated quota and disk usage related things in the web client.

Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/clients/web/net/sf/basedb/clients/web/Base.java

    r7548 r7595  
    17231723    @since 2.5
    17241724  */
    1725   @SuppressWarnings("deprecation")
    17261725  public static String getFileLinks(String ID, File file, String root)
    17271726  {
     
    17321731    {
    17331732      link += " [offline]";
    1734     }
    1735     else if (l == Location.SECONDARY)
    1736     {
    1737       link += " [secondary]";
    17381733    }
    17391734    else if (l.isDownloadable())
  • trunk/src/core/net/sf/basedb/core/DbControl.java

    r7551 r7595  
    596596      throw new InvalidDataException("QuotaType.TOTAL is not a valid quota type for item " + item + ".");
    597597    }
    598     if (location == Location.SECONDARY && !quotaType.getSecondaryLocation())
    599     {
    600       throw new InvalidDataException(quotaType.getName()+" cannot use the secondary location");
    601     }
    602598   
    603599    // Ignore quota check for some locations
  • trunk/src/core/net/sf/basedb/core/Location.java

    r7548 r7595  
    4444  */
    4545  PRIMARY(1, "Primary", true, true),
    46   /**
    47     The item is stored in secondary storage. Note! This type
    48     of storage may not be available on all servers.
    49     @deprecated In 3.14, no replacement
    50   */
    51   @Deprecated
    52   SECONDARY(2, "Secondary", false, true),
    5346  /**
    5447    The item is stored externally. Some information like
  • trunk/src/core/net/sf/basedb/core/Quota.java

    r7548 r7595  
    379379    @throws PermissionDeniedException If the user has no write permissions.
    380380  */
    381   @SuppressWarnings("deprecation")
    382381  public void setQuotaValue(QuotaType quotaType, Location location, long bytes)
    383382    throws InvalidDataException, PermissionDeniedException
     
    392391      throw new InvalidUseOfNullException("A quota must have a location");
    393392    }
    394     else if (location == Location.SECONDARY && !quotaType.hasSecondaryLocation())
    395     {
    396       throw new InvalidDataException("Quota for the secondary location cannot be set for "+quotaType.getName());
     393    else if (!location.isQuotaLimited())
     394    {
     395      throw new InvalidDataException("Quota for '" + location + "' location cannot be set for "+quotaType.getName());
    397396    }
    398397    if ((bytes < 0) && (bytes != UNLIMITED) && (bytes != UNDEFINED))
  • trunk/src/core/net/sf/basedb/core/Update.java

    r7573 r7595  
    20792079    all files with location=2 (secondary), remove the 'action'
    20802080    column and all stored contexts using the 'action' column.
     2081    Update the QuotaValues table by removing all entries with
     2082    location=2
    20812083    @return The new schema version (=144)
    20822084  */
     
    21022104          query.executeUpdate();
    21032105     
     2106          // Remove rows in QuotaValues with location=2
     2107          query = HibernateUtil.createSqlQuery(session,
     2108            "DELETE FROM [QuotaValues] WHERE [location]=2");
     2109          query.executeUpdate();
     2110         
    21042111          // Remove table filters, etc. that use the 'action' property
    21052112          cleanContextFromProperty(session, Item.FILE, "action", null, true);
  • trunk/www/admin/diskusage/details/view_details.jsp

    r6834 r7595  
    263263            <th style="width: 12em;">Total</td>
    264264            <th style="width: 12em;">Primary</td>
    265             <th style="width: 12em;">Secondary</td>
     265            <th style="width: 12em;">External</td>
    266266            <th style="width: 12em;">Offline</td>
    267             <th style="width: 12em;">External</td>
    268267          </tr>
    269268          <tr style="border-top-width: 1px;" class="highlight">
     
    271270            <td><%=Values.formatBytes(summary.getTotal())%></td>
    272271            <td><%=Values.formatBytes(summary.getTotal(Location.PRIMARY))%></td>
    273             <td><%=Values.formatBytes(summary.getTotal(Location.SECONDARY))%></td>
     272            <td><%=Values.formatBytes(summary.getTotal(Location.EXTERNAL))%></td>     
    274273            <td><%=Values.formatBytes(summary.getTotal(Location.OFFLINE))%></td>     
    275             <td><%=Values.formatBytes(summary.getTotal(Location.EXTERNAL))%></td>     
    276274          </tr>
    277275          <%
     
    283281              <td><%=Values.formatBytes(summary.getTotal(qt))%></td>
    284282              <td><%=Values.formatBytes(summary.getTotal(qt, Location.PRIMARY))%></td>
    285               <td><%=qt.hasSecondaryLocation() ? Values.formatBytes(summary.getTotal(qt, Location.SECONDARY)) : "n/a"%></td>
     283              <td><%=qt.getSystemId().equals(QuotaType.FILE) ? Values.formatBytes(summary.getTotal(qt, Location.EXTERNAL)) : "n/a"%></td>
    286284              <td><%=qt.getSystemId().equals(QuotaType.FILE) ? Values.formatBytes(summary.getTotal(qt, Location.OFFLINE)) : "n/a"%></td>
    287               <td><%=qt.getSystemId().equals(QuotaType.FILE) ? Values.formatBytes(summary.getTotal(qt, Location.EXTERNAL)) : "n/a"%></td>
    288285            </tr>
    289286            <%
  • trunk/www/admin/diskusage/list_groups.jsp

    r6834 r7595  
    7979final ModeInfo mode = ModeInfo.get(request.getParameter("mode"));
    8080final boolean writePermission = sc.hasPermission(Permission.WRITE, Item.GROUP);
    81 final String showStatistics = Values.getString(cc.getSetting("showStatistics"),
    82   Application.hasSecondaryStorage() ? "full" : "quotaType");
     81final String showStatistics = Values.getString(cc.getSetting("showStatistics"), "full");
    8382
    8483final boolean hasLocation = "location".equals(showStatistics) || "full".equals(showStatistics);
     
    375374                        <th>Total</th>
    376375                        <td>Primary</td>
    377                         <td>Secondary</td>
     376                        <td>External</td>
    378377                        <td>Offline</td>
    379                         <td>External</td>
    380378                      </tr>
    381379                      <%
     
    397395                        %>
    398396                        <td><%=Values.formatBytes(summary.getTotal(Location.PRIMARY))%></td>
    399                         <td><%=Values.formatBytes(summary.getTotal(Location.SECONDARY))%></td>
     397                        <td><%=Values.formatBytes(summary.getTotal(Location.EXTERNAL))%></td>
    400398                        <td><%=Values.formatBytes(summary.getTotal(Location.OFFLINE))%></td>
    401                         <td><%=Values.formatBytes(summary.getTotal(Location.EXTERNAL))%></td>
    402399                        <%
    403400                      }
     
    418415                            %>
    419416                            <td><%=Values.formatBytes(summary.getTotal(qt, Location.PRIMARY))%></td>
    420                             <td><%=qt.hasSecondaryLocation() ? Values.formatBytes(summary.getTotal(qt, Location.SECONDARY)) : "n/a"%></td>
     417                            <td><%=qt.getSystemId().equals(QuotaType.FILE) ? Values.formatBytes(summary.getTotal(qt, Location.EXTERNAL)) : "n/a"%></td>
    421418                            <td><%=qt.getSystemId().equals(QuotaType.FILE) ? Values.formatBytes(summary.getTotal(qt, Location.OFFLINE)) : "n/a"%></td>
    422                             <td><%=qt.getSystemId().equals(QuotaType.FILE) ? Values.formatBytes(summary.getTotal(qt, Location.EXTERNAL)) : "n/a"%></td>
    423419                            <%
    424420                          }
  • trunk/www/admin/diskusage/list_users.jsp

    r6834 r7595  
    8282final boolean impersonatePermission = sc.hasSystemPermission(Permission.ACT_AS_ANOTHER_USER);
    8383final boolean writePermission = sc.hasPermission(Permission.WRITE, Item.USER);
    84 final String showStatistics = Values.getString(cc.getSetting("showStatistics"),
    85   Application.hasSecondaryStorage() ? "full" : "quotaType");
     84final String showStatistics = Values.getString(cc.getSetting("showStatistics"), "full");
    8685
    8786final boolean hasLocation = "location".equals(showStatistics) || "full".equals(showStatistics);
     
    511510                        <th>Total</th>
    512511                        <td>Primary</td>
    513                         <td>Secondary</td>
     512                        <td>External</td>
    514513                        <td>Offline</td>
    515                         <td>External</td>
    516514                      </tr>
    517515                      <%
     
    533531                        %>
    534532                        <td><%=Values.formatBytes(summary.getTotal(Location.PRIMARY))%></td>
    535                         <td><%=Values.formatBytes(summary.getTotal(Location.SECONDARY))%></td>
     533                        <td><%=Values.formatBytes(summary.getTotal(Location.EXTERNAL))%></td>
    536534                        <td><%=Values.formatBytes(summary.getTotal(Location.OFFLINE))%></td>
    537                         <td><%=Values.formatBytes(summary.getTotal(Location.EXTERNAL))%></td>
    538535                        <%
    539536                      }
     
    554551                            %>
    555552                            <td><%=Values.formatBytes(summary.getTotal(qt, Location.PRIMARY))%></td>
    556                             <td><%=qt.hasSecondaryLocation() ? Values.formatBytes(summary.getTotal(qt, Location.SECONDARY)) : "n/a"%></td>
     553                            <td><%=qt.getSystemId().equals(QuotaType.FILE) ? Values.formatBytes(summary.getTotal(qt, Location.EXTERNAL)) : "n/a"%></td>
    557554                            <td><%=qt.getSystemId().equals(QuotaType.FILE) ? Values.formatBytes(summary.getTotal(qt, Location.OFFLINE)) : "n/a"%></td>
    558                             <td><%=qt.getSystemId().equals(QuotaType.FILE) ? Values.formatBytes(summary.getTotal(qt, Location.EXTERNAL)) : "n/a"%></td>
    559555                            <%
    560556                          }
  • trunk/www/admin/diskusage/overview.jsp

    r6621 r7595  
    101101        <th style="width: 12em;">Total</th>
    102102        <th style="width: 12em;">Primary</th>
    103         <th style="width: 12em;">Secondary</th>
     103        <th style="width: 12em;">External</th>
    104104        <th style="width: 12em;">Offline</th>
    105         <th style="width: 12em;">External</th>
    106105      </tr>
    107106      <tr style="border-top-width: 1px;" class="highlight">
     
    109108        <td><%=Values.formatBytes(summary.getTotal())%></td>
    110109        <td><%=Values.formatBytes(summary.getTotal(Location.PRIMARY))%></td>
    111         <td><%=Values.formatBytes(summary.getTotal(Location.SECONDARY))%></td>
     110        <td><%=Values.formatBytes(summary.getTotal(Location.EXTERNAL))%></td>     
    112111        <td><%=Values.formatBytes(summary.getTotal(Location.OFFLINE))%></td>     
    113         <td><%=Values.formatBytes(summary.getTotal(Location.EXTERNAL))%></td>     
    114112      </tr>
    115113      <%
     
    121119          <td><%=Values.formatBytes(summary.getTotal(qt))%></td>
    122120          <td><%=Values.formatBytes(summary.getTotal(qt, Location.PRIMARY))%></td>
    123           <td><%=qt.hasSecondaryLocation() ? Values.formatBytes(summary.getTotal(qt, Location.SECONDARY)) : "n/a"%></td>
     121          <td><%=qt.getSystemId().equals(QuotaType.FILE) ? Values.formatBytes(summary.getTotal(qt, Location.EXTERNAL)) : "n/a"%></td>
    124122          <td><%=qt.getSystemId().equals(QuotaType.FILE) ? Values.formatBytes(summary.getTotal(qt, Location.OFFLINE)) : "n/a"%></td>
    125           <td><%=qt.getSystemId().equals(QuotaType.FILE) ? Values.formatBytes(summary.getTotal(qt, Location.EXTERNAL)) : "n/a"%></td>
    126123        </tr>
    127124        <%
  • trunk/www/admin/quota/edit_quota.jsp

    r6621 r7595  
    5757private String getQuotaInput(Quota quota, QuotaType type, Location location)
    5858{
    59   if (location == Location.SECONDARY && !type.hasSecondaryLocation()) return "N/A";
    6059  long bytes = quota == null ? Quota.UNDEFINED : quota.getQuotaValue(type, location);
    6160  String fBytes = "";
     
    159158        <th></th>
    160159        <td><b>Primary location</b></td>
    161         <td><b>Secondary location</b></td>
    162160        <td></td>
    163161      </tr>
     
    165163        <th>Total quota</th>
    166164        <td><%=getQuotaInput(quota, total, Location.PRIMARY)%></td>
    167         <td><%=getQuotaInput(quota, total, Location.SECONDARY)%></td>
    168165        <td></td>
    169166      </tr>
     
    176173          <th class="subprompt"><%=HTML.encodeTags(current.getName())%></th>
    177174          <td><%=getQuotaInput(quota, current, Location.PRIMARY)%></td>
    178           <td><%=getQuotaInput(quota, current, Location.SECONDARY)%></td>
    179175          <td></td>
    180176        </tr>
  • trunk/www/admin/quota/index.jsp

    r6305 r7595  
    160160        for (Location location : Location.values())
    161161        {
    162           if (!(location == Location.SECONDARY && !type.hasSecondaryLocation()))
     162          if (location.isQuotaLimited())
    163163          {
    164164            long bytes = Quota.UNDEFINED;
  • trunk/www/admin/quota/view_quota.jsp

    r6621 r7595  
    6464  private String displayQuota(Quota quota, QuotaType type, Location location)
    6565  {
    66     if (location == Location.SECONDARY && !type.hasSecondaryLocation()) return "N/A";
    6766    long bytes = quota.getQuotaValue(type, location);
    6867    String fBytes = "";
     
    245244            <th style="width: 10em;"></th>
    246245            <th style="width: 12em;">Primary location</th>
    247             <th style="width: 12em;">Secondary location</th>
    248246          </tr>
    249247          <tr class="bottomborder">
    250248            <th><%=Base.getLinkedName(ID, total, false, true)%></th>
    251249            <td><%=displayQuota(quota, total, Location.PRIMARY)%></td>
    252             <td><%=displayQuota(quota, total, Location.SECONDARY)%></td>
    253250          </tr>
    254251          <%
     
    256253          for (QuotaType current : quotaTypes)
    257254          {
    258             long primaryBytes = quota.getQuotaValue(current, Location.PRIMARY);
    259             long secondaryBytes = quota.getQuotaValue(current, Location.SECONDARY);
    260255            %>
    261256            <tr>
    262257            <th><%=Base.getLinkedName(ID, current, false, true)%></th>
    263258            <td><%=displayQuota(quota, current, Location.PRIMARY)%></td>
    264             <td><%=displayQuota(quota, current, Location.SECONDARY)%></td>
    265259            </tr>
    266260            <%
Note: See TracChangeset for help on using the changeset viewer.