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

jvergara
05.14.2007 e6ee0bf1195bc2911b2d1efa6e5c04c3a51ef7c9
opendj-sdk/opends/src/ads/org/opends/admin/ads/ServerDescriptor.java
@@ -57,7 +57,6 @@
  private Map<ServerProperty, Object> serverProperties =
    new HashMap<ServerProperty, Object>();
  private TopologyCacheException lastException;
  /**
   * Enumeration containing the different server properties that we can keep in
   * the ServerProperty object.
@@ -129,7 +128,11 @@
     * The instance key-pair public-key certificate. The associated value is a
     * byte[] (ds-cfg-public-key-certificate;binary).
     */
    INSTANCE_PUBLIC_KEY_CERTIFICATE
    INSTANCE_PUBLIC_KEY_CERTIFICATE,
    /**
     * The schema generation ID.
     */
    SCHEMA_GENERATION_ID
  }
  private ServerDescriptor()
@@ -425,6 +428,15 @@
  }
  /**
   * Returns the schema generation ID of the server.
   * @return the schema generation ID of the server.
   */
  public String getSchemaReplicationID()
  {
    return (String)serverProperties.get(ServerProperty.SCHEMA_GENERATION_ID);
  }
  /**
   * Returns the last exception that was encountered reading the configuration
   * of the server.  Returns null if there was no problem loading the
   * configuration of the server.
@@ -545,6 +557,7 @@
    updateReplicas(desc, ctx);
    updateReplication(desc, ctx);
    updatePublicKeyCertificate(desc, ctx);
    updateMiscellaneous(desc, ctx);
    desc.serverProperties.put(ServerProperty.HOST_NAME,
        ConnectionUtils.getHostName(ctx));
@@ -995,6 +1008,29 @@
    }
  }
  private static void updateMiscellaneous(ServerDescriptor desc,
      InitialLdapContext ctx) throws NamingException
  {
    SearchControls ctls = new SearchControls();
    ctls.setSearchScope(SearchControls.OBJECT_SCOPE);
    ctls.setReturningAttributes(
        new String[] {
            "ds-sync-generation-id"
        });
    String filter = "|(objectclass=*)(objectclass=ldapsubentry)";
    LdapName jndiName = new LdapName("cn=schema");
    NamingEnumeration listeners = ctx.search(jndiName, filter, ctls);
    while(listeners.hasMore())
    {
      SearchResult sr = (SearchResult)listeners.next();
      desc.serverProperties.put(ServerProperty.SCHEMA_GENERATION_ID,
          getFirstValue(sr, "ds-sync-generation-id"));
    }
  }
  /**
   Seeds the bound instance's local ads-truststore with a set of instance
   key-pair public key certificates. The result is the instance will trust any