mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Jean-Noël Rouvignac
01.27.2016 4bed4a99e8e37c7e1cbcbcb1eec5ecb8e6360809
OPENDJ-3037 Remove DirectoryServer.getDefault*Syntax() methods
4 files modified
240 ■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/api/MonitorData.java 10 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java 125 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/ConfigureDS.java 35 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/types/DirectoryConfig.java 70 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/api/MonitorData.java
@@ -95,19 +95,19 @@
        || attrValue instanceof Double)
    {
      // coming first because they are the most common types
      syntax = getDefaultStringSyntax();
      syntax = CoreSchema.getDirectoryStringSyntax();
    }
    else if (attrValue instanceof Number)
    {
      syntax = getDefaultIntegerSyntax();
      syntax = CoreSchema.getIntegerSyntax();
    }
    else if (attrValue instanceof Boolean)
    {
      syntax = getDefaultBooleanSyntax();
      syntax = CoreSchema.getBooleanSyntax();
    }
    else if (attrValue instanceof DN)
    {
      syntax = getDefaultDNSyntax();
      syntax = CoreSchema.getDNSyntax();
    }
    else if (attrValue instanceof Date)
    {
@@ -125,7 +125,7 @@
    }
    else
    {
      syntax = getDefaultStringSyntax();
      syntax = CoreSchema.getDirectoryStringSyntax();
    }
    add(attrName, syntax, attrValue);
  }
opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
@@ -17,6 +17,7 @@
package org.opends.server.core;
import static com.forgerock.opendj.cli.CommonArguments.*;
import static org.forgerock.util.Reject.*;
import static org.opends.messages.CoreMessages.*;
import static org.opends.messages.ToolMessages.*;
@@ -70,7 +71,6 @@
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.schema.CoreSchema;
import org.forgerock.opendj.ldap.schema.DITContentRule;
import org.forgerock.opendj.ldap.schema.DITStructureRule;
import org.forgerock.opendj.ldap.schema.MatchingRule;
@@ -1213,7 +1213,6 @@
        // the core schema should not have any warning
        throw new RuntimeException(unexpected);
      }
      directoryServer.bootstrapAttributeSyntaxes();
      // Perform any additional initialization that might be necessary before
      // loading the configuration.
