| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldif; |
| | | |
| | |
| | | */ |
| | | public final class EntryGenerator implements EntryReader { |
| | | |
| | | private static final int DEFAULT_RANDOM_SEED = 1; |
| | | |
| | | /** Template file that contains directives for generation of entries. */ |
| | | private TemplateFile templateFile; |
| | | |
| | |
| | | private boolean isInitialized; |
| | | |
| | | /** Random seed is used to generate random data. */ |
| | | private int randomSeed = DEFAULT_RANDOM_SEED; |
| | | private Random random = new Random(); |
| | | |
| | | /** |
| | | * Path to the directory that may contain additional resource files needed |
| | |
| | | * @return A reference to this {@code EntryGenerator}. |
| | | */ |
| | | public EntryGenerator setRandomSeed(final int seed) { |
| | | randomSeed = seed; |
| | | random = new Random(seed); |
| | | return this; |
| | | } |
| | | |
| | |
| | | if (schema == null) { |
| | | schema = Schema.getDefaultSchema(); |
| | | } |
| | | templateFile = new TemplateFile(schema, constants, resourcePath, new Random(randomSeed), generateBranches); |
| | | templateFile = new TemplateFile(schema, constants, resourcePath, random, generateBranches); |
| | | try { |
| | | if (templatePath != null) { |
| | | templateFile.parse(templatePath, warnings); |