Search in sources :

Example 1 with GravatarGenerator

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;
}
Also used : GravatarGenerator(com.gitblit.GravatarGenerator) AvatarGenerator(com.gitblit.AvatarGenerator) IStoredSettings(com.gitblit.IStoredSettings)

Aggregations

AvatarGenerator (com.gitblit.AvatarGenerator)1 GravatarGenerator (com.gitblit.GravatarGenerator)1 IStoredSettings (com.gitblit.IStoredSettings)1