VLVIndexPanel.java revision 9e82f3d205d5756d6cc6a400dc92e07c078862d6
a28658e7b50a29668499ee011576a857117fea4fPhill Cunnington * CDDL HEADER START
a28658e7b50a29668499ee011576a857117fea4fPhill Cunnington * The contents of this file are subject to the terms of the
a28658e7b50a29668499ee011576a857117fea4fPhill Cunnington * Common Development and Distribution License, Version 1.0 only
a28658e7b50a29668499ee011576a857117fea4fPhill Cunnington * (the "License"). You may not use this file except in compliance
a28658e7b50a29668499ee011576a857117fea4fPhill Cunnington * with the License.
a28658e7b50a29668499ee011576a857117fea4fPhill Cunnington * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
a28658e7b50a29668499ee011576a857117fea4fPhill Cunnington * or http://forgerock.org/license/CDDLv1.0.html.
a28658e7b50a29668499ee011576a857117fea4fPhill Cunnington * See the License for the specific language governing permissions
a28658e7b50a29668499ee011576a857117fea4fPhill Cunnington * and limitations under the License.
3a9e5adf8ed71f7841c483df0173964166267d9bJames Phillpotts * When distributing Covered Code, include this CDDL HEADER in each
a28658e7b50a29668499ee011576a857117fea4fPhill Cunnington * file and include the License file at legal-notices/CDDLv1_0.txt.
a28658e7b50a29668499ee011576a857117fea4fPhill Cunnington * If applicable, add the following below this CDDL HEADER, with the
a28658e7b50a29668499ee011576a857117fea4fPhill Cunnington * fields enclosed by brackets "[]" replaced with your own identifying
a28658e7b50a29668499ee011576a857117fea4fPhill Cunnington * information:
a28658e7b50a29668499ee011576a857117fea4fPhill Cunnington * Portions Copyright [yyyy] [name of copyright owner]
a28658e7b50a29668499ee011576a857117fea4fPhill Cunnington * CDDL HEADER END
a28658e7b50a29668499ee011576a857117fea4fPhill Cunnington * Copyright 2008-2009 Sun Microsystems, Inc.
6328925537fd7e5d853fe7540b10d6f909057805Phill Cunnington * Portions Copyright 2011-2015 ForgeRock AS
0e8bc8c8be7bf9b827d1d025079244092584f506Jaco Joosteimport static org.opends.guitools.controlpanel.util.Utilities.*;
0e8bc8c8be7bf9b827d1d025079244092584f506Jaco Joosteimport static org.opends.messages.AdminToolMessages.*;
a28658e7b50a29668499ee011576a857117fea4fPhill Cunningtonimport javax.naming.ldap.InitialLdapContext;
a28658e7b50a29668499ee011576a857117fea4fPhill Cunningtonimport org.forgerock.i18n.LocalizableMessage;
a28658e7b50a29668499ee011576a857117fea4fPhill Cunningtonimport org.forgerock.opendj.config.server.ConfigException;
a28658e7b50a29668499ee011576a857117fea4fPhill Cunningtonimport org.forgerock.opendj.ldap.SearchScope;
a28658e7b50a29668499ee011576a857117fea4fPhill Cunningtonimport org.opends.guitools.controlpanel.datamodel.AbstractIndexDescriptor;
a28658e7b50a29668499ee011576a857117fea4fPhill Cunningtonimport org.opends.guitools.controlpanel.datamodel.CategorizedComboBoxElement;
c3b0fb5f5fcfcf4947d168527ca89a8236ccf012sean oneillimport org.opends.guitools.controlpanel.datamodel.ControlPanelInfo;
c3b0fb5f5fcfcf4947d168527ca89a8236ccf012sean oneillimport org.opends.guitools.controlpanel.datamodel.ServerDescriptor;
c3b0fb5f5fcfcf4947d168527ca89a8236ccf012sean oneillimport org.opends.guitools.controlpanel.datamodel.VLVIndexDescriptor;
c3b0fb5f5fcfcf4947d168527ca89a8236ccf012sean oneillimport org.opends.guitools.controlpanel.datamodel.VLVSortOrder;
c3b0fb5f5fcfcf4947d168527ca89a8236ccf012sean oneillimport org.opends.guitools.controlpanel.event.ConfigurationChangeEvent;
c3b0fb5f5fcfcf4947d168527ca89a8236ccf012sean oneillimport org.opends.guitools.controlpanel.event.ScrollPaneBorderListener;
c3b0fb5f5fcfcf4947d168527ca89a8236ccf012sean oneillimport org.opends.guitools.controlpanel.task.DeleteIndexTask;
c3b0fb5f5fcfcf4947d168527ca89a8236ccf012sean oneillimport org.opends.guitools.controlpanel.task.OfflineUpdateException;
c3b0fb5f5fcfcf4947d168527ca89a8236ccf012sean oneillimport org.opends.guitools.controlpanel.task.Task;
c3b0fb5f5fcfcf4947d168527ca89a8236ccf012sean oneillimport org.opends.guitools.controlpanel.util.ConfigReader;
c3b0fb5f5fcfcf4947d168527ca89a8236ccf012sean oneillimport org.opends.guitools.controlpanel.util.Utilities;
c3b0fb5f5fcfcf4947d168527ca89a8236ccf012sean oneillimport org.opends.server.admin.client.ManagementContext;
c3b0fb5f5fcfcf4947d168527ca89a8236ccf012sean oneillimport org.opends.server.admin.client.ldap.JNDIDirContextAdaptor;
c3b0fb5f5fcfcf4947d168527ca89a8236ccf012sean oneillimport org.opends.server.admin.client.ldap.LDAPManagementContext;
c3b0fb5f5fcfcf4947d168527ca89a8236ccf012sean oneillimport org.opends.server.admin.std.client.LocalDBBackendCfgClient;
c3b0fb5f5fcfcf4947d168527ca89a8236ccf012sean oneillimport org.opends.server.admin.std.client.LocalDBVLVIndexCfgClient;
c3b0fb5f5fcfcf4947d168527ca89a8236ccf012sean oneillimport org.opends.server.admin.std.client.RootCfgClient;
6328925537fd7e5d853fe7540b10d6f909057805Phill Cunningtonimport org.opends.server.types.LDIFImportConfig;
6328925537fd7e5d853fe7540b10d6f909057805Phill Cunningtonimport org.opends.server.types.OpenDsException;
6328925537fd7e5d853fe7540b10d6f909057805Phill Cunningtonimport com.forgerock.opendj.cli.CommandBuilder;
6328925537fd7e5d853fe7540b10d6f909057805Phill Cunnington * The panel that displays an existing VLV index (it appears on the right of the
6328925537fd7e5d853fe7540b10d6f909057805Phill Cunnington * 'Manage Indexes' dialog).
6328925537fd7e5d853fe7540b10d6f909057805Phill Cunningtonpublic class VLVIndexPanel extends AbstractVLVIndexPanel
6328925537fd7e5d853fe7540b10d6f909057805Phill Cunnington private static final long serialVersionUID = 6333337497315464283L;
a28658e7b50a29668499ee011576a857117fea4fPhill Cunnington private static final LocalizableMessage INDEX_MODIFIED = INFO_CTRL_PANEL_INDEX_MODIFIED_MESSAGE.get();
a28658e7b50a29668499ee011576a857117fea4fPhill Cunnington private final JButton deleteIndex = Utilities.createButton(INFO_CTRL_PANEL_DELETE_INDEX_LABEL.get());
a28658e7b50a29668499ee011576a857117fea4fPhill Cunnington private final JButton saveChanges = Utilities.createButton(INFO_CTRL_PANEL_SAVE_CHANGES_LABEL.get());
a28658e7b50a29668499ee011576a857117fea4fPhill Cunnington private final JLabel warning = Utilities.createDefaultLabel();
a28658e7b50a29668499ee011576a857117fea4fPhill Cunnington private ScrollPaneBorderListener scrollListener;
a28658e7b50a29668499ee011576a857117fea4fPhill Cunnington private boolean ignoreCheckSave;
a28658e7b50a29668499ee011576a857117fea4fPhill Cunnington /** Default constructor. */
return baseDN;
LocalizableMessage msg = isLocal() ? INFO_CTRL_PANEL_AUTHENTICATION_REQUIRED_FOR_VLV_INDEX_EDITING.get()
public void run()
public void okClicked()
public boolean mustCheckUnsavedChanges()
final UnsavedChangesDialog unsavedChangesDlg = new UnsavedChangesDialog(getParentDialog(this), getInfo());
saveIndex(false);
return result;
private void checkSaveButton()
private void createLayout()
p.setOpaque(false);
deleteIndex();
saveIndex(false);
private void deleteIndex()
if (!isModified())
new ProgressDialog(getFrame(this), getFrame(this), INFO_CTRL_PANEL_MODIFYING_INDEX_TITLE.get(), getInfo());
ignoreCheckSave = true;
indexes[i] = i;
if (o.getType() == CategorizedComboBoxElement.Type.REGULAR && o.getValue().equals(s.getAttributeName()))
ignoreCheckSave = false;
case BASE_OBJECT:
case SINGLE_LEVEL:
case SUBORDINATES:
case WHOLE_SUBTREE:
private boolean isModified()
|| !index.getFilter().equals(filter.getText().trim()) || !index.getSortOrder().equals(getSortOrder());
return backendSet;
public boolean canLaunch(Task taskToBeLaunched, Collection<LocalizableMessage> incompatibilityReasons)
boolean canLaunch = true;
canLaunch = false;
return canLaunch;
boolean configHandlerUpdated = false;
if (!isServerRunning())
configHandlerUpdated = true;
public void run()
public void run()
if (isServerRunning())
modifyIndex();
public void run()
getProgressDialog().appendProgressHtml(Utilities.getProgressDone(ColorAndFontConstants.progressFont));
if (configHandlerUpdated)
DirectoryServer.getInstance().initializeConfiguration(ConfigReader.configClassName, ConfigReader.configFile);
final Collection<String> args = getObfuscatedCommandLineArguments(getDSConfigCommandLineArguments());
final ManagementContext mCtx = LDAPManagementContext.createFromContext(JNDIDirContextAdaptor.adapt(ctx));
return null;
return null;
public void runTask()
catch (final Throwable t)
lastException = t;
public void postOperation()
return args;