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

mrossign
22.35.2009 97024e80c3bdb5ad19b0eb42137f6e32f5f725b2
opends/resource/schema/02-config.ldif
@@ -2444,6 +2444,11 @@
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
  SINGLE-VALUE
  X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.600
  NAME 'ds-cfg-plugin-order-ldif-import-begin'
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
  SINGLE-VALUE
  X-ORIGIN 'OpenDS Directory Server' )
objectClasses: ( 1.3.6.1.4.1.26027.1.2.1
  NAME 'ds-cfg-access-control-handler'
  SUP top
@@ -3502,6 +3507,7 @@
        ds-cfg-plugin-order-post-disconnect $
        ds-cfg-plugin-order-ldif-import $
        ds-cfg-plugin-order-ldif-import-end $
        ds-cfg-plugin-order-ldif-import-begin $
        ds-cfg-plugin-order-ldif-export $
        ds-cfg-plugin-order-pre-parse-abandon $
        ds-cfg-plugin-order-pre-parse-add $
opends/src/admin/defn/org/opends/server/admin/std/PluginConfiguration.xml
@@ -121,6 +121,11 @@
            Invoked at the end of an LDIF import session.
          </adm:synopsis>
        </adm:value>
        <adm:value name="ldifimportbegin">
          <adm:synopsis>
            Invoked at the beginning of an LDIF import session.
          </adm:synopsis>
        </adm:value>
        <adm:value name="ldifexport">
          <adm:synopsis>
            Invoked for each operation to be written during an LDIF
opends/src/admin/defn/org/opends/server/admin/std/PluginRootConfiguration.xml
@@ -233,6 +233,35 @@
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="plugin-order-ldif-import-begin">
    <adm:synopsis>
      Specifies the order in which LDIF import begin plug-ins are to be loaded
      and invoked.
    </adm:synopsis>
    <adm:description>
      The value is a comma-delimited list of plug-in
      names (where the plug-in name is the RDN value from the plug-in
      configuration entry DN). The list can include at most one asterisk
      to indicate the position of any unspecified plug-in (and the
      relative order of those unspecified plug-ins is undefined).
    </adm:description>
    <adm:default-behavior>
      <adm:alias>
        <adm:synopsis>
          The order in which LDIF import begin plug-ins are loaded and invoked
          is undefined.
        </adm:synopsis>
      </adm:alias>
    </adm:default-behavior>
    <adm:syntax>
      <adm:string />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:name>ds-cfg-plugin-order-ldif-import-begin</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="plugin-order-ldif-export">
    <adm:synopsis>
      Specifies the order in which LDIF export plug-ins are to be loaded
opends/src/server/org/opends/server/api/plugin/DirectoryServerPlugin.java
@@ -348,6 +348,22 @@
  }
  /**
   * Starts an import session.
   * Performs any necessary processing that should be done at the
   * beginning of an LDIF import session based on the provided
   * configuration.
   *
   * @param  importConfig  The configuration used for the LDIF import.
   */
  public void doLDIFImportBegin(LDIFImportConfig importConfig)
  {
    Message message = ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
        String.valueOf(pluginDN),
        PluginType.LDIF_IMPORT_BEGIN.getName());
    throw new UnsupportedOperationException(message.toString());
  }
  /**
   * Performs any necessary processing that should be done during an
   * LDIF export operation immediately after determining that the
   * provided entry should be included in the export.
opends/src/server/org/opends/server/api/plugin/PluginType.java
@@ -94,6 +94,14 @@
  /**
   * The plugin type for plugins that are to be invoked for each
   * import session beginning.
   */
  LDIF_IMPORT_BEGIN("ldifimportbegin"),
  /**
   * The plugin type for plugins that are to be invoked for each entry
   * written during an LDIF export.
   */
opends/src/server/org/opends/server/core/PluginConfigManager.java
@@ -91,6 +91,7 @@
  private DirectoryServerPlugin[] postDisconnectPlugins;
  private DirectoryServerPlugin[] ldifImportPlugins;
  private DirectoryServerPlugin[] ldifImportEndPlugins;
  private DirectoryServerPlugin[] ldifImportBeginPlugins;
  private DirectoryServerPlugin[] ldifExportPlugins;
  private DirectoryServerPlugin[] preParseAbandonPlugins;
  private DirectoryServerPlugin[] preParseAddPlugins;
@@ -176,6 +177,7 @@
    postDisconnectPlugins              = new DirectoryServerPlugin[0];
    ldifImportPlugins                  = new DirectoryServerPlugin[0];
    ldifImportEndPlugins               = new DirectoryServerPlugin[0];
    ldifImportBeginPlugins             = new DirectoryServerPlugin[0];
    ldifExportPlugins                  = new DirectoryServerPlugin[0];
    preParseAbandonPlugins             = new DirectoryServerPlugin[0];
    preParseAddPlugins                 = new DirectoryServerPlugin[0];
