throw new IllegalArgumentException("version must be > 1");
}
if (startingTimeMillis<0) {
throw new IllegalArgumentException("startingTimeMillis must be >= 0");
}
PropertyManager pm = PropertyManager.getInstance();
List properties = pm.findProperties(null, null, null, LOGGING_PROPERTIES_CATEGORY, LOGGING_VERSION_PROPERTY_NAME);
if (properties!=null && properties.size()>0) {
// when there are already versions defined, lets see if the one which should be set now is already defined
for (Iterator it = properties.iterator(); it.hasNext();) {
Property property = (Property) it.next();
if (property.getStringValue().equals(String.valueOf(version))) {
// yes, the version is already set... overwrite this property then
log_.info("setLoggingVersion: overwriting existing version property for version="+version+" from starttime "+property.getLongValue()+" to "+startingTimeMillis);
property.setLongValue(startingTimeMillis);
pm.saveProperty(property);
return;
}
}
}
log_.info("setLoggingVersion: setting version property for version="+version+" to "+startingTimeMillis);
Property newp = pm.createPropertyInstance(null, null, null, LOGGING_PROPERTIES_CATEGORY, LOGGING_VERSION_PROPERTY_NAME, null, startingTimeMillis, String.valueOf(version), null);
pm.saveProperty(newp);
}