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

Matthew Swift
16.40.2016 8a7ff716fed166cd42ec42faaabb7d70e317f884
OPENDJ-3505 Provide method for obtaining the user provided name of a component

Added Configuration#name() which returns the RDN value of
Configuration#dn()
17 files modified
137 ■■■■■ changed files
opendj-config/src/main/java/org/forgerock/opendj/config/Configuration.java 10 ●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/server/ServerManagedObject.java 16 ●●●● patch | view | raw | blame | history
opendj-config/src/test/java/org/forgerock/opendj/config/TestChildCfgDefn.java 4 ●●●● patch | view | raw | blame | history
opendj-config/src/test/java/org/forgerock/opendj/config/TestParentCfgDefn.java 4 ●●●● patch | view | raw | blame | history
opendj-config/src/test/java/org/forgerock/opendj/config/server/DefaultBehaviorTest.java 4 ●●●● patch | view | raw | blame | history
opendj-maven-plugin/src/main/resources/config/stylesheets/metaMO.xsl 15 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/forgerock/opendj/reactive/LDAPConnectionHandler2.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/ConfigurationBackend.java 6 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/config/AdministrationConnector.java 39 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/loggers/CommonAudit.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/protocols/http/HTTPConnectionHandler.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPConnectionHandler.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/EntityTagVirtualAttributeProviderTestCase.java 7 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyTestCase.java 6 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/DomainFakeCfg.java 6 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/ExternalChangelogDomainFakeCfg.java 6 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/replication/server/ReplServerFakeConfiguration.java 6 ●●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/Configuration.java
@@ -25,12 +25,18 @@
    /**
     * Gets the DN of the LDAP entry associated with this configuration.
     *
     * @return Returns the DN of the LDAP entry associated with this
     *         configuration.
     * @return The DN of the LDAP entry associated with this configuration.
     */
    DN dn();
    /**
     * Gets the RDN value of the LDAP entry associated with this configuration.
     *
     * @return The RDN value of the LDAP entry associated with this configuration.
     */
    String name();
    /**
     * Gets the configuration class associated with this configuration.
     *
     * @return Returns the configuration class associated with this
opendj-config/src/main/java/org/forgerock/opendj/config/server/ServerManagedObject.java
@@ -42,6 +42,7 @@
import org.forgerock.opendj.config.server.spi.ConfigDeleteListener;
import org.forgerock.opendj.config.server.spi.ConfigurationRepository;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.RDN;
import org.forgerock.util.Pair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -502,8 +503,8 @@
    /**
     * Get the DN of the LDAP entry associated with this server managed object.
     *
     * @return Returns the DN of the LDAP entry associated with this server
     *         managed object, or an null DN if this is the root managed object.
     * @return The DN of the LDAP entry associated with this server
     *         managed object, or the root DN if this is the root managed object.
     */
    public DN getDN() {
        if (configDN != null) {
@@ -513,6 +514,17 @@
    }
    /**
     * Returns the RDN value of the LDAP entry associated with this server managed object.
     *
     * @return The RDN value of the LDAP entry associated with this server managed object, or an empty string if this is
     *         the root managed object.
     */
    public String getName() {
        final RDN rdn = getDN().rdn();
        return rdn != null ? rdn.getFirstAVA().getAttributeValue().toString() : "";
    }
    /**
     * Get the definition associated with this server managed object.
     *
     * @return Returns the definition associated with this server managed
opendj-config/src/test/java/org/forgerock/opendj/config/TestChildCfgDefn.java
@@ -400,5 +400,9 @@
            return impl.getDN();
        }
        @Override
        public String name() {
            return impl.getName();
        }
    }
}
opendj-config/src/test/java/org/forgerock/opendj/config/TestParentCfgDefn.java
@@ -463,5 +463,9 @@
            return impl.getDN();
        }
        @Override
        public String name() {
            return impl.getName();
        }
    }
}
opendj-config/src/test/java/org/forgerock/opendj/config/server/DefaultBehaviorTest.java
@@ -62,7 +62,7 @@
        /** Gets the child configuration checking that it has the expected name. */
        public TestChildCfg getChildCfg(String expectedName) {
            Assert.assertNotNull(childCfg);
            Assert.assertEquals(childCfg.dn().rdn().getFirstAVA().getAttributeValue().toString(), expectedName);
            Assert.assertEquals(childCfg.name(), expectedName);
            return childCfg;
        }
@@ -86,7 +86,7 @@
        /** Gets the child configuration checking that it has the expected name. */
        public TestChildCfg getChildCfg(String expectedName) {
            Assert.assertNotNull(childCfg);
            Assert.assertEquals(childCfg.dn().rdn().getFirstAVA().getAttributeValue().toString(), expectedName);
            Assert.assertEquals(childCfg.name(), expectedName);
            return childCfg;
        }
opendj-maven-plugin/src/main/resources/config/stylesheets/metaMO.xsl
@@ -12,7 +12,7 @@
  information: "Portions Copyright [year] [name of copyright owner]".
  Copyright 2007-2010 Sun Microsystems, Inc.
  Portions copyright 2011-2014 ForgeRock AS.
  Portions copyright 2011-2016 ForgeRock AS.
  ! -->
<xsl:stylesheet version="1.0" xmlns:adm="http://opendj.forgerock.org/admin"
  xmlns:admpp="http://opendj.forgerock.org/admin-preprocessor"
@@ -610,6 +610,17 @@
                     '    public DN dn() {&#xa;',
                     '      return impl.getDN();&#xa;',
                     '    }&#xa;')" />
    <!--
      Configuration name getter.
    -->
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:value-of
        select="concat('    /** {@inheritDoc} */&#xa;',
                     '    public String name() {&#xa;',
                     '      return impl.getName();&#xa;',
                     '    }&#xa;')" />
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>&#xa;</xsl:text>
@@ -1635,7 +1646,7 @@
      <!--
        Check that all advanced properties conform to one of
        the following rules:
        * is mandatory and has a defined default value(s)
        * is mandatory and is part of an advanced managed object
        * is mandatory and is part of an abstract managed object
