Remove @Activate/RemoveOnceNewConfigFrameworkIsUsed
3 files deleted
9 files modified
| | |
| | | import java.util.TreeSet; |
| | | |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType;; |
| | | |
| | | /** |
| | | * The class used to describe the index configuration (the normal index: the one |
| | |
| | | private static final String[] DATABASE_INDEXES = new String[] { |
| | | DN2ID_INDEX_NAME, ID2CHILDREN_COUNT_NAME, ID2CHILDREN_INDEX_NAME, ID2SUBTREE_INDEX_NAME }; |
| | | |
| | | private final SortedSet<IndexTypeDescriptor> types = new TreeSet<>(); |
| | | private final SortedSet<IndexType> types = new TreeSet<>(); |
| | | private final boolean isDatabaseIndex; |
| | | private final int entryLimit; |
| | | private final AttributeType attr; |
| | |
| | | * the entry limit for the index. |
| | | */ |
| | | public IndexDescriptor( |
| | | String name, AttributeType attr, BackendDescriptor backend, Set<IndexTypeDescriptor> types, int entryLimit) |
| | | String name, AttributeType attr, BackendDescriptor backend, Set<IndexType> types, int entryLimit) |
| | | { |
| | | super(name, backend); |
| | | this.attr = attr; |
| | |
| | | * |
| | | * @return the type of indexes (equality, substring, etc.). |
| | | */ |
| | | public SortedSet<IndexTypeDescriptor> getTypes() |
| | | public SortedSet<IndexType> getTypes() |
| | | { |
| | | return new TreeSet<>(types); |
| | | } |
| | |
| | | protected void recalculateHashCode() |
| | | { |
| | | final StringBuilder sb = new StringBuilder(); |
| | | for (final IndexTypeDescriptor t : types) |
| | | for (final IndexType t : types) |
| | | { |
| | | sb.append(t).append(","); |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType; |
| | | |
| | | /** |
| | | * The table model for the indexes. This is the table model used by the table |
| | | * that appears on the right side of the Manage Index dialog when the user |
| | | * clicks on the node "Index" and it gives a global view of the indexes |
| | | * defined on a given backend. |
| | | * |
| | | */ |
| | | public class IndexTableModel extends AbstractIndexTableModel |
| | | { |
| | |
| | | private String getIndexTypeString(IndexDescriptor index) |
| | | { |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (IndexTypeDescriptor type : index.getTypes()) |
| | | for (IndexType type : index.getTypes()) |
| | | { |
| | | if (sb.length() > 0) |
| | | { |
| | |
| | | return sb.toString(); |
| | | } |
| | | |
| | | private LocalizableMessage getIndexName(IndexTypeDescriptor type) |
| | | private LocalizableMessage getIndexName(IndexType type) |
| | | { |
| | | switch (type) |
| | | { |
| | |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | | import static org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType.*; |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | |
| | | import java.awt.Container; |
| | |
| | | import org.forgerock.opendj.server.config.client.BackendIndexCfgClient; |
| | | import org.forgerock.opendj.server.config.client.PluggableBackendCfgClient; |
| | | import org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn; |
| | | import org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType; |
| | | import org.opends.guitools.controlpanel.datamodel.IndexDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.IndexTypeDescriptor; |
| | | import org.opends.guitools.controlpanel.ui.components.TitlePanel; |
| | | import org.opends.guitools.controlpanel.ui.renderer.CustomListCellRenderer; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | |
| | | /** Substring index type check box. */ |
| | | final JCheckBox substring = Utilities.createCheckBox(INFO_CTRL_PANEL_SUBSTRING_LABEL.get()); |
| | | /** Array of checkboxes. */ |
| | | final JCheckBox[] types = { approximate, equality, ordering, presence, substring }; |
| | | final JCheckBox[] types = { approximate, equality, ordering, presence, substring }; |
| | | /** Array of index types that matches the array of checkboxes (types). */ |
| | | final IndexTypeDescriptor[] configTypes = { IndexTypeDescriptor.APPROXIMATE, IndexTypeDescriptor.EQUALITY, |
| | | IndexTypeDescriptor.ORDERING, IndexTypeDescriptor.PRESENCE, IndexTypeDescriptor.SUBSTRING }; |
| | | final IndexType[] configTypes = { APPROXIMATE, EQUALITY, ORDERING, PRESENCE, SUBSTRING }; |
| | | |
| | | final JButton deleteIndex = Utilities.createButton(INFO_CTRL_PANEL_DELETE_INDEX_LABEL.get()); |
| | | final JButton saveChanges = Utilities.createButton(INFO_CTRL_PANEL_SAVE_CHANGES_LABEL.get()); |
| | |
| | | * @return a sorted set of indexes (that matches what the user selected on the |
| | | * check boxes). |
| | | */ |
| | | SortedSet<IndexTypeDescriptor> getTypes() |
| | | SortedSet<IndexType> getTypes() |
| | | { |
| | | SortedSet<IndexTypeDescriptor> indexTypes = new TreeSet<>(); |
| | | SortedSet<IndexType> indexTypes = new TreeSet<>(); |
| | | for (int i = 0; i < types.length; i++) |
| | | { |
| | | if (types[i].isSelected()) |
| | |
| | | } |
| | | |
| | | void createIndexOffline(final String backendName, final String attributeName, |
| | | final Set<IndexTypeDescriptor> indexTypes, final int indexEntryLimit) throws OpenDsException |
| | | final Set<IndexType> indexTypes, final int indexEntryLimit) throws OpenDsException |
| | | { |
| | | updateIndexOffline(backendName, null, attributeName, indexTypes, indexEntryLimit); |
| | | } |
| | | |
| | | void modifyIndexOffline(final String backendName, final String attributeName, final IndexDescriptor indexToModify, |
| | | final Set<IndexTypeDescriptor> indexTypes, final int indexEntryLimit) throws OpenDsException |
| | | final Set<IndexType> indexTypes, final int indexEntryLimit) throws OpenDsException |
| | | { |
| | | updateIndexOffline(backendName, indexToModify, attributeName, indexTypes, indexEntryLimit); |
| | | } |
| | | |
| | | private void updateIndexOffline(final String backendName, final IndexDescriptor indexToModify, |
| | | final String attributeName, final Set<IndexTypeDescriptor> indexTypes, final int indexEntryLimit) |
| | | final String attributeName, final Set<IndexType> indexTypes, final int indexEntryLimit) |
| | | throws OpenDsException |
| | | { |
| | | getInfo().initializeConfigurationFramework(); |
| | |
| | | } |
| | | |
| | | private void updateBackendIndexOnline(final PluggableBackendCfgClient backend, |
| | | final IndexDescriptor indexToModify, final String attributeName, final Set<IndexTypeDescriptor> indexTypes, |
| | | final IndexDescriptor indexToModify, final String attributeName, final Set<IndexType> indexTypes, |
| | | final int indexEntryLimit) throws Exception |
| | | { |
| | | final boolean isCreation = indexToModify == null; |
| | |
| | | |
| | | if (isCreation || indexTypes.equals(indexToModify.getTypes())) |
| | | { |
| | | index.setIndexType(IndexTypeDescriptor.toNewConfigBackendIndexTypes(indexTypes)); |
| | | index.setIndexType(indexTypes); |
| | | } |
| | | |
| | | if (indexEntryLimit != index.getIndexEntryLimit()) |
| | |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | | import static org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType.*; |
| | | import static org.opends.guitools.controlpanel.util.Utilities.*; |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | |
| | |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.forgerock.opendj.server.config.client.BackendVLVIndexCfgClient; |
| | | import org.forgerock.opendj.server.config.client.PluggableBackendCfgClient; |
| | | import org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType; |
| | | import org.forgerock.opendj.server.config.meta.BackendVLVIndexCfgDefn; |
| | | import org.opends.guitools.controlpanel.datamodel.BackendDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.BaseDNDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.CategorizedComboBoxElement; |
| | | import org.opends.guitools.controlpanel.datamodel.IndexDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.IndexTypeDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.ServerDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.VLVIndexDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.VLVSortOrder; |
| | |
| | | { FilterType.EQUALITY, FilterType.SUBSTRING, FilterType.GREATER_OR_EQUAL, FilterType.LESS_OR_EQUAL, |
| | | FilterType.PRESENT, FilterType.APPROXIMATE_MATCH, FilterType.EXTENSIBLE_MATCH }; |
| | | |
| | | IndexTypeDescriptor[] indexTypes = |
| | | { IndexTypeDescriptor.EQUALITY, IndexTypeDescriptor.SUBSTRING, IndexTypeDescriptor.ORDERING, |
| | | IndexTypeDescriptor.ORDERING, IndexTypeDescriptor.PRESENCE, IndexTypeDescriptor.APPROXIMATE, null }; |
| | | IndexType[] indexTypes = { EQUALITY, SUBSTRING, ORDERING, ORDERING, PRESENCE, APPROXIMATE, null }; |
| | | |
| | | LocalizableMessage[] indexTypeNames = |
| | | { INFO_CTRL_PANEL_VLV_INDEX_EQUALITY_TYPE.get(), INFO_CTRL_PANEL_VLV_INDEX_SUBSTRING_TYPE.get(), |
| | |
| | | IndexDescriptor index = getIndex(filter.getAttributeType()); |
| | | if (index != null) |
| | | { |
| | | IndexTypeDescriptor type = indexTypes[i]; |
| | | IndexType type = indexTypes[i]; |
| | | if (type != null && !index.getTypes().contains(type)) |
| | | { |
| | | msgs.add(INFO_CTRL_PANEL_MUST_UPDATE_INDEX_DEFINITION_TYPE.get(filter.getAttributeType(), |
| | |
| | | import org.opends.guitools.controlpanel.datamodel.AbstractIndexDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo; |
| | | import org.opends.guitools.controlpanel.datamodel.IndexDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.IndexTypeDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.ServerDescriptor; |
| | | import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent; |
| | | import org.opends.guitools.controlpanel.event.ScrollPaneBorderListener; |
| | |
| | | import org.forgerock.opendj.server.config.client.BackendCfgClient; |
| | | import org.forgerock.opendj.server.config.client.BackendIndexCfgClient; |
| | | import org.forgerock.opendj.server.config.client.PluggableBackendCfgClient; |
| | | import org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.DN; |
| | |
| | | ordering.setSelected(false); |
| | | substring.setSelected(false); |
| | | presence.setSelected(false); |
| | | for (IndexTypeDescriptor type : index.getTypes()) |
| | | for (IndexType type : index.getTypes()) |
| | | { |
| | | switch(type) |
| | | { |
| | |
| | | private String backendName; |
| | | private int entryLimitValue; |
| | | private IndexDescriptor indexToModify; |
| | | private SortedSet<IndexTypeDescriptor> indexTypes = new TreeSet<>(); |
| | | private SortedSet<IndexType> indexTypes = new TreeSet<>(); |
| | | private IndexDescriptor modifiedIndex; |
| | | |
| | | /** |
| | |
| | | final BackendIndexCfgClient index = backend.getBackendIndex(attributeName); |
| | | if (!indexTypes.equals(indexToModify.getTypes())) |
| | | { |
| | | index.setIndexType(IndexTypeDescriptor.toBackendIndexTypes(indexTypes)); |
| | | index.setIndexType(indexTypes); |
| | | } |
| | | |
| | | if (entryLimitValue != index.getIndexEntryLimit()) |
| | |
| | | if (!indexTypes.equals(indexToModify.getTypes())) |
| | | { |
| | | // To add |
| | | Set<IndexTypeDescriptor> toAdd = new TreeSet<>(); |
| | | for (IndexTypeDescriptor newType : indexTypes) |
| | | Set<IndexType> toAdd = new TreeSet<>(); |
| | | for (IndexType newType : indexTypes) |
| | | { |
| | | if (!indexToModify.getTypes().contains(newType)) |
| | | { |
| | |
| | | } |
| | | } |
| | | // To delete |
| | | Set<IndexTypeDescriptor> toDelete = new TreeSet<>(); |
| | | for (IndexTypeDescriptor oldType : indexToModify.getTypes()) |
| | | Set<IndexType> toDelete = new TreeSet<>(); |
| | | for (IndexType oldType : indexToModify.getTypes()) |
| | | { |
| | | if (!indexTypes.contains(oldType)) |
| | | { |
| | | toDelete.add(oldType); |
| | | } |
| | | } |
| | | for (IndexTypeDescriptor newType : toDelete) |
| | | for (IndexType newType : toDelete) |
| | | { |
| | | args.add("--remove"); |
| | | args.add("index-type:" + newType); |
| | | } |
| | | for (IndexTypeDescriptor newType : toAdd) |
| | | for (IndexType newType : toAdd) |
| | | { |
| | | args.add("--add"); |
| | | args.add("index-type:" + newType.toBackendIndexType()); |
| | | args.add("index-type:" + newType); |
| | | } |
| | | } |
| | | if (entryLimitValue != indexToModify.getEntryLimit()) |
| | |
| | | import org.opends.guitools.controlpanel.datamodel.BackendDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.BaseDNDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo; |
| | | import org.opends.guitools.controlpanel.datamodel.IndexTypeDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.ServerDescriptor; |
| | | import org.opends.guitools.controlpanel.event.BrowseActionListener; |
| | | import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent; |
| | |
| | | import org.forgerock.opendj.server.config.client.BackendIndexCfgClient; |
| | | import org.forgerock.opendj.server.config.client.PluggableBackendCfgClient; |
| | | import org.forgerock.opendj.server.config.client.RootCfgClient; |
| | | import org.forgerock.opendj.server.config.meta.BackendCfgDefn; |
| | | import org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn; |
| | | import org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType; |
| | | import org.opends.server.core.DirectoryServer; |
| | |
| | | import org.opends.server.tools.LDAPModify; |
| | | import org.opends.server.tools.makeldif.MakeLDIF; |
| | | import org.opends.server.types.OpenDsException; |
| | | import org.opends.server.util.RemoveOnceNewConfigFrameworkIsUsed; |
| | | import org.opends.server.util.SetupUtils; |
| | | |
| | | import com.forgerock.opendj.cli.CommandBuilder; |
| | |
| | | { |
| | | try |
| | | { |
| | | Set<DN> baseDN = Collections.singleton(DN.valueOf(newBaseDN)); |
| | | BackendCreationHelper.createBackendOffline(backendName, baseDN, getSelectedBackendType().getBackend()); |
| | | Set<DN> baseDNs = Collections.singleton(DN.valueOf(newBaseDN)); |
| | | BackendCreationHelper.createBackendOffline(backendName, baseDNs, getSelectedBackendType().getBackend()); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | @RemoveOnceNewConfigFrameworkIsUsed("Use BackendCreationHelper.createBackend(...)") |
| | | private void createBackendOnline(String backendName) throws Exception |
| | | { |
| | | final RootCfgClient root = getRootConfigurationClient(); |
| | | final BackendCfgClient backend = |
| | | root.createBackend(getSelectedBackendType().getBackend(), backendName, null); |
| | | backend.setEnabled(true); |
| | | backend.setBaseDN(Collections.singleton(DN.valueOf(newBaseDN))); |
| | | backend.setBackendId(backendName); |
| | | backend.setWritabilityMode(BackendCfgDefn.WritabilityMode.ENABLED); |
| | | backend.commit(); |
| | | Set<DN> baseDNs = Collections.singleton(DN.valueOf(newBaseDN)); |
| | | BackendCreationHelper.createBackendOffline(backendName, baseDNs, getSelectedBackendType().getBackend()); |
| | | } |
| | | |
| | | private RootCfgClient getRootConfigurationClient() throws LdapException |
| | |
| | | args.add("--index-name"); |
| | | args.add(defaultIndex.getName()); |
| | | args.add("--set"); |
| | | args.add("index-type:" + IndexTypeDescriptor.EQUALITY.toBackendIndexType()); |
| | | args.add("index-type:" + IndexType.EQUALITY); |
| | | if (defaultIndex.shouldCreateSubstringIndex()) |
| | | { |
| | | args.add("--set"); |
| | | args.add("index-type:" + IndexTypeDescriptor.SUBSTRING.toBackendIndexType()); |
| | | args.add("index-type:" + IndexType.SUBSTRING); |
| | | } |
| | | args.addAll(getConnectionCommandLineArguments()); |
| | | args.add(getNoPropertiesFileArgument()); |
| | |
| | | import org.opends.guitools.controlpanel.datamodel.CategorizedComboBoxElement; |
| | | import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo; |
| | | import org.opends.guitools.controlpanel.datamodel.IndexDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.IndexTypeDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.ServerDescriptor; |
| | | import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent; |
| | | import org.opends.guitools.controlpanel.task.Task; |
| | |
| | | import org.forgerock.opendj.server.config.client.BackendIndexCfgClient; |
| | | import org.forgerock.opendj.server.config.client.PluggableBackendCfgClient; |
| | | import org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn; |
| | | import org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.schema.SomeSchemaElement; |
| | |
| | | private final Set<String> backendSet = new HashSet<>(); |
| | | private final String attributeName; |
| | | private final int entryLimitValue; |
| | | private final SortedSet<IndexTypeDescriptor> indexTypes; |
| | | private final SortedSet<IndexType> indexTypes; |
| | | |
| | | /** |
| | | * The constructor of the task. |
| | |
| | | final List<PropertyException> exceptions = new ArrayList<>(); |
| | | final BackendIndexCfgClient index = backend.createBackendIndex( |
| | | BackendIndexCfgDefn.getInstance(), attributeName, exceptions); |
| | | index.setIndexType(IndexTypeDescriptor.toBackendIndexTypes(indexTypes)); |
| | | index.setIndexType(indexTypes); |
| | | if (entryLimitValue != index.getIndexEntryLimit()) |
| | | { |
| | | index.setIndexEntryLimit(entryLimitValue); |
| | |
| | | args.add("--index-name"); |
| | | args.add(attributeName); |
| | | |
| | | for (IndexTypeDescriptor type : indexTypes) |
| | | for (IndexType type : indexTypes) |
| | | { |
| | | args.add("--set"); |
| | | args.add("index-type:" + type.toBackendIndexType()); |
| | | args.add("index-type:" + type); |
| | | } |
| | | args.add("--set"); |
| | | args.add("index-entry-limit:" + entryLimitValue); |
| | |
| | | import org.opends.guitools.controlpanel.datamodel.ConnectionHandlerDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.CustomSearchResult; |
| | | import org.opends.guitools.controlpanel.datamodel.IndexDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.IndexTypeDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.VLVIndexDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.VLVSortOrder; |
| | | import org.opends.guitools.controlpanel.task.OnlineUpdateException; |
| | |
| | | final BackendIndexCfgClient index = db.getBackendIndex(indexName); |
| | | indexes.add(new IndexDescriptor( |
| | | index.getAttribute().getNameOrOID(), index.getAttribute(), |
| | | null, IndexTypeDescriptor.fromBackendIndexTypes(index.getIndexType()), index.getIndexEntryLimit())); |
| | | null, index.getIndexType(), index.getIndexEntryLimit())); |
| | | } |
| | | } |
| | | catch (Exception oe) |
| | |
| | | import org.opends.guitools.controlpanel.datamodel.ConnectionHandlerDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.CustomSearchResult; |
| | | import org.opends.guitools.controlpanel.datamodel.IndexDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.IndexTypeDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.VLVIndexDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.VLVSortOrder; |
| | | import org.opends.guitools.controlpanel.task.OfflineUpdateException; |
| | |
| | | final BackendIndexCfg index = db.getBackendIndex(indexName); |
| | | indexes.add(new IndexDescriptor( |
| | | index.getAttribute().getNameOrOID(), index.getAttribute(), |
| | | null, IndexTypeDescriptor.fromBackendIndexTypes(index.getIndexType()), index.getIndexEntryLimit())); |
| | | null, index.getIndexType(), index.getIndexEntryLimit())); |
| | | } |
| | | } |
| | | catch (ConfigException ce) |