again? Longer wrapping

(shendaras)
This commit is contained in:
shendaras
2004-04-10 10:08:33 +00:00
committed by zzz
parent 4fb3d34786
commit d81f42e3e9

View File

@@ -118,9 +118,8 @@ public class ClientConfig {
* @param averagePeriods * @param averagePeriods
* list of minutes to summarize over * list of minutes to summarize over
*/ */
public ClientConfig(Destination peer, Destination us, String statFile, public ClientConfig(Destination peer, Destination us, String statFile, int duration, int statFreq, int sendFreq,
int duration, int statFreq, int sendFreq, int sendSize, int sendSize, int numHops, String comment, int averagePeriods[]) {
int numHops, String comment, int averagePeriods[]) {
_peer = peer; _peer = peer;
_us = us; _us = us;
_statFile = statFile; _statFile = statFile;
@@ -345,25 +344,16 @@ public class ClientConfig {
*/ */
public boolean load(Properties clientConfig, int peerNum) { public boolean load(Properties clientConfig, int peerNum) {
if ((clientConfig == null) || (peerNum < 0)) return false; if ((clientConfig == null) || (peerNum < 0)) return false;
String peerVal = clientConfig.getProperty(PROP_PREFIX + peerNum String peerVal = clientConfig.getProperty(PROP_PREFIX + peerNum + PROP_PEER);
+ PROP_PEER); String statFileVal = clientConfig.getProperty(PROP_PREFIX + peerNum + PROP_STATFILE);
String statFileVal = clientConfig.getProperty(PROP_PREFIX + peerNum String statDurationVal = clientConfig.getProperty(PROP_PREFIX + peerNum + PROP_STATDURATION);
+ PROP_STATFILE); String statFrequencyVal = clientConfig.getProperty(PROP_PREFIX + peerNum + PROP_STATFREQUENCY);
String statDurationVal = clientConfig.getProperty(PROP_PREFIX + peerNum String sendFrequencyVal = clientConfig.getProperty(PROP_PREFIX + peerNum + PROP_SENDFREQUENCY);
+ PROP_STATDURATION); String sendSizeVal = clientConfig.getProperty(PROP_PREFIX + peerNum + PROP_SENDSIZE);
String statFrequencyVal = clientConfig.getProperty(PROP_PREFIX String commentVal = clientConfig.getProperty(PROP_PREFIX + peerNum + PROP_COMMENT);
+ peerNum + PROP_STATFREQUENCY); String periodsVal = clientConfig.getProperty(PROP_PREFIX + peerNum + PROP_AVERAGEPERIODS);
String sendFrequencyVal = clientConfig.getProperty(PROP_PREFIX
+ peerNum + PROP_SENDFREQUENCY);
String sendSizeVal = clientConfig.getProperty(PROP_PREFIX + peerNum
+ PROP_SENDSIZE);
String commentVal = clientConfig.getProperty(PROP_PREFIX + peerNum
+ PROP_COMMENT);
String periodsVal = clientConfig.getProperty(PROP_PREFIX + peerNum
+ PROP_AVERAGEPERIODS);
if ((peerVal == null) || (statFileVal == null) if ((peerVal == null) || (statFileVal == null) || (statDurationVal == null) || (statFrequencyVal == null)
|| (statDurationVal == null) || (statFrequencyVal == null)
|| (sendFrequencyVal == null) || (sendSizeVal == null)) { || (sendFrequencyVal == null) || (sendSizeVal == null)) {
if (_log.shouldLog(Log.DEBUG)) { if (_log.shouldLog(Log.DEBUG)) {
_log.debug("Peer number " + peerNum + " does not exist"); _log.debug("Peer number " + peerNum + " does not exist");
@@ -377,13 +367,10 @@ public class ClientConfig {
int sendFreq = getInt(sendFrequencyVal); int sendFreq = getInt(sendFrequencyVal);
int sendSize = getInt(sendSizeVal); int sendSize = getInt(sendSizeVal);
if ((duration <= 0) || (statFreq <= 0) || (sendFreq <= 0) if ((duration <= 0) || (statFreq <= 0) || (sendFreq <= 0) || (sendSize <= 0)) {
|| (sendSize <= 0)) {
if (_log.shouldLog(Log.WARN)) { if (_log.shouldLog(Log.WARN)) {
_log.warn("Invalid client config: duration [" _log.warn("Invalid client config: duration [" + statDurationVal + "] stat frequency ["
+ statDurationVal + "] stat frequency [" + statFrequencyVal + "] send frequency [" + sendFrequencyVal + "] send size [" + sendSizeVal
+ statFrequencyVal + "] send frequency ["
+ sendFrequencyVal + "] send size [" + sendSizeVal
+ "]"); + "]");
} }
return false; return false;
@@ -433,8 +420,7 @@ public class ClientConfig {
_averagePeriods = avgPeriods; _averagePeriods = avgPeriods;
return true; return true;
} catch (DataFormatException dfe) { } catch (DataFormatException dfe) {
_log.error("Peer destination for " + peerNum + " was invalid: " _log.error("Peer destination for " + peerNum + " was invalid: " + peerVal);
+ peerVal);
return false; return false;
} }
} }
@@ -450,8 +436,7 @@ public class ClientConfig {
* @return true if it was stored correctly, false if there were errors * @return true if it was stored correctly, false if there were errors
*/ */
public boolean store(Properties clientConfig, int peerNum) { public boolean store(Properties clientConfig, int peerNum) {
if ((_peer == null) || (_sendFrequency <= 0) || (_sendSize <= 0) if ((_peer == null) || (_sendFrequency <= 0) || (_sendSize <= 0) || (_statDuration <= 0) || (_statFrequency <= 0)
|| (_statDuration <= 0) || (_statFrequency <= 0)
|| (_statFile == null)) { return false; } || (_statFile == null)) { return false; }
String comment = _comment; String comment = _comment;
@@ -469,21 +454,14 @@ public class ClientConfig {
} }
} }
clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_PEER, _peer clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_PEER, _peer.toBase64());
.toBase64()); clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_STATFILE, _statFile);
clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_STATFILE, clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_STATDURATION, _statDuration + "");
_statFile); clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_STATFREQUENCY, _statFrequency + "");
clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_STATDURATION, clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_SENDFREQUENCY, _sendFrequency + "");
_statDuration + ""); clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_SENDSIZE, _sendSize + "");
clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_STATFREQUENCY,
_statFrequency + "");
clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_SENDFREQUENCY,
_sendFrequency + "");
clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_SENDSIZE,
_sendSize + "");
clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_COMMENT, comment); clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_COMMENT, comment);
clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_AVERAGEPERIODS, clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_AVERAGEPERIODS, buf.toString());
buf.toString());
return true; return true;
} }