AutoRefactor'ed use Map.entrySet() instead of Map.keySet() in a loop
| | |
| | | * This sub-command implements the various set-xxx-prop sub-commands. |
| | | */ |
| | | final class SetPropSubCommandHandler extends SubCommandHandler { |
| | | |
| | | /** Type of modification being performed. */ |
| | | private static enum ModificationType { |
| | | private enum ModificationType { |
| | | /** Append a single value to the property. */ |
| | | ADD, |
| | | /** Remove a single value from the property. */ |
| | |
| | | } else { |
| | | app.println(); |
| | | if (app.confirmAction(INFO_DSCFG_PROMPT_EDIT_TO_ENABLE.get(rufn, name, ufn), true)) { |
| | | MenuResult<Void> result = SetPropSubCommandHandler.modifyManagedObject(app, |
| | | context, ref, handler); |
| | | MenuResult<Void> result = modifyManagedObject(app, context, ref, handler); |
| | | if (result.isQuit()) { |
| | | return result; |
| | | } else if (result.isSuccess()) { |
| | |
| | | |
| | | // Reset properties. |
| | | for (String m : propertyResetArgument.getValues()) { |
| | | |
| | | // Check one does not try to reset with a value |
| | | if (m.contains(":")) { |
| | | throw ArgumentExceptionFactory.unableToResetPropertyWithValue(m, OPTION_DSCFG_LONG_RESET); |
| | |
| | | } |
| | | |
| | | // Apply the command line changes. |
| | | for (PropertyDefinition<?> pd : changes.keySet()) { |
| | | for (Map.Entry<PropertyDefinition, Set> entry : changes.entrySet()) { |
| | | try { |
| | | child.setPropertyValues(pd, changes.get(pd)); |
| | | child.setPropertyValues(entry.getKey(), entry.getValue()); |
| | | } catch (PropertyException e) { |
| | | throw ArgumentExceptionFactory.adaptPropertyException(e, d); |
| | | } |
| | |
| | | Entry toEntry() { |
| | | final Entry entry = new LinkedHashMapEntry(getDN()); |
| | | |
| | | for (final AttributeType attributeType : attributes.keySet()) { |
| | | final List<TemplateValue> valueList = attributes.get(attributeType); |
| | | for (Map.Entry<AttributeType, List<TemplateValue>> mapEntry : attributes.entrySet()) { |
| | | AttributeType attributeType = mapEntry.getKey(); |
| | | final List<TemplateValue> valueList = mapEntry.getValue(); |
| | | final Attribute newAttribute = |
| | | new LinkedAttribute(AttributeDescription.create(attributeType)); |
| | | for (final TemplateValue value : valueList) { |
| | |
| | | import java.util.Iterator; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Queue; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import java.util.concurrent.TimeUnit; |
| | |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.LDAPClientContext; |
| | | import org.forgerock.opendj.ldap.LDAPClientContext.ConnectionEventListener; |
| | | import org.forgerock.opendj.ldap.LdapException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.requests.UnbindRequest; |
| | | import org.forgerock.opendj.ldap.responses.CompareResult; |
| | |
| | | * The socket channel that may be used to communicate with the client. |
| | | * @param protocol |
| | | * String representing the protocol (LDAP or LDAP+SSL). |
| | | * @throws LdapException |
| | | * @throws DirectoryException |
| | | * If SSL initialisation fails. |
| | | */ |
| | | LDAPClientConnection2(LDAPConnectionHandler2 connectionHandler, LDAPClientContext clientContext, String protocol, |
| | | boolean keepStats) { |
| | |
| | | } |
| | | |
| | | // Try to add the operation to the work queue, |
| | | // or run it synchronously (typically for the administration |
| | | // connector) |
| | | // or run it synchronously (typically for the administration connector) |
| | | queueingStrategy.enqueueRequest(operation); |
| | | } catch (DirectoryException de) { |
| | | logger.traceException(de); |
| | |
| | | // Make sure that no one can add any new operations. |
| | | synchronized (opsInProgressLock) { |
| | | try { |
| | | for (int msgID : operationsInProgress.keySet()) { |
| | | for (Map.Entry<Integer, Operation> entry : operationsInProgress.entrySet()) { |
| | | int msgID = entry.getKey(); |
| | | if (msgID == messageID) { |
| | | continue; |
| | | } |
| | | |
| | | Operation o = operationsInProgress.get(msgID); |
| | | Operation o = entry.getValue(); |
| | | if (o != null) { |
| | | try { |
| | | o.abort(cancelRequest); |
| | |
| | | DN dn = makeDNFromServerProperties(serverProperties); |
| | | |
| | | AddRequest request = newAddRequest(dn); |
| | | for (ServerProperty prop : serverProperties.keySet()) |
| | | for (Map.Entry<ServerProperty, Object> entry : serverProperties.entrySet()) |
| | | { |
| | | Attribute attribute = makeAttrFromServerProperty(prop, serverProperties.get(prop)); |
| | | ServerProperty prop = entry.getKey(); |
| | | Attribute attribute = makeAttrFromServerProperty(prop, entry.getValue()); |
| | | if (attribute != null) |
| | | { |
| | | request.addAttribute(attribute); |
| | |
| | | try |
| | | { |
| | | ModifyRequest request = newModifyRequest(dn); |
| | | for (ServerProperty prop : serverProperties.keySet()) |
| | | for (Map.Entry<ServerProperty, Object> entry : serverProperties.entrySet()) |
| | | { |
| | | Attribute attr = makeAttrFromServerProperty(prop, serverProperties.get(prop)); |
| | | ServerProperty prop = entry.getKey(); |
| | | Attribute attr = makeAttrFromServerProperty(prop, entry.getValue()); |
| | | if (attr != null) |
| | | { |
| | | request.addModification(new Modification(REPLACE, attr)); |
| | |
| | | String dn = makeDNFromServerGroupProperties(serverGroupProperties); |
| | | AddRequest request = newAddRequest(dn) |
| | | .addAttribute("objectclass", "top", "groupOfUniqueNames"); |
| | | for (ServerGroupProperty prop : serverGroupProperties.keySet()) |
| | | for (Map.Entry<ServerGroupProperty, Object> entry : serverGroupProperties.entrySet()) |
| | | { |
| | | request.addAttribute(makeAttrFromServerGroupProperty(prop, serverGroupProperties.get(prop))); |
| | | ServerGroupProperty prop = entry.getKey(); |
| | | request.addAttribute(makeAttrFromServerGroupProperty(prop, entry.getValue())); |
| | | } |
| | | |
| | | try |
| | |
| | | |
| | | // Transform 'properties' into 'attributes' |
| | | ModifyRequest request = newModifyRequest(dn); |
| | | for (ServerGroupProperty prop : serverGroupProperties.keySet()) |
| | | for (Map.Entry<ServerGroupProperty, Object> entry : serverGroupProperties.entrySet()) |
| | | { |
| | | ServerGroupProperty prop = entry.getKey(); |
| | | request.addModification(new Modification( |
| | | REPLACE, makeAttrFromServerGroupProperty(prop, serverGroupProperties.get(prop)))); |
| | | REPLACE, makeAttrFromServerGroupProperty(prop, entry.getValue()))); |
| | | } |
| | | throwIfNotSuccess(connectionWrapper.getConnection().modify(request)); |
| | | } |
| | |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | import javax.net.ssl.KeyManager; |
| | | |
| | |
| | | * {@code false} otherwise. |
| | | */ |
| | | public boolean isConnectionRegistered(ConnectionWrapper conn) { |
| | | for (String key : connectionTable.keySet()) |
| | | for (ConnectionRecord cr : connectionTable.values()) |
| | | { |
| | | final ConnectionRecord cr = connectionTable.get(key); |
| | | if (cr.conn != null) |
| | | { |
| | | final ConnectionWrapper c = cr.conn.getConnectionWrapper(); |
| | |
| | | String targetKey = null; |
| | | ConnectionRecord targetRecord = null; |
| | | synchronized(this) { |
| | | for (String key : connectionTable.keySet()) { |
| | | ConnectionRecord cr = connectionTable.get(key); |
| | | for (Map.Entry<String, ConnectionRecord> entry : connectionTable.entrySet()) { |
| | | String key = entry.getKey(); |
| | | ConnectionRecord cr = entry.getValue(); |
| | | if (cr.conn == conn) { |
| | | targetKey = key; |
| | | targetRecord = cr; |
| | |
| | | /** Cancel all the object from this queue. */ |
| | | public synchronized void cancelAll() { |
| | | waitingQueue.clear(); |
| | | for (BasicNode node : workingList.keySet()) |
| | | for (Map.Entry<BasicNode, AbstractNodeTask> entry : workingList.entrySet()) |
| | | { |
| | | AbstractNodeTask task = workingList.get(node); |
| | | BasicNode node = entry.getKey(); |
| | | AbstractNodeTask task = entry.getValue(); |
| | | cancelList.put(node, node); |
| | | task.cancel(); |
| | | } |
| | |
| | | { |
| | | Map<String, List<String>> extraProperties = new HashMap<>(); |
| | | Map<String, List<String>> props = element.getExtraProperties(); |
| | | for (String name : props.keySet()) |
| | | for (Map.Entry<String, List<String>> entry : props.entrySet()) |
| | | { |
| | | extraProperties.put(name, new ArrayList<>(props.get(name))); |
| | | String name = entry.getKey(); |
| | | extraProperties.put(name, new ArrayList<>(entry.getValue())); |
| | | } |
| | | return extraProperties; |
| | | } |
| | |
| | | gbc.fill = GridBagConstraints.NONE; |
| | | gbc.anchor = GridBagConstraints.NORTHWEST; |
| | | gbc.insets.top = 10; |
| | | for (LocalizableMessage label : taskSpecificAttrs.keySet()) |
| | | for (Map.Entry<LocalizableMessage, List<String>> entry : taskSpecificAttrs.entrySet()) |
| | | { |
| | | List<String> values = taskSpecificAttrs.get(label); |
| | | LocalizableMessage label = entry.getKey(); |
| | | List<String> values = entry.getValue(); |
| | | gbc.gridx = 0; |
| | | gbc.insets.left = 10; |
| | | gbc.insets.right = 0; |
| | |
| | | import org.forgerock.opendj.ldap.RDN; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.schema.ObjectClass; |
| | | import org.forgerock.opendj.ldap.schema.Schema; |
| | | import org.forgerock.opendj.ldap.schema.Syntax; |
| | | import org.forgerock.opendj.ldif.LDIFEntryReader; |
| | | import org.opends.guitools.controlpanel.datamodel.BinaryValue; |
| | |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.opends.server.schema.SchemaConstants; |
| | | import org.opends.server.types.OpenDsException; |
| | | import org.forgerock.opendj.ldap.schema.Schema; |
| | | |
| | | /** The panel displaying a simplified view of an entry. */ |
| | | class SimplifiedViewEntryPanel extends ViewEntryPanel |
| | |
| | | errors.add(ERR_CTRL_PANEL_DN_NOT_VALID.get()); |
| | | } |
| | | |
| | | for (String attrName : hmLabels.keySet()) |
| | | for (Map.Entry<String, JComponent> mapEntry : hmLabels.entrySet()) |
| | | { |
| | | setPrimaryValid(hmLabels.get(attrName)); |
| | | mapEntry.getKey(); |
| | | setPrimaryValid(mapEntry.getValue()); |
| | | } |
| | | |
| | | // Check passwords |
| | |
| | | Schema schema = getInfo().getServerDescriptor().getSchema(); |
| | | if (schema != null) |
| | | { |
| | | for (String attrName : hmEditors.keySet()) |
| | | for (Map.Entry<String, List<EditorComponent>> entry : hmEditors.entrySet()) |
| | | { |
| | | String attrName = entry.getKey(); |
| | | if (isPassword(attrName) || isConfirmPassword(attrName)) |
| | | { |
| | | continue; |
| | | } |
| | | List<EditorComponent> comps = hmEditors.get(attrName); |
| | | List<EditorComponent> comps = entry.getValue(); |
| | | if (!comps.isEmpty()) |
| | | { |
| | | Object o = comps.iterator().next().getValue(); |
| | |
| | | |
| | | private void updateAttributeVisibility(boolean showAll) |
| | | { |
| | | for (String attrName : hmLabels.keySet()) |
| | | for (Map.Entry<String, JComponent> entry : hmLabels.entrySet()) |
| | | { |
| | | String attrName = entry.getKey(); |
| | | final boolean visible = showAll || requiredAttrs.contains(attrName) || hasValue(hmEditors.get(attrName)); |
| | | hmLabels .get(attrName).setVisible(visible); |
| | | entry.getValue().setVisible(visible); |
| | | hmComponents.get(attrName).setVisible(visible); |
| | | } |
| | | repaint(); |
| | |
| | | Set<SearchResultEntry> monitorEntries = new HashSet<>(); |
| | | if (ch.getState() == ConnectionHandlerDescriptor.State.ENABLED) |
| | | { |
| | | for (String key : hmConnectionHandlersMonitor.keySet()) |
| | | for (Map.Entry<String, SearchResultEntry> entry : hmConnectionHandlersMonitor.entrySet()) |
| | | { |
| | | String key = entry.getKey(); |
| | | // The name of the connection handler does not appear necessarily in the |
| | | // key (which is based on the DN of the monitoring entry). In general |
| | | // the DN contains the String specified in |
| | |
| | | if (key.contains(getKey("port " + ch.getPort())) |
| | | && hasAllAddresses(ch, key)) |
| | | { |
| | | monitorEntries.add(hmConnectionHandlersMonitor.get(key)); |
| | | monitorEntries.add(entry.getValue()); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | InstallerHelper helper = new InstallerHelper(); |
| | | for (ServerDescriptor server : hmConfiguredRemoteReplication.keySet()) |
| | | for (Map.Entry<ServerDescriptor, ConfiguredReplication> entry : hmConfiguredRemoteReplication.entrySet()) |
| | | { |
| | | ServerDescriptor server = entry.getKey(); |
| | | notifyListeners(getFormattedWithPoints(INFO_PROGRESS_UNCONFIGURING_REPLICATION_REMOTE.get(getHostPort(server)))); |
| | | try (ConnectionWrapper connectionWrapper = getRemoteConnection(server)) |
| | | { |
| | | helper.unconfigureReplication(connectionWrapper, hmConfiguredRemoteReplication.get(server)); |
| | | helper.unconfigureReplication(connectionWrapper, entry.getValue()); |
| | | } |
| | | catch (ApplicationException ae) |
| | | { |
| | |
| | | try (ConnectionWrapper connection = createLocalConnection()) |
| | | { |
| | | final InstallerHelper helper = new InstallerHelper(); |
| | | for (String backendId : hmBackendSuffix.keySet()) |
| | | for (Map.Entry<String, Set<DN>> entry : hmBackendSuffix.entrySet()) |
| | | { |
| | | helper.createBackend(connection, backendId, hmBackendSuffix.get(backendId), |
| | | String backendId = entry.getKey(); |
| | | helper.createBackend(connection, backendId, entry.getValue(), |
| | | backendTypes.get(backendId).getBackend()); |
| | | } |
| | | } |
| | |
| | | replicas.add(replica); |
| | | } |
| | | } |
| | | for (ServerDescriptor server : hm.keySet()) |
| | | for (Map.Entry<ServerDescriptor, Set<ReplicaDescriptor>> entry : hm.entrySet()) |
| | | { |
| | | ServerDescriptor server = entry.getKey(); |
| | | notifyListeners(getFormattedWithPoints(INFO_PROGRESS_CONFIGURING_REPLICATION_REMOTE.get(getHostPort(server)))); |
| | | Integer v = (Integer) server.getServerProperties().get(REPLICATION_SERVER_PORT); |
| | | int replicationPort; |
| | |
| | | } |
| | | } |
| | | Set<DN> dns = new HashSet<>(); |
| | | for (ReplicaDescriptor replica : hm.get(server)) |
| | | for (ReplicaDescriptor replica : entry.getValue()) |
| | | { |
| | | dns.add(replica.getSuffix().getDN()); |
| | | } |
| | |
| | | if (repServer == null) |
| | | { |
| | | // Do the comparison manually |
| | | for (DN dn1 : replicationServers.keySet()) |
| | | for (Map.Entry<DN, Set<HostPort>> rs1 : replicationServers.entrySet()) |
| | | { |
| | | DN dn1 = rs1.getKey(); |
| | | if (dn.equals(dn1)) |
| | | { |
| | | repServer = replicationServers.get(dn1); |
| | | repServer = rs1.getValue(); |
| | | dn = dn1; |
| | | break; |
| | | } |
| | |
| | | { |
| | | domains[i] = sync.getReplicationDomain(domainNames[i]); |
| | | } |
| | | for (DN dn : replicationServers.keySet()) |
| | | for (Map.Entry<DN, Set<HostPort>> entry : replicationServers.entrySet()) |
| | | { |
| | | DN dn = entry.getKey(); |
| | | ReplicationDomainCfgClient domain = null; |
| | | boolean isCreated; |
| | | String domainName = null; |
| | |
| | | { |
| | | oldServers = new TreeSet<>(); |
| | | } |
| | | servers = toLowerCaseStrings(replicationServers.get(dn)); |
| | | servers = toLowerCaseStrings(entry.getValue()); |
| | | domain.setReplicationServer(servers); |
| | | usedReplicaServerIds.add(domain.getServerId()); |
| | | |
| | |
| | | writer.newLine(); |
| | | } |
| | | |
| | | for (String key : otherProperties.keySet()) |
| | | for (Map.Entry<String, String> entry : otherProperties.entrySet()) |
| | | { |
| | | writer.write(key + "=" + otherProperties.get(key)); |
| | | writer.write(entry.getKey() + "=" + entry.getValue()); |
| | | writer.newLine(); |
| | | } |
| | | |
| | | for (String scriptName : arguments.keySet()) |
| | | for (Map.Entry<String, JavaArguments> entry : arguments.entrySet()) |
| | | { |
| | | String argument = arguments.get(scriptName).getStringArguments(); |
| | | String scriptName = entry.getKey(); |
| | | String argument = entry.getValue().getStringArguments(); |
| | | writer.newLine(); |
| | | writer.write(getJavaArgPropertyForScript(scriptName) + "=" + argument); |
| | | } |
| | |
| | | import java.awt.event.FocusListener; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import javax.swing.Box; |
| | | import javax.swing.ButtonGroup; |
| | |
| | | { |
| | | if (fieldName == FieldName.DATA_OPTIONS) |
| | | { |
| | | for (NewSuffixOptions.Type type : hmRadioButtons.keySet()) |
| | | for (Map.Entry<NewSuffixOptions.Type, JRadioButton> entry : hmRadioButtons.entrySet()) |
| | | { |
| | | if (hmRadioButtons.get(type).isSelected()) |
| | | NewSuffixOptions.Type type = entry.getKey(); |
| | | if (entry.getValue().isSelected()) |
| | | { |
| | | return type; |
| | | } |
| | |
| | | LabelFieldDescriptor.LabelType.SECONDARY, UIFactory.NUMBER_ENTRIES_FIELD_SIZE); |
| | | hm.put(FieldName.NUMBER_ENTRIES, entryNumberLabelDescriptor); |
| | | |
| | | for (final FieldName fieldName : hm.keySet()) |
| | | for (Map.Entry<FieldName, LabelFieldDescriptor> entry : hm.entrySet()) |
| | | { |
| | | final LabelFieldDescriptor desc = hm.get(fieldName); |
| | | FieldName fieldName = entry.getKey(); |
| | | final LabelFieldDescriptor desc = entry.getValue(); |
| | | final String defaultValue = fieldName == FieldName.NUMBER_ENTRIES ? |
| | | Integer.toString(defaultUserData.getNewSuffixOptions().getNumberEntries()) |
| | | : getDefaultValue(fieldName); |
| | |
| | | |
| | | final NewSuffixOptions.Type defaultType = defaultUserData.getNewSuffixOptions().getType(); |
| | | final ButtonGroup buttonGroup = new ButtonGroup(); |
| | | for (NewSuffixOptions.Type type : hmRadioButtons.keySet()) |
| | | for (Map.Entry<NewSuffixOptions.Type, JRadioButton> entry : hmRadioButtons.entrySet()) |
| | | { |
| | | final JRadioButton radioButton = hmRadioButtons.get(type); |
| | | NewSuffixOptions.Type type = entry.getKey(); |
| | | final JRadioButton radioButton = entry.getValue(); |
| | | radioButton.setSelected(type == defaultType); |
| | | buttonGroup.add(radioButton); |
| | | } |
| | |
| | | import java.awt.event.FocusEvent; |
| | | import java.awt.event.FocusListener; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | import javax.swing.Box; |
| | | import javax.swing.ButtonGroup; |
| | |
| | | LabelFieldDescriptor.LabelType.SECONDARY, |
| | | UIFactory.PORT_FIELD_SIZE)); |
| | | |
| | | for (FieldName fieldName : hm.keySet()) |
| | | for (Map.Entry<FieldName, LabelFieldDescriptor> entry : hm.entrySet()) |
| | | { |
| | | LabelFieldDescriptor desc = hm.get(fieldName); |
| | | FieldName fieldName = entry.getKey(); |
| | | LabelFieldDescriptor desc = entry.getValue(); |
| | | |
| | | String defaultValue = getDefaultStringValue(fieldName); |
| | | JTextComponent field = UIFactory.makeJTextComponent(desc, defaultValue); |
| | |
| | | import java.awt.event.FocusEvent; |
| | | import java.awt.event.FocusListener; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | import javax.swing.Box; |
| | | import javax.swing.JLabel; |
| | |
| | | LabelFieldDescriptor.LabelType.PRIMARY, |
| | | UIFactory.PASSWORD_FIELD_SIZE)); |
| | | |
| | | for (FieldName fieldName : hm.keySet()) |
| | | for (Map.Entry<FieldName, LabelFieldDescriptor> entry : hm.entrySet()) |
| | | { |
| | | LabelFieldDescriptor desc = hm.get(fieldName); |
| | | FieldName fieldName = entry.getKey(); |
| | | LabelFieldDescriptor desc = entry.getValue(); |
| | | String defaultValue = getDefaultValue(fieldName); |
| | | JTextComponent field = UIFactory.makeJTextComponent(desc, defaultValue); |
| | | JLabel label = UIFactory.makeJLabel(desc); |
| | |
| | | LabelFieldDescriptor.FieldType.READ_ONLY, |
| | | LabelFieldDescriptor.LabelType.PRIMARY, 0)); |
| | | |
| | | for (final FieldName fieldName : hm.keySet()) |
| | | for (Map.Entry<FieldName, org.opends.quicksetup.ui.LabelFieldDescriptor> entry : hm.entrySet()) |
| | | { |
| | | final LabelFieldDescriptor desc = hm.get(fieldName); |
| | | FieldName fieldName = entry.getKey(); |
| | | final LabelFieldDescriptor desc = entry.getValue(); |
| | | final JLabel label = UIFactory.makeJLabel(desc); |
| | | final JTextComponent field = UIFactory.makeJTextComponent(desc, null); |
| | | field.setOpaque(false); |
| | |
| | | buf.append(s); |
| | | |
| | | final TreeSet<LocalizableMessage> remoteServerLines = new TreeSet<>(); |
| | | for (final ServerDescriptor server : remotePorts.keySet()) |
| | | for (Map.Entry<ServerDescriptor, AuthenticationData> entry : remotePorts.entrySet()) |
| | | { |
| | | ServerDescriptor server = entry.getKey(); |
| | | HostPort serverDisplay; |
| | | if (server.getHostPort(false).equals(serverToConnectDisplay)) |
| | | { |
| | |
| | | serverDisplay = server.getHostPort(true); |
| | | } |
| | | |
| | | final AuthenticationData repPort = remotePorts.get(server); |
| | | final AuthenticationData repPort = entry.getValue(); |
| | | if (repPort.useSecureConnection()) |
| | | { |
| | | s = INFO_SECURE_REPLICATION_PORT_LABEL.get(repPort.getPort()).toString(); |
| | |
| | | if (fieldName == FieldName.REMOTE_REPLICATION_PORT) |
| | | { |
| | | Map<String, String> hm = new HashMap<>(); |
| | | for (String id : hmFields.keySet()) |
| | | for (Map.Entry<String, JTextComponent> entry : hmFields.entrySet()) |
| | | { |
| | | hm.put(id, hmFields.get(id).getText()); |
| | | String id = entry.getKey(); |
| | | hm.put(id, entry.getValue().getText()); |
| | | } |
| | | value = hm; |
| | | } |
| | | else if (fieldName == FieldName.REMOTE_REPLICATION_SECURE) |
| | | { |
| | | Map<String, Boolean> hm = new HashMap<>(); |
| | | for (String id : hmCbs.keySet()) |
| | | for (Map.Entry<String, JCheckBox> entry : hmCbs.entrySet()) |
| | | { |
| | | hm.put(id, hmCbs.get(id).isSelected()); |
| | | String id = entry.getKey(); |
| | | hm.put(id, entry.getValue().isSelected()); |
| | | } |
| | | value = hm; |
| | | } |
| | |
| | | { |
| | | if (fieldName == FieldName.REMOTE_REPLICATION_PORT) |
| | | { |
| | | for (String id : hmLabels.keySet()) |
| | | for (Map.Entry<String, JLabel> entry : hmLabels.entrySet()) |
| | | { |
| | | UIFactory.setTextStyle(hmLabels.get(id), |
| | | String id = entry.getKey(); |
| | | UIFactory.setTextStyle(entry.getValue(), |
| | | UIFactory.TextStyle.SECONDARY_FIELD_VALID); |
| | | } |
| | | if (invalid) |
| | | { |
| | | for (String id : hmLabels.keySet()) |
| | | for (Map.Entry<String, JLabel> entry : hmLabels.entrySet()) |
| | | { |
| | | String id = entry.getKey(); |
| | | String sPort = hmFields.get(id).getText(); |
| | | if (!isValid(sPort)) |
| | | { |
| | | UIFactory.setTextStyle(hmLabels.get(id), |
| | | UIFactory.setTextStyle(entry.getValue(), |
| | | UIFactory.TextStyle.SECONDARY_FIELD_INVALID); |
| | | } |
| | | } |
| | |
| | | }; |
| | | lastFocusComponent = null; |
| | | HashMap<String, String> hmOldValues = new HashMap<>(); |
| | | for (String id : hmFields.keySet()) |
| | | for (Map.Entry<String, JTextComponent> entry : hmFields.entrySet()) |
| | | { |
| | | hmOldValues.put(id, hmFields.get(id).getText()); |
| | | String id = entry.getKey(); |
| | | hmOldValues.put(id, entry.getValue().getText()); |
| | | } |
| | | HashMap<String, Boolean> hmOldSecureValues = new HashMap<>(); |
| | | for (String id : hmCbs.keySet()) |
| | | for (Map.Entry<String, JCheckBox> entry : hmCbs.entrySet()) |
| | | { |
| | | hmOldSecureValues.put(id, hmCbs.get(id).isSelected()); |
| | | String id = entry.getKey(); |
| | | hmOldSecureValues.put(id, entry.getValue().isSelected()); |
| | | } |
| | | orderedServers.clear(); |
| | | orderedServers.addAll(array); |
| | |
| | | import java.awt.event.FocusListener; |
| | | import java.io.File; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | import javax.swing.Box; |
| | | import javax.swing.JButton; |
| | |
| | | LabelFieldDescriptor.LabelType.PRIMARY, |
| | | UIFactory.PASSWORD_FIELD_SIZE)); |
| | | |
| | | for (FieldName fieldName : hm.keySet()) |
| | | for (Map.Entry<FieldName, LabelFieldDescriptor> entry : hm.entrySet()) |
| | | { |
| | | LabelFieldDescriptor desc = hm.get(fieldName); |
| | | FieldName fieldName = entry.getKey(); |
| | | LabelFieldDescriptor desc = entry.getValue(); |
| | | String defaultValue = getDefaultValue(fieldName); |
| | | |
| | | JLabel label = UIFactory.makeJLabel(desc); |
| | |
| | | { |
| | | serverToConnectDisplay = newServerDisplay; |
| | | Map<String, Boolean> hmOldValues = new HashMap<>(); |
| | | for (String id : hmCheckBoxes.keySet()) |
| | | for (Entry<String, JCheckBox> entry : hmCheckBoxes.entrySet()) |
| | | { |
| | | hmOldValues.put(id, hmCheckBoxes.get(id).isSelected()); |
| | | String id = entry.getKey(); |
| | | hmOldValues.put(id, entry.getValue().isSelected()); |
| | | } |
| | | orderedSuffixes.clear(); |
| | | for (SuffixDescriptor suffix : array) |
| | |
| | | { |
| | | final List<List<String>> cmdLines = new ArrayList<>(); |
| | | final Map<ServerDescriptor, Set<DN>> hmServerBaseDNs = getServerDescriptorBaseDNMap(userData); |
| | | for (ServerDescriptor server : hmServerBaseDNs.keySet()) |
| | | for (Map.Entry<ServerDescriptor, Set<DN>> entry : hmServerBaseDNs.entrySet()) |
| | | { |
| | | cmdLines.add(getDsReplicationEquivalentCommandLine(subcommand, userData, hmServerBaseDNs.get(server), server)); |
| | | ServerDescriptor server = entry.getKey(); |
| | | cmdLines.add(getDsReplicationEquivalentCommandLine(subcommand, userData, entry.getValue(), server)); |
| | | } |
| | | return cmdLines; |
| | | } |
| | |
| | | |
| | | if (isUnix()) { |
| | | // Change the permissions for UNIX systems |
| | | for (String perm : permissions.keySet()) { |
| | | List<String> paths = permissions.get(perm); |
| | | for (Map.Entry<String, List<String>> mapEntry : permissions.entrySet()) { |
| | | String perm = mapEntry.getKey(); |
| | | List<String> paths = mapEntry.getValue(); |
| | | try { |
| | | int result = Utils.setPermissionsUnix(paths, perm); |
| | | if (result != 0) { |
| | |
| | | import java.util.Collection; |
| | | import java.util.Date; |
| | | import java.util.Iterator; |
| | | import java.util.Map; |
| | | import java.util.Properties; |
| | | import java.util.TreeMap; |
| | | import java.util.TreeSet; |
| | |
| | | "configuration components."); |
| | | jumpSection(); |
| | | |
| | | for (String catName : list.keySet()) { |
| | | for (Map.Entry<String, TreeMap<String, AbstractManagedObjectDefinition>> entry : list.entrySet()) { |
| | | String catName = entry.getKey(); |
| | | heading3(getFriendlyName(catName)); |
| | | // Get the list of the category |
| | | TreeMap<String, AbstractManagedObjectDefinition> catList = list.get(catName); |
| | | TreeMap<String, AbstractManagedObjectDefinition> catList = entry.getValue(); |
| | | for (AbstractManagedObjectDefinition mo : catList.values()) { |
| | | RelationDefinition relDefn = relList.get(mo.getName()); |
| | | if (relDefn != null && relDefn.hasOption(RelationOption.HIDDEN)) { |
| | |
| | | "container components."); |
| | | jumpSection(); |
| | | |
| | | for (String catName : list.keySet()) { |
| | | for (Map.Entry<String, TreeMap<String, RelationDefinition>> entry : list.entrySet()) { |
| | | String catName = entry.getKey(); |
| | | heading3(getFriendlyName(catName)); |
| | | // Get the list of the category |
| | | TreeMap<String, RelationDefinition> catList = list.get(catName); |
| | | TreeMap<String, RelationDefinition> catList = entry.getValue(); |
| | | genMORelationTree(catList); |
| | | } |
| | | |
| | |
| | | if (backupBaseDN.equals(entryDN)) |
| | | { |
| | | long count = 0; |
| | | for (File dir : backupDirectories.keySet()) |
| | | for (Map.Entry<File, CachedBackupDirectory> entry : backupDirectories.entrySet()) |
| | | { |
| | | File dir = entry.getKey(); |
| | | // Check to see if the descriptor file exists. If not, then skip this |
| | | // backup directory. |
| | | File descriptorFile = new File(dir, BACKUP_DIRECTORY_DESCRIPTOR_FILE); |
| | |
| | | count++; |
| | | try |
| | | { |
| | | BackupDirectory backupDirectory = backupDirectories.get(dir).getBackupDirectory(); |
| | | count += backupDirectory.getBackups().keySet().size(); |
| | | BackupDirectory backupDirectory = entry.getValue().getBackupDirectory(); |
| | | count += backupDirectory.getBackups().size(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | { |
| | | File dir = new File(v.toString()); |
| | | BackupDirectory backupDirectory = backupDirectories.get(dir).getBackupDirectory(); |
| | | count += backupDirectory.getBackups().keySet().size(); |
| | | count += backupDirectory.getBackups().size(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | import java.util.HashMap; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | |
| | | int usedOptionalCharacterSets = 0; |
| | | int optionalCharacterSets = 0; |
| | | int mandatoryCharacterSets = 0; |
| | | for (String characterSet : characterSets.keySet()) |
| | | for (Map.Entry<String, Integer> entry : characterSets.entrySet()) |
| | | { |
| | | int minimumCount = characterSets.get(characterSet); |
| | | String characterSet = entry.getKey(); |
| | | int minimumCount = entry.getValue(); |
| | | Integer passwordCount = setCounts.get(characterSet); |
| | | if (minimumCount > 0) |
| | | { |
| | |
| | | } |
| | | } |
| | | } |
| | | for (String characterRange : characterRanges.keySet()) |
| | | for (Map.Entry<String, Integer> entry : characterRanges.entrySet()) |
| | | { |
| | | int minimumCount = characterRanges.get(characterRange); |
| | | String characterRange = entry.getKey(); |
| | | int minimumCount = entry.getValue(); |
| | | Integer passwordCount = rangeCounts.get(characterRange); |
| | | if (minimumCount > 0) |
| | | { |
| | |
| | | if (usedOptionalCharacterSets < requiredOptionalCharacterSets) |
| | | { |
| | | StringBuilder builder = new StringBuilder(); |
| | | for (String characterSet : characterSets.keySet()) |
| | | for (Map.Entry<String, Integer> entry : characterSets.entrySet()) |
| | | { |
| | | if (characterSets.get(characterSet) == 0) |
| | | String characterSet = entry.getKey(); |
| | | if (entry.getValue() == 0) |
| | | { |
| | | if (builder.length() > 0) |
| | | { |
| | |
| | | builder.append('\''); |
| | | } |
| | | } |
| | | for (String characterRange : characterRanges.keySet()) |
| | | for (Map.Entry<String, Integer> entry : characterRanges.entrySet()) |
| | | { |
| | | if (characterRanges.get(characterRange) == 0) |
| | | String characterRange = entry.getKey(); |
| | | if (entry.getValue() == 0) |
| | | { |
| | | if (builder.length() > 0) |
| | | { |
| | |
| | | import java.util.LinkedHashMap; |
| | | import java.util.LinkedHashSet; |
| | | import java.util.LinkedList; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.concurrent.LinkedBlockingQueue; |
| | | import java.util.concurrent.TimeUnit; |
| | |
| | | // optimizations that we can do here, but in general the filter will look |
| | | // like "(&(filter)(|(urlFilters)))". |
| | | LinkedHashMap<DN,SearchFilter> searchMap = new LinkedHashMap<>(); |
| | | for (DN urlBaseDN : baseDNs.keySet()) |
| | | for (Map.Entry<DN, LinkedList<LDAPURL>> entry : baseDNs.entrySet()) |
| | | { |
| | | LinkedList<LDAPURL> urlList = baseDNs.get(urlBaseDN); |
| | | DN urlBaseDN = entry.getKey(); |
| | | LinkedList<LDAPURL> urlList = entry.getValue(); |
| | | LinkedHashSet<SearchFilter> urlFilters = new LinkedHashSet<>(); |
| | | for (LDAPURL url : urlList) |
| | | { |
| | |
| | | } |
| | | |
| | | // Check dnMap first. |
| | | for (DN dn : dnMapCopy.keySet()) { |
| | | final CacheEntry cacheEntry = dnMapCopy.get(dn); |
| | | for (Map.Entry<DN, CacheEntry> mapEntry : dnMapCopy.entrySet()) { |
| | | DN dn = mapEntry.getKey(); |
| | | final CacheEntry cacheEntry = mapEntry.getValue(); |
| | | sb.append(dn); |
| | | sb.append(":"); |
| | | sb.append(cacheEntry != null ? Long.toString(cacheEntry.getEntryID()) : null); |
| | |
| | | import java.io.IOException; |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | import javax.swing.JEditorPane; |
| | | import javax.swing.JFrame; |
| | |
| | | html.append("</B><BR><BR>Occurrences by Source Line Number:<BR>"); |
| | | |
| | | HashMap<Integer,Long> lineNumbers = frame.getLineNumbers(); |
| | | for (Integer lineNumber : lineNumbers.keySet()) |
| | | for (Map.Entry<Integer, Long> entry : lineNumbers.entrySet()) |
| | | { |
| | | Integer lineNumber = entry.getKey(); |
| | | html.append(" "); |
| | | |
| | | long count = lineNumbers.get(lineNumber); |
| | | long count = entry.getValue(); |
| | | |
| | | if (lineNumber == ProfileStack.LINE_NUMBER_NATIVE) |
| | | { |
| | |
| | | frame.getMethodName(); |
| | | HashMap<ProfileStack,Long> stacks = stacksByMethod.get(classAndMethod); |
| | | |
| | | for (ProfileStack stack : stacks.keySet()) |
| | | for (Map.Entry<ProfileStack, Long> entry : stacks.entrySet()) |
| | | { |
| | | ProfileStack stack = entry.getKey(); |
| | | html.append("<BR><BR>"); |
| | | html.append(stacks.get(stack)); |
| | | html.append(entry.getValue()); |
| | | html.append(" occurrence(s):"); |
| | | |
| | | appendHTMLStack(stack, html, classAndMethod); |
| | |
| | | |
| | | |
| | | // Iterate through the threads and process their associated stack traces. |
| | | for (Thread t : stacks.keySet()) |
| | | for (Map.Entry<Thread, StackTraceElement[]> entry : stacks.entrySet()) |
| | | { |
| | | Thread t = entry.getKey(); |
| | | // We don't want to capture information about the profiler thread. |
| | | if (t == currentThread()) |
| | | { |
| | |
| | | |
| | | |
| | | // We'll skip over any stack that doesn't have any information. |
| | | StackTraceElement[] threadStack = stacks.get(t); |
| | | StackTraceElement[] threadStack = entry.getValue(); |
| | | if (threadStack == null || threadStack.length == 0) |
| | | { |
| | | continue; |
| | |
| | | |
| | | // For each unique stack captured, write it to the file followed by the |
| | | // number of occurrences. |
| | | for (ProfileStack s : stackTraces.keySet()) |
| | | for (Map.Entry<ProfileStack, Long> entry : stackTraces.entrySet()) |
| | | { |
| | | ProfileStack s = entry.getKey(); |
| | | s.write(writer); |
| | | writer.writeInteger(stackTraces.get(s)); |
| | | writer.writeInteger(entry.getValue()); |
| | | } |
| | | } |
| | | finally |
| | |
| | | import java.util.Collection; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import java.util.concurrent.atomic.AtomicLong; |
| | | import java.util.concurrent.atomic.AtomicReference; |
| | |
| | | { |
| | | try |
| | | { |
| | | for (int msgID : operationsInProgress.keySet()) |
| | | for (Map.Entry<Integer, Operation> entry : operationsInProgress.entrySet()) |
| | | { |
| | | int msgID = entry.getKey(); |
| | | if (msgID == messageID) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | Operation o = operationsInProgress.get(msgID); |
| | | Operation o = entry.getValue(); |
| | | if (o != null) |
| | | { |
| | | try |
| | |
| | | import java.util.concurrent.ConcurrentSkipListMap; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.util.Pair; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | |
| | | /** |
| | |
| | | { |
| | | list = new ConcurrentSkipListMap<>(); |
| | | |
| | | for (Map.Entry<DN, ServerState> mapEntry : cookie.list.entrySet()) |
| | | for (Entry<DN, ServerState> mapEntry : cookie.list.entrySet()) |
| | | { |
| | | DN dn = mapEntry.getKey(); |
| | | ServerState state = mapEntry.getValue(); |
| | |
| | | */ |
| | | public boolean cover(MultiDomainServerState covered) |
| | | { |
| | | for (DN baseDN : covered.list.keySet()) |
| | | for (Entry<DN, ServerState> entry : covered.list.entrySet()) |
| | | { |
| | | DN baseDN = entry.getKey(); |
| | | ServerState state = list.get(baseDN); |
| | | ServerState coveredState = covered.list.get(baseDN); |
| | | ServerState coveredState = entry.getValue(); |
| | | if (state == null || coveredState == null || !state.cover(coveredState)) |
| | | { |
| | | return false; |
| | |
| | | } |
| | | |
| | | int diff = 0; |
| | | for (Integer serverId : ss1.serverIdToCSN.keySet()) |
| | | for (Map.Entry<Integer, CSN> entry : ss1.serverIdToCSN.entrySet()) |
| | | { |
| | | CSN csn1 = ss1.serverIdToCSN.get(serverId); |
| | | Integer serverId = entry.getKey(); |
| | | CSN csn1 = entry.getValue(); |
| | | if (csn1 != null) |
| | | { |
| | | CSN csn2 = ss2.serverIdToCSN.get(serverId); |
| | |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.schema.ObjectClass; |
| | | import org.forgerock.opendj.ldap.schema.Schema; |
| | | import org.forgerock.opendj.server.config.meta.ReplicationDomainCfgDefn.IsolationPolicy; |
| | | import org.forgerock.opendj.server.config.server.ExternalChangelogDomainCfg; |
| | | import org.forgerock.opendj.server.config.server.ReplicationDomainCfg; |
| | | import org.opends.server.api.AlertGenerator; |
| | | import org.opends.server.api.DirectoryThread; |
| | | import org.opends.server.api.LocalBackend; |
| | | import org.opends.server.api.LocalBackend.BackendOperation; |
| | | import org.opends.server.api.LocalBackendInitializationListener; |
| | | import org.opends.server.api.DirectoryThread; |
| | | import org.opends.server.api.MonitorData; |
| | | import org.opends.server.api.ServerShutdownListener; |
| | | import org.opends.server.api.SynchronizationProvider; |
| | |
| | | import org.opends.server.types.Operation; |
| | | import org.opends.server.types.OperationType; |
| | | import org.opends.server.types.RawModification; |
| | | import org.forgerock.opendj.ldap.schema.Schema; |
| | | import org.opends.server.types.SearchFilter; |
| | | import org.opends.server.types.SearchResultEntry; |
| | | import org.opends.server.types.SearchResultReference; |
| | |
| | | // Check consistency of specific classes attributes |
| | | Schema schema = DirectoryServer.getSchema(); |
| | | int fractionalMode = newFractionalConfig.fractionalConfigToInt(); |
| | | for (String className : newFractionalSpecificClassesAttributes.keySet()) |
| | | for (Map.Entry<String, Set<String>> entry : newFractionalSpecificClassesAttributes.entrySet()) |
| | | { |
| | | String className = entry.getKey(); |
| | | // Does the class exist ? |
| | | ObjectClass fractionalClass = schema.getObjectClass(className); |
| | | if (fractionalClass.isPlaceHolder()) |
| | |
| | | |
| | | boolean isExtensibleObjectClass = fractionalClass.isExtensible(); |
| | | |
| | | Set<String> attributes = |
| | | newFractionalSpecificClassesAttributes.get(className); |
| | | |
| | | Set<String> attributes = entry.getValue(); |
| | | for (String attrName : attributes) |
| | | { |
| | | // Not a prohibited attribute ? |
| | |
| | | * list is equivalent to specificClassesAttributes2 attribute list |
| | | */ |
| | | Schema schema = DirectoryServer.getSchema(); |
| | | for (String className1 : specificClassesAttrs1.keySet()) |
| | | for (Map.Entry<String, Set<String>> entry : specificClassesAttrs1.entrySet()) |
| | | { |
| | | String className1 = entry.getKey(); |
| | | // Get class from specificClassesAttributes1 |
| | | ObjectClass objectClass1 = schema.getObjectClass(className1); |
| | | if (objectClass1.isPlaceHolder()) |
| | |
| | | |
| | | // Look for matching one in specificClassesAttributes2 |
| | | boolean foundClass = false; |
| | | for (String className2 : specificClassesAttrs2.keySet()) |
| | | for (Map.Entry<String, Set<String>> mapEntry : specificClassesAttrs2.entrySet()) |
| | | { |
| | | String className2 = mapEntry.getKey(); |
| | | ObjectClass objectClass2 = schema.getObjectClass(className2); |
| | | if (objectClass2.isPlaceHolder()) |
| | | { |
| | |
| | | { |
| | | foundClass = true; |
| | | // Now compare the 2 attribute lists |
| | | Set<String> attributes1 = specificClassesAttrs1.get(className1); |
| | | Set<String> attributes2 = specificClassesAttrs2.get(className2); |
| | | Set<String> attributes1 = entry.getValue(); |
| | | Set<String> attributes2 = mapEntry.getValue(); |
| | | if (!areAttributesEquivalent(attributes1, attributes2)) |
| | | { |
| | | return false; |
| | |
| | | boolean allRsWithZeroDistance = true; |
| | | int highestWeightRsId = -1; |
| | | int highestWeight = -1; |
| | | for (Integer rsId : bestServers.keySet()) |
| | | for (Entry<Integer, ReplicationServerInfo> entry : bestServers.entrySet()) |
| | | { |
| | | Integer rsId = entry.getKey(); |
| | | float loadDistance = loadDistances.get(rsId).floatValue(); |
| | | if (loadDistance > highestDistance) |
| | | { |
| | |
| | | { |
| | | allRsWithZeroDistance = false; |
| | | } |
| | | int weight = bestServers.get(rsId).getWeight(); |
| | | int weight = entry.getValue().getWeight(); |
| | | if (weight > highestWeight) |
| | | { |
| | | // This server has a higher weight |
| | |
| | | |
| | | File schemaInstanceDir = serverContext.getSchemaHandler().getSchemaDirectoryPath(); |
| | | |
| | | for (String name : tempSchemaFiles.keySet()) |
| | | for (Map.Entry<String, File> entry : tempSchemaFiles.entrySet()) |
| | | { |
| | | String name = entry.getKey(); |
| | | installedFileList.add(new File(schemaInstanceDir, name)); |
| | | tempFileList.add(tempSchemaFiles.get(name)); |
| | | tempFileList.add(entry.getValue()); |
| | | origFileList.add(new File(schemaInstanceDir, name + ".orig")); |
| | | } |
| | | |
| | |
| | | { |
| | | // Create a map from the base DNs of the backends to the corresponding backend ID. |
| | | Map<DN, String> baseToIDMap = new TreeMap<>(); |
| | | for (String id : backends.keySet()) |
| | | for (Map.Entry<String, Set<DN>> entry : backends.entrySet()) |
| | | { |
| | | for (DN dn : backends.get(id)) |
| | | String id = entry.getKey(); |
| | | for (DN dn : entry.getValue()) |
| | | { |
| | | baseToIDMap.put(dn, id); |
| | | } |
| | |
| | | table.appendHeading(INFO_TASKINFO_FIELD_ID.get()); |
| | | table.appendHeading(INFO_TASKINFO_FIELD_TYPE.get()); |
| | | table.appendHeading(INFO_TASKINFO_FIELD_STATUS.get()); |
| | | for (String taskId : mapIdToEntry.keySet()) { |
| | | TaskEntry entryWrapper = mapIdToEntry.get(taskId); |
| | | for (Map.Entry<String, TaskEntry> mapEntry : mapIdToEntry.entrySet()) { |
| | | String taskId = mapEntry.getKey(); |
| | | TaskEntry entryWrapper = mapEntry.getValue(); |
| | | table.startRow(); |
| | | table.appendCell(taskId); |
| | | table.appendCell(entryWrapper.getType()); |
| | |
| | | INFO_TASKINFO_FIELD_STATUS.get()); |
| | | menuBuilder.setColumnWidths(null, null, 0); |
| | | int index = 0; |
| | | for (final String taskId : mapIdToEntry.keySet()) { |
| | | for (Map.Entry<String, TaskEntry> mapEntry : mapIdToEntry.entrySet()) { |
| | | String taskId = mapEntry.getKey(); |
| | | taskIds.add(taskId); |
| | | final TaskEntry taskEntry = mapIdToEntry.get(taskId); |
| | | final TaskEntry taskEntry = mapEntry.getValue(); |
| | | menuBuilder.addNumberedOption( |
| | | LocalizableMessage.raw(taskEntry.getId()), |
| | | new TaskDrilldownMenu(taskId), |
| | |
| | | table.appendHeading(INFO_TASKINFO_OPTIONS.get(taskEntry.getType())); |
| | | Map<LocalizableMessage,List<String>> taskSpecificAttrs = |
| | | taskEntry.getTaskSpecificAttributeValuePairs(); |
| | | for (LocalizableMessage attrName : taskSpecificAttrs.keySet()) { |
| | | for (Map.Entry<LocalizableMessage, List<String>> entry : taskSpecificAttrs.entrySet()) { |
| | | LocalizableMessage attrName = entry.getKey(); |
| | | table.startRow(); |
| | | table.appendCell(attrName); |
| | | List<String> values = taskSpecificAttrs.get(attrName); |
| | | List<String> values = entry.getValue(); |
| | | if (!values.isEmpty()) { |
| | | table.appendCell(values.get(0)); |
| | | } |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import org.forgerock.opendj.ldap.AVA; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | |
| | | LinkedHashMap<AttributeType, List<Attribute>> urlAttributes = new LinkedHashMap<>(); |
| | | LinkedHashMap<AttributeType, List<Attribute>> base64Attributes = new LinkedHashMap<>(); |
| | | |
| | | for (AttributeType t : attributes.keySet()) |
| | | for (Map.Entry<AttributeType, ArrayList<TemplateValue>> entry : attributes.entrySet()) |
| | | { |
| | | ArrayList<TemplateValue> valueList = attributes.get(t); |
| | | AttributeType t = entry.getKey(); |
| | | ArrayList<TemplateValue> valueList = entry.getValue(); |
| | | if (t.isObjectClass()) |
| | | { |
| | | for (TemplateValue v : valueList) |
| | |
| | | |
| | | |
| | | // Now the set of user attributes. |
| | | for (AttributeType attrType : userAttributes.keySet()) |
| | | for (Map.Entry<AttributeType, List<Attribute>> entry : userAttributes.entrySet()) |
| | | { |
| | | AttributeType attrType = entry.getKey(); |
| | | if (exportConfig.includeAttribute(attrType)) |
| | | { |
| | | for (Attribute a : userAttributes.get(attrType)) |
| | | for (Attribute a : entry.getValue()) |
| | | { |
| | | if (a.isVirtual() && !exportConfig.includeVirtualAttributes()) |
| | | { |
| | |
| | | // Next, the set of operational attributes. |
| | | if (exportConfig.includeOperationalAttributes()) |
| | | { |
| | | for (AttributeType attrType : operationalAttributes.keySet()) |
| | | for (Map.Entry<AttributeType, List<Attribute>> entry : operationalAttributes.entrySet()) |
| | | { |
| | | AttributeType attrType = entry.getKey(); |
| | | if (exportConfig.includeAttribute(attrType)) |
| | | { |
| | | for (Attribute a : operationalAttributes.get(attrType)) |
| | | for (Attribute a : entry.getValue()) |
| | | { |
| | | if (a.isVirtual() && !exportConfig.includeVirtualAttributes()) |
| | | { |
| | |
| | | |
| | | if (! backupProperties.isEmpty()) |
| | | { |
| | | for (String name : backupProperties.keySet()) |
| | | for (Map.Entry<String, String> entry : backupProperties.entrySet()) |
| | | { |
| | | String value = backupProperties.get(name); |
| | | String name = entry.getKey(); |
| | | String value = entry.getValue(); |
| | | if (value == null) |
| | | { |
| | | value = ""; |
| | |
| | | switch (mod.getModificationType().asEnum()) |
| | | { |
| | | case ADD: |
| | | for (ObjectClass oc : ocs.keySet()) |
| | | for (Map.Entry<ObjectClass, String> entry : ocs.entrySet()) |
| | | { |
| | | ObjectClass oc = entry.getKey(); |
| | | if (objectClasses.containsKey(oc)) |
| | | { |
| | | if (!relaxConstraints) |
| | |
| | | } |
| | | else |
| | | { |
| | | objectClasses.put(oc, ocs.get(oc)); |
| | | objectClasses.put(oc, entry.getValue()); |
| | | } |
| | | } |
| | | objectClassAttribute = null; |
| | |
| | | // Make sure all the user attributes are allowed, have at least |
| | | // one value, and if they are single-valued that they have exactly |
| | | // one value. |
| | | for (AttributeType t : userAttributes.keySet()) |
| | | for (Map.Entry<AttributeType, List<Attribute>> entry : userAttributes.entrySet()) |
| | | { |
| | | AttributeType t = entry.getKey(); |
| | | boolean found = false; |
| | | for (ObjectClass o : objectClasses.keySet()) |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | List<Attribute> attrList = userAttributes.get(t); |
| | | List<Attribute> attrList = entry.getValue(); |
| | | if (attrList != null) |
| | | { |
| | | for (Attribute a : attrList) |
| | |
| | | |
| | | // Iterate through all of the operational attributes and make sure |
| | | // that all of the single-valued attributes only have one value. |
| | | for (AttributeType t : operationalAttributes.keySet()) |
| | | for (Map.Entry<AttributeType, List<Attribute>> entry : operationalAttributes.entrySet()) |
| | | { |
| | | AttributeType t = entry.getKey(); |
| | | if (t.isSingleValue()) |
| | | { |
| | | List<Attribute> attrList = operationalAttributes.get(t); |
| | | List<Attribute> attrList = entry.getValue(); |
| | | if (attrList != null) |
| | | { |
| | | for (Attribute a : attrList) |
| | |
| | | // Put back all the suppressed attributes where they belonged to. |
| | | // Then hopefully processVirtualAttributes() will rebuild the suppressed |
| | | // attribute list correctly. |
| | | for (AttributeType t : suppressedAttributes.keySet()) |
| | | for (Map.Entry<AttributeType, List<Attribute>> entry : suppressedAttributes.entrySet()) |
| | | { |
| | | List<Attribute> attrList = suppressedAttributes.get(t); |
| | | AttributeType t = entry.getKey(); |
| | | List<Attribute> attrList = entry.getValue(); |
| | | if (t.isOperational()) |
| | | { |
| | | operationalAttrsCopy.put(t, attrList); |
| | |
| | | // virtual attribute. |
| | | if (! exportConfig.includeVirtualAttributes()) |
| | | { |
| | | for (AttributeType t : suppressedAttributes.keySet()) |
| | | for (Map.Entry<AttributeType, List<Attribute>> entry : suppressedAttributes.entrySet()) |
| | | { |
| | | AttributeType t = entry.getKey(); |
| | | if (exportConfig.includeAttribute(t)) |
| | | { |
| | | for (Attribute a : suppressedAttributes.get(t)) |
| | | for (Attribute a : entry.getValue()) |
| | | { |
| | | writeLDIFLine(a, typesOnly, writer, wrapLines, wrapColumn); |
| | | } |
| | |
| | | LDIFExportConfig exportConfig, BufferedWriter writer, int wrapColumn, |
| | | boolean wrapLines) throws IOException |
| | | { |
| | | for (AttributeType attrType : attributes.keySet()) |
| | | for (Map.Entry<AttributeType, List<Attribute>> entry : attributes.entrySet()) |
| | | { |
| | | AttributeType attrType = entry.getKey(); |
| | | if (exportConfig.includeAttribute(attrType)) |
| | | { |
| | | List<Attribute> attrList = attributes.get(attrType); |
| | | List<Attribute> attrList = entry.getValue(); |
| | | for (Attribute a : attrList) |
| | | { |
| | | if (a.isVirtual() && !exportConfig.includeVirtualAttributes()) |
| | |
| | | private boolean equals(Map<AttributeType, List<Attribute>> attributes1, |
| | | Map<AttributeType, List<Attribute>> attributes2) |
| | | { |
| | | for (AttributeType at : attributes1.keySet()) |
| | | for (Map.Entry<AttributeType, List<Attribute>> entry : attributes1.entrySet()) |
| | | { |
| | | List<Attribute> list1 = attributes1.get(at); |
| | | AttributeType at = entry.getKey(); |
| | | List<Attribute> list1 = entry.getValue(); |
| | | List<Attribute> list2 = attributes2.get(at); |
| | | if (list2 == null || list1.size() != list2.size()) |
| | | { |
| | |
| | | System.setOut(originalSystemOut); |
| | | System.setErr(originalSystemErr); |
| | | |
| | | for (Logger l : disabledLogHandlers.keySet()) |
| | | for (Map.Entry<Logger, Handler> entry : disabledLogHandlers.entrySet()) |
| | | { |
| | | Handler h = disabledLogHandlers.get(l); |
| | | Logger l = entry.getKey(); |
| | | Handler h = entry.getValue(); |
| | | l.addHandler(h); |
| | | } |
| | | disabledLogHandlers.clear(); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.controls; |
| | | |
| | |
| | | import static org.testng.Assert.*; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | import org.forgerock.opendj.io.ASN1; |
| | |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | /** |
| | | * Test password control. |
| | | */ |
| | | /** Test password control. */ |
| | | @SuppressWarnings("javadoc") |
| | | public class PasswordControlTest |
| | | extends ControlsTestCase |
| | | { |
| | | |
| | | /** |
| | | * Create values for PasswordPolicyErrorType. |
| | | */ |
| | | /** Create values for PasswordPolicyErrorType. */ |
| | | @DataProvider(name = "passwordPolicyErrorTypeData") |
| | | public Object[][] createPasswordPolicyErrorTypeData() |
| | | { |
| | |
| | | return new Object[][] { { values } }; |
| | | } |
| | | |
| | | /** |
| | | * Test if int value are ok. |
| | | */ |
| | | /** Test if int value are ok. */ |
| | | @Test(dataProvider = "passwordPolicyErrorTypeData") |
| | | public void checkIntValuePasswordPolicyErrorTypeTest( |
| | | HashMap<Integer, String> expectedValues) throws Exception |
| | | Map<Integer, String> expectedValues) throws Exception |
| | | { |
| | | for (Integer i : expectedValues.keySet()) |
| | | for (Map.Entry<Integer, String> entry : expectedValues.entrySet()) |
| | | { |
| | | PasswordPolicyErrorType val = PasswordPolicyErrorType.valueOf(i); |
| | | String expected = expectedValues.get(i); |
| | | PasswordPolicyErrorType val = PasswordPolicyErrorType.valueOf(entry.getKey()); |
| | | String expected = entry.getValue(); |
| | | assertEquals(val.toString(), expected); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Test If we have only the required values. |
| | | */ |
| | | /** Test If we have only the required values. */ |
| | | @Test(dataProvider = "passwordPolicyErrorTypeData") |
| | | public void checkRequiredValuesPasswordPolicyErrorTypeTest( |
| | | HashMap<Integer, String> exceptedValues) throws Exception |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Test invalid int values. |
| | | */ |
| | | /** Test invalid int values. */ |
| | | @Test(dataProvider = "passwordPolicyErrorTypeData") |
| | | public void checkInvalidIntPasswordPolicyErrorTypeTest( |
| | | HashMap<Integer, String> exceptedValues) throws Exception |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Create correct values. |
| | | */ |
| | | /** Create correct values. */ |
| | | @DataProvider(name = "passwordPolicyWarningTypeData") |
| | | public Object[][] createPasswordPolicyWarningTypeData() |
| | | { |
| | |
| | | return new Object[][] { { values } }; |
| | | } |
| | | |
| | | /** |
| | | * Test if byte values are ok. |
| | | */ |
| | | /** Test if byte values are ok. */ |
| | | @Test(dataProvider = "passwordPolicyWarningTypeData") |
| | | public void checkIntValuePasswordPolicyWarningTypeTest( |
| | | HashMap<Byte, String> expectedValues) throws Exception |
| | | { |
| | | for (byte i : expectedValues.keySet()) |
| | | for (Map.Entry<Byte, String> entry : expectedValues.entrySet()) |
| | | { |
| | | byte i = entry.getKey(); |
| | | PasswordPolicyWarningType val = PasswordPolicyWarningType.valueOf(i); |
| | | String expected = expectedValues.get(i); |
| | | String expected = entry.getValue(); |
| | | |
| | | assertEquals(val.toString(), expected); |
| | | assertEquals(i, val.getType()); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Test If we have only the required values. |
| | | */ |
| | | /** Test If we have only the required values. */ |
| | | @Test(dataProvider = "passwordPolicyWarningTypeData") |
| | | public void checkRequiredValuesPasswordPolicyWarningTypeTest( |
| | | HashMap<Byte, String> exceptedValues) throws Exception |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Test invalid int values. |
| | | */ |
| | | /** Test invalid int values. */ |
| | | @Test(dataProvider = "passwordPolicyWarningTypeData") |
| | | public void checkInvalidIntPasswordPolicyWarningTypeTest( |
| | | HashMap<Integer, String> exceptedValues) throws Exception |
| | |
| | | Set<Integer> keys = exceptedValues.keySet(); |
| | | for (int i = 0x70; i < 0x90; i++) |
| | | { |
| | | byte b = new Integer(i).byteValue(); |
| | | byte b = Integer.valueOf(i).byteValue(); |
| | | if (!keys.contains(b)) |
| | | { |
| | | assertNull(PasswordPolicyWarningType.valueOf(b)); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Create values for PasswordExpiredControl. |
| | | */ |
| | | /** Create values for PasswordExpiredControl. */ |
| | | @DataProvider(name = "passwordExpiredControlData") |
| | | public Object[][] createPasswordExpiredControlData() |
| | | { |
| | |
| | | }; |
| | | } |
| | | |
| | | /** |
| | | * Test OID. |
| | | */ |
| | | /** Test OID. */ |
| | | @Test |
| | | public void checkPasswordOID() throws Exception |
| | | { |
| | |
| | | //assertEquals(OID_PASSWORD_POLICY_CONTROL, ""); |
| | | } |
| | | |
| | | /** |
| | | * Test "Netscape password expired control" implementation. |
| | | */ |
| | | /** Test "Netscape password expired control" implementation. */ |
| | | @Test(dataProvider = "passwordExpiredControlData") |
| | | public void passwordExpiredControlTest( |
| | | boolean isCritical) throws Exception |
| | |
| | | assertEquals(pec.getOID(),OID_NS_PASSWORD_EXPIRED); |
| | | } |
| | | |
| | | /** |
| | | * Create values for PasswordControl. |
| | | */ |
| | | /** Create values for PasswordControl. */ |
| | | @DataProvider(name = "passwordExpiringControlData") |
| | | public Object[][] createPasswordExpiringControlData() |
| | | { |
| | |
| | | }; |
| | | } |
| | | |
| | | /** |
| | | * Test "Netscape password expired control" implementation. |
| | | */ |
| | | /** Test "Netscape password expired control" implementation. */ |
| | | @Test(dataProvider = "passwordExpiringControlData") |
| | | public void passwordExpiringControlTest( |
| | | boolean isCritical, int sec) throws Exception |
| | |
| | | assertEquals(pec.getSecondsUntilExpiration(), sec); |
| | | } |
| | | |
| | | /** |
| | | * Create values for PasswordControl. |
| | | */ |
| | | /** Create values for PasswordControl. */ |
| | | @DataProvider(name = "passwordPolicyRequestControlData") |
| | | public Object[][] createPasswordPolicyRequestControlData() |
| | | { |
| | |
| | | }; |
| | | } |
| | | |
| | | /** |
| | | * Test PasswordPolicyRequestControl. |
| | | */ |
| | | /** Test PasswordPolicyRequestControl. */ |
| | | @Test(dataProvider = "passwordPolicyRequestControlData") |
| | | public void passwordPolicyRequestControlTest( |
| | | boolean isCritical) throws Exception |
| | |
| | | assertEquals("PasswordPolicyRequestControl()", pec.toString()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Create values for PasswordControl. |
| | | */ |
| | | /** Create values for PasswordControl. */ |
| | | @DataProvider(name = "passwordPolicyResponseControl") |
| | | public Object[][] createPasswordPolicyResponseControlData() |
| | | { |
| | |
| | | }; |
| | | } |
| | | |
| | | /** |
| | | * Test PasswordPolicyResponseControl. |
| | | */ |
| | | /** Test PasswordPolicyResponseControl. */ |
| | | @Test(dataProvider = "passwordPolicyResponseControl") |
| | | public void passwordPolicyResponseControlTest(boolean isCritical, int warningValue) |
| | | throws Exception |
| | |
| | | assertNull(pprc.getWarningType()); |
| | | assertNull(pprc.getErrorType()); |
| | | |
| | | |
| | | // check constructor PasswordPolicyResponseControl |
| | | // (PasswordPolicyWarningType warningType, |
| | | // int warningValue, |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // check encode/decode |
| | | ByteStringBuilder bsb = new ByteStringBuilder(); |
| | | ASN1Writer writer = ASN1.getWriter(bsb); |
| | |
| | | "PasswordPolicyResponseControl(" + warningType + "=" + warningValue + ", " + errorType + ")" ; |
| | | assertEquals(pprc.toString(), toString); |
| | | |
| | | |
| | | // check null value for the control |
| | | try |
| | | { |
| | |
| | | { |
| | | } |
| | | |
| | | |
| | | // check null warning type |
| | | bsb.clear(); |
| | | control = new PasswordPolicyResponseControl(isCritical, |
| | |
| | | public void checkIntValueTest(Map<Integer, String> expectedValues) |
| | | throws Exception |
| | | { |
| | | for (Integer i : expectedValues.keySet()) |
| | | for (Map.Entry<Integer, String> entry : expectedValues.entrySet()) |
| | | { |
| | | PersistentSearchChangeType val = PersistentSearchChangeType.valueOf(i); |
| | | String expected = expectedValues.get(i); |
| | | PersistentSearchChangeType val = PersistentSearchChangeType.valueOf(entry.getKey()); |
| | | String expected = entry.getValue(); |
| | | assertEquals(val.toString(), expected); |
| | | } |
| | | } |
| | |
| | | Iterator<ReplicationServerDomain> rsdIt = rs[rsIndex].getDomainIterator(); |
| | | if (rsdIt.hasNext()) |
| | | { |
| | | return rsdIt.next().getConnectedDSs().keySet().size(); |
| | | return rsdIt.next().getConnectedDSs().size(); |
| | | } |
| | | return 0; |
| | | } |