001    /*
002     * CDDL HEADER START
003     *
004     * The contents of this file are subject to the terms of the
005     * Common Development and Distribution License, Version 1.0 only
006     * (the "License").  You may not use this file except in compliance
007     * with the License.
008     *
009     * You can obtain a copy of the license at
010     * trunk/opends/resource/legal-notices/OpenDS.LICENSE
011     * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
012     * See the License for the specific language governing permissions
013     * and limitations under the License.
014     *
015     * When distributing Covered Code, include this CDDL HEADER in each
016     * file and include the License file at
017     * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
018     * add the following below this CDDL HEADER, with the fields enclosed
019     * by brackets "[]" replaced with your own identifying information:
020     *      Portions Copyright [yyyy] [name of copyright owner]
021     *
022     * CDDL HEADER END
023     *
024     *
025     *      Copyright 2008 Sun Microsystems, Inc.
026     */
027    package org.opends.server.admin.std.meta;
028    
029    
030    
031    import org.opends.server.admin.AbstractManagedObjectDefinition;
032    import org.opends.server.admin.AdministratorAction;
033    import org.opends.server.admin.BooleanPropertyDefinition;
034    import org.opends.server.admin.ClassPropertyDefinition;
035    import org.opends.server.admin.PropertyOption;
036    import org.opends.server.admin.std.client.MatchingRuleCfgClient;
037    import org.opends.server.admin.std.server.MatchingRuleCfg;
038    import org.opends.server.admin.Tag;
039    import org.opends.server.admin.TopCfgDefn;
040    import org.opends.server.admin.UndefinedDefaultBehaviorProvider;
041    
042    
043    
044    /**
045     * An interface for querying the Matching Rule managed object
046     * definition meta information.
047     * <p>
048     * Matching Rules define a set of rules for performing matching
049     * operations against assertion values.
050     */
051    public final class MatchingRuleCfgDefn extends AbstractManagedObjectDefinition<MatchingRuleCfgClient, MatchingRuleCfg> {
052    
053      // The singleton configuration definition instance.
054      private static final MatchingRuleCfgDefn INSTANCE = new MatchingRuleCfgDefn();
055    
056    
057    
058      // The "enabled" property definition.
059      private static final BooleanPropertyDefinition PD_ENABLED;
060    
061    
062    
063      // The "java-class" property definition.
064      private static final ClassPropertyDefinition PD_JAVA_CLASS;
065    
066    
067    
068      // Build the "enabled" property definition.
069      static {
070          BooleanPropertyDefinition.Builder builder = BooleanPropertyDefinition.createBuilder(INSTANCE, "enabled");
071          builder.setOption(PropertyOption.MANDATORY);
072          builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "enabled"));
073          builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider<Boolean>());
074          PD_ENABLED = builder.getInstance();
075          INSTANCE.registerPropertyDefinition(PD_ENABLED);
076      }
077    
078    
079    
080      // Build the "java-class" property definition.
081      static {
082          ClassPropertyDefinition.Builder builder = ClassPropertyDefinition.createBuilder(INSTANCE, "java-class");
083          builder.setOption(PropertyOption.MANDATORY);
084          builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "java-class"));
085          builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider<String>());
086          builder.addInstanceOf("org.opends.server.api.MatchingRule");
087          PD_JAVA_CLASS = builder.getInstance();
088          INSTANCE.registerPropertyDefinition(PD_JAVA_CLASS);
089      }
090    
091    
092    
093      // Register the tags associated with this managed object definition.
094      static {
095        INSTANCE.registerTag(Tag.valueOf("core-server"));
096      }
097    
098    
099    
100      /**
101       * Get the Matching Rule configuration definition singleton.
102       *
103       * @return Returns the Matching Rule configuration definition
104       *         singleton.
105       */
106      public static MatchingRuleCfgDefn getInstance() {
107        return INSTANCE;
108      }
109    
110    
111    
112      /**
113       * Private constructor.
114       */
115      private MatchingRuleCfgDefn() {
116        super("matching-rule", TopCfgDefn.getInstance());
117      }
118    
119    
120    
121      /**
122       * Get the "enabled" property definition.
123       * <p>
124       * Indicates whether the Matching Rule is enabled for use.
125       *
126       * @return Returns the "enabled" property definition.
127       */
128      public BooleanPropertyDefinition getEnabledPropertyDefinition() {
129        return PD_ENABLED;
130      }
131    
132    
133    
134      /**
135       * Get the "java-class" property definition.
136       * <p>
137       * Specifies the fully-qualified name of the Java class that
138       * provides the Matching Rule implementation.
139       *
140       * @return Returns the "java-class" property definition.
141       */
142      public ClassPropertyDefinition getJavaClassPropertyDefinition() {
143        return PD_JAVA_CLASS;
144      }
145    }