| | |
| | | import static org.opends.messages.ToolMessages.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static com.forgerock.opendj.cli.Utils.*; |
| | | import static com.forgerock.opendj.cli.CommonArguments.*; |
| | | import static com.forgerock.opendj.cli.Utils.*; |
| | | |
| | | import java.io.OutputStream; |
| | | import java.io.PrintStream; |
| | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageDescriptor.Arg1; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.server.config.server.BackendCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.Backend.BackendOperation; |
| | |
| | | import org.opends.server.protocols.ldap.LDAPAttribute; |
| | | import org.opends.server.tasks.RebuildTask; |
| | | import org.opends.server.tools.tasks.TaskTool; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.NullOutputStream; |
| | | import org.opends.server.types.RawAttribute; |
| | |
| | | { |
| | | if (initializeServer) |
| | | { |
| | | final int init = initializeServer(out, err); |
| | | final int init = initializeServer(err); |
| | | if (init != 0) |
| | | { |
| | | return init; |
| | |
| | | /** |
| | | * Initializes the directory server. |
| | | * |
| | | * @param out |
| | | * The output stream to use for standard output, or {@code null} if |
| | | * standard output is not needed. |
| | | * @param err |
| | | * The output stream to use for standard error, or {@code null} if |
| | | * standard error is not needed. |
| | | * @return The result code. |
| | | */ |
| | | private int initializeServer(final PrintStream out, final PrintStream err) |
| | | private int initializeServer(final PrintStream err) |
| | | { |
| | | try |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | private String toErrorMsg(Arg1<Object> errorMsg, Exception ex) |
| | | { |
| | | final LocalizableMessage message = getErrorMsg(ex, errorMsg); |
| | | return wrapText(message, MAX_LINE_WIDTH); |
| | | } |
| | | |
| | | private LocalizableMessage getErrorMsg(Exception ex, Arg1<Object> errorMsg) |
| | | { |
| | | if (ex instanceof ConfigException || ex instanceof InitializationException) |
| | | { |
| | | return errorMsg.get(ex.getMessage()); |
| | | } |
| | | return errorMsg.get(getExceptionMessage(ex)); |
| | | } |
| | | |
| | | /** |
| | | * Initializes and sets the rebuild index configuration. |
| | | * |
| | |
| | | */ |
| | | private Backend<?> retrieveBackend(final DN selectedDN) throws ConfigException, Exception |
| | | { |
| | | final ArrayList<Backend> backendList = new ArrayList<>(); |
| | | final ArrayList<BackendCfg> entryList = new ArrayList<>(); |
| | | final ArrayList<List<DN>> dnList = new ArrayList<>(); |
| | | final List<Backend<?>> backendList = new ArrayList<>(); |
| | | final List<BackendCfg> entryList = new ArrayList<>(); |
| | | final List<List<DN>> dnList = new ArrayList<>(); |
| | | BackendToolUtils.getBackends(backendList, entryList, dnList); |
| | | |
| | | Backend<?> backend = null; |
| | |
| | | |
| | | if (initializeServer) |
| | | { |
| | | final int init = initializeServer(out, out); |
| | | final int init = initializeServer(out); |
| | | if (init != 0) |
| | | { |
| | | return init; |