public static class LocatorLauncher.Builder extends Object
Modifier and Type | Field and Description |
---|---|
protected static LocatorLauncher.Command |
DEFAULT_COMMAND |
Constructor and Description |
---|
Builder()
Default constructor used to create an instance of the Builder class for programmatical
access.
|
Builder(String... args)
Constructor used to create and configure an instance of the Builder class with the specified
arguments, often passed from the command-line when launching an instance of this class from
the command-line using the Java launcher.
|
Modifier and Type | Method and Description |
---|---|
LocatorLauncher |
build()
Validates the Builder configuration settings and then constructs an instance of the
LocatorLauncher class to invoke operations on a Geode Locator.
|
InetAddress |
getBindAddress()
Gets the IP address to which the Locator has bound itself listening for client requests.
|
LocatorLauncher.Command |
getCommand()
Gets the Locator launcher command used during the invocation of the LocatorLauncher.
|
Boolean |
getDebug()
Determines whether the new instance of the LocatorLauncher will be set to debug mode.
|
Boolean |
getDeletePidFileOnStop()
Determines whether the Geode Locator should delete the pid file when its service stops or
when the JVM exits.
|
Properties |
getDistributedSystemProperties()
Gets the Geode Distributed System (cluster) Properties configuration.
|
Boolean |
getForce()
Gets the boolean value used by the Locator to determine if it should overwrite the PID file
if it already exists.
|
Boolean |
getHelp()
Determines whether the new instance of LocatorLauncher will be used to output help
information for either a specific command, or for using LocatorLauncher in general.
|
String |
getHostnameForClients()
Gets the hostname used by clients to lookup the Locator.
|
String |
getMemberName()
Gets the member name of this Locator in Geode.
|
Integer |
getPid()
Gets the process ID (PID) of the running Locator indicated by the user as an argument to the
LocatorLauncher.
|
Integer |
getPort()
Gets the port number used by the Locator to listen for client requests.
|
Boolean |
getRedirectOutput()
Determines whether the new instance of LocatorLauncher will redirect output to system logs
when starting a Locator.
|
String |
getWorkingDirectory()
Gets the working directory pathname in which the Locator will be ran.
|
protected void |
parseArguments(String... args)
Parses an array of arguments to configure this Builder with the intent of constructing a
Locator launcher to invoke a Locator.
|
protected void |
parseCommand(String... args)
Iterates the list of arguments in search of the target Locator launcher command.
|
protected void |
parseMemberName(String... args)
Iterates the list of arguments in search of the Locator's Geode member name.
|
LocatorLauncher.Builder |
set(Properties properties)
add the properties in the Geode Distributed System Property
|
LocatorLauncher.Builder |
set(String propertyName,
String propertyValue)
Sets a Geode Distributed System Property.
|
LocatorLauncher.Builder |
setBindAddress(String addressString)
Sets the IP address as an java.net.InetAddress to which the Locator has bound itself
listening for client requests.
|
LocatorLauncher.Builder |
setCommand(LocatorLauncher.Command command)
Sets the Locator launcher command used during the invocation of the LocatorLauncher
|
LocatorLauncher.Builder |
setDebug(Boolean debug)
Sets whether the new instance of the LocatorLauncher will be set to debug mode.
|
LocatorLauncher.Builder |
setDeletePidFileOnStop(Boolean deletePidFileOnStop)
Sets whether the Geode Locator should delete the pid file when its service stops or when the
JVM exits.
|
LocatorLauncher.Builder |
setForce(Boolean force)
Sets the boolean value used by the Locator to determine if it should overwrite the PID file
if it already exists.
|
LocatorLauncher.Builder |
setHelp(Boolean help)
Sets whether the new instance of LocatorLauncher will be used to output help information for
either a specific command, or for using LocatorLauncher in general.
|
LocatorLauncher.Builder |
setHostnameForClients(String hostnameForClients)
Sets the hostname used by clients to lookup the Locator.
|
LocatorLauncher.Builder |
setMemberName(String memberName)
Sets the member name of the Locator in Geode.
|
LocatorLauncher.Builder |
setPid(Integer pid)
Sets the process ID (PID) of the running Locator indicated by the user as an argument to the
LocatorLauncher.
|
LocatorLauncher.Builder |
setPort(Integer port)
Sets the port number used by the Locator to listen for client requests.
|
LocatorLauncher.Builder |
setRedirectOutput(Boolean redirectOutput)
Sets whether the new instance of LocatorLauncher will redirect output to system logs when
starting a Locator.
|
LocatorLauncher.Builder |
setWorkingDirectory(String workingDirectory)
Sets the working directory in which the Locator will be ran.
|
protected void |
validate()
Validates the configuration settings and properties of this Builder, ensuring that all
invariants have been met.
|
protected void |
validateOnStart()
Validates the arguments passed to the Builder when the 'start' command has been issued.
|
protected void |
validateOnStatus()
Validates the arguments passed to the Builder when the 'status' command has been issued.
|
protected void |
validateOnStop()
Validates the arguments passed to the Builder when the 'stop' command has been issued.
|
@Immutable protected static final LocatorLauncher.Command DEFAULT_COMMAND
public Builder()
public Builder(String... args)
args
- the array of arguments used to configure the Builder.protected void parseArguments(String... args)
args
- the array of arguments used to configure this Builder and create an instance of
LocatorLauncher.protected void parseCommand(String... args)
args
- an array of arguments from which to search for the Locator launcher command.LocatorLauncher.Command.valueOfName(String)
,
parseArguments(String...)
protected void parseMemberName(String... args)
args
- the array of arguments from which to search for the Locator's member name in
Geode.LocatorLauncher.Command.isCommand(String)
,
parseArguments(String...)
public LocatorLauncher.Command getCommand()
setCommand(org.apache.geode.distributed.LocatorLauncher.Command)
,
LocatorLauncher.Command
public LocatorLauncher.Builder setCommand(LocatorLauncher.Command command)
command
- the targeted Locator launcher command used during the invocation (run) of
LocatorLauncher.getCommand()
,
LocatorLauncher.Command
public Boolean getDebug()
setDebug(Boolean)
public LocatorLauncher.Builder setDebug(Boolean debug)
debug
- a boolean value indicating whether debug mode is to be enabled or disabled.getDebug()
public Boolean getDeletePidFileOnStop()
setDeletePidFileOnStop(Boolean)
public LocatorLauncher.Builder setDeletePidFileOnStop(Boolean deletePidFileOnStop)
deletePidFileOnStop
- a boolean value indicating if the pid file should be deleted when
this service stops or when the JVM exits.getDeletePidFileOnStop()
public Properties getDistributedSystemProperties()
Properties
public Boolean getForce()
setForce(Boolean)
public LocatorLauncher.Builder setForce(Boolean force)
force
- a boolean value indicating whether to overwrite the PID file when it already
exists.getForce()
public Boolean getHelp()
setHelp(Boolean)
public LocatorLauncher.Builder setHelp(Boolean help)
help
- a boolean indicating whether help information is to be displayed during
invocation of LocatorLauncher.getHelp()
public InetAddress getBindAddress()
setBindAddress(String)
,
InetAddress
public LocatorLauncher.Builder setBindAddress(String addressString)
addressString
- the InetAddress with the IP address or hostname on which the Locator is
bound and listening.IllegalArgumentException
- wrapping the UnknownHostException if the IP address or
hostname for the bind address is unknown.getBindAddress()
,
InetAddress
public String getHostnameForClients()
setHostnameForClients(String)
public LocatorLauncher.Builder setHostnameForClients(String hostnameForClients)
hostnameForClients
- a String indicating the hostname Locator binding used in client
lookups.IllegalArgumentException
- if the hostname was not specified (is blank or empty), such
as when the --hostname-for-clients command-line option may have been specified
without any argument.getHostnameForClients()
public String getMemberName()
setMemberName(String)
public LocatorLauncher.Builder setMemberName(String memberName)
memberName
- a String indicating the member name of this Locator in Geode.IllegalArgumentException
- if the member name is invalid.getMemberName()
public Integer getPid()
setPid(Integer)
public LocatorLauncher.Builder setPid(Integer pid)
pid
- a user specified Integer value indicating the process ID of the running Locator.IllegalArgumentException
- if the process ID (PID) is not valid (greater than zero if
not null).getPid()
public Integer getPort()
setPort(Integer)
public LocatorLauncher.Builder setPort(Integer port)
port
- an Integer value indicating the port used by the Locator to listen for client
requests.IllegalArgumentException
- if the port number is not valid.getPort()
public Boolean getRedirectOutput()
setRedirectOutput(Boolean)
public LocatorLauncher.Builder setRedirectOutput(Boolean redirectOutput)
redirectOutput
- a boolean value indicating if output will be redirected to system logs
when starting a Locator.getRedirectOutput()
public String getWorkingDirectory()
setWorkingDirectory(String)
public LocatorLauncher.Builder setWorkingDirectory(String workingDirectory)
workingDirectory
- a String indicating the pathname of the directory in which the
Locator will be ran.IllegalArgumentException
- wrapping a FileNotFoundException if the working directory
pathname cannot be found.getWorkingDirectory()
,
FileNotFoundException
public LocatorLauncher.Builder set(String propertyName, String propertyValue)
propertyName
- a String indicating the name of the Geode Distributed System property
as described in ConfigurationProperties
propertyValue
- a String value for the Geode Distributed System property.public LocatorLauncher.Builder set(Properties properties)
properties
- a property object that holds one or more Geode Distributed System
properties as described in ConfigurationProperties
protected void validate()
IllegalStateException
- if the Builder is not properly configured.protected void validateOnStart()
LocatorLauncher.Command.START
protected void validateOnStatus()
LocatorLauncher.Command.STATUS
protected void validateOnStop()
LocatorLauncher.Command.STOP
public LocatorLauncher build()
validate()
,
LocatorLauncher