Search in sources :

Example 6 with LDIFReader

use of com.unboundid.ldif.LDIFReader in project oxCore by GluuFederation.

the class LdifDataUtility method importLdifFileContent.

/**
	 * Performs ldif file conent import
	 * 
	 * @param connection
	 *            Connection to LDAP server
	 * @param ldifFileContent
	 *            LDIF file
	 * @return The result code for the processing that was performed
	 */
public ResultCode importLdifFileContent(LDAPConnection connection, String ldifFileContent) {
    BufferedReader is = null;
    LDIFReader ldifReader = null;
    try {
        is = new BufferedReader(new StringReader(ldifFileContent));
        ldifReader = new LDIFReader(is);
        return importLdifFile(connection, ldifReader);
    } finally {
        IOUtils.closeQuietly(is);
        if (ldifReader != null) {
            disposeLdifReader(ldifReader);
        }
    }
}
Also used : LDIFReader(com.unboundid.ldif.LDIFReader) BufferedReader(java.io.BufferedReader) StringReader(java.io.StringReader)

Aggregations

LDIFReader (com.unboundid.ldif.LDIFReader)6 IOException (java.io.IOException)5 LDAPException (com.unboundid.ldap.sdk.LDAPException)3 ResultCode (com.unboundid.ldap.sdk.ResultCode)2 File (java.io.File)2 LdifDataUtility (org.gluu.site.ldap.persistence.LdifDataUtility)2 LdapMappingException (org.gluu.site.ldap.persistence.exception.LdapMappingException)2 GitblitAuthority (com.gitblit.authority.GitblitAuthority)1 NewCertificateConfig (com.gitblit.authority.NewCertificateConfig)1 GitblitContext (com.gitblit.servlet.GitblitContext)1 X509Log (com.gitblit.utils.X509Utils.X509Log)1 X509Metadata (com.gitblit.utils.X509Utils.X509Metadata)1 InMemoryDirectoryServer (com.unboundid.ldap.listener.InMemoryDirectoryServer)1 InMemoryDirectoryServerConfig (com.unboundid.ldap.listener.InMemoryDirectoryServerConfig)1 Entry (com.unboundid.ldap.sdk.Entry)1 LDAPConnection (com.unboundid.ldap.sdk.LDAPConnection)1 SearchResult (com.unboundid.ldap.sdk.SearchResult)1 SearchResultEntry (com.unboundid.ldap.sdk.SearchResultEntry)1 LDIFException (com.unboundid.ldif.LDIFException)1 BufferedReader (java.io.BufferedReader)1