org.opends.server.tools.makeldif
Class RandomTag

java.lang.Object
  extended by org.opends.server.tools.makeldif.Tag
      extended by org.opends.server.tools.makeldif.RandomTag

public class RandomTag
extends Tag

This class defines a tag that may be used to generate random values. It has a number of subtypes based on the type of information that should be generated, including:


Field Summary
static char[] ALPHA_CHARS
          The character set that will be used for alphabetic characters.
static char[] ALPHANUMERIC_CHARS
          The character set that will be used for alphanumeric characters.
static char[] BASE64_CHARS
          The character set that will be used for base64 characters.
static char[] HEX_CHARS
          The character set that will be used for hexadecimal characters.
static java.lang.String[] MONTHS
          The set of month names that will be used.
static char[] NUMERIC_CHARS
          The character set that will be used for numeric characters.
static int RANDOM_TYPE_CHARS_FIXED
          The value that indicates that the value is to be generated from a fixed number of characters from a given character set.
static int RANDOM_TYPE_CHARS_VARIABLE
          The value that indicates that the value is to be generated from a variable number of characters from a given character set.
static int RANDOM_TYPE_MONTH
          The value that indicates that the value should be a random month.
static int RANDOM_TYPE_NUMERIC
          The value that indicates that the value should be a random number.
static int RANDOM_TYPE_TELEPHONE
          The value that indicates that the value should be a telephone number.
 
Constructor Summary
RandomTag()
          Creates a new instance of this random tag.
 
Method Summary
 boolean allowedInBranch()
          Indicates whether this tag is allowed for use in the extra lines for branches.
 TagResult generateValue(TemplateEntry templateEntry, TemplateValue templateValue)
          Generates the content for this tag by appending it to the provided tag.
 java.lang.String getName()
          Retrieves the name for this tag.
 void initializeForBranch(TemplateFile templateFile, Branch branch, java.lang.String[] arguments, int lineNumber, java.util.List<Message> warnings)
          Performs any initialization for this tag that may be needed while parsing a branch definition.
 void initializeForTemplate(TemplateFile templateFile, Template template, java.lang.String[] arguments, int lineNumber, java.util.List<Message> warnings)
          Performs any initialization for this tag that may be needed while parsing a template definition.
 
Methods inherited from class org.opends.server.tools.makeldif.Tag
initializeForParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RANDOM_TYPE_CHARS_FIXED

public static final int RANDOM_TYPE_CHARS_FIXED
The value that indicates that the value is to be generated from a fixed number of characters from a given character set.

See Also:
Constant Field Values

RANDOM_TYPE_CHARS_VARIABLE

public static final int RANDOM_TYPE_CHARS_VARIABLE
The value that indicates that the value is to be generated from a variable number of characters from a given character set.

See Also:
Constant Field Values

RANDOM_TYPE_NUMERIC

public static final int RANDOM_TYPE_NUMERIC
The value that indicates that the value should be a random number.

See Also:
Constant Field Values

RANDOM_TYPE_MONTH

public static final int RANDOM_TYPE_MONTH
The value that indicates that the value should be a random month.

See Also:
Constant Field Values

RANDOM_TYPE_TELEPHONE

public static final int RANDOM_TYPE_TELEPHONE
The value that indicates that the value should be a telephone number.

See Also:
Constant Field Values

ALPHA_CHARS

public static final char[] ALPHA_CHARS
The character set that will be used for alphabetic characters.


NUMERIC_CHARS

public static final char[] NUMERIC_CHARS
The character set that will be used for numeric characters.


ALPHANUMERIC_CHARS

public static final char[] ALPHANUMERIC_CHARS
The character set that will be used for alphanumeric characters.


HEX_CHARS

public static final char[] HEX_CHARS
The character set that will be used for hexadecimal characters.


BASE64_CHARS

public static final char[] BASE64_CHARS
The character set that will be used for base64 characters.


MONTHS

public static final java.lang.String[] MONTHS
The set of month names that will be used.

Constructor Detail

RandomTag

public RandomTag()
Creates a new instance of this random tag.

Method Detail

getName

public java.lang.String getName()
Retrieves the name for this tag.

Specified by:
getName in class Tag
Returns:
The name for this tag.

allowedInBranch

public boolean allowedInBranch()
Indicates whether this tag is allowed for use in the extra lines for branches.

Specified by:
allowedInBranch in class Tag
Returns:
true if this tag may be used in branch definitions, or false if not.

initializeForBranch

public void initializeForBranch(TemplateFile templateFile,
                                Branch branch,
                                java.lang.String[] arguments,
                                int lineNumber,
                                java.util.List<Message> warnings)
                         throws InitializationException
Performs any initialization for this tag that may be needed while parsing a branch definition.

Overrides:
initializeForBranch in class Tag
Parameters:
templateFile - The template file in which this tag is used.
branch - The branch in which this tag is used.
arguments - The set of arguments provided for this tag.
lineNumber - The line number on which this tag appears in the template file.
warnings - A list into which any appropriate warning messages may be placed.
Throws:
InitializationException - If a problem occurs while initializing this tag.

initializeForTemplate

public void initializeForTemplate(TemplateFile templateFile,
                                  Template template,
                                  java.lang.String[] arguments,
                                  int lineNumber,
                                  java.util.List<Message> warnings)
                           throws InitializationException
Performs any initialization for this tag that may be needed while parsing a template definition.

Specified by:
initializeForTemplate in class Tag
Parameters:
templateFile - The template file in which this tag is used.
template - The template in which this tag is used.
arguments - The set of arguments provided for this tag.
lineNumber - The line number on which this tag appears in the template file.
warnings - A list into which any appropriate warning messages may be placed.
Throws:
InitializationException - If a problem occurs while initializing this tag.

generateValue

public TagResult generateValue(TemplateEntry templateEntry,
                               TemplateValue templateValue)
Generates the content for this tag by appending it to the provided tag.

Specified by:
generateValue in class Tag
Parameters:
templateEntry - The entry for which this tag is being generated.
templateValue - The template value to which the generated content should be appended.
Returns:
The result of generating content for this tag.