Class AllocationCommands

java.lang.Object
org.elasticsearch.cluster.routing.allocation.command.AllocationCommands
All Implemented Interfaces:
org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentFragment

public class AllocationCommands
extends java.lang.Object
implements org.elasticsearch.common.xcontent.ToXContentFragment
A simple AllocationCommand composite managing several AllocationCommand implementations
  • Constructor Details

  • Method Details

    • add

      public AllocationCommands add​(AllocationCommand... commands)
      Adds a set of commands to this collection
      Parameters:
      commands - Array of commands to add to this instance
      Returns:
      AllocationCommands with the given commands added
    • commands

      public java.util.List<AllocationCommand> commands()
      Get the commands wrapped by this instance
      Returns:
      List of commands
    • execute

      public RoutingExplanations execute​(RoutingAllocation allocation, boolean explain)
      Executes all wrapped commands on a given RoutingAllocation
      Parameters:
      allocation - RoutingAllocation to apply this command to
      Throws:
      ElasticsearchException - if something happens during execution
    • readFrom

      public static AllocationCommands readFrom​(StreamInput in) throws java.io.IOException
      Parameters:
      in - StreamInput to read from
      Returns:
      AllocationCommands read
      Throws:
      java.io.IOException - if something happens during read
    • writeTo

      public static void writeTo​(AllocationCommands commands, StreamOutput out) throws java.io.IOException
      Parameters:
      commands - Commands to write
      out - StreamOutput to write the commands to
      Throws:
      java.io.IOException - if something happens during write
    • fromXContent

      public static AllocationCommands fromXContent​(org.elasticsearch.common.xcontent.XContentParser parser) throws java.io.IOException
      Reads AllocationCommands from a XContentParser
           {
               "commands" : [
                    {"allocate" : {"index" : "test", "shard" : 0, "node" : "test"}}
               ]
           }
       
      Parameters:
      parser - XContentParser to read the commands from
      Returns:
      AllocationCommands read
      Throws:
      java.io.IOException - if something bad happens while reading the stream
    • toXContent

      public org.elasticsearch.common.xcontent.XContentBuilder toXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException
      Specified by:
      toXContent in interface org.elasticsearch.common.xcontent.ToXContent
      Throws:
      java.io.IOException
    • equals

      public boolean equals​(java.lang.Object obj)
      Overrides:
      equals in class java.lang.Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object