Java Code Examples for org.apache.directory.api.ldap.model.constants.SchemaConstants#NORMALIZERS_PATH

The following examples show how to use org.apache.directory.api.ldap.model.constants.SchemaConstants#NORMALIZERS_PATH . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JarLdifSchemaLoader.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public List<Entry> loadNormalizers( Schema... schemas ) throws LdapException, IOException
{
    List<Entry> normalizerList = new ArrayList<>();

    if ( schemas == null )
    {
        return normalizerList;
    }

    for ( Schema schema : schemas )
    {
        String start = getSchemaDirectoryString( schema )
            + SchemaConstants.NORMALIZERS_PATH + "/" + "m-oid=";
        String end = "." + LDIF_EXT;

        for ( String resourcePath : RESOURCE_MAP.keySet() )
        {
            if ( resourcePath.startsWith( start ) && resourcePath.endsWith( end ) )
            {
                URL resource = getResource( resourcePath, "normalizer LDIF file" );
                LdifReader reader = new LdifReader( resource.openStream() );
                LdifEntry entry = reader.next();
                reader.close();

                normalizerList.add( entry.getEntry() );
            }
        }
    }

    return normalizerList;
}
 
Example 2
Source File: LdifSchemaLoader.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public List<Entry> loadNormalizers( Schema... schemas ) throws LdapException, IOException
{
    List<Entry> normalizerList = new ArrayList<>();

    if ( schemas == null )
    {
        return normalizerList;
    }

    for ( Schema schema : schemas )
    {
        File normalizersDirectory = new File( getSchemaDirectory( schema ), SchemaConstants.NORMALIZERS_PATH );

        if ( !normalizersDirectory.exists() )
        {
            return normalizerList;
        }

        File[] normalizerFiles = normalizersDirectory.listFiles( ldifFilter );

        if ( normalizerFiles != null )
        {
            for ( File ldifFile : normalizerFiles )
            {
                LdifReader reader = new LdifReader( ldifFile );
                LdifEntry entry = reader.next();
                reader.close();

                normalizerList.add( entry.getEntry() );
            }
        }
    }

    return normalizerList;
}