| | |
| | | import java.io.File; |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | |
| | |
| | | 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; |
| | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 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; |
| | | |
| | |
| | | |
| | | |
| | | |
| | | 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 |
| | |
| | | // 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) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | retentionTime = retentionAttr.activeValue(); |
| | | retentionTime = retentionAttr.activeCalculatedValue(); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | |
| | | 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; |
| | | } |
| | |
| | | |
| | | |
| | | 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) |
| | | { |
| | |
| | | |
| | | 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) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | tmpRetentionTime = retentionTime; |
| | | tmpRetentionTime = retentionAttr.activeCalculatedValue(); |
| | | } |
| | | } |
| | | catch (Exception e) |