public class TemplateFile extends Object
Constructor and Description |
---|
TemplateFile(String resourcePath,
Random random)
Creates a new, empty template file structure.
|
Modifier and Type | Method and Description |
---|---|
TagResult |
generateLDIF(EntryWriter entryWriter)
Generates the LDIF content and writes it to the provided LDIF writer.
|
Map<org.forgerock.opendj.ldap.Dn,Branch> |
getBranches()
Retrieves the set of branches defined in this template file.
|
Map<String,String> |
getConstants()
Retrieves the set of constants defined for this template file.
|
File |
getFile(String path)
Retrieves a File object based on the provided path.
|
String[] |
getFileLines(File file)
Retrieves the lines of the specified file as a string array.
|
String |
getFirstName()
Retrieves the first name value that should be used for the current entry.
|
String |
getLastName()
Retrieves the last name value that should be used for the current entry.
|
Random |
getRandom()
Retrieves the random number generator for this template file.
|
Map<String,Tag> |
getTags()
Retrieves the set of tags that have been registered.
|
Map<String,Template> |
getTemplates()
Retrieves the set of templates defined in this template file.
|
void |
nextFirstAndLastNames()
Updates the first and last name indexes to choose new values.
|
void |
parse(String[] lines,
List<LocalizableMessage> warnings)
Parses the provided data as a MakeLDIF template file definition.
|
void |
parse(String filename,
List<LocalizableMessage> warnings)
Parses the contents of the specified file as a MakeLDIF template file
definition.
|
public TemplateFile(String resourcePath, Random random)
resourcePath
- The path to the directory that may contain additional
resource files needed during the LDIF generation
process.random
- The random number generator for this template file.public Map<String,Tag> getTags()
public Map<String,String> getConstants()
public Map<org.forgerock.opendj.ldap.Dn,Branch> getBranches()
public Map<String,Template> getTemplates()
public Random getRandom()
public void nextFirstAndLastNames()
public String getFirstName()
public String getLastName()
public void parse(String filename, List<LocalizableMessage> warnings) throws IOException, InitializationException, MakeLDIFException
filename
- The name of the file containing the template data.warnings
- A list into which any warnings identified may be placed.IOException
- If a problem occurs while attempting to read data
from the specified file.InitializationException
- If a problem occurs while initializing
any of the MakeLDIF components.MakeLDIFException
- If any other problem occurs while parsing the
template file.public void parse(String[] lines, List<LocalizableMessage> warnings) throws InitializationException, MakeLDIFException
lines
- The lines that make up the template file.warnings
- A list into which any warnings identified may be placed.InitializationException
- If a problem occurs while initializing
any of the MakeLDIF components.MakeLDIFException
- If any other problem occurs while parsing the
template file.public File getFile(String path)
path
- The path provided for the file.null
if
the specified file could not be found.public String[] getFileLines(File file) throws IOException
file
- The file for which to retrieve the contents.IOException
- If a problem occurs while reading the file.public TagResult generateLDIF(EntryWriter entryWriter) throws IOException, MakeLDIFException
entryWriter
- The entry writer that should be used to write the
entries.IOException
- If an error occurs while writing to the LDIF file.MakeLDIFException
- If some other problem occurs.Copyright © 2010-2017 ForgeRock AS. All Rights Reserved.