Package org.opends.server.tools
Class ImportLdif
- java.lang.Object
-
- com.forgerock.opendj.cli.Tool
-
- org.opends.server.tools.ImportLdif
-
- All Implemented Interfaces:
Closeable,AutoCloseable,TaskCommand
public final class ImportLdif extends com.forgerock.opendj.cli.Tool implements TaskCommand
This program provides a utility that may be used to import the contents of an LDIF file into a Directory Server backend. This will be a process that is intended to run separate from Directory Server and not internally within the server process (e.g., via the tasks interface).
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTaskAttributes(Entry taskEntry)Adds attributes to the task entry before it is sent to the server.booleancanInitializeClient()Indicates whether to initialize a Directory Server client when running online.Class<? extends Task>getTaskClass()Returns the task class.StringgetTaskObjectClass()Returns the task's object class.static voidimportLdifEmbeddedOffline(com.forgerock.opendj.cli.ArgumentsBuilder arguments, PrintStream outStream, PrintStream errStream)This method is used for running the import-ldif tool programmatically against an offline server.booleanisQuiet()Indicates whether the user has requested quiet output.static voidmain(String[] args)The main method forImportLdiftool.static com.forgerock.opendj.cli.ReturnCodemainImportLdif(String[] args, ServerContext serverContext, PrintStream outStream, PrintStream errStream)Processes the command-line arguments and invokes the import process.com.forgerock.opendj.cli.ReturnCodeprocessLocal()Runs the command in offline mode.com.forgerock.opendj.cli.ReturnCoderun(String... args)Run thisTooltool with the provided arguments.-
Methods inherited from class com.forgerock.opendj.cli.Tool
askPort, close, confirmAction, enableConsoleLoggingIfVerbose, errPrintln, errPrintln, errPrintln, errPrintlnSurroundedByBlankLines, errPrintVerboseMessage, flush, flushLogStream, getErrorStream, getErrStream, getInputStream, getOutputStream, isFullyInteractive, isScriptFriendly, isVerbose, logVerboseMessage, mayPrompt, parseArguments, pressReturnToContinue, print, println, println, println, printlnNoWrap, printlnSurroundedByBlankLines, printNoWrap, readInput, readInput, readInputAllowEmpty, readLineOfInput, readPassword, readValidatedInput, readValidatedInputOrThrow, report
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opends.server.tools.TaskCommand
validateArguments
-
-
-
-
Method Detail
-
main
public static void main(String[] args)
The main method forImportLdiftool.- Parameters:
args- The command-line arguments provided to this program.
-
mainImportLdif
public static com.forgerock.opendj.cli.ReturnCode mainImportLdif(String[] args, ServerContext serverContext, PrintStream outStream, PrintStream errStream)
Processes the command-line arguments and invokes the import process.- Parameters:
args- The command-line arguments provided to this program.serverContext- The server context, ornullif the tool should initialize the server context itself.outStream- The output stream to use for standard output, ornullif standard output is not needed.errStream- The output stream to use for standard error, ornullif standard error is not needed.- Returns:
- The return code.
-
importLdifEmbeddedOffline
public static void importLdifEmbeddedOffline(com.forgerock.opendj.cli.ArgumentsBuilder arguments, PrintStream outStream, PrintStream errStream) throws com.forgerock.opendj.cli.ClientExceptionThis method is used for running the import-ldif tool programmatically against an offline server.The --offline and --noPropertyFile arguments are automatically added to the tool arguments.
Import offline implies that theDirectoryServerwill be initialized.
No modification will be performed to the running JVM JDK logging configuration.- Parameters:
arguments- The command-line arguments provided to this programoutStream- The output stream to use for standard output, ornullif standard output is not needederrStream- The output stream to use for standard error, ornullif standard error is not needed- Throws:
com.forgerock.opendj.cli.ClientException- If an error occurs during the tool execution or if the tool has returned an error
-
isQuiet
public boolean isQuiet()
Description copied from class:com.forgerock.opendj.cli.ToolIndicates whether the user has requested quiet output. The default implementation returnsfalse.- Overrides:
isQuietin classcom.forgerock.opendj.cli.Tool- Returns:
trueif the user has requested quiet output.
-
run
public com.forgerock.opendj.cli.ReturnCode run(String... args) throws com.forgerock.opendj.cli.ClientException
Description copied from class:com.forgerock.opendj.cli.ToolRun thisTooltool with the provided arguments. Output and errors will be written on the provided streams.This method can be used to run the tool programmatically.
- Overrides:
runin classcom.forgerock.opendj.cli.Tool- Parameters:
args- Arguments set to pass to the tool.- Returns:
0if all processing completed successfully, or non-zero if an error occurred.- Throws:
com.forgerock.opendj.cli.ClientException- If an error occurs while running the tool.
-
addTaskAttributes
public void addTaskAttributes(Entry taskEntry)
Description copied from interface:TaskCommandAdds attributes to the task entry before it is sent to the server.- Specified by:
addTaskAttributesin interfaceTaskCommand- Parameters:
taskEntry- the task entry.
-
canInitializeClient
public boolean canInitializeClient()
Description copied from interface:TaskCommandIndicates whether to initialize a Directory Server client when running online. This method should only returnfalsewhen running tests while a client has already been initialized.- Specified by:
canInitializeClientin interfaceTaskCommand- Returns:
- whether to initialize a Directory Server client when running online.
-
getTaskClass
public Class<? extends Task> getTaskClass()
Description copied from interface:TaskCommandReturns the task class.- Specified by:
getTaskClassin interfaceTaskCommand- Returns:
- the task class.
-
getTaskObjectClass
public String getTaskObjectClass()
Description copied from interface:TaskCommandReturns the task's object class.- Specified by:
getTaskObjectClassin interfaceTaskCommand- Returns:
- the task's object class
-
processLocal
public com.forgerock.opendj.cli.ReturnCode processLocal() throws com.forgerock.opendj.cli.ClientExceptionDescription copied from interface:TaskCommandRuns the command in offline mode.- Specified by:
processLocalin interfaceTaskCommand- Returns:
- the return code.
- Throws:
com.forgerock.opendj.cli.ClientException- If an error occurs.
-
-