Class AllocationCommands
- java.lang.Object
-
- org.elasticsearch.cluster.routing.allocation.command.AllocationCommands
-
- All Implemented Interfaces:
ToXContent
,ToXContentFragment
public class AllocationCommands extends java.lang.Object implements ToXContentFragment
A simpleAllocationCommand
composite managing severalAllocationCommand
implementations
-
-
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
Modifier and Type Method Description AllocationCommands
add(AllocationCommand... commands)
Adds a set of commands to this collectionjava.util.List<AllocationCommand>
commands()
Get the commands wrapped by this instanceboolean
equals(java.lang.Object obj)
RoutingExplanations
execute(RoutingAllocation allocation, boolean explain)
Executes all wrapped commands on a givenRoutingAllocation
static AllocationCommands
fromXContent(XContentParser parser)
ReadsAllocationCommands
from aXContentParser
int
hashCode()
static AllocationCommands
readFrom(StreamInput in)
Reads aAllocationCommands
from aStreamInput
java.lang.String
toString()
XContentBuilder
toXContent(XContentBuilder builder, ToXContent.Params params)
static void
writeTo(AllocationCommands commands, StreamOutput out)
WritesAllocationCommands
to 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
-AllocationCommand
s 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:
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 givenRoutingAllocation
- 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
Reads aAllocationCommands
from aStreamInput
- 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
WritesAllocationCommands
to aStreamOutput
- Parameters:
commands
- Commands to writeout
-StreamOutput
to write the commands to- Throws:
java.io.IOException
- if something happens during write
-
fromXContent
public static AllocationCommands fromXContent(XContentParser parser) throws java.io.IOException
ReadsAllocationCommands
from aXContentParser
{ "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 XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
- Specified by:
toXContent
in interfaceToXContent
- Throws:
java.io.IOException
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-