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

io.searchbox.action.AbstractMultiINodeActionBuilder Maven / Gradle / Ivy

package io.searchbox.action;

import org.apache.commons.lang3.StringUtils;

import java.util.Collection;
import java.util.LinkedList;

/**
 * @author cihat keser
 */
@SuppressWarnings("unchecked")
public abstract class AbstractMultiINodeActionBuilder extends AbstractAction.Builder {
    private Collection nodes = new LinkedList();

    /**
     * Most cluster level APIs allow to specify which nodes to execute on (for example, getting the node stats for a node).
     * Nodes can be identified in the APIs either using their internal node id, the node name, address, custom attributes,
     * or just the _local node receiving the request. For example, here are some sample values for node:
     * 

*

     *    # Local   ->  _local
     *
     *    # Address ->  10.0.0.3,10.0.0.4
     *              ->  10.0.0.*
     *
     *    # Names   ->  node_name_goes_here
     *              ->  node_name_goes_*
     *
     *    # Attributes (set something like node.rack: 2 in the config)
     *              ->  rack:2
     *                  ->  ra*:2
     *              ->  ra*:2*
     * 
*/ public K addNode(String node) { if (StringUtils.isNotEmpty(node)) { nodes.add(node); } return (K) this; } /** * Most cluster level APIs allow to specify which nodes to execute on (for example, getting the node stats for a node). * Nodes can be identified in the APIs either using their internal node id, the node name, address, custom attributes, * or just the _local node receiving the request. For example, here are some sample values for node: *

*

     *    # Local   ->  _local
     *
     *    # Address ->  10.0.0.3,10.0.0.4
     *              ->  10.0.0.*
     *
     *    # Names   ->  node_name_goes_here
     *              ->  node_name_goes_*
     *
     *    # Attributes (set something like node.rack: 2 in the config)
     *              ->  rack:2
     *                  ->  ra*:2
     *              ->  ra*:2*
     * 
*/ public K addNode(Collection nodes) { this.nodes.addAll(nodes); return (K) this; } public String getJoinedNodes() { if (!nodes.isEmpty()) { return StringUtils.join(nodes, ","); } else { return "_all"; } } abstract public T build(); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy