|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opends.server.util.args.Argument
org.opends.server.util.args.FileBasedArgument
public class FileBasedArgument
This class defines an argument whose value will be read from a file rather
than actually specified on the command-line. When a value is specified on
the command line, it will be treated as the path to the file containing the
actual value rather than the value itself.
Note that if if no filename is provided on the command line but a default
value is specified programatically or if the default value is read from a
specified property, then that default value will be taken as the actual value
rather than a filename.
Also note that this argument type assumes that the entire value for the
argument is on a single line in the specified file. If the file contains
multiple lines, then only the first line will be read.
Constructor Summary | |
---|---|
FileBasedArgument(java.lang.String name,
java.lang.Character shortIdentifier,
java.lang.String longIdentifier,
boolean isRequired,
boolean isMultiValued,
Message valuePlaceholder,
java.lang.String defaultValue,
java.lang.String propertyName,
Message description)
Creates a new file-based argument with the provided information. |
|
FileBasedArgument(java.lang.String name,
java.lang.Character shortIdentifier,
java.lang.String longIdentifier,
boolean isRequired,
Message valuePlaceholder,
Message description)
Creates a new file-based argument with the provided information. |
Method Summary | |
---|---|
void |
addValue(java.lang.String valueString)
Adds a value to the set of values for this argument. |
java.util.LinkedHashMap<java.lang.String,java.lang.String> |
getNameToValueMap()
Retrieves a map between the filenames specified on the command line and the first lines read from those files. |
boolean |
valueIsAcceptable(java.lang.String valueString,
MessageBuilder invalidReason)
Indicates whether the provided value is acceptable for use in this argument. |
Methods inherited from class org.opends.server.util.args.Argument |
---|
clearValues, getBooleanValue, getDefaultValue, getDescription, getIntValue, getIntValues, getLongIdentifier, getName, getPropertyName, getShortIdentifier, getValue, getValuePlaceholder, getValues, hasValue, isHidden, isMultiValued, isPresent, isRequired, isValueSetByProperty, needsValue, setDefaultValue, setHidden, setMultiValued, setNeedsValue, setPresent, setPropertyName, setRequired, setValuePlaceholder, setValueSetByProperty |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileBasedArgument(java.lang.String name, java.lang.Character shortIdentifier, java.lang.String longIdentifier, boolean isRequired, Message valuePlaceholder, Message description) throws ArgumentException
name
- The generic name that should be used to refer to
this argument.shortIdentifier
- The single-character identifier for this
argument, or null
if there is none.longIdentifier
- The long identifier for this argument, or
null
if there is none.isRequired
- Indicates whether this argument must be specified
on the command line.valuePlaceholder
- The placeholder for the argument value that will
be displayed in usage information, or
null
if this argument does not
require a value.description
- Message for the description of this
argument.
ArgumentException
- If there is a problem with any of the
parameters used to create this argument.public FileBasedArgument(java.lang.String name, java.lang.Character shortIdentifier, java.lang.String longIdentifier, boolean isRequired, boolean isMultiValued, Message valuePlaceholder, java.lang.String defaultValue, java.lang.String propertyName, Message description) throws ArgumentException
name
- The generic name that should be used to refer to
this argument.shortIdentifier
- The single-character identifier for this
argument, or null
if there is none.longIdentifier
- The long identifier for this argument, or
null
if there is none.isRequired
- Indicates whether this argument must be specified
on the command line.isMultiValued
- Indicates whether this argument may be specified
more than once to provide multiple values.valuePlaceholder
- The placeholder for the argument value that will
be displayed in usage information, or
null
if this argument does not
require a value.defaultValue
- The default value that should be used for this
argument if none is provided in a properties file
or on the command line. This may be
null
if there is no generic default.propertyName
- The name of the property in a property file that
may be used to override the default value but
will be overridden by a command-line argument.description
- Message for the description of this
argument.
ArgumentException
- If there is a problem with any of the
parameters used to create this argument.Method Detail |
---|
public java.util.LinkedHashMap<java.lang.String,java.lang.String> getNameToValueMap()
public boolean valueIsAcceptable(java.lang.String valueString, MessageBuilder invalidReason)
valueIsAcceptable
in class Argument
valueString
- The value for which to make the determination.invalidReason
- A buffer into which the invalid reason may be
written if the value is not acceptable.
true
if the value is acceptable, or
false
if it is not.public void addValue(java.lang.String valueString)
valueIsAcceptable
method. Note that in this case, correct behavior depends on a previous
successful call to valueIsAcceptable
so that the value read
from the file may be stored in the name-to-value hash and used in place of
the filename here.
addValue
in class Argument
valueString
- The string representation of the value to add to this
argument.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |