Class AllocationCommands
- java.lang.Object
-
- org.elasticsearch.cluster.routing.allocation.command.AllocationCommands
-
- All Implemented Interfaces:
ToXContent,ToXContentFragment
public class AllocationCommands extends Object implements ToXContentFragment
A simpleAllocationCommandcomposite managing severalAllocationCommandimplementations
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
-
-
Field Summary
-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Constructor Description AllocationCommands(AllocationCommand... commands)Creates a new set ofAllocationCommands
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AllocationCommandsadd(AllocationCommand... commands)Adds a set of commands to this collectionList<AllocationCommand>commands()Get the commands wrapped by this instancebooleanequals(Object obj)RoutingExplanationsexecute(RoutingAllocation allocation, boolean explain)Executes all wrapped commands on a givenRoutingAllocationstatic AllocationCommandsfromXContent(XContentParser parser)ReadsAllocationCommandsfrom aXContentParserinthashCode()static AllocationCommandsreadFrom(StreamInput in)Reads aAllocationCommandsfrom aStreamInputStringtoString()XContentBuildertoXContent(XContentBuilder builder, ToXContent.Params params)static voidwriteTo(AllocationCommands commands, StreamOutput out)WritesAllocationCommandsto aStreamOutput-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
-
-
-
Constructor Detail
-
AllocationCommands
public AllocationCommands(AllocationCommand... commands)
Creates a new set ofAllocationCommands- Parameters:
commands-AllocationCommands that are wrapped by this instance
-
-
Method Detail
-
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:
AllocationCommandswith the given commands added
-
commands
public List<AllocationCommand> commands()
Get the commands wrapped by this instance- Returns:
Listof commands
-
execute
public RoutingExplanations execute(RoutingAllocation allocation, boolean explain)
Executes all wrapped commands on a givenRoutingAllocation- Parameters:
allocation-RoutingAllocationto apply this command to- Throws:
ElasticsearchException- if something happens during execution
-
readFrom
public static AllocationCommands readFrom(StreamInput in) throws IOException
Reads aAllocationCommandsfrom aStreamInput- Parameters:
in-StreamInputto read from- Returns:
AllocationCommandsread- Throws:
IOException- if something happens during read
-
writeTo
public static void writeTo(AllocationCommands commands, StreamOutput out) throws IOException
WritesAllocationCommandsto aStreamOutput- Parameters:
commands- Commands to writeout-StreamOutputto write the commands to- Throws:
IOException- if something happens during write
-
fromXContent
public static AllocationCommands fromXContent(XContentParser parser) throws IOException
ReadsAllocationCommandsfrom 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 XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
- Specified by:
toXContentin interfaceToXContent- Throws:
IOException
-
-