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

Jean-Noël Rouvignac
15.30.2016 00006ce6d59364fe3c379761749213e9a949cc40
Removed unused types: InvokableComponent interface and InvokableMethod class
2 files deleted
3 files modified
684 ■■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/api/InvokableComponent.java 80 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/config/JMXMBean.java 159 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java 39 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/types/DirectoryConfig.java 34 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/types/InvokableMethod.java 372 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/api/InvokableComponent.java
File was deleted
opendj-server-legacy/src/main/java/org/opends/server/config/JMXMBean.java
@@ -40,14 +40,15 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchScope;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.util.Utils;
import org.opends.server.admin.std.server.MonitorProviderCfg;
import org.opends.server.api.AlertGenerator;
import org.opends.server.api.ClientConnection;
import org.opends.server.api.DirectoryServerMBean;
import org.opends.server.api.InvokableComponent;
import org.opends.server.api.MonitorProvider;
import org.opends.server.core.DirectoryServer;
import org.opends.server.protocols.internal.InternalClientConnection;
@@ -55,9 +56,7 @@
import org.opends.server.protocols.internal.SearchRequest;
import org.opends.server.protocols.jmx.Credential;
import org.opends.server.protocols.jmx.JmxClientConnection;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.InvokableMethod;
import static org.opends.messages.ConfigMessages.*;
import static org.opends.server.protocols.internal.Requests.*;
@@ -91,9 +90,6 @@
  /** The set of alert generators for this MBean. */
  private List<AlertGenerator> alertGenerators;
  /** The set of invokable components for this MBean. */
  private List<InvokableComponent> invokableComponents;
  /** The set of monitor providers for this MBean. */
  private List<MonitorProvider<? extends MonitorProviderCfg>> monitorProviders;
