net.sf.basedb.clients.migrate
Class QuotaTransfer
java.lang.Object
net.sf.basedb.clients.migrate.Manager
net.sf.basedb.clients.migrate.Transfer
net.sf.basedb.clients.migrate.QuotaTransfer
public class QuotaTransfer
- extends Transfer
- Version:
- 2.0.1
- Author:
- nicklas, Martin
- Last modified
- $Date: 2008-09-11 22:05:50 +0200 (Thu, 11 Sep 2008) $
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 |
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
QuotaTransfer
QuotaTransfer()
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 formatteddecimals
- The number of decimals to display, use a negative value to
display all decimalsunit
- 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