use of com.gitblit.GravatarGenerator in project gitblit by gitblit.
the class AvatarGeneratorProvider method get.
@Override
public synchronized AvatarGenerator get() {
if (avatarGenerator != null) {
return avatarGenerator;
}
IStoredSettings settings = runtimeManager.getSettings();
String clazz = settings.getString(Keys.web.avatarClass, GravatarGenerator.class.getName());
if (StringUtils.isEmpty(clazz)) {
clazz = GravatarGenerator.class.getName();
}
try {
Class<? extends AvatarGenerator> generatorClass = (Class<? extends AvatarGenerator>) Class.forName(clazz);
avatarGenerator = runtimeManager.getInjector().getInstance(generatorClass);
} catch (Exception e) {
logger.error("failed to create avatar generator", e);
avatarGenerator = new GravatarGenerator();
}
return avatarGenerator;
}
Aggregations