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

neil_a_wilson
16.22.2006 176919e2700e49462eadc0f412237579e4d76165
Update the task backend to change the format of the ds-cfg-task-retention-time
configuration attribute from an integer (with the value specified in seconds)
to an integer with unit (specified as an integer value followed by a unit of
"seconds", "minutes", "hours", "days", or "weeks"). Also change the syntax of
the attribute in the schema from integer to directory string.
3 files modified
72 ■■■■■ changed files
opends/resource/config/config.ldif 2 ●●● patch | view | raw | blame | history
opends/resource/schema/02-config.ldif 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/task/TaskBackend.java 68 ●●●●● patch | view | raw | blame | history
opends/resource/config/config.ldif
@@ -233,7 +233,7 @@
ds-cfg-backend-writability-mode: enabled
ds-cfg-backend-base-dn: cn=tasks
ds-cfg-task-backing-file: config/tasks.ldif
ds-cfg-task-retention-time: 86400
ds-cfg-task-retention-time: 24 hours
dn: cn=Connection Handlers,cn=config
objectClass: top
opends/resource/schema/02-config.ldif
@@ -355,7 +355,7 @@
  NAME 'ds-task-notify-on-error' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
  X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.106
  NAME 'ds-cfg-task-retention-time' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
  NAME 'ds-cfg-task-retention-time' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
  X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.107
  NAME 'ds-task-scheduled-start-time' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
opends/src/server/org/opends/server/backends/task/TaskBackend.java
@@ -31,6 +31,7 @@
import java.io.File;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
@@ -39,7 +40,7 @@
import org.opends.server.config.ConfigAttribute;
import org.opends.server.config.ConfigEntry;
import org.opends.server.config.ConfigException;
import org.opends.server.config.IntegerConfigAttribute;
import org.opends.server.config.IntegerWithUnitConfigAttribute;
import org.opends.server.config.StringConfigAttribute;
import org.opends.server.core.AddOperation;
import org.opends.server.core.CancelledOperationException;
@@ -88,6 +89,15 @@
  /**
   * The set of time units that will be used for expressing the task retention
   * time.
   */
  private static final LinkedHashMap<String,Double> timeUnits =
       new LinkedHashMap<String,Double>();
  // The DN of the configuration entry for this backend.
  private DN configEntryDN;
@@ -124,6 +134,17 @@
  static
  {
    timeUnits.put("seconds", 1.0);
    timeUnits.put("minutes", 60.0);
    timeUnits.put("hours", (60.0*60.0));
    timeUnits.put("days", (24.0*60.0*60.0));
    timeUnits.put("weeks", (7.0*24.0*60.0*60.0));
  }
  /**
   * Creates a new backend with the provided information.  All backend
   * implementations must implement a default constructor that use
@@ -237,13 +258,14 @@
    // Get the retention time that will be used to determine how long task
    // information stays around once the associated task is completed.
    int msgID = MSGID_TASKBE_DESCRIPTION_RETENTION_TIME;
    IntegerConfigAttribute retentionStub =
         new IntegerConfigAttribute(ATTR_TASK_RETENTION_TIME, getMessage(msgID),
                                    true, false, false, true, 0, false, 0);
    IntegerWithUnitConfigAttribute retentionStub =
         new IntegerWithUnitConfigAttribute(ATTR_TASK_RETENTION_TIME,
                                            getMessage(msgID), false, timeUnits,
                                            true, 0, false, 0);
    try
    {
      IntegerConfigAttribute retentionAttr =
           (IntegerConfigAttribute)
      IntegerWithUnitConfigAttribute retentionAttr =
           (IntegerWithUnitConfigAttribute)
           configEntry.getConfigAttribute(retentionStub);
      if (retentionAttr == null)
      {
@@ -251,7 +273,7 @@
      }
      else
      {
        retentionTime = retentionAttr.activeValue();
        retentionTime = retentionAttr.activeCalculatedValue();
      }
    }
    catch (Exception e)
@@ -1260,9 +1282,11 @@
                                           taskBackingFile));
    description = getMessage(MSGID_TASKBE_DESCRIPTION_RETENTION_TIME);
    attrList.add(new IntegerConfigAttribute(ATTR_TASK_RETENTION_TIME,
                                            description, true, false, false,
                                            true, 0, false, 0, retentionTime));
    attrList.add(new IntegerWithUnitConfigAttribute(ATTR_TASK_RETENTION_TIME,
                                                    description, false,
                                                    timeUnits, true, 0, false,
                                                    0, retentionTime,
                                                    "seconds"));
    return attrList;
  }
@@ -1363,13 +1387,14 @@
    description = getMessage(MSGID_TASKBE_DESCRIPTION_RETENTION_TIME);
    IntegerConfigAttribute retentionStub =
         new IntegerConfigAttribute(ATTR_TASK_RETENTION_TIME, description,
                                    true, false, false, true, 0, false, 0);
    IntegerWithUnitConfigAttribute retentionStub =
         new IntegerWithUnitConfigAttribute(ATTR_TASK_RETENTION_TIME,
                                            description, false, timeUnits,
                                            true, 0, false, 0);
    try
    {
      IntegerConfigAttribute retentionAttr =
           (IntegerConfigAttribute)
      IntegerWithUnitConfigAttribute retentionAttr =
           (IntegerWithUnitConfigAttribute)
           configEntry.getConfigAttribute(retentionStub);
      if (retentionAttr == null)
      {
@@ -1494,13 +1519,14 @@
    long tmpRetentionTime = retentionTime;
    description = getMessage(MSGID_TASKBE_DESCRIPTION_RETENTION_TIME);
    IntegerConfigAttribute retentionStub =
         new IntegerConfigAttribute(ATTR_TASK_RETENTION_TIME, description,
                                    true, false, false, true, 0, false, 0);
    IntegerWithUnitConfigAttribute retentionStub =
         new IntegerWithUnitConfigAttribute(ATTR_TASK_RETENTION_TIME,
                                            description, false, timeUnits,
                                            true, 0, false, 0);
    try
    {
      IntegerConfigAttribute retentionAttr =
           (IntegerConfigAttribute)
      IntegerWithUnitConfigAttribute retentionAttr =
           (IntegerWithUnitConfigAttribute)
           configEntry.getConfigAttribute(retentionStub);
      if (retentionAttr == null)
      {
@@ -1514,7 +1540,7 @@
      }
      else
      {
        tmpRetentionTime = retentionTime;
        tmpRetentionTime = retentionAttr.activeCalculatedValue();
      }
    }
    catch (Exception e)