Class ElasticsearchNodeCommand
- java.lang.Object
-
- org.elasticsearch.cli.Command
-
- org.elasticsearch.cli.EnvironmentAwareCommand
-
- org.elasticsearch.cluster.coordination.ElasticsearchNodeCommand
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
- Direct Known Subclasses:
DetachClusterCommand
,NodeRepurposeCommand
,OverrideNodeVersionCommand
,UnsafeBootstrapMasterCommand
public abstract class ElasticsearchNodeCommand extends EnvironmentAwareCommand
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
ABORTED_BY_USER_MSG
protected static java.lang.String
DELIMITER
protected static java.lang.String
FAILED_TO_OBTAIN_NODE_LOCK_MSG
protected static java.lang.String
GLOBAL_GENERATION_MISSING_MSG
protected NamedXContentRegistry
namedXContentRegistry
-
Fields inherited from class org.elasticsearch.cli.Command
description, parser
-
-
Constructor Summary
Constructors Constructor Description ElasticsearchNodeCommand(java.lang.String description)
-
Method Summary
Modifier and Type Method Description protected void
confirm(Terminal terminal, java.lang.String msg)
protected void
execute(Terminal terminal, joptsimple.OptionSet options, Environment env)
Execute the command with the initializedEnvironment
.protected Tuple<Manifest,MetaData>
loadMetaData(Terminal terminal, java.nio.file.Path[] dataPaths)
protected abstract void
processNodePaths(Terminal terminal, java.nio.file.Path[] dataPaths, Environment env)
Process the paths.protected void
processNodePathsWithLock(Terminal terminal, joptsimple.OptionSet options, Environment env)
protected NodeEnvironment.NodePath[]
toNodePaths(java.nio.file.Path[] dataPaths)
protected boolean
validateBeforeLock(Terminal terminal, Environment env)
Validate that the command can run before taking any locks.protected void
writeNewMetaData(Terminal terminal, Manifest oldManifest, long newCurrentTerm, MetaData oldMetaData, MetaData newMetaData, java.nio.file.Path[] dataPaths)
-
Methods inherited from class org.elasticsearch.cli.EnvironmentAwareCommand
createEnv, execute
-
Methods inherited from class org.elasticsearch.cli.Command
addShutdownHook, close, exit, main, printAdditionalHelp
-
-
-
-
Field Detail
-
namedXContentRegistry
protected final NamedXContentRegistry namedXContentRegistry
-
DELIMITER
protected static final java.lang.String DELIMITER
- See Also:
- Constant Field Values
-
FAILED_TO_OBTAIN_NODE_LOCK_MSG
protected static final java.lang.String FAILED_TO_OBTAIN_NODE_LOCK_MSG
- See Also:
- Constant Field Values
-
GLOBAL_GENERATION_MISSING_MSG
protected static final java.lang.String GLOBAL_GENERATION_MISSING_MSG
- See Also:
- Constant Field Values
-
ABORTED_BY_USER_MSG
protected static final java.lang.String ABORTED_BY_USER_MSG
- See Also:
- Constant Field Values
-
-
Method Detail
-
processNodePathsWithLock
protected void processNodePathsWithLock(Terminal terminal, joptsimple.OptionSet options, Environment env) throws java.io.IOException
- Throws:
java.io.IOException
-
loadMetaData
protected Tuple<Manifest,MetaData> loadMetaData(Terminal terminal, java.nio.file.Path[] dataPaths) throws java.io.IOException
- Throws:
java.io.IOException
-
confirm
protected void confirm(Terminal terminal, java.lang.String msg)
-
execute
protected final void execute(Terminal terminal, joptsimple.OptionSet options, Environment env) throws java.lang.Exception
Description copied from class:EnvironmentAwareCommand
Execute the command with the initializedEnvironment
.- Specified by:
execute
in classEnvironmentAwareCommand
- Throws:
java.lang.Exception
-
validateBeforeLock
protected boolean validateBeforeLock(Terminal terminal, Environment env)
Validate that the command can run before taking any locks.- Parameters:
terminal
- the terminal to print toenv
- the env to validate.- Returns:
- true to continue, false to stop (must print message in validate).
-
processNodePaths
protected abstract void processNodePaths(Terminal terminal, java.nio.file.Path[] dataPaths, Environment env) throws java.io.IOException
Process the paths. Locks for the paths is held during this method invocation.- Parameters:
terminal
- the terminal to use for messagesdataPaths
- the paths of the node to processenv
- the env of the node to process- Throws:
java.io.IOException
-
writeNewMetaData
protected void writeNewMetaData(Terminal terminal, Manifest oldManifest, long newCurrentTerm, MetaData oldMetaData, MetaData newMetaData, java.nio.file.Path[] dataPaths)
-
toNodePaths
protected NodeEnvironment.NodePath[] toNodePaths(java.nio.file.Path[] dataPaths)
-
-