Class EmbeddedOpenDJ
- java.lang.Object
-
- org.openidentityplatform.opendj.embedded.EmbeddedOpenDJ
-
-
Constructor Summary
Constructors Constructor Description EmbeddedOpenDJ()EmbeddedOpenDJ(Config config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Stops this instance, if it is still running, and deletes its temporary directory.voidgetData(String baseDN, OutputStream out)Writes the entries below the given base DN to the given stream, as LDIF.FilegetServerRootDirectory()Returns the server root directory of this embedded instance.voidimportData(InputStream inputStream)Imports the LDIF read from the given stream.booleanisRunning()voidrun()
-
-
-
Constructor Detail
-
EmbeddedOpenDJ
public EmbeddedOpenDJ()
-
EmbeddedOpenDJ
public EmbeddedOpenDJ(Config config)
-
-
Method Detail
-
getServerRootDirectory
public File getServerRootDirectory()
Returns the server root directory of this embedded instance.- Returns:
- the server root directory
- Throws:
IllegalStateException- If this instance has been closed, and the directory therefore deleted.
-
close
public void close()
Stops this instance, if it is still running, and deletes its temporary directory.This method is idempotent: it is also registered as a JVM shutdown hook.
When the server cannot be stopped, this instance stays open and keeps its shutdown hook registered, so that a later call - or the hook at JVM exit - retries the stop.
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
importData
public void importData(InputStream inputStream) throws EmbeddedDirectoryServerException, IOException
Imports the LDIF read from the given stream.The stream is closed by this method, whether the import succeeds or not.
- Parameters:
inputStream- the LDIF to import- Throws:
IllegalStateException- If this instance has been closed.EmbeddedDirectoryServerExceptionIOException
-
getData
public void getData(String baseDN, OutputStream out) throws IOException, EmbeddedDirectoryServerException
Writes the entries below the given base DN to the given stream, as LDIF.The stream is flushed and closed by this method, whether the export succeeds or not.
- Parameters:
baseDN- the base DN of the subtree to exportout- where the LDIF is written- Throws:
IllegalStateException- If this instance has been closed.IOExceptionEmbeddedDirectoryServerException
-
isRunning
public boolean isRunning()
-
-