@@ -115,10 +111,9 @@
   */
  public static String getJmxName (DN configEntryDN)
  {
      String typeStr = null;
      String nameStr = null ;
      try
      {
          String typeStr = null;
          String dnString = configEntryDN.toString();
          if (dnString != null && dnString.length() != 0)
          {
@@ -151,13 +146,13 @@
              typeStr = buffer.toString();
          }
          nameStr = MBEAN_BASE_DOMAIN + ":" + "Name=rootDSE" + typeStr;
          return MBEAN_BASE_DOMAIN + ":" + "Name=rootDSE" + typeStr;
      } catch (Exception e)
      {
        logger.traceException(e);
        logger.error(ERR_CONFIG_JMX_CANNOT_REGISTER_MBEAN, configEntryDN, e);
        return null;
      }
      return nameStr ;
  }
  /**
@@ -171,7 +166,6 @@
        this.configEntryDN = configEntryDN;
        alertGenerators = new CopyOnWriteArrayList<>();
        invokableComponents = new CopyOnWriteArrayList<>();
        monitorProviders = new CopyOnWriteArrayList<>();
        MBeanServer mBeanServer = DirectoryServer.getJMXMBeanServer();
@@ -269,60 +263,6 @@
    }
  }
  /**
   * Retrieves the set of invokable components associated with this JMX MBean.
   *
   * @return  The set of invokable components associated with this JMX MBean.
   */
  public List<InvokableComponent> getInvokableComponents()
  {
    return invokableComponents;
  }
  /**
   * Adds the provided invokable component to the set of components associated
   * with this JMX MBean.
   *
   * @param  component  The component to add to the set of invokable components
   *                    for this JMX MBean.
   */
  public void addInvokableComponent(InvokableComponent component)
  {
    synchronized (invokableComponents)
    {
      if (! invokableComponents.contains(component))
      {
        invokableComponents.add(component);
      }
    }
  }
  /**
   * Removes the provided invokable component from the set of components
   * associated with this JMX MBean.
   *
   * @param  component  The component to remove from the set of invokable
   *                    components for this JMX MBean.
   *
   * @return  <CODE>true</CODE> if the specified component was successfully
   *          removed, or <CODE>false</CODE> if not.
   */
  public boolean removeInvokableComponent(InvokableComponent component)
  {
    synchronized (invokableComponents)
    {
      return invokableComponents.remove(component);
    }
  }
  /**
   * Retrieves the set of monitor providers associated with this JMX MBean.
   *
@@ -451,20 +391,12 @@
    }
    // prepare the ldap search
    try
    {
      // Perform the Ldap operation for
      //  - ACI Check
      //  - Loggin purpose
      SearchRequest request = newSearchRequest(configEntryDN, SearchScope.BASE_OBJECT);
      InternalSearchOperation op = null;
      if (clientConnection instanceof JmxClientConnection) {
        op = ((JmxClientConnection) clientConnection).processSearch(request);
      }
      else if (clientConnection instanceof InternalClientConnection) {
        op = ((InternalClientConnection) clientConnection).processSearch(request);
      }
      InternalSearchOperation op = searchMBeanConfigEntry(clientConnection);
      // BUG : op may be null
      ResultCode rc = op.getResultCode();
      if (rc != ResultCode.SUCCESS) {
@@ -530,15 +462,7 @@
    // Perform the Ldap operation for
    //  - ACI Check
    //  - Loggin purpose
    SearchRequest request = newSearchRequest(configEntryDN, SearchScope.BASE_OBJECT);
    InternalSearchOperation op = null;
    if (clientConnection instanceof JmxClientConnection) {
      op = ((JmxClientConnection) clientConnection).processSearch(request);
    }
    else if (clientConnection instanceof InternalClientConnection) {
      op = ((InternalClientConnection) clientConnection).processSearch(request);
    }
    InternalSearchOperation op = searchMBeanConfigEntry(clientConnection);
    if (op == null)
    {
      return null;
@@ -577,6 +501,18 @@
    return attrList;
  }
  private InternalSearchOperation searchMBeanConfigEntry(ClientConnection clientConnection)
  {
    SearchRequest request = newSearchRequest(configEntryDN, SearchScope.BASE_OBJECT);
    if (clientConnection instanceof JmxClientConnection) {
      return ((JmxClientConnection) clientConnection).processSearch(request);
    }
    else if (clientConnection instanceof InternalClientConnection) {
      return ((InternalClientConnection) clientConnection).processSearch(request);
    }
    return null;
  }
  /**
   * Sets the values of several attributes of the Dynamic MBean.
   *
@@ -617,49 +553,11 @@
  public Object invoke(String actionName, Object[] params, String[] signature)
         throws MBeanException
  {
    for (InvokableComponent component : invokableComponents)
    {
      for (InvokableMethod method : component.getOperationSignatures())
      {
        if (method.hasSignature(actionName, signature))
        {
          try
          {
            method.invoke(component, params);
          }
          catch (MBeanException me)
          {
            logger.traceException(me);
            throw me;
          }
          catch (Exception e)
          {
            logger.traceException(e);
            throw new MBeanException(e);
          }
        }
      }
    }
    // If we've gotten here, then there is no such method so throw an exception.
    StringBuilder buffer = new StringBuilder();
    buffer.append(actionName);
    buffer.append("(");
    if (signature.length > 0)
    {
      buffer.append(signature[0]);
      for (int i=1; i < signature.length; i++)
      {
        buffer.append(", ");
        buffer.append(signature[i]);
      }
    }
    Utils.joinAsString(", ", (Object[]) signature);
    buffer.append(")");
    LocalizableMessage message = ERR_CONFIG_JMX_NO_METHOD.get(buffer, configEntryDN);
@@ -711,25 +609,12 @@
      }
    }
    MBeanConstructorInfo[] mBeanConstructors = new MBeanConstructorInfo[0];
    MBeanOperationInfo[] mBeanOperations = new MBeanOperationInfo[0];
    MBeanNotificationInfo[] mBeanNotifications = new MBeanNotificationInfo[notifications.size()];
    notifications.toArray(mBeanNotifications);
    List<MBeanOperationInfo> ops = new ArrayList<>();
    for (InvokableComponent component : invokableComponents)
    {
      for (InvokableMethod method : component.getOperationSignatures())
      {
        ops.add(method.toOperationInfo());
      }
    }
    MBeanOperationInfo[] mBeanOperations = new MBeanOperationInfo[ops.size()];
    ops.toArray(mBeanOperations);
    MBeanConstructorInfo[]  mBeanConstructors  = new MBeanConstructorInfo[0];
    return new MBeanInfo(CLASS_NAME,
                         "Configurable Attributes for " + configEntryDN,
                         mBeanAttributes, mBeanConstructors, mBeanOperations,
opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
@@ -61,6 +61,7 @@
import org.forgerock.i18n.LocalizedIllegalArgumentException;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.config.server.ConfigException;
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;
@@ -103,7 +104,6 @@
import org.opends.server.api.IdentityMapper;
import org.opends.server.api.ImportTaskListener;
import org.opends.server.api.InitializationCompletedListener;
import org.opends.server.api.InvokableComponent;
import org.opends.server.api.KeyManagerProvider;
import org.opends.server.api.MonitorProvider;
import org.opends.server.api.PasswordGenerator;
@@ -147,7 +147,6 @@
import org.opends.server.types.Control;
import org.opends.server.types.DITContentRule;
import org.opends.server.types.DITStructureRule;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.DirectoryEnvironmentConfig;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Entry;
@@ -3022,42 +3021,6 @@
  }
  /**
   * Registers the provided invokable component with the Directory Server.
   *
   * @param  component  The invokable component to register.
   */
  public static void registerInvokableComponent(InvokableComponent component)
  {
    DN componentDN = component.getInvokableComponentEntryDN();
    JMXMBean mBean = directoryServer.mBeans.get(componentDN);
    if (mBean == null)
    {
      mBean = new JMXMBean(componentDN);
      mBean.addInvokableComponent(component);
      directoryServer.mBeans.put(componentDN, mBean);
    }
    else
    {
      mBean.addInvokableComponent(component);
    }
  }
  /**
   * Deregisters the provided invokable component with the Directory Server.
   *
   * @param  component  The invokable component to deregister.
   */
  public static void deregisterInvokableComponent(InvokableComponent component)
  {
    DN componentDN = component.getInvokableComponentEntryDN();
    JMXMBean mBean = directoryServer.mBeans.get(componentDN);
    if (mBean != null)
    {
      mBean.removeInvokableComponent(component);
    }
  }
  /**
   * Registers the provided alert generator with the Directory Server.
   *
   * @param  alertGenerator  The alert generator to register.
opendj-server-legacy/src/main/java/org/opends/server/types/DirectoryConfig.java
@@ -16,8 +16,6 @@
 */
