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.types;
028    
029    
030    
031    /**
032     * This interface defines a set of methods that must be provided by a
033     * schema file element, which is a schema element that is loaded from
034     * a schema configuration file.
035     * <BR><BR>
036     * Note that this interface is not meant to be implemented by
037     * third-party code, and only the following classes should be
038     * considered schema file elements:
039     * <UL>
040     *   <LI>{@code org.opends.server.types.AttributeType}</LI>
041     *   <LI>{@code org.opends.server.types.ObjectClass}</LI>
042     *   <LI>{@code org.opends.server.types.NameForm}</LI>
043     *   <LI>{@code org.opends.server.types.DITContentRule}</LI>
044     *   <LI>{@code org.opends.server.types.DITStructureRule}</LI>
045     *   <LI>{@code org.opends.server.types.MatchingRuleUse}</LI>
046     * </UL>
047     */
048    @org.opends.server.types.PublicAPI(
049         stability=org.opends.server.types.StabilityLevel.VOLATILE,
050         mayInstantiate=false,
051         mayExtend=false,
052         mayInvoke=true)
053    public interface SchemaFileElement
054    {
055      /**
056       * Retrieves the name of the schema file in which this element is
057       * defined.
058       *
059       * @return  The name of the schema file in which this element is
060       *          defined, or {@code null} if it is not known or this
061       *          element is not defined in any schema file.
062       */
063      public String getSchemaFile();
064    
065    
066    
067      /**
068       * Specifies the name of the schema file in which this element is
069       * defined.
070       *
071       * @param  schemaFile  The name of the schema file in which this
072       *                     element is defined, or {@code null} if it is
073       *                     not defined in any schema file.
074       */
075      public void setSchemaFile(String schemaFile);
076    
077    
078    
079      /**
080       * Retrieves the definition string that is used to represent this
081       * element in the schema configuration file.
082       *
083       * @return  The definition string that should be used to represent
084       *          this element in the schema configuration file.
085       */
086      public String getDefinition();
087    
088    
089    
090      /**
091       * Creates a new instance of this schema element based on the
092       * definition from the schema file.  The new instance should also
093       * be created with all appropriate state information that may not
094       * be directly represented in the schema definition (e.g., the name
095       * of the schema file containing the definition).
096       * <BR><BR>
097       * Whenever an existing schema file element is modified with the
098       * server online, this method will be invoked to recreate any
099       * schema elements that might have been dependent upon the
100       * modified element.
101       *
102       * @return  A new instance of this schema element based on the
103       *          definition.
104       *
105       * @throws  DirectoryException  If a problem occurs while attempting
106       *                              to create the new instance of this
107       *                              schema element.
108       */
109      public SchemaFileElement recreateFromDefinition()
110             throws DirectoryException;
111    }
112