throws ConfigException
{
Validator.ensureNotNull(config);
Validator.ensureTrue(config instanceof TaskBackendCfg);
TaskBackendCfg cfg = (TaskBackendCfg)config;
DN[] baseDNs = new DN[cfg.getBaseDN().size()];
cfg.getBaseDN().toArray(baseDNs);
ConfigEntry configEntry = DirectoryServer.getConfigEntry(cfg.dn());
configEntryDN = configEntry.getDN();
// Make sure that the provided set of base DNs contains exactly one value.
// We will only allow one base for task entries.
if ((baseDNs == null) || (baseDNs.length == 0))
{
Message message = ERR_TASKBE_NO_BASE_DNS.get();
throw new ConfigException(message);
}
else if (baseDNs.length > 1)
{
Message message = ERR_TASKBE_MULTIPLE_BASE_DNS.get();
throw new ConfigException(message);
}
else
{
this.baseDNs = baseDNs;
taskRootDN = baseDNs[0];
String recurringTaskBaseString = RECURRING_TASK_BASE_RDN + "," +
taskRootDN.toString();
try
{
recurringTaskParentDN = DN.decode(recurringTaskBaseString);
}
catch (Exception e)
{
if (debugEnabled())
{
TRACER.debugCaught(DebugLogLevel.ERROR, e);
}
// This should never happen.
Message message = ERR_TASKBE_CANNOT_DECODE_RECURRING_TASK_BASE_DN.get(
String.valueOf(recurringTaskBaseString), getExceptionMessage(e));
throw new ConfigException(message, e);
}
String scheduledTaskBaseString = SCHEDULED_TASK_BASE_RDN + "," +
taskRootDN.toString();
try
{
scheduledTaskParentDN = DN.decode(scheduledTaskBaseString);
}
catch (Exception e)
{
if (debugEnabled())
{
TRACER.debugCaught(DebugLogLevel.ERROR, e);
}
// This should never happen.
Message message = ERR_TASKBE_CANNOT_DECODE_SCHEDULED_TASK_BASE_DN.get(
String.valueOf(scheduledTaskBaseString), getExceptionMessage(e));
throw new ConfigException(message, e);
}
}
// Get the retention time that will be used to determine how long task
// information stays around once the associated task is completed.
retentionTime = cfg.getTaskRetentionTime();
// Get the notification sender address.
notificationSenderAddress = cfg.getNotificationSenderAddress();
if (notificationSenderAddress == null)
{
try
{
notificationSenderAddress = "nasutekds-task-notification@" +
InetAddress.getLocalHost().getCanonicalHostName();
}
catch (Exception e)
{
notificationSenderAddress = "nasutekds-task-notification@nasutekds.org";
}
}
// Get the path to the task data backing file.
taskBackingFile = cfg.getTaskBackingFile();
// Define an empty sets for the supported controls and features.
supportedControls = new HashSet<String>(0);
supportedFeatures = new HashSet<String>(0);