opendj-server-legacy/src/main/java/org/forgerock/opendj/reactive/LDAPConnectionHandler2.java
@@ -470,7 +470,7 @@
    public void initializeConnectionHandler(ServerContext serverContext, LDAPConnectionHandlerCfg config)
            throws ConfigException, InitializationException {
        if (friendlyName == null) {
            friendlyName = config.dn().rdn().getFirstAVA().getAttributeValue().toString();
            friendlyName = config.name();
        }
        // Save this configuration for future reference.
opendj-server-legacy/src/main/java/org/opends/server/backends/ConfigurationBackend.java
@@ -91,6 +91,12 @@
    }
    @Override
    public String name()
    {
      return dn().rdn().getFirstAVA().getAttributeValue().toString();
    }
    @Override
    public Class<? extends LocalBackendCfg> configurationClass()
    {
      return this.getClass();
opendj-server-legacy/src/main/java/org/opends/server/config/AdministrationConnector.java
@@ -195,14 +195,12 @@
      this.config = config;
    }
    /** {@inheritDoc} */
    @Override
    public Class<? extends LDAPConnectionHandlerCfg> configurationClass()
    {
      return LDAPConnectionHandlerCfg.class;
    }
    /** {@inheritDoc} */
    @Override
    public void addLDAPChangeListener(
        ConfigurationChangeListener<LDAPConnectionHandlerCfg> listener)
@@ -210,7 +208,6 @@
      // do nothing. change listener already added.
    }
    /** {@inheritDoc} */
    @Override
    public void removeLDAPChangeListener(
        ConfigurationChangeListener<LDAPConnectionHandlerCfg> listener)
@@ -218,175 +215,150 @@
      // do nothing. change listener already added.
    }
    /** {@inheritDoc} */
    @Override
    public int getAcceptBacklog()
    {
      return ADMIN_ACCEPT_BACKLOG;
    }
    /** {@inheritDoc} */
    @Override
    public boolean isAllowLDAPV2()
    {
      return ADMIN_ALLOW_LDAP_V2;
    }
    /** {@inheritDoc} */
    @Override
    public boolean isAllowStartTLS()
    {
      return ADMIN_ALLOW_START_TLS;
    }
    /** {@inheritDoc} */
    @Override
    public boolean isAllowTCPReuseAddress()
    {
      return ADMIN_ALLOW_TCP_REUSE_ADDRESS;
    }
    /** {@inheritDoc} */
    @Override
    public String getJavaClass()
    {
      return ADMIN_CLASS_NAME;
    }
    /** {@inheritDoc} */
    @Override
    public boolean isKeepStats()
    {
      return ADMIN_KEEP_STATS;
    }
    /** {@inheritDoc} */
    @Override
    public String getKeyManagerProvider()
    {
      return config.getKeyManagerProvider();
    }
    /** {@inheritDoc} */
    @Override
    public DN getKeyManagerProviderDN()
    {
      return config.getKeyManagerProviderDN();
    }
    /** {@inheritDoc} */
    @Override
    public SortedSet<InetAddress> getListenAddress()
    {
      return config.getListenAddress();
    }
    /** {@inheritDoc} */
    @Override
    public int getListenPort()
    {
      return config.getListenPort();
    }
    /** {@inheritDoc} */
    @Override
    public long getMaxBlockedWriteTimeLimit()
    {
      return ADMIN_MAX_BLOCKED_WRITE_TIME_LIMIT;
    }
    /** {@inheritDoc} */
    @Override
    public long getMaxRequestSize()
    {
      return ADMIN_MAX_REQUEST_SIZE;
    }
    /** {@inheritDoc} */
    @Override
    public long getBufferSize()
    {
      return ADMIN_WRITE_BUFFER_SIZE;
    }
    /** {@inheritDoc} */
    @Override
    public Integer getNumRequestHandlers()
    {
      return ADMIN_NUM_REQUEST_HANDLERS;
    }
    /** {@inheritDoc} */
    @Override
    public boolean isSendRejectionNotice()
    {
      return ADMIN_SEND_REJECTION_NOTICE;
    }
    /** {@inheritDoc} */
    @Override
    public SortedSet<String> getSSLCertNickname()
    {
      return config.getSSLCertNickname();
    }
    /** {@inheritDoc} */
    @Override
    public SortedSet<String> getSSLCipherSuite()
    {
      return config.getSSLCipherSuite();
    }
    /** {@inheritDoc} */
    @Override
    public SSLClientAuthPolicy getSSLClientAuthPolicy()
    {
      return ADMIN_SSL_CLIENT_AUTH_POLICY;
    }
    /** {@inheritDoc} */
    @Override
    public SortedSet<String> getSSLProtocol()
    {
      return config.getSSLProtocol();
    }
    /** {@inheritDoc} */
    @Override
    public String getTrustManagerProvider()
    {
      return config.getTrustManagerProvider();
    }
    /** {@inheritDoc} */
    @Override
    public DN getTrustManagerProviderDN()
    {
      return config.getTrustManagerProviderDN();
    }
    /** {@inheritDoc} */
    @Override
    public boolean isUseSSL()
    {
      return ADMIN_USE_SSL;
    }
    /** {@inheritDoc} */
    @Override
    public boolean isUseTCPKeepAlive()
    {
      return ADMIN_USE_TCP_KEEP_ALIVE;
    }
    /** {@inheritDoc} */
    @Override
    public boolean isUseTCPNoDelay()
    {
      return ADMIN_USE_TCP_NO_DELAY;
    }
    /** {@inheritDoc} */
    @Override
    public void addChangeListener(
        ConfigurationChangeListener<ConnectionHandlerCfg> listener)
