Package org.opends.server.tools.makeldif
Class Branch
- java.lang.Object
-
- org.opends.server.tools.makeldif.Branch
-
public class Branch extends Object
This class defines a branch that should be included in the resulting LDIF. A branch may or may not have subordinate entries.
-
-
Constructor Summary
Constructors Constructor Description Branch(TemplateFile templateFile, DN branchDN)Creates a new branch with the provided information.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddExtraLine(TemplateLine line)Adds the provided template line to the set of extra lines for this branch.voidaddSubordinateTemplate(String name, int numEntries)Adds a new subordinate template to this branch.voidcompleteBranchInitialization(Map<String,Template> templates)Performs any necessary processing to ensure that the branch initialization is completed.DNgetBranchDN()Retrieves the DN for this branch entry.TemplateLine[]getExtraLines()Retrieves the set of extra lines that should be included in this branch entry.int[]getNumEntriesPerTemplate()Retrieves the number of entries that should be created below this branch for each subordinate template.String[]getSubordinateTemplateNames()Retrieves the names of the subordinate templates for this branch.Template[]getSubordinateTemplates()Retrieves the set of subordinate templates used to generate entries below this branch.booleanhasAttribute(AttributeType attributeType)Indicates whether this branch contains a reference to the specified attribute type, either in the RDN components of the DN or in the extra lines.TagResultwriteEntries(EntryWriter entryWriter)Writes the entry for this branch, as well as all appropriate subordinate entries.
-
-
-
Constructor Detail
-
Branch
public Branch(TemplateFile templateFile, DN branchDN)
Creates a new branch with the provided information.- Parameters:
templateFile- The template file in which this branch appears.branchDN- The DN for this branch entry.
-
-
Method Detail
-
completeBranchInitialization
public void completeBranchInitialization(Map<String,Template> templates) throws MakeLDIFException
Performs any necessary processing to ensure that the branch initialization is completed. In particular, it should make sure that all referenced subordinate templates actually exist in the template file.- Parameters:
templates- The set of templates defined in the template file.- Throws:
MakeLDIFException- If any of the subordinate templates are not defined in the template file.
-
getBranchDN
public DN getBranchDN()
Retrieves the DN for this branch entry.- Returns:
- The DN for this branch entry.
-
getSubordinateTemplateNames
public String[] getSubordinateTemplateNames()
Retrieves the names of the subordinate templates for this branch.- Returns:
- The names of the subordinate templates for this branch.
-
getSubordinateTemplates
public Template[] getSubordinateTemplates()
Retrieves the set of subordinate templates used to generate entries below this branch. Note that the subordinate templates will not be available until thecompleteBranchInitializationmethod has been called.- Returns:
- The set of subordinate templates used to generate entries below this branch.
-
getNumEntriesPerTemplate
public int[] getNumEntriesPerTemplate()
Retrieves the number of entries that should be created below this branch for each subordinate template.- Returns:
- The number of entries that should be created below this branch for each subordinate template.
-
addSubordinateTemplate
public void addSubordinateTemplate(String name, int numEntries)
Adds a new subordinate template to this branch. Note that this should not be used aftercompleteBranchInitializationhas been called.- Parameters:
name- The name of the template to use to generate the entries.numEntries- The number of entries to create based on the template.
-
getExtraLines
public TemplateLine[] getExtraLines()
Retrieves the set of extra lines that should be included in this branch entry.- Returns:
- The set of extra lines that should be included in this branch entry.
-
addExtraLine
public void addExtraLine(TemplateLine line)
Adds the provided template line to the set of extra lines for this branch.- Parameters:
line- The line to add to the set of extra lines for this branch.
-
hasAttribute
public boolean hasAttribute(AttributeType attributeType)
Indicates whether this branch contains a reference to the specified attribute type, either in the RDN components of the DN or in the extra lines.- Parameters:
attributeType- The attribute type for which to make the determination.- Returns:
trueif the branch does contain the specified attribute type, orfalseif it does not.
-
writeEntries
public TagResult writeEntries(EntryWriter entryWriter) throws IOException, MakeLDIFException
Writes the entry for this branch, as well as all appropriate subordinate entries.- Parameters:
entryWriter- The entry writer to which the entries should be written.- Returns:
- The result that indicates whether processing should continue.
- Throws:
IOException- If a problem occurs while attempting to write to the LDIF writer.MakeLDIFException- If some other problem occurs.
-
-