| | |
| | | private DN[] baseDNs; |
| | | |
| | | /** The mapping between parent DNs and their immediate children. */ |
| | | private final Map<DN, Set<DN>> childDNs; |
| | | private final Map<DN, Set<DN>> childDNs = new HashMap<>(); |
| | | |
| | | /** The base DNs for this backend, in a hash set. */ |
| | | private Set<DN> baseDNSet; |
| | |
| | | private LDIFBackendCfg currentConfig; |
| | | |
| | | /** The mapping between entry DNs and the corresponding entries. */ |
| | | private final Map<DN, Entry> entryMap; |
| | | private final Map<DN, Entry> entryMap = new LinkedHashMap<>(); |
| | | |
| | | /** A read-write lock used to protect access to this backend. */ |
| | | private final ReentrantReadWriteLock backendLock; |
| | | private final ReentrantReadWriteLock backendLock = new ReentrantReadWriteLock(); |
| | | |
| | | /** The path to the LDIF file containing the data for this backend. */ |
| | | private String ldifFilePath; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new backend with the provided information. All backend |
| | | * implementations must implement a default constructor that use |
| | |
| | | */ |
| | | public LDIFBackend() |
| | | { |
| | | entryMap = new LinkedHashMap<DN,Entry>(); |
| | | childDNs = new HashMap<DN, Set<DN>>(); |
| | | backendLock = new ReentrantReadWriteLock(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | |
| | | Set<DN> childDNSet = childDNs.get(parentDN); |
| | | if (childDNSet == null) |
| | | { |
| | | childDNSet = new HashSet<DN>(); |
| | | childDNSet = new HashSet<>(); |
| | | childDNs.put(parentDN, childDNSet); |
| | | } |
| | | childDNSet.add(entryDN); |
| | |
| | | parentChildDNs = childDNs.get(newParentDN); |
| | | if (parentChildDNs == null) |
| | | { |
| | | parentChildDNs = new HashSet<DN>(); |
| | | parentChildDNs = new HashSet<>(); |
| | | childDNs.put(newParentDN, parentChildDNs); |
| | | } |
| | | parentChildDNs.add(newDN); |
| | |
| | | Set<DN> parentChildren = childDNs.get(newParentDN); |
| | | if (parentChildren == null) |
| | | { |
| | | parentChildren = new HashSet<DN>(); |
| | | parentChildren = new HashSet<>(); |
| | | childDNs.put(newParentDN, parentChildren); |
| | | } |
| | | parentChildren.add(newEntryDN); |
| | |
| | | Set<DN> childDNSet = childDNs.get(parentDN); |
| | | if (childDNSet == null) |
| | | { |
| | | childDNSet = new HashSet<DN>(); |
| | | childDNSet = new HashSet<>(); |
| | | childDNs.put(parentDN, childDNSet); |
| | | } |
| | | |
| | |
| | | throw new ConfigException(ERR_LDIF_BACKEND_MULTIPLE_BASE_DNS.get(currentConfig.dn())); |
| | | } |
| | | |
| | | baseDNSet = new HashSet<DN>(); |
| | | baseDNSet = new HashSet<>(); |
| | | Collections.addAll(baseDNSet, baseDNs); |
| | | |
| | | ldifFilePath = currentConfig.getLDIFFile(); |
| | |
| | | @Override |
| | | public Map<String,String> getAlerts() |
| | | { |
| | | Map<String,String> alerts = new LinkedHashMap<String,String>(); |
| | | |
| | | Map<String,String> alerts = new LinkedHashMap<>(); |
| | | alerts.put(ALERT_TYPE_LDIF_BACKEND_CANNOT_WRITE_UPDATE, |
| | | ALERT_DESCRIPTION_LDIF_BACKEND_CANNOT_WRITE_UPDATE); |
| | | |
| | | return alerts; |
| | | } |
| | | } |