* @return The appropriate implementation
*
* TODO ROCKET When upgrading from GWT 1.5 reapply changes
*/
protected LoggerOptimiser getLoggerOptimiser(final JProgram program, final PropertyOracle propertyOracle, final TreeLogger logger) {
final LoggingPropertyReader reader = new LoggingPropertyReader() {
@Override
protected String getPropertyValue() {
try {
return propertyOracle.getPropertyValue(logger, this.getPropertyName());
} catch (final BadPropertyValueException badPropertyValueException) {
throw new RuntimeException(badPropertyValueException);
}
}
@Override
protected void throwInvalidPropertyValue(final String propertyValue) {
throw new RuntimeException("Invalid " + this.getPropertyName() + " value of \"" + propertyValue + "\" encountered.");
}
@Override
protected Object handleDisableLoggingValue() {
final NoneLoggingFactoryGetLoggerOptimiser none = new NoneLoggingFactoryGetLoggerOptimiser();
none.setProgram(program);
none.setGetLogger(program.getLoggerFactoryGetLogger());
return none;
}
@Override
protected Object handleEnableLoggingValue() {
final LoggingLevelByNameAssigner loggingFactory = new LoggingLevelByNameAssigner();
loggingFactory.setProgram(program);
loggingFactory.setGetLogger(program.getLoggerFactoryGetLogger());
loggingFactory.setLoggingFactoryConfig(this.createPropertiesFileLoggingConfig());
return loggingFactory;
}
};
return (LoggerOptimiser) reader.readProperty();
}