Fields Summary |
---|
public static final String | AUTO_UPLOAD_ENABLED_CONFIGKEY |
public static final String | AUTO_UPLOAD_SEEDING_ENABLED_CONFIGKEY |
public static final String | UPLOAD_CONFIGKEY |
public static final String | UPLOAD_SEEDING_CONFIGKEY |
public static final String | DOWNLOAD_CONFIGKEY |
public static final String | UPLOAD_SEEDING_ENABLED_CONFIGKEY |
public static final String[] | CONFIG_PARAMS |
private final String | configKey |
private final Number | configValue |
private static boolean | seeding_upload_enabled |
Methods Summary |
---|
public static java.lang.String | getActiveAutoUploadParameter(org.gudy.azureus2.core3.global.GlobalManager gm)
// if downloading+seeding is set then we always use this regardless of
// only seeding status
if ( COConfigurationManager.getBooleanParameter(TransferSpeedValidator.AUTO_UPLOAD_ENABLED_CONFIGKEY)){
return( TransferSpeedValidator.AUTO_UPLOAD_ENABLED_CONFIGKEY );
}
if ( gm.isSeedingOnly()){
return( TransferSpeedValidator.AUTO_UPLOAD_SEEDING_ENABLED_CONFIGKEY );
}else{
return( TransferSpeedValidator.AUTO_UPLOAD_ENABLED_CONFIGKEY );
}
|
public static java.lang.String | getActiveUploadParameter(org.gudy.azureus2.core3.global.GlobalManager gm)
if ( seeding_upload_enabled && gm.isSeedingOnly()){
return( TransferSpeedValidator.UPLOAD_SEEDING_CONFIGKEY );
}else{
return( TransferSpeedValidator.UPLOAD_CONFIGKEY );
}
|
public static java.lang.String | getDownloadParameter()
return( DOWNLOAD_CONFIGKEY );
|
public static int | getGlobalDownloadRateLimitBytesPerSecond()
return( COConfigurationManager.getIntParameter( getDownloadParameter()) * 1024 );
|
public java.lang.Object | getValue()Validates the given configuration key/value pair and returns the validated value
return validate(configKey, configValue);
|
public static boolean | isAutoSpeedActive(org.gudy.azureus2.core3.global.GlobalManager gm)
return( COConfigurationManager.getBooleanParameter( getActiveAutoUploadParameter( gm )));
|
public static boolean | isAutoUploadAvailable(com.aelitis.azureus.core.AzureusCore core)
return( core.getSpeedManager().isAvailable());
|
public static void | setGlobalDownloadRateLimitBytesPerSecond(int bytes_per_second)
COConfigurationManager.setParameter( getDownloadParameter(), bytes_per_second/1024 );
|
private static java.lang.Object | validate(java.lang.String configKey, java.lang.Number value)Gets the transformed value as an Integer
//assert value instanceof Number;
int newValue = value.intValue();
if(newValue < 0)
{
newValue = 0;
}
if(configKey == UPLOAD_CONFIGKEY)
{
final int downValue = COConfigurationManager.getIntParameter(DOWNLOAD_CONFIGKEY);
if(
newValue != 0 &&
newValue < COConfigurationManager.CONFIG_DEFAULT_MIN_MAX_UPLOAD_SPEED &&
(downValue == 0 || downValue > newValue*2)
)
{
newValue = (downValue + 1)/2;
//COConfigurationManager.setParameter(DOWNLOAD_CONFIGKEY, newValue * 2);
}
}
else if(configKey == DOWNLOAD_CONFIGKEY)
{
final int upValue = COConfigurationManager.getIntParameter(UPLOAD_CONFIGKEY);
if(
upValue != 0 &&
upValue < COConfigurationManager.CONFIG_DEFAULT_MIN_MAX_UPLOAD_SPEED
)
{
if(newValue > upValue*2)
{
newValue = upValue*2;
//COConfigurationManager.setParameter(UPLOAD_CONFIGKEY, (newValue+1)/2);
}
else if(newValue == 0)
{
newValue = upValue*2;
//COConfigurationManager.setParameter(UPLOAD_CONFIGKEY, 0);
}
}
}else if ( configKey == UPLOAD_SEEDING_CONFIGKEY ){
// nothing to do as this is active only when were not downloading
// so we don't really care
}else
{
throw new IllegalArgumentException("Invalid Configuation Key; use key for max upload and max download");
}
return new Integer(newValue);
//return value;
|