001/* 002 * The contents of this file are subject to the terms of the Common Development and 003 * Distribution License (the License). You may not use this file except in compliance with the 004 * License. 005 * 006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the 007 * specific language governing permission and limitations under the License. 008 * 009 * When distributing Covered Software, include this CDDL Header Notice in each file and include 010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL 011 * Header, with the fields enclosed by brackets [] replaced by your own identifying 012 * information: "Portions Copyright [year] [name of copyright owner]". 013 * 014 * Copyright 2008 Sun Microsystems, Inc. 015 * Portions Copyright 2014-2016 ForgeRock AS. 016 */ 017package org.opends.server.schema; 018 019import java.util.Collection; 020import java.util.Collections; 021 022import org.forgerock.opendj.config.server.ConfigException; 023import org.forgerock.opendj.ldap.schema.CoreSchema; 024import org.forgerock.opendj.ldap.schema.SchemaBuilder; 025import org.forgerock.opendj.server.config.server.MatchingRuleCfg; 026import org.opends.server.api.MatchingRuleFactory; 027import org.opends.server.types.InitializationException; 028 029import static org.opends.server.schema.SchemaConstants.*; 030 031/** 032 * This class is a factory class for {@link AuthPasswordEqualityMatchingRule}. 033 */ 034public final class AuthPasswordEqualityMatchingRuleFactory 035 extends MatchingRuleFactory<MatchingRuleCfg> 036{ 037 private org.forgerock.opendj.ldap.schema.MatchingRule matchingRule; 038 039 /** {@inheritDoc} */ 040 @Override 041 public final void initializeMatchingRule(MatchingRuleCfg configuration) 042 throws ConfigException, InitializationException 043 { 044 matchingRule = new SchemaBuilder(CoreSchema.getInstance()).buildMatchingRule(EMR_AUTH_PASSWORD_OID) 045 .names(EMR_AUTH_PASSWORD_NAME) 046 .syntaxOID(SYNTAX_AUTH_PASSWORD_OID).description(EMR_AUTH_PASSWORD_DESCRIPTION) 047 .implementation(new AuthPasswordEqualityMatchingRule()) 048 .addToSchema().toSchema().getMatchingRule(EMR_AUTH_PASSWORD_OID); 049 } 050 051 /** {@inheritDoc} */ 052 @Override 053 public final Collection<org.forgerock.opendj.ldap.schema.MatchingRule> getMatchingRules() 054 { 055 return Collections.singleton(matchingRule); 056 } 057}