From 34a9d1734d80b8b9906a9e14692a7fa0eb3f1f1c Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 04 Apr 2016 13:38:35 +0000
Subject: [PATCH] Remove @Activate/RemoveOnceNewConfigFrameworkIsUsed
---
/dev/null | 30 ----------
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromDirContext.java | 3
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromFile.java | 3
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewBaseDNPanel.java | 22 ++-----
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/IndexDescriptor.java | 9 +-
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractIndexPanel.java | 22 +++---
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractVLVIndexPanel.java | 9 +-
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewIndexPanel.java | 10 +-
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/IndexPanel.java | 22 +++---
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/IndexTableModel.java | 9 +-
10 files changed, 48 insertions(+), 91 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/IndexDescriptor.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/IndexDescriptor.java
index a6f3746..8a1fc96 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/IndexDescriptor.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/IndexDescriptor.java
@@ -24,6 +24,7 @@
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
@@ -35,7 +36,7 @@
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;
@@ -67,7 +68,7 @@
* 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;
@@ -104,7 +105,7 @@
*
* @return the type of indexes (equality, substring, etc.).
*/
- public SortedSet<IndexTypeDescriptor> getTypes()
+ public SortedSet<IndexType> getTypes()
{
return new TreeSet<>(types);
}
@@ -180,7 +181,7 @@
protected void recalculateHashCode()
{
final StringBuilder sb = new StringBuilder();
- for (final IndexTypeDescriptor t : types)
+ for (final IndexType t : types)
{
sb.append(t).append(",");
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/IndexTableModel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/IndexTableModel.java
index 06b589b..57b887f 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/IndexTableModel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/IndexTableModel.java
@@ -12,21 +12,20 @@
* 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
{
@@ -133,7 +132,7 @@
private String getIndexTypeString(IndexDescriptor index)
{
StringBuilder sb = new StringBuilder();
- for (IndexTypeDescriptor type : index.getTypes())
+ for (IndexType type : index.getTypes())
{
if (sb.length() > 0)
{
@@ -148,7 +147,7 @@
return sb.toString();
}
- private LocalizableMessage getIndexName(IndexTypeDescriptor type)
+ private LocalizableMessage getIndexName(IndexType type)
{
switch (type)
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/IndexTypeDescriptor.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/IndexTypeDescriptor.java
deleted file mode 100644
index cb6f719..0000000
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/IndexTypeDescriptor.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2015-2016 ForgeRock AS.
- */
-package org.opends.guitools.controlpanel.datamodel;
-
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-import org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn;
-import org.opends.server.util.RemoveOnceNewConfigFrameworkIsUsed;
-
-/**
- * Defines the set of values for the index type and provides adaptors to convert
- * from/to corresponding configuration classes.
- */
-@RemoveOnceNewConfigFrameworkIsUsed
-public enum IndexTypeDescriptor
-{
- /**
- * This index type is used to improve the efficiency of searches using
- * approximate matching search filters.
- */
- APPROXIMATE(BackendIndexCfgDefn.IndexType.APPROXIMATE,
- org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType.APPROXIMATE),
-
- /**
- * This index type is used to improve the efficiency of searches using
- * equality search filters.
- */
- EQUALITY(BackendIndexCfgDefn.IndexType.EQUALITY,
- org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType.EQUALITY),
-
- /**
- * This index type is used to improve the efficiency of searches using
- * extensible matching search filters.
- */
- EXTENSIBLE(BackendIndexCfgDefn.IndexType.EXTENSIBLE,
- org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType.EXTENSIBLE),
-
- /**
- * This index type is used to improve the efficiency of searches using
- * "greater than or equal to" or "less then or equal to" search filters.
- */
- ORDERING(BackendIndexCfgDefn.IndexType.ORDERING,
- org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType.ORDERING),
-
- /**
- * This index type is used to improve the efficiency of searches using the
- * presence search filters.
- */
- PRESENCE(BackendIndexCfgDefn.IndexType.PRESENCE,
- org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType.PRESENCE),
-
- /**
- * This index type is used to improve the efficiency of searches using
- * substring search filters.
- */
- SUBSTRING(BackendIndexCfgDefn.IndexType.SUBSTRING,
- org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType.SUBSTRING);
-
- private final BackendIndexCfgDefn.IndexType oldConfigBackendIndexType;
- private final org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType backendIndexType;
-
- private IndexTypeDescriptor(final BackendIndexCfgDefn.IndexType oldConfigBackendIndexType,
- final org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType backendIndexType)
- {
- this.oldConfigBackendIndexType = oldConfigBackendIndexType;
- this.backendIndexType = backendIndexType;
- }
-
- /**
- * Convert the index type to the equivalent
- * {@code BackendIndexCfgDefn.IndexType}.
- *
- * @return The index type to the equivalent
- * {@code BackendIndexCfgDefn.IndexType}
- */
- public BackendIndexCfgDefn.IndexType toBackendIndexType()
- {
- return oldConfigBackendIndexType;
- }
-
- private static IndexTypeDescriptor fromBackendIndexType(final BackendIndexCfgDefn.IndexType indexType)
- {
- switch (indexType)
- {
- case APPROXIMATE:
- return APPROXIMATE;
- case EQUALITY:
- return EQUALITY;
- case EXTENSIBLE:
- return EXTENSIBLE;
- case ORDERING:
- return ORDERING;
- case PRESENCE:
- return PRESENCE;
- case SUBSTRING:
- return SUBSTRING;
- default:
- throw new IllegalArgumentException("No IndexTypeDescriptor corresponding to: " + indexType);
- }
- }
-
- /**
- * Convert the provided {@code Set<BackendIndexCfgDefn.IndexType>} to a
- * {@code Set<IndexTypeDescriptor>}.
- *
- * @param indexTypes
- * A set of {@code Set<BackendIndexCfgDefn.IndexType>}
- * @return A set of {@code Set<IndexTypeDescriptor>} corresponding to the
- * provided {@code Set<BackendIndexCfgDefn.IndexType>}
- */
- public static Set<IndexTypeDescriptor> fromBackendIndexTypes(final Set<BackendIndexCfgDefn.IndexType> indexTypes)
- {
- final Set<IndexTypeDescriptor> indexTypeDescriptors = new LinkedHashSet<>();
- for (final BackendIndexCfgDefn.IndexType indexType : indexTypes)
- {
- indexTypeDescriptors.add(fromBackendIndexType(indexType));
- }
- return indexTypeDescriptors;
- }
-
- /**
- * Convert the provided {@code Set<IndexTypeDescriptor>} to a
- * {@code Set<BackendIndexCfgDefn.IndexType>}.
- *
- * @param indexTypeDescriptors
- * A set of {@code Set<IndexTypeDescriptor>}
- * @return A set of {@code Set<BackendIndexCfgDefn.IndexType>} corresponding
- * to the provided {@code Set<IndexTypeDescriptor>}
- */
- public static Set<BackendIndexCfgDefn.IndexType> toBackendIndexTypes(
- final Set<IndexTypeDescriptor> indexTypeDescriptors)
- {
- final Set<BackendIndexCfgDefn.IndexType> indexTypes = new LinkedHashSet<>();
- for (final IndexTypeDescriptor indexTypeDescriptor : indexTypeDescriptors)
- {
- indexTypes.add(indexTypeDescriptor.toBackendIndexType());
- }
- return indexTypes;
- }
-
- /**
- * Convert the provided {@code Set<IndexTypeDescriptor>} to a
- * {@code Set<org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType>}.
- *
- * @param indexTypeDescriptors
- * A set of {@code Set<IndexTypeDescriptor>}
- * @return A set of
- * {@code Set<org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType>}
- * corresponding to the provided {@code Set<IndexTypeDescriptor>}
- */
- public static Set<org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType> toNewConfigBackendIndexTypes(
- final Set<IndexTypeDescriptor> indexTypeDescriptors)
- {
- Set<org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType> newConfigIndexTypes = new HashSet<>();
- for (IndexTypeDescriptor indexType : indexTypeDescriptors)
- {
- newConfigIndexTypes.add(indexType.backendIndexType);
- }
- return newConfigIndexTypes;
- }
-
-}
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractIndexPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractIndexPanel.java
index a00f35b..4398668 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractIndexPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractIndexPanel.java
@@ -16,6 +16,7 @@
*/
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;
@@ -44,8 +45,8 @@
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;
@@ -116,10 +117,9 @@
/** 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());
@@ -304,9 +304,9 @@
* @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())
@@ -357,19 +357,19 @@
}
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();
@@ -388,7 +388,7 @@
}
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;
@@ -399,7 +399,7 @@
if (isCreation || indexTypes.equals(indexToModify.getTypes()))
{
- index.setIndexType(IndexTypeDescriptor.toNewConfigBackendIndexTypes(indexTypes));
+ index.setIndexType(indexTypes);
}
if (indexEntryLimit != index.getIndexEntryLimit())
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractVLVIndexPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractVLVIndexPanel.java
index c7c537e..390900a 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractVLVIndexPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractVLVIndexPanel.java
@@ -16,6 +16,7 @@
*/
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.*;
@@ -61,12 +62,12 @@
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;
@@ -479,9 +480,7 @@
{ 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(),
@@ -494,7 +493,7 @@
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(),
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/IndexPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/IndexPanel.java
index efe905d..38878e8 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/IndexPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/IndexPanel.java
@@ -48,7 +48,6 @@
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;
@@ -59,6 +58,7 @@
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;
@@ -389,7 +389,7 @@
ordering.setSelected(false);
substring.setSelected(false);
presence.setSelected(false);
- for (IndexTypeDescriptor type : index.getTypes())
+ for (IndexType type : index.getTypes())
{
switch(type)
{
@@ -476,7 +476,7 @@
private String backendName;
private int entryLimitValue;
private IndexDescriptor indexToModify;
- private SortedSet<IndexTypeDescriptor> indexTypes = new TreeSet<>();
+ private SortedSet<IndexType> indexTypes = new TreeSet<>();
private IndexDescriptor modifiedIndex;
/**
@@ -639,7 +639,7 @@
final BackendIndexCfgClient index = backend.getBackendIndex(attributeName);
if (!indexTypes.equals(indexToModify.getTypes()))
{
- index.setIndexType(IndexTypeDescriptor.toBackendIndexTypes(indexTypes));
+ index.setIndexType(indexTypes);
}
if (entryLimitValue != index.getIndexEntryLimit())
@@ -726,8 +726,8 @@
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))
{
@@ -735,23 +735,23 @@
}
}
// 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())
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewBaseDNPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewBaseDNPanel.java
index ee55956..927f12b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewBaseDNPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewBaseDNPanel.java
@@ -64,7 +64,6 @@
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;
@@ -82,7 +81,6 @@
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;
@@ -94,7 +92,6 @@
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;
@@ -945,8 +942,8 @@
{
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)
{
@@ -954,17 +951,10 @@
}
}
- @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
@@ -1119,11 +1109,11 @@
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());
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewIndexPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewIndexPanel.java
index 4618617..0ca6d8b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewIndexPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewIndexPanel.java
@@ -41,7 +41,6 @@
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;
@@ -52,6 +51,7 @@
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;
@@ -334,7 +334,7 @@
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.
@@ -469,7 +469,7 @@
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);
@@ -549,10 +549,10 @@
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);
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromDirContext.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromDirContext.java
index e4c33ef..2b42966 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromDirContext.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromDirContext.java
@@ -52,7 +52,6 @@
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;
@@ -484,7 +483,7 @@
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)
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromFile.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromFile.java
index a5679c1..a03683f 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromFile.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromFile.java
@@ -38,7 +38,6 @@
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;
@@ -294,7 +293,7 @@
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)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/ActivateOnceNewConfigFrameworkIsUsed.java b/opendj-server-legacy/src/main/java/org/opends/server/util/ActivateOnceNewConfigFrameworkIsUsed.java
deleted file mode 100644
index b8658bb..0000000
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/ActivateOnceNewConfigFrameworkIsUsed.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2015 ForgeRock AS.
- */
-package org.opends.server.util;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * Temporary annotation to remind that annotated code should be activated once the
- * new configuration framework is used in place of legacy one.
- */
-@Retention(RetentionPolicy.SOURCE)
-public @interface ActivateOnceNewConfigFrameworkIsUsed
-{
- /** Optional comment on activation. */
- String value() default "";
-}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/RemoveOnceNewConfigFrameworkIsUsed.java b/opendj-server-legacy/src/main/java/org/opends/server/util/RemoveOnceNewConfigFrameworkIsUsed.java
deleted file mode 100644
index 8ee1ebe..0000000
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/RemoveOnceNewConfigFrameworkIsUsed.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2015 ForgeRock AS.
- */
-package org.opends.server.util;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * Temporary annotation to remind that annotated code could be removed once the
- * new configuration framework is used in place of legacy one.
- */
-@Retention(RetentionPolicy.SOURCE)
-public @interface RemoveOnceNewConfigFrameworkIsUsed
-{
- /** Optional comment on removal. */
- String value() default "";
-}
--
Gitblit v1.10.0