@@ -1677,45 +1676,6 @@
  }
  /**
   * Registers a basic set of attribute syntaxes with the server that should
   * always be available regardless of the server configuration and may be
   * needed for configuration processing.
   */
  private void bootstrapAttributeSyntaxes()
  {
    Syntax[] syntaxes = {
      getDefaultBinarySyntax(),
      getDefaultBooleanSyntax(),
      getDefaultStringSyntax(),
      getDefaultDNSyntax(),
      getDefaultIntegerSyntax(),
      CoreSchema.getAttributeTypeDescriptionSyntax(),
      CoreSchema.getIA5StringSyntax(),
      CoreSchema.getGeneralizedTimeSyntax(),
      CoreSchema.getObjectClassDescriptionSyntax(),
      CoreSchema.getOIDSyntax(),
      CoreSchema.getTelephoneNumberSyntax()
    };
    for (Syntax syntax : syntaxes)
    {
      registerSyntax(syntax);
    }
  }
  private Syntax registerSyntax(Syntax syntax)
  {
    try
    {
      schema.registerSyntax(syntax, true);
    }
    catch (Exception e)
    {
      logger.error(ERR_CANNOT_BOOTSTRAP_SYNTAX, syntax.getClass().getName(), stackTraceToSingleLineString(e));
    }
    return syntax;
  }
  /**
   * Retrieves the authenticated users manager for the Directory Server.
   *
   * @return  The authenticated users manager for the Directory Server.
@@ -2450,7 +2410,7 @@
   */
  public static AttributeType getAttributeType(String nameOrOid)
  {
    return getAttributeType(nameOrOid, getDefaultAttributeSyntax());
    return getAttributeType(nameOrOid, getSchema().getDefaultSyntax());
  }
  /**
@@ -2491,87 +2451,6 @@
  }
  /**
   * Retrieves the default attribute syntax that should be used for attributes
   * that are not defined in the server schema.
   *
   * @return  The default attribute syntax that should be used for attributes
   *          that are not defined in the server schema.
   */
  private static Syntax getDefaultAttributeSyntax()
  {
    return DirectoryServer.directoryServer.schema.getDefaultSyntax();
  }
  /**
   * Retrieves the default attribute syntax that should be used for attributes
   * that are not defined in the server schema and are meant to store binary
   * values.
   *
   * @return  The default attribute syntax that should be used for attributes
   *          that are not defined in the server schema and are meant to store
   *          binary values.
   */
  public static Syntax getDefaultBinarySyntax()
  {
    return CoreSchema.getBinarySyntax();
  }
  /**
   * Retrieves the default attribute syntax that should be used for attributes
   * that are not defined in the server schema and are meant to store Boolean
   * values.
   *
   * @return  The default attribute syntax that should be used for attributes
   *          that are not defined in the server schema and are meant to store
   *          Boolean values.
   */
  public static Syntax getDefaultBooleanSyntax()
  {
    return CoreSchema.getBooleanSyntax();
  }
  /**
   * Retrieves the default attribute syntax that should be used for attributes
   * that are not defined in the server schema and are meant to store DN values.
   *
   * @return  The default attribute syntax that should be used for attributes
   *          that are not defined in the server schema and are meant to store
   *          DN values.
   */
  public static Syntax getDefaultDNSyntax()
  {
    return CoreSchema.getDNSyntax();
  }
  /**
   * Retrieves the default attribute syntax that should be used for attributes
   * that are not defined in the server schema and are meant to store integer
   * values.
   *
   * @return  The default attribute syntax that should be used for attributes
   *          that are not defined in the server schema and are meant to store
   *          integer values.
   */
  public static Syntax getDefaultIntegerSyntax()
  {
    return CoreSchema.getIntegerSyntax();
  }
  /**
   * Retrieves the default attribute syntax that should be used for attributes
   * that are not defined in the server schema and are meant to store string
   * values.
   *
   * @return  The default attribute syntax that should be used for attributes
   *          that are not defined in the server schema and are meant to store
   *          string values.
   */
  public static Syntax getDefaultStringSyntax()
  {
    return CoreSchema.getDirectoryStringSyntax();
  }
  /**
   * Retrieves the set of matching rule uses defined in the Directory Server.
   *
   * @return  The set of matching rule uses defined in the Directory Server.
opendj-server-legacy/src/main/java/org/opends/server/tools/ConfigureDS.java
@@ -56,6 +56,7 @@
import org.forgerock.opendj.ldap.LinkedAttribute;
import org.forgerock.opendj.ldap.LinkedHashMapEntry;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.schema.CoreSchema;
import org.forgerock.opendj.ldap.schema.Syntax;
import org.forgerock.opendj.server.config.client.BackendCfgClient;
import org.forgerock.opendj.server.config.meta.CryptoManagerCfgDefn;
@@ -756,7 +757,7 @@
      {
        updateConfigEntryWithAttribute(
            DN_LDAP_CONNECTION_HANDLER, ATTR_LISTEN_PORT,
            DirectoryServer.getDefaultIntegerSyntax(),
            CoreSchema.getIntegerSyntax(),
            ldapPort.getIntValue());
      }
      catch (final Exception e)
@@ -775,7 +776,7 @@
        updateConfigEntryWithAttribute(
            DN_ADMIN_CONNECTOR,
            ATTR_LISTEN_PORT,
            DirectoryServer.getDefaultIntegerSyntax(),
            CoreSchema.getIntegerSyntax(),
            adminConnectorPort.getIntValue());
      }
      catch (final Exception e)
@@ -794,13 +795,13 @@
        updateConfigEntryWithAttribute(
            DN_LDAPS_CONNECTION_HANDLER,
            ATTR_LISTEN_PORT,
            DirectoryServer.getDefaultIntegerSyntax(),
            CoreSchema.getIntegerSyntax(),
            ldapsPort.getIntValue());
        updateConfigEntryWithAttribute(
            DN_LDAPS_CONNECTION_HANDLER,
            ATTR_CONNECTION_HANDLER_ENABLED,
            DirectoryServer.getDefaultBooleanSyntax(),
            CoreSchema.getBooleanSyntax(),
            ServerConstants.TRUE_VALUE);
      }
      catch (final Exception e)
@@ -819,13 +820,13 @@
        updateConfigEntryWithAttribute(
            DN_JMX_CONNECTION_HANDLER,
            ATTR_LISTEN_PORT,
            DirectoryServer.getDefaultIntegerSyntax(),
            CoreSchema.getIntegerSyntax(),
            jmxPort.getIntValue());
        updateConfigEntryWithAttribute(
            DN_JMX_CONNECTION_HANDLER,
            ATTR_CONNECTION_HANDLER_ENABLED,
            DirectoryServer.getDefaultBooleanSyntax(),
            CoreSchema.getBooleanSyntax(),
            ServerConstants.TRUE_VALUE);
      }
      catch (final Exception e)
@@ -844,7 +845,7 @@
        updateConfigEntryWithAttribute(
            DN_LDAP_CONNECTION_HANDLER,
            ATTR_ALLOW_STARTTLS,
            DirectoryServer.getDefaultBooleanSyntax(),
            CoreSchema.getBooleanSyntax(),
            ServerConstants.TRUE_VALUE);
      }
      catch (final Exception e)
@@ -866,7 +867,7 @@
          updateConfigEntryWithAttribute(
              keyManagerProviderDN.getValue(),
              ATTR_KEYMANAGER_ENABLED,
              DirectoryServer.getDefaultBooleanSyntax(),
              CoreSchema.getBooleanSyntax(),
              ServerConstants.TRUE_VALUE);
        }
        catch (final Exception e)
@@ -886,7 +887,7 @@
          updateConfigEntryWithAttribute(
              keyManagerProviderDN.getValue(),
              ATTR_KEYSTORE_FILE,
              DirectoryServer.getDefaultStringSyntax(),
              CoreSchema.getDirectoryStringSyntax(),
              keyManagerPath.getValue());
        }
        catch (final Exception e)
@@ -907,7 +908,7 @@
        updateConfigEntryWithAttribute(
            attributeDN,
            ATTR_KEYMANAGER_DN,
            DirectoryServer.getDefaultStringSyntax(),
            CoreSchema.getDirectoryStringSyntax(),
            keyManagerProviderDN.getValue());
      }
      catch (final Exception e)
@@ -928,7 +929,7 @@
          updateConfigEntryWithAttribute(
              trustManagerProviderDN.getValue(),
              ATTR_TRUSTMANAGER_ENABLED,
              DirectoryServer.getDefaultBooleanSyntax(),
              CoreSchema.getBooleanSyntax(),
              ServerConstants.TRUE_VALUE);
        }
        catch (final Exception e)
@@ -968,7 +969,7 @@
        updateConfigEntryWithAttribute(
            attributeDN,
            ATTR_TRUSTMANAGER_DN,
            DirectoryServer.getDefaultStringSyntax(),
            CoreSchema.getDirectoryStringSyntax(),
            trustManagerProviderDN.getValue());
      }
      catch (final Exception e)
@@ -988,7 +989,7 @@
        updateConfigEntryWithAttribute(
            attributeDN,
            attrName,
            DirectoryServer.getDefaultStringSyntax(),
            CoreSchema.getDirectoryStringSyntax(),
            attrValues.toArray(new Object[attrValues.size()]));
      }
      else
@@ -1023,13 +1024,13 @@
        updateConfigEntryWithAttribute(
            DN_ROOT_USER,
            ATTR_ROOTDN_ALTERNATE_BIND_DN,
            DirectoryServer.getDefaultStringSyntax(),
            CoreSchema.getDirectoryStringSyntax(),
            rootDN);
        final String encodedPassword = SaltedSHA512PasswordStorageScheme.encodeOffline(getBytes(rootPW));
        updateConfigEntryWithAttribute(
            DN_ROOT_USER,
            ATTR_USER_PASSWORD,
            DirectoryServer.getDefaultStringSyntax(),
            CoreSchema.getDirectoryStringSyntax(),
            encodedPassword);
      }
      catch (final Exception e)
@@ -1047,7 +1048,7 @@
      updateConfigEntryWithAttribute(
          DN_DIGEST_MD5_SASL_MECHANISM,
          "ds-cfg-server-fqdn",
          DirectoryServer.getDefaultStringSyntax(),
          CoreSchema.getDirectoryStringSyntax(),
          hostName.getValue());
    }
    catch (final Exception e)
@@ -1097,7 +1098,7 @@
            updateConfigEntryWithAttribute(
                DN_CRYPTO_MANAGER,
                ATTR_CRYPTO_CIPHER_KEY_WRAPPING_TRANSFORMATION,
                DirectoryServer.getDefaultStringSyntax(),
                CoreSchema.getDirectoryStringSyntax(),
                alternativeCipher);
          }
          catch (final Exception e)
opendj-server-legacy/src/main/java/org/opends/server/types/DirectoryConfig.java
@@ -268,76 +268,6 @@
  }
  /**
   * Retrieves the default attribute syntax that should be used for
   * attributes that are not defined in the server schema and are
   * meant to store binary values.
   *
   * @return  The default attribute syntax that should be used for
   *          attributes that are not defined in the server schema and
   *          are meant to store binary values.
   */
  public static Syntax getDefaultBinarySyntax()
  {
    return DirectoryServer.getDefaultBinarySyntax();
  }
  /**
   * Retrieves the default attribute syntax that should be used for
   * attributes that are not defined in the server schema and are
   * meant to store Boolean values.
   *
   * @return  The default attribute syntax that should be used for
   *          attributes that are not defined in the server schema and
   *          are meant to store Boolean values.
   */
  public static Syntax getDefaultBooleanSyntax()
  {
    return DirectoryServer.getDefaultBooleanSyntax();
  }
  /**
   * Retrieves the default attribute syntax that should be used for
   * attributes that are not defined in the server schema and are
   * meant to store DN values.
   *
   * @return  The default attribute syntax that should be used for
   *          attributes that are not defined in the server schema and
   *          are meant to store DN values.
   */
  public static Syntax getDefaultDNSyntax()
  {
    return DirectoryServer.getDefaultDNSyntax();
  }
  /**
   * Retrieves the default attribute syntax that should be used for
   * attributes that are not defined in the server schema and are
   * meant to store integer values.
   *
   * @return  The default attribute syntax that should be used for
   *          attributes that are not defined in the server schema and
   *          are meant to store integer values.
   */
  public static Syntax getDefaultIntegerSyntax()
  {
    return DirectoryServer.getDefaultIntegerSyntax();
  }
  /**
   * Retrieves the default attribute syntax that should be used for
   * attributes that are not defined in the server schema and are
   * meant to store string values.
   *
   * @return  The default attribute syntax that should be used for
   *          attributes that are not defined in the server schema and
   *          are meant to store string values.
   */
  public static Syntax getDefaultStringSyntax()
  {
    return DirectoryServer.getDefaultStringSyntax();
  }
  /**
   * Retrieves the set of matching rule uses defined in the Directory
   * Server.  The mapping will be between the matching rule and its
   * corresponding matching rule use.  The returned map must not be