2.14.1: 2009-11-05

net.sf.basedb.clients.migrate
Class QuotaTransfer

java.lang.Object
  extended by net.sf.basedb.clients.migrate.Manager
      extended by net.sf.basedb.clients.migrate.Transfer
          extended by net.sf.basedb.clients.migrate.QuotaTransfer

public class QuotaTransfer
extends Transfer

Version:
2.0.1
Author:
nicklas, Martin
Last modified
$Date: 2009-04-06 14:52:39 +0200 (Mon, 06 Apr 2009) $

Field Summary
private static long GB
           
private static long kB
           
private static Logger log
          Logger for this class
private static long MB
           
private  Map<Long,Quota> quotas
           
 
Fields inherited from class net.sf.basedb.clients.migrate.Transfer
BASE2, FROM, itemList, LIMIT, LOCAL_MYSQL_TRANSFER, mapIds, progress, properties, QUICK_TRANSFER, selectOffset, sessionControl, TO
 
Constructor Summary
QuotaTransfer()
           
 
Method Summary
static String formatBytes(long bytes)
          Formats a value using units of bytes, kilobytes, megabytes or gigabytes.
static String formatNumber(Float number, int decimals, String unit)
          Formats a decimal number with the specified number of decimals and optionally adding a unit.
 Quota getQuotaForTotal(DbControl dc, long totalQuota)
          Get the quota which has a total of the given total quota.
 void start()
          Starts the actual transfer.
 
Methods inherited from class net.sf.basedb.clients.migrate.Transfer
cleanUpMemory, commit, createItem, createItem, dependencyFailure, done, getBase2Id, getBatchSize, getCount, getDependencyStatus, getIdMap, getInt, getProperty, initIdMap, isDone, mapId, newDbControl, readRestorePointData, run, run, runUnBatched, saveItem, setup, startProgress, writeRestorePointData
 
Methods inherited from class net.sf.basedb.clients.migrate.Manager
getPreparedStatements, prepareStatementFromFile, print, printDate, setPreparedStatements, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final Logger log
Logger for this class


quotas

private Map<Long,Quota> quotas

GB

private static final long GB
See Also:
Constant Field Values

MB

private static final long MB
See Also:
Constant Field Values

kB

private static final long kB
See Also:
Constant Field Values
Constructor Detail

QuotaTransfer

QuotaTransfer()
Method Detail

start

public void start()
Description copied from class: Transfer
Starts the actual transfer.

Specified by:
start in class Transfer

getQuotaForTotal

public Quota getQuotaForTotal(DbControl dc,
                              long totalQuota)
Get the quota which has a total of the given total quota. If no such quota exist a new quota is created and saved to the database.


formatBytes

public static final String formatBytes(long bytes)
Formats a value using units of bytes, kilobytes, megabytes or gigabytes.

Parameters:
bytes - The value to format
Returns:
A string with a decimal value follwed by bytes, Kb, Mb or Gb.

formatNumber

public static final String formatNumber(Float number,
                                        int decimals,
                                        String unit)
Formats a decimal number with the specified number of decimals and optionally adding a unit.

Parameters:
number - The number to be formatted
decimals - The number of decimals to display, use a negative value to display all decimals
unit - A string that is added to the end of the formatted number, or null to not add anything
Returns:
A string with the formatted number, or an empty string if the number is null

2.14.1: 2009-11-05