AutoRefactor: use Collection.addAll()
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock, AS. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.admin.ads; |
| | |
| | | */ |
| | | public Set<String> getReplicationServers() |
| | | { |
| | | HashSet<String> copy = new HashSet<String>(); |
| | | copy.addAll(replicationServers); |
| | | return copy; |
| | | return new HashSet<String>(replicationServers); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public Set<ReplicaDescriptor> getReplicas() |
| | | { |
| | | Set<ReplicaDescriptor> copy = new HashSet<ReplicaDescriptor>(); |
| | | copy.addAll(replicas); |
| | | return copy; |
| | | return new HashSet<ReplicaDescriptor>(replicas); |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.admin.ads; |
| | |
| | | */ |
| | | public Set<ReplicaDescriptor> getReplicas() |
| | | { |
| | | Set<ReplicaDescriptor> copy = new HashSet<ReplicaDescriptor>(); |
| | | copy.addAll(replicas); |
| | | return copy; |
| | | return new HashSet<ReplicaDescriptor>(replicas); |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | |
| | | TreeSet<TaskEntry> sortedSet = new TreeSet<TaskEntry>(this); |
| | | sortedSet.addAll(data); |
| | | dataSourceArray.clear(); |
| | | for (TaskEntry task : sortedSet) |
| | | { |
| | | dataSourceArray.add(task); |
| | | } |
| | | dataSourceArray.addAll(sortedSet); |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.task; |
| | |
| | | { |
| | | getProgressDialog().appendProgressHtml("<br><br>"); |
| | | } |
| | | ArrayList<String> args = new ArrayList<String>(); |
| | | args.addAll(getObfuscatedCommandLineArguments(arguments)); |
| | | ArrayList<String> args = new ArrayList<String>(getObfuscatedCommandLineArguments(arguments)); |
| | | printEquivalentCommandLine(getCommandLinePath("manage-tasks"), |
| | | args, INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_CANCEL_TASK.get( |
| | | task.getId())); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.task; |
| | |
| | | { |
| | | oldBaseDNs.add(baseDN.getDn()); |
| | | } |
| | | LinkedList<DN> newBaseDNs = new LinkedList<DN>(); |
| | | newBaseDNs.addAll(oldBaseDNs); |
| | | LinkedList<DN> newBaseDNs = new LinkedList<DN>(oldBaseDNs); |
| | | ArrayList<DN> dnsToRemove = new ArrayList<DN>(); |
| | | for (BaseDNDescriptor baseDN : baseDNs) |
| | | { |
| | |
| | | (LocalDBBackendCfgClient)root.getBackend( |
| | | baseDNs.iterator().next().getBackend().getBackendID()); |
| | | SortedSet<DN> oldBaseDNs = backend.getBaseDN(); |
| | | SortedSet<DN> newBaseDNs = new TreeSet<DN>(); |
| | | newBaseDNs.addAll(oldBaseDNs); |
| | | SortedSet<DN> newBaseDNs = new TreeSet<DN>(oldBaseDNs); |
| | | ArrayList<DN> dnsToRemove = new ArrayList<DN>(); |
| | | for (BaseDNDescriptor baseDN : baseDNs) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | * Portions Copyright 2013-2015 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.task; |
| | |
| | | */ |
| | | private void printEquivalentCommandToDelete(DN dn, boolean usingControl) |
| | | { |
| | | ArrayList<String> args = new ArrayList<String>(); |
| | | args.addAll(getObfuscatedCommandLineArguments( |
| | | ArrayList<String> args = new ArrayList<String>(getObfuscatedCommandLineArguments( |
| | | getConnectionCommandLineArguments(useAdminCtx, true))); |
| | | args.add(getNoPropertiesFileArgument()); |
| | | if (usingControl) |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.task; |
| | |
| | | */ |
| | | private void printEquivalentCommand() |
| | | { |
| | | ArrayList<String> args = new ArrayList<String>(); |
| | | args.addAll(getObfuscatedCommandLineArguments( |
| | | ArrayList<String> args = new ArrayList<String>(getObfuscatedCommandLineArguments( |
| | | getConnectionCommandLineArguments(useAdminCtx, true))); |
| | | args.add(getNoPropertiesFileArgument()); |
| | | args.add("--defaultAdd"); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.task; |
| | |
| | | protected void printEquivalentCommandToModify(String dn, |
| | | Collection<ModificationItem> mods, boolean useAdminCtx) |
| | | { |
| | | ArrayList<String> args = new ArrayList<String>(); |
| | | args.addAll(getObfuscatedCommandLineArguments( |
| | | ArrayList<String> args = new ArrayList<String>(getObfuscatedCommandLineArguments( |
| | | getConnectionCommandLineArguments(useAdminCtx, true))); |
| | | args.add(getNoPropertiesFileArgument()); |
| | | String equiv = getEquivalentCommandLine(getCommandLinePath("ldapmodify"), |
| | |
| | | protected void printEquivalentRenameCommand(DN oldDN, DN newDN, |
| | | boolean useAdminCtx) |
| | | { |
| | | ArrayList<String> args = new ArrayList<String>(); |
| | | args.addAll(getObfuscatedCommandLineArguments( |
| | | ArrayList<String> args = new ArrayList<String>(getObfuscatedCommandLineArguments( |
| | | getConnectionCommandLineArguments(useAdminCtx, true))); |
| | | args.add(getNoPropertiesFileArgument()); |
| | | String equiv = getEquivalentCommandLine(getCommandLinePath("ldapmodify"), |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | for (int i=0; i<combos.length; i++) |
| | | { |
| | | DefaultComboBoxModel model = (DefaultComboBoxModel)combos[i].getModel(); |
| | | ArrayList<Object> el = new ArrayList<Object>(); |
| | | el.addAll(ruleNames.get(i)); |
| | | ArrayList<Object> el = new ArrayList<Object>(ruleNames.get(i)); |
| | | if (model.getSize() == 0) |
| | | { |
| | | el.add(0, NO_MATCHING_RULE); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | |
| | | |
| | | private Set<AttributeType> getRequiredAttributes() |
| | | { |
| | | HashSet<AttributeType> attrs = new HashSet<AttributeType>(); |
| | | attrs.addAll(attributes.getSelectedListModel1().getData()); |
| | | attrs.removeAll(inheritedRequiredAttributes); |
| | | return attrs; |
| | | return intersect(attributes.getSelectedListModel1().getData(), inheritedRequiredAttributes); |
| | | } |
| | | |
| | | private Set<AttributeType> getOptionalAttributes() |
| | | { |
| | | HashSet<AttributeType> attrs = new HashSet<AttributeType>(); |
| | | attrs.addAll(attributes.getSelectedListModel2().getData()); |
| | | attrs.removeAll(inheritedOptionalAttributes); |
| | | return intersect(attributes.getSelectedListModel2().getData(), inheritedOptionalAttributes); |
| | | } |
| | | |
| | | private Set<AttributeType> intersect(Set<AttributeType> set1, Set<AttributeType> set2) |
| | | { |
| | | HashSet<AttributeType> attrs = new HashSet<AttributeType>(set1); |
| | | attrs.removeAll(set2); |
| | | return attrs; |
| | | } |
| | | |
| | | private ObjectClass getNewObjectClass() |
| | | { |
| | | ObjectClass newObjectClass = new ObjectClass("", |
| | | return new ObjectClass("", |
| | | getObjectClassName(), |
| | | getAllNames(), |
| | | getOID(), |
| | |
| | | getObjectClassType(), |
| | | obsolete.isSelected(), |
| | | getExtraProperties()); |
| | | |
| | | return newObjectClass; |
| | | } |
| | | |
| | | private void updateAttributes() |
| | |
| | | inheritedRequiredAttributes.clear(); |
| | | for (ObjectClass p : getObjectClassSuperiors()) |
| | | { |
| | | for (AttributeType attr : p.getRequiredAttributeChain()) |
| | | { |
| | | inheritedRequiredAttributes.add(attr); |
| | | } |
| | | for (AttributeType attr : p.getOptionalAttributeChain()) |
| | | { |
| | | inheritedOptionalAttributes.add(attr); |
| | | } |
| | | inheritedRequiredAttributes.addAll(p.getRequiredAttributeChain()); |
| | | inheritedOptionalAttributes.addAll(p.getOptionalAttributeChain()); |
| | | } |
| | | for (AttributeType attr : inheritedRequiredAttributes) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | * @param attributes the attributes that will be proposed to the user. |
| | | * |
| | | */ |
| | | protected MonitoringAttributesViewPanel( |
| | | LinkedHashSet<T> attributes) |
| | | protected MonitoringAttributesViewPanel(LinkedHashSet<T> attributes) |
| | | { |
| | | super(); |
| | | monitoringAttributes = new LinkedHashSet<T>(); |
| | | monitoringAttributes.addAll(attributes); |
| | | monitoringAttributes = new LinkedHashSet<T>(attributes); |
| | | createLayout(); |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | for (int i=0; i<combos.length; i++) |
| | | { |
| | | DefaultComboBoxModel model = (DefaultComboBoxModel)combos[i].getModel(); |
| | | ArrayList<Object> el = new ArrayList<Object>(); |
| | | el.addAll(ruleNames.get(i)); |
| | | ArrayList<Object> el = new ArrayList<Object>(ruleNames.get(i)); |
| | | if (model.getSize() == 0) |
| | | { |
| | | el.add(0, NO_MATCHING_RULE); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | sortedBackends.add(backend.getBackendID()); |
| | | } |
| | | } |
| | | ArrayList<Object> newElements = new ArrayList<Object>(); |
| | | newElements.addAll(sortedBackends); |
| | | ArrayList<Object> newElements = new ArrayList<Object>(sortedBackends); |
| | | if (sortedBackends.size() > 0) |
| | | { |
| | | newElements.add(COMBO_SEPARATOR); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | inheritedRequiredAttributes.clear(); |
| | | for (ObjectClass oc : superiors.getSelectedSuperiors()) |
| | | { |
| | | for (AttributeType attr : oc.getRequiredAttributeChain()) |
| | | { |
| | | inheritedRequiredAttributes.add(attr); |
| | | } |
| | | for (AttributeType attr : oc.getOptionalAttributeChain()) |
| | | { |
| | | inheritedOptionalAttributes.add(attr); |
| | | } |
| | | inheritedRequiredAttributes.addAll(oc.getRequiredAttributeChain()); |
| | | inheritedOptionalAttributes.addAll(oc.getOptionalAttributeChain()); |
| | | } |
| | | for (AttributeType attr : inheritedRequiredAttributes) |
| | | { |
| | |
| | | |
| | | private Set<AttributeType> getRequiredAttributes() |
| | | { |
| | | HashSet<AttributeType> attrs = new HashSet<AttributeType>(); |
| | | attrs.addAll(attributes.getSelectedListModel1().getData()); |
| | | attrs.removeAll(inheritedRequiredAttributes); |
| | | return attrs; |
| | | return intersect(attributes.getSelectedListModel1().getData(), inheritedRequiredAttributes); |
| | | } |
| | | |
| | | private Set<AttributeType> getOptionalAttributes() |
| | | { |
| | | HashSet<AttributeType> attrs = new HashSet<AttributeType>(); |
| | | attrs.addAll(attributes.getSelectedListModel2().getData()); |
| | | attrs.removeAll(inheritedOptionalAttributes); |
| | | return intersect(attributes.getSelectedListModel2().getData(), inheritedOptionalAttributes); |
| | | } |
| | | |
| | | private Set<AttributeType> intersect(Set<AttributeType> set1, Set<AttributeType> set2) |
| | | { |
| | | HashSet<AttributeType> attrs = new HashSet<AttributeType>(set1); |
| | | attrs.removeAll(set2); |
| | | return attrs; |
| | | } |
| | | |
| | | /** |
| | | * A renderer for the attribute lists. The renderer basically marks the |
| | | * inherited attributes with an asterisk. |
| | | * |
| | | */ |
| | | private class AttributeTypeCellRenderer implements ListCellRenderer |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | public void okClicked() |
| | | { |
| | | String struct = (String) structural.getSelectedItem(); |
| | | TreeSet<String> aux = new TreeSet<String>(); |
| | | aux.addAll(auxiliary.getSelectedListModel().getData()); |
| | | TreeSet<String> aux = new TreeSet<String>(auxiliary.getSelectedListModel().getData()); |
| | | aux.add("top"); |
| | | ObjectClassValue newValue = new ObjectClassValue(struct, aux); |
| | | valueChanged = !newValue.equals(value); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | |
| | | // Get all attributes that the entry can have |
| | | Set<String> attributes = new LinkedHashSet<String>(); |
| | | ArrayList<String> entryAttrs = new ArrayList<String>(); |
| | | entryAttrs.addAll(sr.getAttributeNames()); |
| | | |
| | | ArrayList<String> entryAttrs = new ArrayList<String>(sr.getAttributeNames()); |
| | | ArrayList<String> attrsWithNoOptions = new ArrayList<String>(); |
| | | for (String attr : entryAttrs) |
| | | { |
| | |
| | | attrsWithNoOptions, false); |
| | | |
| | | |
| | | for (String attr : entryAttrs) |
| | | { |
| | | attributes.add(attr); |
| | | } |
| | | |
| | | attributes.addAll(entryAttrs); |
| | | attributes.add("aci"); |
| | | |
| | | // In read-only mode display only the attributes with values |
| | |
| | | Object value = comp.getValue(); |
| | | if (value instanceof Collection<?>) |
| | | { |
| | | for (Object o : (Collection<?>)value) |
| | | { |
| | | values.add(o); |
| | | } |
| | | values.addAll((Collection<?>) value); |
| | | } |
| | | else |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | { |
| | | if (valuePair.value instanceof Collection<?>) |
| | | { |
| | | for (Object o : (Collection<?>)valuePair.value) |
| | | { |
| | | values.add(o); |
| | | } |
| | | values.addAll((Collection<?>) valuePair.value); |
| | | } |
| | | else |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.components; |
| | |
| | | LocalizableMessageBuilder sb = new LocalizableMessageBuilder(); |
| | | if (value != null) |
| | | { |
| | | Set<String> aux = new TreeSet<String>(); |
| | | aux.addAll(value.getAuxiliary()); |
| | | Set<String> aux = new TreeSet<String>(value.getAuxiliary()); |
| | | aux.remove("top"); |
| | | if (value.getStructural() != null) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.util; |
| | |
| | | attributesToKeep.add(attr); |
| | | } |
| | | } |
| | | for (MatchingRule mr : sc.getMatchingRules().values()) |
| | | { |
| | | matchingRulesToKeep.add(mr); |
| | | } |
| | | for (AttributeSyntax<?> syntax : sc.getSyntaxes().values()) |
| | | { |
| | | syntaxesToKeep.add(syntax); |
| | | } |
| | | matchingRulesToKeep.addAll(sc.getMatchingRules().values()); |
| | | syntaxesToKeep.addAll(sc.getSyntaxes().values()); |
| | | } |
| | | |
| | | private static String getSchemaDirectoryPath() |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.quicksetup.installer; |
| | |
| | | { |
| | | servers = new HashSet<String>(); |
| | | } |
| | | Set<String> oldServers = new HashSet<String>(); |
| | | oldServers.addAll(servers); |
| | | Set<String> oldServers = new HashSet<String>(servers); |
| | | for (Set<String> rs : replicationServers.values()) |
| | | { |
| | | servers.addAll(rs); |
| | |
| | | replicationServer.setReplicationServer(servers); |
| | | replicationServer.commit(); |
| | | |
| | | Set<String> newReplicationServers = new HashSet<String>(); |
| | | newReplicationServers.addAll(servers); |
| | | newReplicationServers.removeAll(oldServers); |
| | | Set<String> newReplicationServers = intersect(servers, oldServers); |
| | | |
| | | /* |
| | | * Create the domains |
| | |
| | | usedServerIds.add(domain.getServerId()); |
| | | |
| | | domain.commit(); |
| | | Set<String> addedServers = new TreeSet<String>(); |
| | | addedServers.addAll(servers); |
| | | addedServers.removeAll(oldServers); |
| | | Set<String> addedServers = intersect(servers, oldServers); |
| | | ConfiguredDomain domainConf = new ConfiguredDomain(domainName, |
| | | isCreated, addedServers); |
| | | domainsConf.add(domainConf); |
| | |
| | | } |
| | | } |
| | | |
| | | private Set<String> intersect(Set<String> set1, Set<String> set2) |
| | | { |
| | | Set<String> result = new TreeSet<String>(set1); |
| | | result.removeAll(set2); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * Configures the replication on a given server. |
| | | * @param remoteCtx the conection to the server where we want to configure |
| | | * @param remoteCtx the connection to the server where we want to configure |
| | | * the replication. |
| | | * @param replConf the object describing what was configured. |
| | | * @param serverDisplay the server display. |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS |
| | | */ |
| | | |
| | | |
| | |
| | | */ |
| | | public Set<SuffixDescriptor> getAvailableSuffixes() |
| | | { |
| | | LinkedHashSet<SuffixDescriptor> copy = |
| | | new LinkedHashSet<SuffixDescriptor>(); |
| | | copy.addAll(availableSuffixes); |
| | | return copy; |
| | | return new LinkedHashSet<SuffixDescriptor>(availableSuffixes); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public Set<SuffixDescriptor> getSuffixes() |
| | | { |
| | | LinkedHashSet<SuffixDescriptor> copy = |
| | | new LinkedHashSet<SuffixDescriptor>(); |
| | | copy.addAll(suffixesToReplicate); |
| | | return copy; |
| | | return new LinkedHashSet<SuffixDescriptor>(suffixesToReplicate); |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends.task; |
| | | |
| | |
| | | { |
| | | if (DirectoryServer.mailServerConfigured()) |
| | | { |
| | | LinkedHashSet<String> recipients = new LinkedHashSet<String>(); |
| | | recipients.addAll(notifyOnCompletion); |
| | | LinkedHashSet<String> recipients = new LinkedHashSet<String>(notifyOnCompletion); |
| | | if (! TaskState.isSuccessful(taskState)) |
| | | { |
| | | recipients.addAll(notifyOnError); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.config; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | |
| | | |
| | | // Create a temporary set of values that we will use for this change. It |
| | | // may not actually be applied if an error occurs for some reason. |
| | | LinkedHashSet<ByteString> tempValues; |
| | | if (requiresAdminAction && hasPendingValues) |
| | | { |
| | | tempValues = |
| | | new LinkedHashSet<ByteString>(pendingValues.size() + numValues); |
| | | tempValues.addAll(pendingValues); |
| | | } |
| | | else |
| | | { |
| | | tempValues = |
| | | new LinkedHashSet<ByteString>(activeValues.size() + numValues); |
| | | tempValues.addAll(activeValues); |
| | | } |
| | | |
| | | final LinkedHashSet<ByteString> vals = getValues(); |
| | | LinkedHashSet<ByteString> tempValues = new LinkedHashSet<ByteString>(vals.size() + numValues); |
| | | |
| | | // Iterate through all of the provided values. Make sure that each is |
| | | // acceptable for use and that it is not already contained in the value set. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | private LinkedHashSet<ByteString> getValues() |
| | | { |
| | | return requiresAdminAction && hasPendingValues |
| | | ? pendingValues |
| | | : activeValues; |
| | | } |
| | | |
| | | /** |
| | | * Attempts to remove the set of values from this configuration attribute. |
| | |
| | | * value set, or if this is a required attribute and |
| | | * the resulting value list would be empty. |
| | | */ |
| | | protected void removeValues(List<ByteString> values) |
| | | throws ConfigException |
| | | protected void removeValues(List<ByteString> values) throws ConfigException |
| | | { |
| | | // Create a temporary set of values that we will use for this change. It |
| | | // may not actually be applied if an error occurs for some reason. |
| | | LinkedHashSet<ByteString> tempValues; |
| | | if (requiresAdminAction && hasPendingValues) |
| | | { |
| | | tempValues = new LinkedHashSet<ByteString>(pendingValues.size()); |
| | | tempValues.addAll(pendingValues); |
| | | } |
| | | else |
| | | { |
| | | tempValues = new LinkedHashSet<ByteString>(activeValues.size()); |
| | | tempValues.addAll(activeValues); |
| | | } |
| | | |
| | | LinkedHashSet<ByteString> tempValues = new LinkedHashSet<ByteString>(getValues()); |
| | | |
| | | // Iterate through all the provided values and make sure that they are |
| | | // contained in the list. If not, then throw an exception. If so, then |
| | |
| | | |
| | | private Collection<ByteString> toAttributeValues(Collection<ByteString> values) |
| | | { |
| | | Set<ByteString> results = new LinkedHashSet<ByteString>(values.size()); |
| | | for (ByteString s : values) |
| | | { |
| | | results.add(s); |
| | | } |
| | | return results; |
| | | return new LinkedHashSet<ByteString>(values); |
| | | } |
| | | |
| | | /** |
| | |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | //Load base DNs from new configuration. |
| | | LinkedHashSet<DN> newConfiguredBaseDNs = new LinkedHashSet<DN>(); |
| | | for(DN baseDN : newConfiguration.getBaseDN()) |
| | | { |
| | | newConfiguredBaseDNs.add(baseDN); |
| | | } |
| | | |
| | | LinkedHashSet<DN> newConfiguredBaseDNs = new LinkedHashSet<DN>(newConfiguration.getBaseDN()); |
| | | //Load attribute types from new configuration. |
| | | LinkedHashSet<AttributeType> newAttributeTypes = |
| | | new LinkedHashSet<AttributeType>(); |
| | | for (AttributeType type : newConfiguration.getAttributeType()) |
| | | { |
| | | newAttributeTypes.add(type); |
| | | } |
| | | new LinkedHashSet<AttributeType>(newConfiguration.getAttributeType()); |
| | | |
| | | // Load the attribute-filter mapping |
| | | |
| | |
| | | { |
| | | // Iterate through the set of backends and pick out those that were |
| | | // requested. |
| | | HashSet<String> requestedBackends = |
| | | new HashSet<String>(backendList.size()); |
| | | requestedBackends.addAll(backendID.getValues()); |
| | | |
| | | HashSet<String> requestedBackends = new HashSet<String>(backendID.getValues()); |
| | | for (int i=0; i < numBackends; i++) |
| | | { |
| | | Backend<?> b = backendList.get(i); |
| | |
| | | } |
| | | |
| | | ArrayList<String> trailingArgs = argParser.getTrailingArguments(); |
| | | for(String s : trailingArgs) |
| | | { |
| | | dnStrings.add(s); |
| | | } |
| | | dnStrings.addAll(trailingArgs); |
| | | |
| | | // Set the connection options. |
| | | // Parse the SASL properties. |
| | |
| | | return CLIENT_SIDE_PARAM_ERROR; |
| | | } |
| | | } |
| | | // The rest are attributes |
| | | for(String s : filterAndAttributeStrings) |
| | | { |
| | | attributes.add(s); |
| | | } |
| | | |
| | | attributes.addAll(filterAndAttributeStrings); |
| | | } |
| | | |
| | | if(bindPassword.isPresent() && bindPasswordFile.isPresent()) |
| | |
| | | this.attributes = new ArrayList<Attribute>(attributes.size()); |
| | | for (List<Attribute> list : attributes.values()) |
| | | { |
| | | for (Attribute a : list) |
| | | { |
| | | this.attributes.add(a); |
| | | } |
| | | this.attributes.addAll(list); |
| | | } |
| | | } |
| | | |
| | |
| | | public Object[][] invalidAcis() throws Exception { |
| | | TestCaseUtils.startServer(); // This appears to be necessary since the DataProviders can be called before @BeforeClass. |
| | | |
| | | List<String> invalid = new ArrayList<String>(); |
| | | invalid.addAll(Arrays.asList(INVALID_ACIS)); |
| | | List<String> invalid = new ArrayList<String>(Arrays.asList(INVALID_ACIS)); |
| | | for (String[] aciAndMask: INVALID_ACIS_IF_ANY_CHAR_REMOVED) { |
| | | invalid.addAll(getAciMissingCharCombos(aciAndMask[0], aciAndMask[1])); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | private List<SingleSearchParams> explodeTestParams() throws Exception { |
| | | List<SingleSearchParams> explodedTests = new ArrayList<SingleSearchParams>(); |
| | | |
| | | for (SingleSearchParams searchTest: _searchTests) { |
| | | // Add the search test as is. |
| | | explodedTests.add(searchTest); |
| | | |
| | | // Enabling this doubles the number of test cases without much benefit, so we disable it for now |
| | | // And add it with the ACIs merged into the initial import |
| | | // String ditWithAcis = applyChangesToLdif(searchTest._initialDitLdif, searchTest._aciLdif); |
| | | // explodedTests.add(searchTest.clone(ditWithAcis, "")); |
| | | } |
| | | |
| | | return explodedTests; |
| | | } |
| | | |
| | | /** |
| | | * @return the LDIF result of applying changesLdif to changesLdif |
| | | */ |
| | |
| | | List<Object[]> allTestParams = new ArrayList<Object[]>(); |
| | | |
| | | for (SearchTestParams testParams: SEARCH_TEST_PARAMS) { |
| | | List<SingleSearchParams> explodedTests = testParams.explodeTestParams(); |
| | | for (SingleSearchParams singleTest: explodedTests) { |
| | | for (SingleSearchParams singleTest: testParams._searchTests) { |
| | | allTestParams.add(new Object[]{singleTest}); |
| | | } |
| | | } |
| | |
| | | |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.util.Platform; |
| | | import org.testng.Assert; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | import org.testng.annotations.BeforeClass; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines a set of tests for the org.opends.server.core.DN |
| | | * class. |
| | |
| | | @DataProvider(name = "namingContexts") |
| | | public Object[][] getNamingContexts() { |
| | | ArrayList<DN> contextList = new ArrayList<DN>(); |
| | | for (DN baseDN : DirectoryServer.getPublicNamingContexts().keySet()) |
| | | { |
| | | contextList.add(baseDN); |
| | | } |
| | | |
| | | for (DN baseDN : DirectoryServer.getPrivateNamingContexts().keySet()) |
| | | { |
| | | contextList.add(baseDN); |
| | | } |
| | | contextList.addAll(DirectoryServer.getPublicNamingContexts().keySet()); |
| | | contextList.addAll(DirectoryServer.getPrivateNamingContexts().keySet()); |
| | | |
| | | Object[][] contextArray = new Object[contextList.size()][1]; |
| | | for (int i=0; i < contextArray.length; i++) |