001/*
002 * Copyright 2015-2020 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright 2015-2020 Ping Identity Corporation
007 *
008 * Licensed under the Apache License, Version 2.0 (the "License");
009 * you may not use this file except in compliance with the License.
010 * You may obtain a copy of the License at
011 *
012 *    http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing, software
015 * distributed under the License is distributed on an "AS IS" BASIS,
016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017 * See the License for the specific language governing permissions and
018 * limitations under the License.
019 */
020/*
021 * Copyright (C) 2015-2020 Ping Identity Corporation
022 *
023 * This program is free software; you can redistribute it and/or modify
024 * it under the terms of the GNU General Public License (GPLv2 only)
025 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
026 * as published by the Free Software Foundation.
027 *
028 * This program is distributed in the hope that it will be useful,
029 * but WITHOUT ANY WARRANTY; without even the implied warranty of
030 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
031 * GNU General Public License for more details.
032 *
033 * You should have received a copy of the GNU General Public License
034 * along with this program; if not, see <http://www.gnu.org/licenses>.
035 */
036package com.unboundid.ldap.sdk.unboundidds.tasks;
037
038
039
040import java.util.ArrayList;
041import java.util.Arrays;
042import java.util.Collections;
043import java.util.Date;
044import java.util.LinkedHashMap;
045import java.util.List;
046import java.util.Map;
047
048import com.unboundid.ldap.sdk.Attribute;
049import com.unboundid.ldap.sdk.Entry;
050import com.unboundid.util.NotMutable;
051import com.unboundid.util.StaticUtils;
052import com.unboundid.util.ThreadSafety;
053import com.unboundid.util.ThreadSafetyLevel;
054import com.unboundid.util.Validator;
055
056import static com.unboundid.ldap.sdk.unboundidds.tasks.TaskMessages.*;
057
058
059
060/**
061 * This class defines a Directory Proxy Server task that can be used to reload
062 * the contents of the global index.
063 * <BR>
064 * <BLOCKQUOTE>
065 *   <B>NOTE:</B>  This class, and other classes within the
066 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
067 *   supported for use against Ping Identity, UnboundID, and
068 *   Nokia/Alcatel-Lucent 8661 server products.  These classes provide support
069 *   for proprietary functionality or for external specifications that are not
070 *   considered stable or mature enough to be guaranteed to work in an
071 *   interoperable way with other types of LDAP servers.
072 * </BLOCKQUOTE>
073 * <BR>
074 * The properties that are available for use with this type of task include:
075 * <UL>
076 *   <LI>The base DN for the entry-balancing request processor.</LI>
077 *   <LI>An optional set of attributes for which to reload the index
078 *       information.</LI>
079 *   <LI>A flag indicating whether to perform the reload in the background.</LI>
080 *   <LI>A flag indicating whether to reload entries from backend Directory
081 *       Server instances rather than a peer Directory Proxy Server
082 *       instance.</LI>
083 *   <LI>An optional maximum number of entries per second to access when
084 *       priming.</LI>
085 * </UL>
086 */
087@NotMutable()
088@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
089public final class ReloadGlobalIndexTask
090       extends Task
091{
092  /**
093   * The fully-qualified name of the Java class that is used for the re-encode
094   * entries task.
095   */
096  static final String RELOAD_GLOBAL_INDEX_TASK_CLASS =
097       "com.unboundid.directory.proxy.tasks.ReloadTask";
098
099
100
101  /**
102   * The name of the attribute used to indicate whether the reload should be
103   * done in the background.
104   */
105  private static final String ATTR_BACKGROUND_RELOAD =
106       "ds-task-reload-background";
107
108
109
110  /**
111   * The name of the attribute used to specify the base DN for the
112   * entry-balancing request processor.
113   */
114  private static final String ATTR_BASE_DN = "ds-task-reload-base-dn";
115
116
117
118  /**
119   * The name of the attribute used to specify the names of the attributes for
120   * which to reload the indexes.
121   */
122  private static final String ATTR_INDEX_NAME = "ds-task-reload-index-name";
123
124
125
126  /**
127   * The name of the attribute used to specify a target rate limit for the
128   * maximum number of entries per second.
129   */
130  private static final String ATTR_MAX_ENTRIES_PER_SECOND =
131       "ds-task-search-entry-per-second";
132
133
134
135  /**
136   * The name of the attribute used to indicate whether the data should be
137   * loaded from backend Directory Server instances rather than a peer Directory
138   * Proxy Server instance.
139   */
140  private static final String ATTR_RELOAD_FROM_DS = "ds-task-reload-from-ds";
141
142
143
144  /**
145   * The name of the object class used in reload global index task entries.
146   */
147  private static final String OC_RELOAD_GLOBAL_INDEX_TASK =
148       "ds-task-reload-index";
149
150
151
152  /**
153   * The task property that will be used for the request processor base DN.
154   */
155  private static final TaskProperty PROPERTY_BACKGROUND_RELOAD =
156       new TaskProperty(ATTR_BACKGROUND_RELOAD,
157            INFO_DISPLAY_NAME_RELOAD_GLOBAL_INDEX_BACKGROUND.get(),
158            INFO_DESCRIPTION_RELOAD_GLOBAL_INDEX_BACKGROUND.get(),
159            Boolean.class, false, false, false);
160
161
162
163  /**
164   * The task property that will be used for the request processor base DN.
165   */
166  private static final TaskProperty PROPERTY_BASE_DN = new TaskProperty(
167       ATTR_BASE_DN, INFO_DISPLAY_NAME_RELOAD_GLOBAL_INDEX_BASE_DN.get(),
168       INFO_DESCRIPTION_RELOAD_GLOBAL_INDEX_BASE_DN.get(), String.class, true,
169       false, false);
170
171
172
173  /**
174   * The task property that will be used for the request processor base DN.
175   */
176  private static final TaskProperty PROPERTY_INDEX_NAME = new TaskProperty(
177       ATTR_INDEX_NAME, INFO_DISPLAY_NAME_RELOAD_GLOBAL_INDEX_ATTR_NAME.get(),
178       INFO_DESCRIPTION_RELOAD_GLOBAL_INDEX_ATTR_NAME.get(), String.class,
179       false, true, false);
180
181
182
183  /**
184   * The task property that will be used for the request processor base DN.
185   */
186  private static final TaskProperty PROPERTY_MAX_ENTRIES_PER_SECOND =
187       new TaskProperty(ATTR_MAX_ENTRIES_PER_SECOND,
188            INFO_DISPLAY_NAME_RELOAD_GLOBAL_INDEX_MAX_ENTRIES_PER_SECOND.get(),
189            INFO_DESCRIPTION_RELOAD_GLOBAL_INDEX_MAX_ENTRIES_PER_SECOND.get(),
190            Long.class, false, false, false);
191
192
193
194  /**
195   * The task property that will be used for the request processor base DN.
196   */
197  static final TaskProperty PROPERTY_RELOAD_FROM_DS = new TaskProperty(
198       ATTR_RELOAD_FROM_DS,
199       INFO_DISPLAY_NAME_RELOAD_GLOBAL_INDEX_RELOAD_FROM_DS.get(),
200       INFO_DESCRIPTION_RELOAD_GLOBAL_INDEX_RELOAD_FROM_DS.get(), Boolean.class,
201       false, false, false);
202
203
204
205  /**
206   * The serial version UID for this serializable class.
207   */
208  private static final long serialVersionUID = 9152807987055252560L;
209
210
211
212  // Indicates whether to reload from backend Directory Server instances.
213  private final Boolean reloadFromDS;
214
215  // Indicates whether to reload in the background.
216  private final Boolean reloadInBackground;
217
218  // The names of the indexes to reload.
219  private final List<String> indexNames;
220
221  // The target maximum rate limit to use when loading entry data.
222  private final Long maxEntriesPerSecond;
223
224  // The base DN for the entry-balancing request processor.
225  private final String baseDN;
226
227
228
229  /**
230   * Creates a new uninitialized reload global index task instance which should
231   * only be used for obtaining general information about this task, including
232   * the task name, description, and supported properties.  Attempts to use a
233   * task created with this constructor for any other reason will likely fail.
234   */
235  public ReloadGlobalIndexTask()
236  {
237    reloadFromDS        = null;
238    reloadInBackground  = null;
239    indexNames          = null;
240    maxEntriesPerSecond = null;
241    baseDN              = null;
242  }
243
244
245
246  /**
247   * Creates a new reload global index task with the provided information.
248   *
249   * @param  taskID               The task ID to use for this task.  If it is
250   *                              {@code null} then a UUID will be generated for
251   *                              use as the task ID.
252   * @param  baseDN               The base DN of the entry-balancing request
253   *                              processor for which to reload index
254   *                              information.
255   * @param  indexNames           The names of the attributes for which to
256   *                              reload index data.  This may be {@code null}
257   *                              or empty to indicate that all indexes should
258   *                              be reloaded.
259   * @param  reloadFromDS         Indicates whether to load index data from
260   *                              backend Directory Server instances rather than
261   *                              a peer Directory Proxy Server instance.  This
262   *                              may be {@code null} to indicate that the
263   *                              Directory Proxy Server should automatically
264   *                              select the appropriate source for obtaining
265   *                              index data.
266   * @param  reloadInBackground   Indicates whether to perform the reload in
267   *                              the background, so that the task completes
268   *                              immediately.
269   * @param  maxEntriesPerSecond  The maximum target rate at which to reload
270   *                              index data (in entries per second).  A value
271   *                              of zero indicates no limit.  A value of
272   *                              {@code null} indicates that the Directory
273   *                              Proxy Server should attempt to determine the
274   *                              limit based on its configuration.
275   */
276  public ReloadGlobalIndexTask(final String taskID, final String baseDN,
277                               final List<String> indexNames,
278                               final Boolean reloadFromDS,
279                               final Boolean reloadInBackground,
280                               final Long maxEntriesPerSecond)
281  {
282    this(taskID, baseDN, indexNames, reloadFromDS, reloadInBackground,
283         maxEntriesPerSecond, null, null, null, null, null);
284  }
285
286
287
288  /**
289   * Creates a new reload global index task with the provided information.
290   *
291   * @param  taskID                  The task ID to use for this task.  If it is
292   *                                 {@code null} then a UUID will be generated
293   *                                 for use as the task ID.
294   * @param  baseDN                  The base DN of the entry-balancing request
295   *                                 processor for which to reload index
296   *                                 information.
297   * @param  indexNames              The names of the attributes for which to
298   *                                 reload index data.  This may be
299   *                                 {@code null} or empty to indicate that all
300   *                                 indexes should be reloaded.
301   * @param  reloadFromDS            Indicates whether to load index data from
302   *                                 backend Directory Server instances rather
303   *                                 than a peer Directory Proxy Server
304   *                                 instance.  This may be {@code null} to
305   *                                 indicate that the Directory Proxy Server
306   *                                 should automatically select the appropriate
307   *                                 source for obtaining index data.
308   * @param  reloadInBackground      Indicates whether to perform the reload in
309   *                                 the background, so that the task completes
310   *                                 immediately.
311   * @param  maxEntriesPerSecond     The maximum target rate at which to reload
312   *                                 index data (in entries per second).  A
313   *                                 value of zero indicates no limit.  A value
314   *                                 of {@code null} indicates that the
315   *                                 Directory Proxy Server should attempt to
316   *                                 determine the limit based on its
317   *                                 configuration.
318   * @param  scheduledStartTime      The time that this task should start
319   *                                 running.
320   * @param  dependencyIDs           The list of task IDs that will be required
321   *                                 to complete before this task will be
322   *                                 eligible to start.
323   * @param  failedDependencyAction  Indicates what action should be taken if
324   *                                 any of the dependencies for this task do
325   *                                 not complete successfully.
326   * @param  notifyOnCompletion      The list of e-mail addresses of individuals
327   *                                 that should be notified when this task
328   *                                 completes.
329   * @param  notifyOnError           The list of e-mail addresses of individuals
330   *                                 that should be notified if this task does
331   *                                 not complete successfully.
332   */
333  public ReloadGlobalIndexTask(final String taskID, final String baseDN,
334              final List<String> indexNames, final Boolean reloadFromDS,
335              final Boolean reloadInBackground, final Long maxEntriesPerSecond,
336              final Date scheduledStartTime,
337              final List<String> dependencyIDs,
338              final FailedDependencyAction failedDependencyAction,
339              final List<String> notifyOnCompletion,
340              final List<String> notifyOnError)
341  {
342    this(taskID, baseDN, indexNames, reloadFromDS, reloadInBackground,
343         maxEntriesPerSecond, scheduledStartTime, dependencyIDs,
344         failedDependencyAction, null, notifyOnCompletion, null,
345         notifyOnError, null, null, null);
346  }
347
348
349
350  /**
351   * Creates a new reload global index task with the provided information.
352   *
353   * @param  taskID                  The task ID to use for this task.  If it is
354   *                                 {@code null} then a UUID will be generated
355   *                                 for use as the task ID.
356   * @param  baseDN                  The base DN of the entry-balancing request
357   *                                 processor for which to reload index
358   *                                 information.
359   * @param  indexNames              The names of the attributes for which to
360   *                                 reload index data.  This may be
361   *                                 {@code null} or empty to indicate that all
362   *                                 indexes should be reloaded.
363   * @param  reloadFromDS            Indicates whether to load index data from
364   *                                 backend Directory Server instances rather
365   *                                 than a peer Directory Proxy Server
366   *                                 instance.  This may be {@code null} to
367   *                                 indicate that the Directory Proxy Server
368   *                                 should automatically select the appropriate
369   *                                 source for obtaining index data.
370   * @param  reloadInBackground      Indicates whether to perform the reload in
371   *                                 the background, so that the task completes
372   *                                 immediately.
373   * @param  maxEntriesPerSecond     The maximum target rate at which to reload
374   *                                 index data (in entries per second).  A
375   *                                 value of zero indicates no limit.  A value
376   *                                 of {@code null} indicates that the
377   *                                 Directory Proxy Server should attempt to
378   *                                 determine the limit based on its
379   *                                 configuration.
380   * @param  scheduledStartTime      The time that this task should start
381   *                                 running.
382   * @param  dependencyIDs           The list of task IDs that will be required
383   *                                 to complete before this task will be
384   *                                 eligible to start.
385   * @param  failedDependencyAction  Indicates what action should be taken if
386   *                                 any of the dependencies for this task do
387   *                                 not complete successfully.
388   * @param  notifyOnStart           The list of e-mail addresses of individuals
389   *                                 that should be notified when this task
390   *                                 starts running.
391   * @param  notifyOnCompletion      The list of e-mail addresses of individuals
392   *                                 that should be notified when this task
393   *                                 completes.
394   * @param  notifyOnSuccess         The list of e-mail addresses of individuals
395   *                                 that should be notified if this task
396   *                                 completes successfully.
397   * @param  notifyOnError           The list of e-mail addresses of individuals
398   *                                 that should be notified if this task does
399   *                                 not complete successfully.
400   * @param  alertOnStart            Indicates whether the server should send an
401   *                                 alert notification when this task starts.
402   * @param  alertOnSuccess          Indicates whether the server should send an
403   *                                 alert notification if this task completes
404   *                                 successfully.
405   * @param  alertOnError            Indicates whether the server should send an
406   *                                 alert notification if this task fails to
407   *                                 complete successfully.
408   */
409  public ReloadGlobalIndexTask(final String taskID, final String baseDN,
410              final List<String> indexNames, final Boolean reloadFromDS,
411              final Boolean reloadInBackground, final Long maxEntriesPerSecond,
412              final Date scheduledStartTime,
413              final List<String> dependencyIDs,
414              final FailedDependencyAction failedDependencyAction,
415              final List<String> notifyOnStart,
416              final List<String> notifyOnCompletion,
417              final List<String> notifyOnSuccess,
418              final List<String> notifyOnError, final Boolean alertOnStart,
419              final Boolean alertOnSuccess, final Boolean alertOnError)
420  {
421    super(taskID, RELOAD_GLOBAL_INDEX_TASK_CLASS, scheduledStartTime,
422         dependencyIDs, failedDependencyAction, notifyOnStart,
423         notifyOnCompletion, notifyOnSuccess, notifyOnError, alertOnStart,
424         alertOnSuccess, alertOnError);
425
426    Validator.ensureNotNull(baseDN);
427
428    this.baseDN              = baseDN;
429    this.reloadFromDS        = reloadFromDS;
430    this.reloadInBackground  = reloadInBackground;
431    this.maxEntriesPerSecond = maxEntriesPerSecond;
432
433    if (indexNames == null)
434    {
435      this.indexNames = Collections.emptyList();
436    }
437    else
438    {
439      this.indexNames =
440           Collections.unmodifiableList(new ArrayList<>(indexNames));
441    }
442  }
443
444
445
446  /**
447   * Creates a new reload global index task from the provided entry.
448   *
449   * @param  entry  The entry to use to create this reload global index task.
450   *
451   * @throws  TaskException  If the provided entry cannot be parsed as a reload
452   *                         global index task entry.
453   */
454  public ReloadGlobalIndexTask(final Entry entry)
455         throws TaskException
456  {
457    super(entry);
458
459    // Get the base DN.  It must be present.
460    baseDN = entry.getAttributeValue(ATTR_BASE_DN);
461    if (baseDN == null)
462    {
463      throw new TaskException(
464           ERR_RELOAD_GLOBAL_INDEX_MISSING_REQUIRED_ATTR.get(ATTR_BASE_DN));
465    }
466
467    // Get the names of the indexes to reload.  It may be empty or null.
468    final String[] nameArray = entry.getAttributeValues(ATTR_INDEX_NAME);
469    if ((nameArray == null) || (nameArray.length == 0))
470    {
471      indexNames = Collections.emptyList();
472    }
473    else
474    {
475      indexNames = Collections.unmodifiableList(Arrays.asList(nameArray));
476    }
477
478    // Get the flag indicating whether to reload from backend Directory Server
479    // instances.
480    reloadFromDS = entry.getAttributeValueAsBoolean(ATTR_RELOAD_FROM_DS);
481
482    // Get the flag indicating whether to reload in a background thread.
483    reloadInBackground =
484         entry.getAttributeValueAsBoolean(ATTR_BACKGROUND_RELOAD);
485
486    // Get the value specifying the maximum reload rate in entries per second.
487    maxEntriesPerSecond =
488         entry.getAttributeValueAsLong(ATTR_MAX_ENTRIES_PER_SECOND);
489  }
490
491
492
493  /**
494   * Creates a new reload global index task from the provided set of task
495   * properties.
496   *
497   * @param  properties  The set of task properties and their corresponding
498   *                     values to use for the task.  It must not be
499   *                     {@code null}.
500   *
501   * @throws  TaskException  If the provided set of properties cannot be used to
502   *                         create a valid reload global index task.
503   */
504  public ReloadGlobalIndexTask(final Map<TaskProperty,List<Object>> properties)
505         throws TaskException
506  {
507    super(RELOAD_GLOBAL_INDEX_TASK_CLASS, properties);
508
509    final List<String> attrs = new ArrayList<>(10);
510    Boolean background   = null;
511    Boolean fromDS       = null;
512    Long    maxPerSecond = null;
513    String  baseDNStr    = null;
514
515    for (final Map.Entry<TaskProperty,List<Object>> e : properties.entrySet())
516    {
517      final TaskProperty p = e.getKey();
518      final String attrName = p.getAttributeName();
519      final List<Object> values = e.getValue();
520
521      if (attrName.equalsIgnoreCase(ATTR_BASE_DN))
522      {
523        baseDNStr = parseString(p, values, null);
524      }
525      else if (attrName.equalsIgnoreCase(ATTR_INDEX_NAME))
526      {
527        final String[] nameArray = parseStrings(p, values, null);
528        if (nameArray != null)
529        {
530          attrs.addAll(Arrays.asList(nameArray));
531        }
532      }
533      else if (attrName.equalsIgnoreCase(ATTR_RELOAD_FROM_DS))
534      {
535        fromDS = parseBoolean(p, values, null);
536      }
537      else if (attrName.equalsIgnoreCase(ATTR_BACKGROUND_RELOAD))
538      {
539        background = parseBoolean(p, values, null);
540      }
541      else if (attrName.equalsIgnoreCase(ATTR_MAX_ENTRIES_PER_SECOND))
542      {
543        maxPerSecond = parseLong(p, values, null);
544      }
545    }
546
547    if (baseDNStr == null)
548    {
549      throw new TaskException(
550           ERR_RELOAD_GLOBAL_INDEX_MISSING_REQUIRED_PROPERTY.get(ATTR_BASE_DN));
551    }
552
553    baseDN              = baseDNStr;
554    indexNames          = Collections.unmodifiableList(attrs);
555    reloadFromDS        = fromDS;
556    reloadInBackground  = background;
557    maxEntriesPerSecond = maxPerSecond;
558  }
559
560
561
562  /**
563   * {@inheritDoc}
564   */
565  @Override()
566  public String getTaskName()
567  {
568    return INFO_TASK_NAME_RELOAD_GLOBAL_INDEX.get();
569  }
570
571
572
573  /**
574   * {@inheritDoc}
575   */
576  @Override()
577  public String getTaskDescription()
578  {
579    return INFO_TASK_DESCRIPTION_RELOAD_GLOBAL_INDEX.get();
580  }
581
582
583
584  /**
585   * Retrieves the base DN of the entry-balancing request processor for which to
586   * reload index data.
587   *
588   * @return  The base DN of the entry-balancing request processor for which to
589   *          reload index data.
590   */
591  public String getBaseDN()
592  {
593    return baseDN;
594  }
595
596
597
598  /**
599   * Retrieves the names of the indexes to be reloaded.
600   *
601   * @return  The names of the indexes to be reloaded, or an empty list if the
602   *          Directory Proxy Server should reload all indexes.
603   */
604  public List<String> getIndexNames()
605  {
606    return indexNames;
607  }
608
609
610
611  /**
612   * Indicates whether to reload index information from backend Directory
613   * Servers rather than a peer Directory Proxy Server.
614   *
615   * @return  {@code true} if the index information should be reloaded from
616   *          backend Directory Servers, {@code false} if the index information
617   *          should be reloaded from a peer Directory Proxy Server instance, or
618   *          {@code null} if the Directory Proxy Server should automatically
619   *          determine the reload data source.
620   */
621  public Boolean reloadFromDS()
622  {
623    return reloadFromDS;
624  }
625
626
627
628  /**
629   * Indicates whether to perform the index reload processing in the background.
630   *
631   * @return  {@code true} if the index reload processing should be performed
632   *          in the background (so that the task completes immediately),
633   *          {@code false} if not, or {@code null} if the Directory Proxy
634   *          Server should determine whether to perform the reload in the
635   *          background.
636   */
637  public Boolean reloadInBackground()
638  {
639    return reloadInBackground;
640  }
641
642
643
644  /**
645   * Retrieves the maximum reload rate in entries per second, if defined.
646   *
647   * @return  The maximum rate at which to reload index data, in entries per
648   *          second, zero if no limit should be imposed, or {@code null} if the
649   *          Directory Proxy Server should determine the maximum reload rate.
650   */
651  public Long getMaxEntriesPerSecond()
652  {
653    return maxEntriesPerSecond;
654  }
655
656
657
658  /**
659   * {@inheritDoc}
660   */
661  @Override()
662  protected List<String> getAdditionalObjectClasses()
663  {
664    return Collections.singletonList(OC_RELOAD_GLOBAL_INDEX_TASK);
665  }
666
667
668
669  /**
670   * {@inheritDoc}
671   */
672  @Override()
673  protected List<Attribute> getAdditionalAttributes()
674  {
675    final ArrayList<Attribute> attrList = new ArrayList<>(5);
676
677    attrList.add(new Attribute(ATTR_BASE_DN, baseDN));
678
679    if (! indexNames.isEmpty())
680    {
681      attrList.add(new Attribute(ATTR_INDEX_NAME, indexNames));
682    }
683
684    if (reloadFromDS != null)
685    {
686      attrList.add(new Attribute(ATTR_RELOAD_FROM_DS,
687           String.valueOf(reloadFromDS)));
688    }
689
690    if (reloadInBackground != null)
691    {
692      attrList.add(new Attribute(ATTR_BACKGROUND_RELOAD,
693           String.valueOf(reloadInBackground)));
694    }
695
696    if (maxEntriesPerSecond != null)
697    {
698      attrList.add(new Attribute(ATTR_MAX_ENTRIES_PER_SECOND,
699           String.valueOf(maxEntriesPerSecond)));
700    }
701
702    return attrList;
703  }
704
705
706
707  /**
708   * {@inheritDoc}
709   */
710  @Override()
711  public List<TaskProperty> getTaskSpecificProperties()
712  {
713    return Collections.unmodifiableList(Arrays.asList(
714         PROPERTY_BASE_DN,
715         PROPERTY_INDEX_NAME,
716         PROPERTY_RELOAD_FROM_DS,
717         PROPERTY_BACKGROUND_RELOAD,
718         PROPERTY_MAX_ENTRIES_PER_SECOND));
719  }
720
721
722
723  /**
724   * {@inheritDoc}
725   */
726  @Override()
727  public Map<TaskProperty,List<Object>> getTaskPropertyValues()
728  {
729    final LinkedHashMap<TaskProperty,List<Object>> props =
730         new LinkedHashMap<>(StaticUtils.computeMapCapacity(15));
731
732    props.put(PROPERTY_BASE_DN,
733         Collections.<Object>singletonList(baseDN));
734    props.put(PROPERTY_INDEX_NAME,
735         Collections.<Object>unmodifiableList(indexNames));
736
737    if (reloadFromDS == null)
738    {
739      props.put(PROPERTY_RELOAD_FROM_DS,
740           Collections.emptyList());
741    }
742    else
743    {
744      props.put(PROPERTY_RELOAD_FROM_DS,
745           Collections.<Object>singletonList(reloadFromDS));
746    }
747
748    if (reloadInBackground == null)
749    {
750      props.put(PROPERTY_BACKGROUND_RELOAD,
751           Collections.emptyList());
752    }
753    else
754    {
755      props.put(PROPERTY_BACKGROUND_RELOAD,
756           Collections.<Object>singletonList(reloadInBackground));
757    }
758
759    if (maxEntriesPerSecond == null)
760    {
761      props.put(PROPERTY_MAX_ENTRIES_PER_SECOND,
762           Collections.emptyList());
763    }
764    else
765    {
766      props.put(PROPERTY_MAX_ENTRIES_PER_SECOND,
767           Collections.<Object>singletonList(maxEntriesPerSecond));
768    }
769
770    props.putAll(super.getTaskPropertyValues());
771    return Collections.unmodifiableMap(props);
772  }
773}