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-2015 ForgeRock AS. 016 */ 017package org.opends.server.replication.plugin; 018 019import java.util.Collection; 020import java.util.Collections; 021 022import org.opends.server.api.MatchingRuleFactory; 023import org.opends.server.admin.std.server.MatchingRuleCfg; 024import org.forgerock.opendj.config.server.ConfigException; 025import org.forgerock.opendj.ldap.schema.CoreSchema; 026import org.forgerock.opendj.ldap.schema.MatchingRule; 027import org.forgerock.opendj.ldap.schema.SchemaBuilder; 028import org.opends.server.types.InitializationException; 029 030 /** 031 * This class is a factory class for 032 * {@link HistoricalCsnOrderingMatchingRule}. 033 */ 034public final class HistoricalCsnOrderingMatchingRuleFactory 035 extends MatchingRuleFactory<MatchingRuleCfg> 036{ 037 038 /** Associated Matching Rule. */ 039 private MatchingRule matchingRule; 040 041 /** {@inheritDoc} */ 042 @Override 043 public final void initializeMatchingRule(MatchingRuleCfg configuration) 044 throws ConfigException, InitializationException 045 { 046 final String oid = "1.3.6.1.4.1.26027.1.4.4"; 047 matchingRule = new SchemaBuilder(CoreSchema.getInstance()).buildMatchingRule(oid) 048 .names("historicalCsnOrderingMatch") 049 .syntaxOID("1.3.6.1.4.1.1466.115.121.1.40") 050 .implementation(new HistoricalCsnOrderingMatchingRuleImpl()) 051 .addToSchema().toSchema().getMatchingRule(oid); 052 } 053 054 /** {@inheritDoc} */ 055 @Override 056 public final Collection<MatchingRule> getMatchingRules() 057 { 058 return Collections.singleton(matchingRule); 059 } 060}