/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at legal-notices/CDDLv1_0.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2008-2009 Sun Microsystems, Inc.
* Portions Copyright 2014-2015 ForgeRock AS
*/
/**
* The panel that displays an existing index (it appears on the right of the
* 'Manage Indexes' dialog).
*/
{
private boolean ignoreCheckSave;
/** Default constructor. */
public IndexPanel()
{
super();
createLayout();
}
/**
* Creates the layout of the panel (but the contents are not populated here).
*/
private void createLayout()
{
p.setOpaque(false);
super.createBasicLayout(p, gbc, true);
gbc = new GridBagConstraints();
buttonPanel.setOpaque(false);
deleteIndex.setOpaque(false);
{
{
deleteIndex();
}
});
saveChanges.setOpaque(false);
{
{
saveIndex(false);
}
});
{
{
}
{
}
{
}
});
{
{
}
};
{
}
}
{
return INFO_CTRL_PANEL_INDEX_PANEL_TITLE.get();
}
{
return entryLimit;
}
{
isLocal() ?
{
public void run()
{
}
});
}
public void okClicked()
{
}
/**
* Method used to know if there are unsaved changes or not. It is used by the
* index selection listener when the user changes the selection.
*
* @return <CODE>true</CODE> if there are unsaved changes (and so the
* selection of the index should be canceled) and <CODE>false</CODE>
* otherwise.
*/
public boolean mustCheckUnsavedChanges()
{
}
/**
* Tells whether the user chose to save the changes in the panel, to not save
* them or simply cancelled the selection in the tree.
*
* @return the value telling whether the user chose to save the changes in the
* panel, to not save them or simply cancelled the selection change in
* the tree.
*/
{
UnsavedChangesDialog unsavedChangesDlg = new UnsavedChangesDialog(Utilities.getParentDialog(this), getInfo());
unsavedChangesDlg.setVisible(true);
{
saveIndex(false);
{
}
}
return result;
}
/** Checks the enabling state of the save button. */
private void checkSaveButton()
{
{
isModified());
}
}
private void deleteIndex()
{
Utilities.getParentDialog(this),
{
}
{
{
dlg.setVisible(true);
}
}
else
{
}
}
/**
* Saves the index modifications.
*
* @param modal
* whether the progress dialog for the task must be modal or not.
*/
{
if (!isModified())
{
return;
}
{
{
}
{
saveChanges.setEnabled(false);
dlg.setVisible(true);
}
}
{
}
}
/**
* Updates the contents of the panel with the provided index.
*
* @param index
* the index descriptor to be used to update the panel.
*/
{
ignoreCheckSave = true;
approximate.setSelected(false);
equality.setSelected(false);
ordering.setSelected(false);
substring.setSelected(false);
presence.setSelected(false);
{
switch(type)
{
case APPROXIMATE:
approximate.setSelected(true);
break;
case PRESENCE:
presence.setSelected(true);
break;
case EQUALITY:
equality.setSelected(true);
break;
case ORDERING:
ordering.setSelected(true);
break;
case SUBSTRING:
substring.setSelected(true);
break;
}
}
{
}
if (index.isDatabaseIndex())
{
}
if (index.isDatabaseIndex())
{
warning.setVisible(true);
}
{
{
warning.setVisible(true);
}
else
{
warning.setVisible(false);
}
}
ignoreCheckSave = false;
}
/**
* Returns <CODE>true</CODE> if the index has been modified and
* <CODE>false</CODE> otherwise.
*
* @return <CODE>true</CODE> if the index has been modified and
* <CODE>false</CODE> otherwise.
*/
private boolean isModified()
{
}
/**
* The task in charge of modifying the index.
*/
{
private int entryLimitValue;
/**
* The constructor of the task.
*
* @param info
* the control panel info.
* @param dlg
* the progress dialog that shows the progress of the task.
*/
{
backendSet = new HashSet<>();
indexTypes = getTypes();
}
{
return Type.MODIFY_INDEX;
}
{
return backendSet;
}
{
}
public boolean canLaunch(Task taskToBeLaunched, Collection<LocalizableMessage> incompatibilityReasons)
{
boolean canLaunch = true;
{
// All the operations are incompatible if they apply to this
// backend for safety. This is a short operation so the limitation
// has not a lot of impact.
{
canLaunch = false;
}
}
return canLaunch;
}
/**
* Updates the configuration of the modified index.
*
* @throws OpenDsException
* if there is an error updating the configuration.
*/
{
boolean configHandlerUpdated = false;
try
{
if (!isServerRunning())
{
configHandlerUpdated = true;
getInfo().stopPooling();
if (getInfo().mustDeregisterConfig())
{
}
getInfo().setMustDeregisterConfig(true);
}
else
{
{
public void run()
{
}
});
}
{
public void run()
{
}
});
if (isServerRunning())
{
}
else
{
}
{
public void run()
{
}
});
}
finally
{
if (configHandlerUpdated)
{
DirectoryServer.getInstance().initializeConfiguration(ConfigReader.configClassName, ConfigReader.configFile);
getInfo().startPooling();
}
}
}
/**
* Modifies index using the provided connection.
*
* @param ctx
* the connection to be used to update the index configuration.
* @throws OpenDsException
* if there is an error updating the server.
*/
{
final ManagementContext mCtx = LDAPManagementContext.createFromContext(JNDIDirContextAdaptor.adapt(ctx));
}
private void modifyBackendIndexOnline(final PluggableBackendCfgClient backend) throws OpenDsException
{
{
}
{
}
}
{
return null;
}
{
return new ArrayList<>();
}
/**
* Returns the full command-line path of the dsconfig command-line if we can
* provide an equivalent command-line (the server is running).
*
* @return the full command-line path of the dsconfig command-line if we can
* provide an equivalent command-line (the server is running).
*/
{
if (isServerRunning() && isModified())
{
return getCommandLinePath("dsconfig");
}
else
{
return null;
}
}
public void runTask()
{
try
{
}
catch (Throwable t)
{
lastException = t;
}
}
public void postOperation()
{
{
}
}
{
{
// To add
{
{
}
}
// To delete
{
{
}
}
{
}
{
}
}
{
}
return args;
}
}
}