opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/api/BackendInitializationListener.java
@@ -49,9 +49,7 @@ * @param backend The backend that has been initialized and is * about to be put into service. */ void performBackendInitializationProcessing(Backend backend); void performBackendInitializationProcessing(Backend<?> backend); /** * Performs any processing that may be required whenever a backend @@ -61,6 +59,6 @@ * @param backend The backend that has been taken out of service * and is about to be finalized. */ void performBackendFinalizationProcessing(Backend backend); void performBackendFinalizationProcessing(Backend<?> backend); } opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciList.java
@@ -51,8 +51,7 @@ * A map containing all the ACIs. * We use the copy-on-write technique to avoid locking when reading. */ private volatile DITCacheMap<List<Aci>> aciList = new DITCacheMap<List<Aci>>(); private volatile DITCacheMap<List<Aci>> aciList = new DITCacheMap<>(); /** * Lock to protect internal data structures. @@ -82,8 +81,8 @@ * @param baseDN The DN to check. * @return A list of candidate ACIs that might be applicable. */ public LinkedList<Aci> getCandidateAcis(DN baseDN) { LinkedList<Aci> candidates = new LinkedList<Aci>(); public List<Aci> getCandidateAcis(DN baseDN) { List<Aci> candidates = new LinkedList<>(); if(baseDN == null) { return candidates; @@ -178,7 +177,7 @@ lock.writeLock().lock(); try { aciList.put(dn, new LinkedList<Aci>(acis)); aciList.put(dn, new LinkedList<>(acis)); } finally { @@ -197,9 +196,9 @@ * exceptions. * @return The number of valid ACI attribute values added to the ACI list. */ public int addAci(Entry entry, boolean hasAci, public int addAci(Entry entry, boolean hasAci, boolean hasGlobalAci, LinkedList<LocalizableMessage> failedACIMsgs) { List<LocalizableMessage> failedACIMsgs) { int validAcis=0; lock.writeLock().lock(); @@ -246,14 +245,14 @@ private static int addAciAttributeList(DITCacheMap<List<Aci>> aciList, DN dn, DN configDN, List<Attribute> attributeList, LinkedList<LocalizableMessage> failedACIMsgs) { List<LocalizableMessage> failedACIMsgs) { if (attributeList == null) { return 0; } int validAcis=0; ArrayList<Aci> acis = new ArrayList<Aci>(); List<Aci> acis = new ArrayList<>(); for (Attribute attribute : attributeList) { for (ByteString value : attribute) { try { @@ -293,7 +292,7 @@ lock.writeLock().lock(); try { LinkedList<LocalizableMessage>failedACIMsgs=new LinkedList<LocalizableMessage>(); List<LocalizableMessage> failedACIMsgs=new LinkedList<>(); //Process "aci" attribute types. if(hasAci) { aciList.remove(oldEntry.getName()); @@ -380,7 +379,7 @@ * @param backend The backend to check if each DN is handled by that * backend. */ public void removeAci(Backend backend) { public void removeAci(Backend<?> backend) { lock.writeLock().lock(); try @@ -416,7 +415,7 @@ lock.writeLock().lock(); try { Map<DN,List<Aci>> tempAciList = new HashMap<DN,List<Aci>>(); Map<DN,List<Aci>> tempAciList = new HashMap<>(); Iterator<Map.Entry<DN,List<Aci>>> iterator = aciList.entrySet().iterator(); while (iterator.hasNext()) { @@ -432,7 +431,7 @@ newRDNs[i] = newDN.getRDN(j); } DN relocateDN=new DN(newRDNs); List<Aci> acis = new LinkedList<Aci>(); List<Aci> acis = new LinkedList<>(); for(Aci aci : hashEntry.getValue()) { try { Aci newAci = opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciListenerManager.java
@@ -233,7 +233,7 @@ { // Ignore this list, the ACI syntax has already passed and it // should be empty. LinkedList<LocalizableMessage> failedACIMsgs = new LinkedList<LocalizableMessage>(); List<LocalizableMessage> failedACIMsgs = new LinkedList<>(); aciList.addAci(addedEntry, hasAci, hasGlobalAci, failedACIMsgs); } @@ -395,7 +395,7 @@ * to the ACI list. */ @Override public void performBackendInitializationProcessing(Backend backend) public void performBackendInitializationProcessing(Backend<?> backend) { // Check to make sure that the backend has a presence index defined // for the ACI attribute. If it does not, then log a warning message @@ -467,7 +467,7 @@ * backend. */ @Override public void performBackendFinalizationProcessing(Backend backend) public void performBackendFinalizationProcessing(Backend<?> backend) { aciList.removeAci(backend); } opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/core/GroupManager.java
@@ -26,8 +26,22 @@ */ package org.opends.server.core; import java.util.*; import static org.opends.messages.ConfigMessages.*; import static org.opends.messages.CoreMessages.*; import static org.opends.server.protocols.internal.InternalClientConnection.*; import static org.opends.server.protocols.internal.Requests.*; import static org.opends.server.util.ServerConstants.*; import static org.opends.server.util.StaticUtils.*; import java.util.ArrayList; import java.util.EnumSet; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.locks.ReentrantReadWriteLock; import org.forgerock.i18n.LocalizableMessage; @@ -57,17 +71,24 @@ import org.opends.server.protocols.internal.InternalSearchOperation; import org.opends.server.protocols.internal.SearchRequest; import org.opends.server.protocols.ldap.LDAPControl; import org.opends.server.types.*; import org.opends.server.types.operation.*; import org.opends.server.types.Control; import org.opends.server.types.DN; import org.opends.server.types.DirectoryException; import org.opends.server.types.Entry; import org.opends.server.types.InitializationException; import org.opends.server.types.SearchFilter; import org.opends.server.types.SearchResultEntry; import org.opends.server.types.operation.PluginOperation; import org.opends.server.types.operation.PostOperationAddOperation; import org.opends.server.types.operation.PostOperationDeleteOperation; import org.opends.server.types.operation.PostOperationModifyDNOperation; import org.opends.server.types.operation.PostOperationModifyOperation; import org.opends.server.types.operation.PostSynchronizationAddOperation; import org.opends.server.types.operation.PostSynchronizationDeleteOperation; import org.opends.server.types.operation.PostSynchronizationModifyDNOperation; import org.opends.server.types.operation.PostSynchronizationModifyOperation; import org.opends.server.workflowelement.localbackend.LocalBackendSearchOperation; import static org.opends.messages.ConfigMessages.*; import static org.opends.messages.CoreMessages.*; import static org.opends.server.protocols.internal.InternalClientConnection.*; import static org.opends.server.protocols.internal.Requests.*; import static org.opends.server.util.ServerConstants.*; import static org.opends.server.util.StaticUtils.*; /** * This class provides a mechanism for interacting with all groups defined in * the Directory Server. It will handle all necessary processing at server @@ -98,7 +119,7 @@ * A mapping between the DNs of the config entries and the associated group * implementations. */ private ConcurrentHashMap<DN, Group<?>> groupImplementations; private ConcurrentMap<DN, Group<?>> groupImplementations; /** * A mapping between the DNs of all group entries and the corresponding group @@ -134,8 +155,8 @@ PluginType.POST_SYNCHRONIZATION_MODIFY_DN), true); this.serverContext = serverContext; groupImplementations = new ConcurrentHashMap<DN, Group<?>>(); groupInstances = new DITCacheMap<Group<?>>(); groupImplementations = new ConcurrentHashMap<>(); groupInstances = new DITCacheMap<>(); lock = new ReentrantReadWriteLock(); @@ -429,9 +450,9 @@ * @throws InitializationException If a problem occurred while attempting to * initialize the group implementation. */ private Group<?> loadGroup(String className, GroupImplementationCfg configuration, boolean initialize) private static Group<?> loadGroup(String className, GroupImplementationCfg configuration, boolean initialize) throws InitializationException { try @@ -450,7 +471,7 @@ } else { List<LocalizableMessage> unacceptableReasons = new ArrayList<LocalizableMessage>(); List<LocalizableMessage> unacceptableReasons = new ArrayList<>(); if (!group.isConfigurationAcceptable(configuration, unacceptableReasons)) { String reason = Utils.joinAsString(". ", unacceptableReasons); @@ -519,7 +540,7 @@ try { // Return a copy to protect from structural changes. return new ArrayList<Group<?>>(groupInstances.values()); return new ArrayList<>(groupInstances.values()); } finally { @@ -559,7 +580,7 @@ * manager. */ @Override public void performBackendInitializationProcessing(Backend backend) public void performBackendInitializationProcessing(Backend<?> backend) { InternalClientConnection conn = getRootConnection(); @@ -650,7 +671,7 @@ * instances associated with entries in the provided backend. */ @Override public void performBackendFinalizationProcessing(Backend backend) public void performBackendFinalizationProcessing(Backend<?> backend) { lock.writeLock().lock(); try @@ -691,7 +712,7 @@ private boolean hasGroupMembershipUpdateControl(PluginOperation operation) private static boolean hasGroupMembershipUpdateControl(PluginOperation operation) { List<Control> requestControls = operation.getRequestControls(); if (requestControls != null) @@ -804,7 +825,7 @@ lock.writeLock().lock(); try { Set<Group<?>> groupSet = new HashSet<Group<?>>(); Set<Group<?>> groupSet = new HashSet<>(); final DN oldDN = oldEntry.getName(); final DN newDN = newEntry.getName(); groupInstances.removeSubtree(oldDN, groupSet); opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/core/SubentryManager.java
@@ -28,6 +28,7 @@ import java.util.*; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; import org.forgerock.i18n.slf4j.LocalizedLogger; @@ -84,23 +85,22 @@ private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); /** A mapping between the DNs and applicable subentries. */ private HashMap<DN,List<SubEntry>> dn2SubEntry; private Map<DN,List<SubEntry>> dn2SubEntry; /** A mapping between the DNs and applicable collective subentries. */ private HashMap<DN,List<SubEntry>> dn2CollectiveSubEntry; private Map<DN,List<SubEntry>> dn2CollectiveSubEntry; /** A mapping between subentry DNs and subentry objects. */ private DITCacheMap<SubEntry> dit2SubEntry; /** Internal search all operational attributes. */ private LinkedHashSet<String> requestAttrs; private Set<String> requestAttrs; /** Lock to protect internal data structures. */ private final ReentrantReadWriteLock lock; private final ReadWriteLock lock; /** The set of change notification listeners. */ private CopyOnWriteArrayList<SubentryChangeListener> changeListeners; private List<SubentryChangeListener> changeListeners; /** Dummy configuration DN for Subentry Manager. */ private static final String CONFIG_DN = "cn=Subentry Manager,cn=config"; @@ -131,14 +131,13 @@ lock = new ReentrantReadWriteLock(); dn2SubEntry = new HashMap<DN,List<SubEntry>>(); dn2CollectiveSubEntry = new HashMap<DN,List<SubEntry>>(); dit2SubEntry = new DITCacheMap<SubEntry>(); dn2SubEntry = new HashMap<>(); dn2CollectiveSubEntry = new HashMap<>(); dit2SubEntry = new DITCacheMap<>(); changeListeners = new CopyOnWriteArrayList<SubentryChangeListener>(); changeListeners = new CopyOnWriteArrayList<>(); requestAttrs = new LinkedHashSet<String>(); requestAttrs = new LinkedHashSet<>(); requestAttrs.add("*"); requestAttrs.add("+"); @@ -210,7 +209,7 @@ } if (subList == null) { subList = new ArrayList<SubEntry>(); subList = new ArrayList<>(); if (subEntry.isCollective() || subEntry.isInheritedCollective()) { dn2CollectiveSubEntry.put(subDN, subList); @@ -304,7 +303,7 @@ * all subentries that it may contain and register them with this manager. */ @Override public void performBackendInitializationProcessing(Backend backend) public void performBackendInitializationProcessing(Backend<?> backend) { InternalClientConnection conn = getRootConnection(); SubentriesControl control = new SubentriesControl(true, true); @@ -409,8 +408,8 @@ return Collections.emptyList(); } List<SubEntry> subentries = new ArrayList<SubEntry>(); List<SubEntry> subentries = new ArrayList<>(); lock.readLock().lock(); try { @@ -442,8 +441,7 @@ return Collections.emptyList(); } List<SubEntry> subentries = new ArrayList<SubEntry>(); List<SubEntry> subentries = new ArrayList<>(); lock.readLock().lock(); try { @@ -488,8 +486,8 @@ return Collections.emptyList(); } List<SubEntry> subentries = new ArrayList<SubEntry>(); List<SubEntry> subentries = new ArrayList<>(); lock.readLock().lock(); try { @@ -534,8 +532,8 @@ return Collections.emptyList(); } List<SubEntry> subentries = new ArrayList<SubEntry>(); List<SubEntry> subentries = new ArrayList<>(); lock.readLock().lock(); try { @@ -580,7 +578,7 @@ return Collections.emptyList(); } List<SubEntry> subentries = new ArrayList<SubEntry>(); List<SubEntry> subentries = new ArrayList<>(); lock.readLock().lock(); try @@ -616,7 +614,7 @@ * all subentries associated with the provided backend. */ @Override public void performBackendFinalizationProcessing(Backend backend) public void performBackendFinalizationProcessing(Backend<?> backend) { lock.writeLock().lock(); try @@ -927,10 +925,7 @@ ResultCode.INSUFFICIENT_ACCESS_RIGHTS, ERR_SUBENTRY_WRITE_INSUFFICIENT_PRIVILEGES.get()); } else { hasSubentryWritePrivilege = true; } hasSubentryWritePrivilege = true; } for (SubentryChangeListener changeListener : changeListeners) @@ -1024,10 +1019,7 @@ ResultCode.INSUFFICIENT_ACCESS_RIGHTS, ERR_SUBENTRY_WRITE_INSUFFICIENT_PRIVILEGES.get()); } else { hasSubentryWritePrivilege = true; } hasSubentryWritePrivilege = true; } final Entry newEntry = modifyDNOperation.getUpdatedEntry(); opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/crypto/CryptoManagerSync.java
@@ -26,10 +26,19 @@ */ package org.opends.server.crypto; import static org.opends.messages.CoreMessages.*; import static org.opends.server.api.plugin.PluginType.*; import static org.opends.server.config.ConfigConstants.*; import static org.opends.server.protocols.internal.InternalClientConnection.*; import static org.opends.server.protocols.internal.Requests.*; import static org.opends.server.util.ServerConstants.*; import static org.opends.server.util.StaticUtils.*; import java.util.EnumSet; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import org.forgerock.i18n.LocalizableMessage; import org.forgerock.i18n.slf4j.LocalizedLogger; @@ -66,14 +75,6 @@ import org.opends.server.types.operation.PostResponseDeleteOperation; import org.opends.server.types.operation.PostResponseModifyOperation; import static org.opends.messages.CoreMessages.*; import static org.opends.server.api.plugin.PluginType.*; import static org.opends.server.config.ConfigConstants.*; import static org.opends.server.protocols.internal.InternalClientConnection.*; import static org.opends.server.protocols.internal.Requests.*; import static org.opends.server.util.ServerConstants.*; import static org.opends.server.util.StaticUtils.*; /** * This class defines an object that synchronizes certificates from the admin * data branch into the trust store backend, and synchronizes secret-key entries @@ -223,7 +224,7 @@ /** {@inheritDoc} */ @Override public void performBackendInitializationProcessing(Backend backend) public void performBackendInitializationProcessing(Backend<?> backend) { DN[] baseDNs = backend.getBaseDNs(); if (baseDNs != null) @@ -240,7 +241,7 @@ /** {@inheritDoc} */ @Override public void performBackendFinalizationProcessing(Backend backend) public void performBackendFinalizationProcessing(Backend<?> backend) { // No implementation required. } @@ -387,7 +388,7 @@ * Delete an entry from the local trust store. * @param dstDN The DN of the entry to be deleted in the local trust store. */ private void deleteEntry(DN dstDN) private static void deleteEntry(DN dstDN) { InternalClientConnection conn = InternalClientConnection.getRootConnection(); @@ -408,13 +409,11 @@ */ private void addEntry(Entry srcEntry, DN dstDN) { LinkedHashMap<ObjectClass,String> ocMap = new LinkedHashMap<ObjectClass,String>(2); Map<ObjectClass, String> ocMap = new LinkedHashMap<>(2); ocMap.put(DirectoryServer.getTopObjectClass(), OC_TOP); ocMap.put(ocInstanceKey, OC_CRYPTO_INSTANCE_KEY); HashMap<AttributeType, List<Attribute>> userAttrs = new HashMap<AttributeType, List<Attribute>>(); Map<AttributeType, List<Attribute>> userAttrs = new HashMap<>(); List<Attribute> attrList; attrList = srcEntry.getAttribute(attrAlias); opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/extensions/DefaultEntryCache.java
@@ -354,7 +354,7 @@ * * @return The current cache order array. */ public final EntryCache<? extends EntryCacheCfg>[] getCacheOrder() public final static EntryCache<? extends EntryCacheCfg>[] getCacheOrder() { return DefaultEntryCache.cacheOrder; } @@ -366,7 +366,7 @@ * * @param cacheOrderMap The current cache order array. */ public final void setCacheOrder( public final static void setCacheOrder( SortedMap<Integer, EntryCache<? extends EntryCacheCfg>> cacheOrderMap) { @@ -386,7 +386,7 @@ * about to be put into service. */ @Override public void performBackendInitializationProcessing(Backend backend) public void performBackendInitializationProcessing(Backend<?> backend) { // Do nothing. } @@ -402,7 +402,7 @@ * and is about to be finalized. */ @Override public void performBackendFinalizationProcessing(Backend backend) public void performBackendFinalizationProcessing(Backend<?> backend) { // Do not clear any backends if the server is shutting down. if (!DirectoryServer.getInstance().isShuttingDown()) opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/monitors/EntryCacheMonitorProvider.java
@@ -26,7 +26,6 @@ */ package org.opends.server.monitors; import java.util.ArrayList; import java.util.Collections; import java.util.List;