@@ -426,6 +428,7 @@
      case POSTDISCONNECT:         return PluginType.POST_DISCONNECT;
      case LDIFIMPORT:             return PluginType.LDIF_IMPORT;
      case LDIFIMPORTEND:          return PluginType.LDIF_IMPORT_END;
      case LDIFIMPORTBEGIN:        return PluginType.LDIF_IMPORT_BEGIN;
      case LDIFEXPORT:             return PluginType.LDIF_EXPORT;
      case PREPARSEABANDON:        return PluginType.PRE_PARSE_ABANDON;
      case PREPARSEADD:            return PluginType.PRE_PARSE_ADD;
@@ -603,6 +606,11 @@
                 addPlugin(ldifImportEndPlugins, plugin, t,
                           pluginRootConfig.getPluginOrderLDIFImportEnd());
            break;
          case LDIF_IMPORT_BEGIN:
            ldifImportBeginPlugins =
                 addPlugin(ldifImportBeginPlugins, plugin, t,
                           pluginRootConfig.getPluginOrderLDIFImportBegin());
            break;
          case LDIF_EXPORT:
            ldifExportPlugins =
                 addPlugin(ldifExportPlugins, plugin, t,
@@ -1099,6 +1107,10 @@
          case LDIF_IMPORT_END:
            ldifImportEndPlugins = removePlugin(ldifImportEndPlugins, plugin);
            break;
          case LDIF_IMPORT_BEGIN:
            ldifImportBeginPlugins =
              removePlugin(ldifImportBeginPlugins, plugin);
            break;
          case LDIF_EXPORT:
            ldifExportPlugins = removePlugin(ldifExportPlugins, plugin);
            break;
@@ -1569,7 +1581,7 @@
/**
  /**
   * Invokes the set of LDIF import plugins that have been configured in the
   * Directory Server.
   *
@@ -1651,6 +1663,24 @@
  /**
   * Invokes the LDIF import session initialization of LDIF import plugins that
   * have been configured in the Directory Server.
   *
   * @param  importConfig  The LDIF import configuration used for the LDIF
   *                       import session.
   */
  public void invokeLDIFImportBeginPlugins(
      LDIFImportConfig importConfig)
  {
    for (DirectoryServerPlugin p : ldifImportBeginPlugins)
    {
      p.doLDIFImportBegin(importConfig);
    }
  }
  /**
   * Invokes the set of LDIF export plugins that have been configured in the
   * Directory Server.
   *
opends/src/server/org/opends/server/util/LDIFReader.java
@@ -144,6 +144,12 @@
    lastEntryBodyLines   = new LinkedList<StringBuilder>();
    lastEntryHeaderLines = new LinkedList<StringBuilder>();
    pluginConfigManager  = DirectoryServer.getPluginConfigManager();
    // If we should invoke import plugins, then do so.
    if (importConfig.invokeImportPlugins())
    {
      // Inform LDIF import plugins that an import session is ending
      pluginConfigManager.invokeLDIFImportBeginPlugins(importConfig);
    }
  }
@@ -175,6 +181,12 @@
    this.pluginConfigManager  = DirectoryServer.getPluginConfigManager();
    this.buffer        = new byte[size];
    this.rootContainer = rootContainer;
    // If we should invoke import plugins, then do so.
    if (importConfig.invokeImportPlugins())
    {
      // Inform LDIF import plugins that an import session is ending
      this.pluginConfigManager.invokeLDIFImportBeginPlugins(importConfig);
    }
  }
@@ -1477,8 +1489,12 @@
   */
  public void close()
  {
    // Inform LDIF import plugins that an import session is ending
    pluginConfigManager.invokeLDIFImportEndPlugins(importConfig);
    // If we should invoke import plugins, then do so.
    if (importConfig.invokeImportPlugins())
    {
      // Inform LDIF import plugins that an import session is ending
      pluginConfigManager.invokeLDIFImportEndPlugins(importConfig);
    }
    importConfig.close();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/api/plugin/DirectoryServerPluginTestCase.java
@@ -231,6 +231,12 @@
    expectedPublicMethods.add(sigList);
    sigList = new LinkedList<String>();
    sigList.add("doLDIFImportBegin");
    sigList.add("void");
    sigList.add("org.opends.server.types.LDIFImportConfig");
    expectedPublicMethods.add(sigList);
    sigList = new LinkedList<String>();
    sigList.add("doLDIFExport");
    sigList.add("org.opends.server.api.plugin.PluginResult$ImportLDIF");
    sigList.add("org.opends.server.types.LDIFExportConfig");