|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opends.server.tools.makeldif.TemplateFile
public class TemplateFile
This class defines a template file, which is a collection of constant definitions, branches, and templates.
| Field Summary | |
|---|---|
static java.lang.String |
FIRST_NAME_FILE
The name of the file holding the list of first names. |
static java.lang.String |
LAST_NAME_FILE
The name of the file holding the list of last names. |
| Constructor Summary | |
|---|---|
TemplateFile(java.lang.String resourcePath)
Creates a new, empty template file structure. |
|
TemplateFile(java.lang.String resourcePath,
java.util.Random random)
Creates a new, empty template file structure. |
|
| Method Summary | |
|---|---|
TagResult |
generateLDIF(EntryWriter entryWriter)
Generates the LDIF content and writes it to the provided LDIF writer. |
Branch |
getBranch(DN branchDN)
Retrieves the branch registered with the specified DN. |
java.util.Map<DN,Branch> |
getBranches()
Retrieves the set of branches defined in this template file. |
java.lang.String |
getConstant(java.lang.String lowerName)
Retrieves the value of the constant with the specified name. |
java.util.Map<java.lang.String,java.lang.String> |
getConstants()
Retrieves the set of constants defined for this template file. |
java.io.File |
getFile(java.lang.String path)
Retrieves a File object based on the provided path. |
java.lang.String[] |
getFileLines(java.io.File file)
Retrieves the lines of the specified file as a string array. |
java.lang.String |
getFirstName()
Retrieves the first name value that should be used for the current entry. |
java.lang.String |
getLastName()
Retrieves the last name value that should be used for the current entry. |
java.util.Random |
getRandom()
Retrieves the random number generator for this template file. |
Tag |
getTag(java.lang.String lowerName)
Retrieves the tag with the specified name. |
java.util.Map<java.lang.String,Tag> |
getTags()
Retrieves the set of tags that have been registered. |
Template |
getTemplate(java.lang.String lowerName)
Retrieves the template with the specified name. |
java.util.Map<java.lang.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(java.io.InputStream inputStream,
java.util.List<Message> warnings)
Parses the data read from the provided input stream as a MakeLDIF template file definition. |
void |
parse(java.lang.String[] lines,
java.util.List<Message> warnings)
Parses the provided data as a MakeLDIF template file definition. |
void |
parse(java.lang.String filename,
java.util.List<Message> warnings)
Parses the contents of the specified file as a MakeLDIF template file definition. |
void |
registerBranch(Branch branch)
Registers the provided branch in this template file. |
void |
registerConstant(java.lang.String name,
java.lang.String value)
Registers the provided constant for use in the template. |
void |
registerTag(java.lang.String tagClass)
Registers the specified class as a tag that may be used in templates. |
void |
registerTemplate(Template template)
Registers the provided template for use in this template file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String FIRST_NAME_FILE
public static final java.lang.String LAST_NAME_FILE
| Constructor Detail |
|---|
public TemplateFile(java.lang.String resourcePath)
resourcePath - The path to the directory that may contain additional
resource files needed during the LDIF generation
process.
public TemplateFile(java.lang.String resourcePath,
java.util.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.| Method Detail |
|---|
public java.util.Map<java.lang.String,Tag> getTags()
public Tag getTag(java.lang.String lowerName)
lowerName - The name of the tag to retrieve, in all lowercase
characters.
null if no such tag has been
registered.
public void registerTag(java.lang.String tagClass)
throws MakeLDIFException
tagClass - The fully-qualified name of the class to register as a
tag.
MakeLDIFException - If a problem occurs while attempting to
register the specified tag.public java.util.Map<java.lang.String,java.lang.String> getConstants()
public java.lang.String getConstant(java.lang.String lowerName)
lowerName - The name of the constant to retrieve, in all lowercase
characters.
null if there is no such constant.
public void registerConstant(java.lang.String name,
java.lang.String value)
name - The name for the constant.value - The value for the constant.public java.util.Map<DN,Branch> getBranches()
public Branch getBranch(DN branchDN)
branchDN - The DN for which to retrieve the corresponding branch.
null if no such branch has
been registered.public void registerBranch(Branch branch)
branch - The branch to be registered.public java.util.Map<java.lang.String,Template> getTemplates()
public Template getTemplate(java.lang.String lowerName)
lowerName - The name of the template to retrieve, in all lowercase
characters.
null if there is no such
template.public void registerTemplate(Template template)
template - The template to be registered.public java.util.Random getRandom()
public void nextFirstAndLastNames()
public java.lang.String getFirstName()
public java.lang.String getLastName()
public void parse(java.lang.String filename,
java.util.List<Message> warnings)
throws java.io.IOException,
InitializationException,
MakeLDIFException
filename - The name of the file containing the template data.warnings - A list into which any warnings identified may be placed.
java.io.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(java.io.InputStream inputStream,
java.util.List<Message> warnings)
throws java.io.IOException,
InitializationException,
MakeLDIFException
inputStream - The input stream from which to read the template file
data.warnings - A list into which any warnings identified may be
placed.
java.io.IOException - If a problem occurs while attempting to read data
from the provided input stream.
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(java.lang.String[] lines,
java.util.List<Message> 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 java.io.File getFile(java.lang.String path)
path - The path provided for the file.
null if
the specified file could not be found.
public java.lang.String[] getFileLines(java.io.File file)
throws java.io.IOException
file - The file for which to retrieve the contents.
java.io.IOException - If a problem occurs while reading the file.
public TagResult generateLDIF(EntryWriter entryWriter)
throws java.io.IOException,
MakeLDIFException
entryWriter - The entry writer that should be used to write the
entries.
java.io.IOException - If an error occurs while writing to the LDIF file.
MakeLDIFException - If some other problem occurs.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||