| | |
| | | |
| | | 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.ConfigException; |
| | | import org.opends.server.config.DNConfigAttribute; |
| | | import org.opends.server.config.IntegerConfigAttribute; |
| | | import org.opends.server.config.IntegerWithUnitConfigAttribute; |
| | | import org.opends.server.config.MultiChoiceConfigAttribute; |
| | | import org.opends.server.types.AcceptRejectWarn; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | |
| | | |
| | | |
| | | |
| | | /** |
| | | * The set of time units that will be used for the appropriate attributes. |
| | | */ |
| | | private static final LinkedHashMap<String,Double> timeUnits = |
| | | new LinkedHashMap<String,Double>(); |
| | | |
| | | |
| | | |
| | | // The DN of the associated configuration entry. |
| | | private DN configEntryDN; |
| | | |
| | | |
| | | |
| | | static |
| | | { |
| | | timeUnits.put(TIME_UNIT_SECONDS_ABBR, 1D); |
| | | timeUnits.put(TIME_UNIT_SECONDS_FULL, 1D); |
| | | timeUnits.put(TIME_UNIT_MINUTES_ABBR, 60D); |
| | | timeUnits.put(TIME_UNIT_MINUTES_FULL, 60D); |
| | | timeUnits.put(TIME_UNIT_HOURS_ABBR, (double) (60 * 60)); |
| | | timeUnits.put(TIME_UNIT_HOURS_FULL, (double) (60 * 60)); |
| | | timeUnits.put(TIME_UNIT_DAYS_ABBR, (double) (60 * 60 * 24)); |
| | | timeUnits.put(TIME_UNIT_DAYS_FULL, (double) (60 * 60 * 24)); |
| | | timeUnits.put(TIME_UNIT_WEEKS_ABBR, (double) (60 * 60 * 24 * 7)); |
| | | timeUnits.put(TIME_UNIT_WEEKS_FULL, (double) (60 * 60 * 24 * 7)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this core config manager. |
| | | */ |
| | |
| | | msgID = MSGID_CONFIG_CORE_DESCRIPTION_SIZE_LIMIT; |
| | | IntegerConfigAttribute sizeLimitStub = |
| | | new IntegerConfigAttribute(ATTR_SIZE_LIMIT, getMessage(msgID), true, |
| | | false, false, true, -1, true, |
| | | false, false, true, 0, true, |
| | | Integer.MAX_VALUE); |
| | | try |
| | | { |
| | |
| | | |
| | | // Determine the default server time limit. |
| | | msgID = MSGID_CONFIG_CORE_DESCRIPTION_TIME_LIMIT; |
| | | IntegerConfigAttribute timeLimitStub = |
| | | new IntegerConfigAttribute(ATTR_TIME_LIMIT, getMessage(msgID), true, |
| | | false, false, true, -1, true, |
| | | Integer.MAX_VALUE); |
| | | IntegerWithUnitConfigAttribute timeLimitStub = |
| | | new IntegerWithUnitConfigAttribute(ATTR_TIME_LIMIT, getMessage(msgID), |
| | | false, timeUnits, true, 0, true, |
| | | Integer.MAX_VALUE); |
| | | try |
| | | { |
| | | IntegerConfigAttribute timeLimitAttr = |
| | | (IntegerConfigAttribute) |
| | | IntegerWithUnitConfigAttribute timeLimitAttr = |
| | | (IntegerWithUnitConfigAttribute) |
| | | configRoot.getConfigAttribute(timeLimitStub); |
| | | if (timeLimitAttr == null) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | DirectoryServer.setTimeLimit(timeLimitAttr.activeIntValue()); |
| | | DirectoryServer.setTimeLimit( |
| | | (int) timeLimitAttr.activeCalculatedValue()); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | |
| | | msgID = MSGID_CONFIG_CORE_DESCRIPTION_SIZE_LIMIT; |
| | | IntegerConfigAttribute sizeLimitStub = |
| | | new IntegerConfigAttribute(ATTR_SIZE_LIMIT, getMessage(msgID), false, |
| | | false, false, true, -1, true, |
| | | false, false, true, 0, true, |
| | | Integer.MAX_VALUE); |
| | | try |
| | | { |
| | |
| | | |
| | | // Add the server time limit. |
| | | msgID = MSGID_CONFIG_CORE_DESCRIPTION_TIME_LIMIT; |
| | | IntegerConfigAttribute timeLimitStub = |
| | | new IntegerConfigAttribute(ATTR_TIME_LIMIT, getMessage(msgID), false, |
| | | false, false, true, -1, true, |
| | | Integer.MAX_VALUE); |
| | | IntegerWithUnitConfigAttribute timeLimitStub = |
| | | new IntegerWithUnitConfigAttribute(ATTR_TIME_LIMIT, getMessage(msgID), |
| | | false, timeUnits, true, 0, true, |
| | | Integer.MAX_VALUE); |
| | | try |
| | | { |
| | | IntegerConfigAttribute timeLimitAttr = |
| | | (IntegerConfigAttribute) |
| | | IntegerWithUnitConfigAttribute timeLimitAttr = |
| | | (IntegerWithUnitConfigAttribute) |
| | | configEntry.getConfigAttribute(timeLimitStub); |
| | | if (timeLimitAttr == null) |
| | | { |
| | | timeLimitStub.setValue(DirectoryServer.getTimeLimit()); |
| | | timeLimitStub.setValue(DirectoryServer.getTimeLimit(), |
| | | TIME_UNIT_SECONDS_FULL); |
| | | timeLimitAttr = timeLimitStub; |
| | | } |
| | | |
| | |
| | | msgID = MSGID_CONFIG_CORE_DESCRIPTION_SIZE_LIMIT; |
| | | IntegerConfigAttribute sizeLimitStub = |
| | | new IntegerConfigAttribute(ATTR_SIZE_LIMIT, getMessage(msgID), false, |
| | | false, false, true, -1, true, |
| | | false, false, true, 0, true, |
| | | Integer.MAX_VALUE); |
| | | try |
| | | { |
| | |
| | | // See if the entry specifies the server time limit. If so, them make sure |
| | | // it's valid. |
| | | msgID = MSGID_CONFIG_CORE_DESCRIPTION_TIME_LIMIT; |
| | | IntegerConfigAttribute timeLimitStub = |
| | | new IntegerConfigAttribute(ATTR_TIME_LIMIT, getMessage(msgID), false, |
| | | false, false, true, -1, true, |
| | | Integer.MAX_VALUE); |
| | | IntegerWithUnitConfigAttribute timeLimitStub = |
| | | new IntegerWithUnitConfigAttribute(ATTR_TIME_LIMIT, getMessage(msgID), |
| | | false,timeUnits, true, 0, true, |
| | | Integer.MAX_VALUE); |
| | | try |
| | | { |
| | | IntegerConfigAttribute timeLimitAttr = |
| | | (IntegerConfigAttribute) |
| | | IntegerWithUnitConfigAttribute timeLimitAttr = |
| | | (IntegerWithUnitConfigAttribute) |
| | | configEntry.getConfigAttribute(timeLimitStub); |
| | | } |
| | | catch (Exception e) |
| | |
| | | msgID = MSGID_CONFIG_CORE_DESCRIPTION_SIZE_LIMIT; |
| | | IntegerConfigAttribute sizeLimitStub = |
| | | new IntegerConfigAttribute(ATTR_SIZE_LIMIT, getMessage(msgID), false, |
| | | false, false, true, -1, true, |
| | | false, false, true, 0, true, |
| | | Integer.MAX_VALUE); |
| | | try |
| | | { |
| | |
| | | // Get the server time limit. |
| | | int timeLimit = DEFAULT_TIME_LIMIT; |
| | | msgID = MSGID_CONFIG_CORE_DESCRIPTION_TIME_LIMIT; |
| | | IntegerConfigAttribute timeLimitStub = |
| | | new IntegerConfigAttribute(ATTR_TIME_LIMIT, getMessage(msgID), false, |
| | | false, false, true, -1, true, |
| | | Integer.MAX_VALUE); |
| | | IntegerWithUnitConfigAttribute timeLimitStub = |
| | | new IntegerWithUnitConfigAttribute(ATTR_TIME_LIMIT, getMessage(msgID), |
| | | false, timeUnits, true, 0, true, |
| | | Integer.MAX_VALUE); |
| | | try |
| | | { |
| | | IntegerConfigAttribute timeLimitAttr = |
| | | (IntegerConfigAttribute) |
| | | IntegerWithUnitConfigAttribute timeLimitAttr = |
| | | (IntegerWithUnitConfigAttribute) |
| | | configEntry.getConfigAttribute(timeLimitStub); |
| | | if (timeLimitAttr != null) |
| | | { |
| | | timeLimit = timeLimitAttr.pendingIntValue(); |
| | | timeLimit = (int) timeLimitAttr.pendingCalculatedValue(); |
| | | } |
| | | } |
| | | catch (Exception e) |