package org.opends.server.types;
import org.forgerock.opendj.ldap.schema.AttributeType;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@@ -27,12 +25,12 @@
import org.forgerock.opendj.config.server.ConfigException;
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.MatchingRule;
import org.forgerock.opendj.ldap.schema.Syntax;
import org.opends.server.api.AlertGenerator;
import org.opends.server.api.ConfigHandler;
import org.opends.server.api.ExtendedOperationHandler;
import org.opends.server.api.InvokableComponent;
import org.opends.server.api.SASLMechanismHandler;
import org.opends.server.api.ServerShutdownListener;
import org.opends.server.config.ConfigEntry;
@@ -622,36 +620,6 @@
    return DirectoryServer.getNameForm(lowerName);
  }
  /**
   * Registers the provided invokable component with the Directory
   * Server.
   *
   * @param  component  The invokable component to register.
   */
  public static void registerInvokableComponent(
                                InvokableComponent component)
  {
    DirectoryServer.registerInvokableComponent(component);
  }
  /**
   * Deregisters the provided invokable component with the Directory
   * Server.
   *
   * @param  component  The invokable component to deregister.
   */
  public static void deregisterInvokableComponent(
                                InvokableComponent component)
  {
    DirectoryServer.deregisterInvokableComponent(component);
  }
  /**
   * Registers the provided alert generator with the Directory Server.
   *
opendj-server-legacy/src/main/java/org/opends/server/types/InvokableMethod.java
File was deleted