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

Violette Roche-Montane
28.47.2013 5449bec72778bd774c917843783c024243f079ec
Trivial style fix
2 files modified
88 ■■■■■ changed files
opends/src/guitools/org/opends/guitools/controlpanel/util/RemoteSchemaLoader.java 36 ●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/util/SchemaLoader.java 52 ●●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/util/RemoteSchemaLoader.java
@@ -23,6 +23,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2013 ForgeRock AS
 */
package org.opends.guitools.controlpanel.util;
@@ -52,7 +53,6 @@
/**
 * Class used to retrieve the schema from the schema files.
 *
 */
public class RemoteSchemaLoader extends SchemaLoader
{
@@ -60,7 +60,6 @@
  /**
   * Constructor.
   *
   */
  public RemoteSchemaLoader()
  {
@@ -69,13 +68,18 @@
  /**
   * Reads the schema.
   * @param ctx the connection to be used to load the schema.
   * @throws NamingException if an error occurs reading the schema.
   * @throws DirectoryException if an error occurs parsing the schema.
   * @throws InitializationException if an error occurs finding the base
   * schema.
   * @throws ConfigException if an error occurs loading the configuration
   * required to use the schema classes.
   *
   * @param ctx
   *          the connection to be used to load the schema.
   * @throws NamingException
   *           if an error occurs reading the schema.
   * @throws DirectoryException
   *           if an error occurs parsing the schema.
   * @throws InitializationException
   *           if an error occurs finding the base schema.
   * @throws ConfigException
   *           if an error occurs loading the configuration required to use the
   *           schema classes.
   */
  public void readSchema(InitialLdapContext ctx) throws NamingException,
  DirectoryException, InitializationException, ConfigException
@@ -83,15 +87,12 @@
    SearchControls searchControls = new SearchControls();
    searchControls.setSearchScope(SearchControls.OBJECT_SCOPE);
    String[] schemaAttrs =
    {
        ConfigConstants.ATTR_OBJECTCLASSES_LC,
        ConfigConstants.ATTR_ATTRIBUTE_TYPES_LC
    };
        { ConfigConstants.ATTR_OBJECTCLASSES_LC,
          ConfigConstants.ATTR_ATTRIBUTE_TYPES_LC };
    searchControls.setReturningAttributes(schemaAttrs);
    String filter = BrowserController.ALL_OBJECTS_FILTER;
    NamingEnumeration<SearchResult> srs =
      ctx.search(ConfigConstants.DN_DEFAULT_SCHEMA_ROOT,
          filter,
        ctx.search(ConfigConstants.DN_DEFAULT_SCHEMA_ROOT, filter,
          searchControls);
    SearchResult sr = null;
    try
@@ -105,8 +106,8 @@
    {
      srs.close();
    }
    CustomSearchResult csr = new CustomSearchResult(sr,
        ConfigConstants.DN_DEFAULT_SCHEMA_ROOT);
    CustomSearchResult csr =
        new CustomSearchResult(sr, ConfigConstants.DN_DEFAULT_SCHEMA_ROOT);
    schema = getBaseSchema();
@@ -188,6 +189,7 @@
  /**
   * Returns the schema that was read.
   *
   * @return the schema that was read.
   */
  @Override
opends/src/guitools/org/opends/guitools/controlpanel/util/SchemaLoader.java
@@ -51,7 +51,6 @@
/**
 * Class used to retrieve the schema from the schema files.
 *
 */
public class SchemaLoader
{
@@ -76,7 +75,6 @@
  /**
   * Constructor.
   *
   */
  public SchemaLoader()
  {
@@ -111,23 +109,28 @@
  {
    File schemaDir =
      DirectoryServer.getEnvironmentConfig().getSchemaDirectory();
    if (schemaDir != null) {
    if (schemaDir != null)
    {
      return schemaDir.getAbsolutePath();
    } else {
    }
    else
    {
      return null;
    }
  }
  /**
   * Reads the schema.
   * @throws ConfigException if an error occurs reading the schema.
   * @throws InitializationException if an error occurs trying to find out
   * the schema files.
   * @throws DirectoryException if there is an error registering the minimal
   * objectclasses.
   *
   * @throws ConfigException
   *           if an error occurs reading the schema.
   * @throws InitializationException
   *           if an error occurs trying to find out the schema files.
   * @throws DirectoryException
   *           if there is an error registering the minimal objectclasses.
   */
  public void readSchema() throws DirectoryException,
  ConfigException, InitializationException
  public void readSchema() throws DirectoryException, ConfigException,
      InitializationException
  {
    schema = getBaseSchema();
@@ -161,11 +164,12 @@
            if (f.isDirectory())
            {
              accept = true;
            } else if (Utils.isWindows())
            }
            else if (Utils.isWindows())
            {
              accept =
                  f.getName().toLowerCase().endsWith(".ldif");
            } else
              accept = f.getName().toLowerCase().endsWith(".ldif");
            }
            else
            {
              accept = f.getName().endsWith(".ldif");
            }
@@ -195,14 +199,16 @@
    }
    catch (Exception e)
    {
      Message message = ERR_CONFIG_SCHEMA_CANNOT_LIST_FILES.get(
          schemaDirPath, e.getMessage());
      Message message =
          ERR_CONFIG_SCHEMA_CANNOT_LIST_FILES
              .get(schemaDirPath, e.getMessage());
      throw new InitializationException(message, e);
    }
//  Iterate through the schema files and read them as an LDIF file containing
//  a single entry.  Then get the attributeTypes and objectClasses attributes
//  from that entry and parse them to initialize the server schema.
    //  Iterate through the schema files and read them as an LDIF file
    //  containing a single entry.  Then get the attributeTypes and
    //  objectClasses attributes from that entry and parse them to
    //  initialize the server schema.
    for (String schemaFile : fileNames)
    {
      SchemaConfigManager.loadSchemaFile(schema, schemaFile);
@@ -212,9 +218,10 @@
  /**
   * Returns a basic version of the schema.  The schema is created and contains
   * enough definitions for the schema to be loaded.
   *
   * @return a basic version of the schema.
   * @throws DirectoryException if there is an error registering the minimal
   * objectclasses.
   * @throws DirectoryException
   *           if there is an error registering the minimal objectclasses.
   */
  protected Schema getBaseSchema() throws DirectoryException
  {
@@ -240,6 +247,7 @@
  /**
   * Returns the schema that was read.
   *
   * @return the schema that was read.
   */
  public Schema getSchema()