@@ -394,7 +366,6 @@
      // do nothing. change listener already added.
    }
    /** {@inheritDoc} */
    @Override
    public void removeChangeListener(
        ConfigurationChangeListener<ConnectionHandlerCfg> listener)
@@ -402,33 +373,35 @@
      // do nothing. change listener already added.
    }
    /** {@inheritDoc} */
    @Override
    public SortedSet<AddressMask> getAllowedClient()
    {
      return ADMIN_ALLOWED_CLIENT;
    }
    /** {@inheritDoc} */
    @Override
    public SortedSet<AddressMask> getDeniedClient()
    {
      return ADMIN_DENIED_CLIENT;
    }
    /** {@inheritDoc} */
    @Override
    public boolean isEnabled()
    {
      return ADMIN_ENABLED;
    }
    /** {@inheritDoc} */
    @Override
    public DN dn()
    {
      return config.dn();
    }
    @Override
    public String name()
    {
      return config.name();
    }
  }
opendj-server-legacy/src/main/java/org/opends/server/loggers/CommonAudit.java
@@ -781,7 +781,7 @@
    String getName()
    {
      return config.dn().rdn().getFirstAVA().getAttributeValue().toString();
      return config.name();
    }
    String getCommonAuditTopic() throws ConfigException
opendj-server-legacy/src/main/java/org/opends/server/protocols/http/HTTPConnectionHandler.java
@@ -415,7 +415,7 @@
    if (friendlyName == null)
    {
      friendlyName = config.dn().rdn().getFirstAVA().getAttributeValue().toString();
      friendlyName = config.name();
    }
    int listenPort = config.getListenPort();
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPConnectionHandler.java
@@ -565,7 +565,7 @@
  {
    if (friendlyName == null)
    {
      friendlyName = config.dn().rdn().getFirstAVA().getAttributeValue().toString();
      friendlyName = config.name();
    }
    // Open the selector.
opendj-server-legacy/src/test/java/org/opends/server/extensions/EntityTagVirtualAttributeProviderTestCase.java
@@ -114,6 +114,13 @@
    }
    @Override
    public String name()
    {
      // Not needed.
      return null;
    }
    @Override
    public AttributeType getAttributeType()
    {
      // Not needed.
opendj-server-legacy/src/test/java/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyTestCase.java
@@ -365,6 +365,12 @@
    }
    @Override
    public String name()
    {
      return policyDN.rdn().getFirstAVA().getAttributeValue().toString();
    }
    @Override
    public long getConnectionTimeout()
    {
      return timeoutMS;
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/DomainFakeCfg.java
@@ -196,6 +196,12 @@
    return DN.valueOf("cn=domain, cn=domains,cn=Multimaster Synchronization,cn=Synchronization Providers,cn=config");
  }
  @Override
  public String name()
  {
    return "domain";
  }
  /** Set the heartbeat interval. */
  public void setHeartbeatInterval(long interval)
  {
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/ExternalChangelogDomainFakeCfg.java
@@ -123,6 +123,12 @@
    return pDN;
  }
  @Override
  public String name()
  {
    return pDN.rdn().getFirstAVA().getAttributeValue().toString();
  }
  public void setDN(DN dn)
  {
    this.pDN = dn;
opendj-server-legacy/src/test/java/org/opends/server/replication/server/ReplServerFakeConfiguration.java
@@ -193,6 +193,12 @@
    return null;
  }
  @Override
  public String name()
  {
    return null;
  }
  public ServerManagedObject<? extends Configuration> managedObject() {
    return null;
  }