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

com.fasterxml.clustermate.service.state.NodeStateStoreHelper Maven / Gradle / Ivy

The newest version!
package com.fasterxml.clustermate.service.state;

import java.io.File;

import com.fasterxml.clustermate.service.SharedServiceStuff;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.storemate.shared.IpAndPort;
import com.fasterxml.storemate.store.backend.StoreBackendBuilder;
import com.fasterxml.storemate.store.state.NodeStateStore;

public abstract class NodeStateStoreHelper
{
    public static NodeStateStore defaultNodeStateStore(StoreBackendBuilder backendBuilder,
            SharedServiceStuff stuff, File metadataDir)
    {
        final ObjectMapper mapper = stuff.jsonMapper();
        NodeStateStore nodeStates =
                backendBuilder.buildNodeStateStore(metadataDir,
                        new JacksonBasedConverter(mapper, IpAndPort.class),
                        new JacksonBasedConverter(mapper, ActiveNodeState.class));
        return nodeStates;
    }

    public static NodeStateStore defaultRemoteNodeStateStore(StoreBackendBuilder backendBuilder,
            SharedServiceStuff stuff, File metadataDir, String id)
    {
        final ObjectMapper mapper = stuff.jsonMapper();
        NodeStateStore nodeStates =
                backendBuilder.buildSecondaryNodeStateStore(metadataDir, id,
                        new JacksonBasedConverter(mapper, IpAndPort.class),
                        new JacksonBasedConverter(mapper, ActiveNodeState.class));
        return nodeStates;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy