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 Object
implements org.elasticsearch.common.xcontent.ToXContentFragment
A simple
AllocationCommand composite managing several
AllocationCommand implementations-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.Params -
Field Summary
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionAllocationCommands(AllocationCommand... commands)Creates a new set ofAllocationCommands -
Method Summary
Modifier and TypeMethodDescriptionadd(AllocationCommand... commands)Adds a set of commands to this collectioncommands()Get the commands wrapped by this instancebooleanexecute(RoutingAllocation allocation, boolean explain)Executes all wrapped commands on a givenRoutingAllocationstatic AllocationCommandsfromXContent(org.elasticsearch.common.xcontent.XContentParser parser)ReadsAllocationCommandsfrom aXContentParserinthashCode()static AllocationCommandsreadFrom(StreamInput in)Reads aAllocationCommandsfrom aStreamInputtoString()org.elasticsearch.common.xcontent.XContentBuildertoXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)static voidwriteTo(AllocationCommands commands, StreamOutput out)WritesAllocationCommandsto aStreamOutputMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
Constructor Details
-
AllocationCommands
Creates a new set ofAllocationCommands- Parameters:
commands-AllocationCommands that are wrapped by this instance
-
-
Method Details
-
add
Adds a set of commands to this collection- Parameters:
commands- Array of commands to add to this instance- Returns:
AllocationCommandswith the given commands added
-
commands
Get the commands wrapped by this instance- Returns:
Listof commands
-
execute
Executes all wrapped commands on a givenRoutingAllocation- Parameters:
allocation-RoutingAllocationto apply this command to- Throws:
ElasticsearchException- if something happens during execution
-
readFrom
Reads aAllocationCommandsfrom aStreamInput- Parameters:
in-StreamInputto read from- Returns:
AllocationCommandsread- Throws:
IOException- if something happens during read
-
writeTo
WritesAllocationCommandsto aStreamOutput- Parameters:
commands- Commands to writeout-StreamOutputto write the commands to- Throws:
IOException- if something happens during write
-
fromXContent
public static AllocationCommands fromXContent(org.elasticsearch.common.xcontent.XContentParser parser) throws IOExceptionReadsAllocationCommandsfrom aXContentParser{ "commands" : [ {"allocate" : {"index" : "test", "shard" : 0, "node" : "test"}} ] }- Parameters:
parser-XContentParserto read the commands from- Returns:
AllocationCommandsread- Throws:
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 IOException- Specified by:
toXContentin interfaceorg.elasticsearch.common.xcontent.ToXContent- Throws:
IOException
-
equals
-
hashCode
public int hashCode() -
toString
-