All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pl.allegro.tech.hermes.infrastructure.zookeeper.ZookeeperCredentialsRepository Maven / Gradle / Ivy

There is a newer version: 2.7.0
Show newest version
package pl.allegro.tech.hermes.infrastructure.zookeeper;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.curator.framework.CuratorFramework;
import pl.allegro.tech.hermes.common.exception.InternalProcessingException;
import pl.allegro.tech.hermes.domain.CredentialsRepository;
import pl.allegro.tech.hermes.domain.NodePassword;

public class ZookeeperCredentialsRepository extends ZookeeperBasedRepository implements CredentialsRepository {

    public ZookeeperCredentialsRepository(CuratorFramework zookeeper, ObjectMapper mapper, ZookeeperPaths paths) {
        super(zookeeper, mapper, paths);
    }

    @Override
    public NodePassword readAdminPassword() {
        return readFrom(paths.groupsPath(), NodePassword.class);
    }

    @Override
    public void overwriteAdminPassword(String password) {
        try {
            overwrite(paths.groupsPath(), new NodePassword(password));
        } catch (Exception e) {
            throw new InternalProcessingException(e);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy