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 legal-notices/CDDLv1_0.txt
010 * or http://forgerock.org/license/CDDLv1.0.html.
011 * See the License for the specific language governing permissions
012 * and limitations under the License.
013 *
014 * When distributing Covered Code, include this CDDL HEADER in each
015 * file and include the License file at legal-notices/CDDLv1_0.txt.
016 * If applicable, add the following below this CDDL HEADER, with the
017 * fields enclosed by brackets "[]" replaced with your own identifying
018 * information:
019 *      Portions Copyright [yyyy] [name of copyright owner]
020 *
021 * CDDL HEADER END
022 *
023 *
024 *      Copyright 2006-2008 Sun Microsystems, Inc.
025 *      Portions Copyright 2011-2015 ForgeRock AS
026 */
027package org.opends.server.schema;
028
029import static org.opends.server.schema.SchemaConstants.*;
030
031import org.forgerock.opendj.config.server.ConfigException;
032import org.forgerock.opendj.ldap.schema.SchemaBuilder;
033import org.forgerock.opendj.ldap.schema.Syntax;
034import org.opends.server.admin.std.server.AttributeSyntaxCfg;
035import org.opends.server.api.AttributeSyntax;
036import org.opends.server.core.ServerContext;
037
038/**
039 * This class implements the access control information (aci) attribute syntax.
040 */
041public class AciSyntax
042       extends AttributeSyntax<AttributeSyntaxCfg>
043{
044  /**
045   * Creates a new instance of this syntax.  Note that the only thing that
046   * should be done here is to invoke the default constructor for the
047   * superclass.  All initialization should be performed in the
048   * <CODE>initializeSyntax</CODE> method.
049   */
050  public AciSyntax()
051  {
052    super();
053  }
054
055  /** {@inheritDoc} */
056  @Override
057  public void initializeSyntax(AttributeSyntaxCfg configuration, ServerContext serverContext) throws ConfigException
058  {
059    // Add the Aci syntax to the "new" schema
060    SchemaUpdater schemaUpdater = serverContext.getSchemaUpdater();
061    SchemaBuilder builder = schemaUpdater.getSchemaBuilder().buildSyntax(SYNTAX_ACI_OID)
062      .description(SYNTAX_ACI_DESCRIPTION)
063      .implementation(new AciSyntaxImpl())
064      .addToSchema();
065    schemaUpdater.updateSchema(builder.toSchema());
066  }
067
068  /** {@inheritDoc} */
069  @Override
070  public Syntax getSDKSyntax(org.forgerock.opendj.ldap.schema.Schema schema)
071  {
072    return schema.getSyntax(SchemaConstants.SYNTAX_ACI_OID);
073  }
074
075  /**
076   * Retrieves the common name for this attribute syntax.
077   *
078   * @return  The common name for this attribute syntax.
079   */
080  @Override
081  public String getName()
082  {
083    return SYNTAX_ACI_NAME;
084  }
085
086  /**
087   * Retrieves the OID for this attribute syntax.
088   *
089   * @return  The OID for this attribute syntax.
090   */
091  @Override
092  public String getOID()
093  {
094    return SYNTAX_ACI_OID;
095  }
096
097  /**
098   * Retrieves a description for this attribute syntax.
099   *
100   * @return  A description for this attribute syntax.
101   */
102  @Override
103  public String getDescription()
104  {
105    return SYNTAX_ACI_DESCRIPTION;
106  }
107}
108