Class AllocationCommands
org.elasticsearch.cluster.routing.allocation.command.AllocationCommands
- All Implemented Interfaces:
org.elasticsearch.common.xcontent.ToXContent
,org.elasticsearch.common.xcontent.ToXContentFragment
public class AllocationCommands
extends
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
ConstructorDescriptionAllocationCommands(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 instanceboolean
obj)
execute(RoutingAllocation allocation, boolean explain)
Executes all wrapped commands on a givenRoutingAllocation
static AllocationCommands
fromXContent(org.elasticsearch.common.xcontent.XContentParser parser)
ReadsAllocationCommands
from aXContentParser
int
hashCode()
static AllocationCommands
readFrom(StreamInput in)
Reads aAllocationCommands
from aStreamInput
toString()
org.elasticsearch.common.xcontent.XContentBuilder
toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
static void
writeTo(AllocationCommands commands, StreamOutput out)
WritesAllocationCommands
to aStreamOutput
Methods inherited from class java.lang.
, , , , , , ,
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
Constructor Details
-
AllocationCommands
Creates a new set ofAllocationCommands
- Parameters:
commands
-AllocationCommand
s 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:
AllocationCommands
with the given commands added
-
commands
Get the commands wrapped by this instance- Returns:
- of commands
-
execute
Executes all wrapped commands on a givenRoutingAllocation
- Parameters:
allocation
-RoutingAllocation
to apply this command to- Throws:
ElasticsearchException
- if something happens during execution
-
readFrom
Reads aAllocationCommands
from aStreamInput
- Parameters:
in
-StreamInput
to read from- Returns:
AllocationCommands
read- Throws:
- if something happens during read
-
writeTo
WritesAllocationCommands
to aStreamOutput
- Parameters:
commands
- Commands to writeout
-StreamOutput
to write the commands to- Throws:
- if something happens during write
-
fromXContent
public static AllocationCommands fromXContent(org.elasticsearch.common.xcontent.XContentParser parser) throwsReadsAllocationCommands
from aXContentParser
{ "commands" : [ {"allocate" : {"index" : "test", "shard" : 0, "node" : "test"}} ] }
- Parameters:
parser
-XContentParser
to read the commands from- Returns:
AllocationCommands
read- Throws:
- 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- Specified by:
toXContent
in interfaceorg.elasticsearch.common.xcontent.ToXContent
- Throws:
-
equals
public boolean equals( obj)- Overrides:
in class
-
hashCode
public int hashCode()- Overrides:
in class
-
toString
public toString()- Overrides:
in class
-