NewIndexPanel.java revision 688633f95faa52515b090ff00440b1eebdaad7d9
/*
* 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
*/
/**
* Panel that appears when the user defines a new index.
*/
public class NewIndexPanel extends AbstractIndexPanel
{
private static final long serialVersionUID = -3516011638125862137L;
private final Component relativeComponent;
private IndexDescriptor newIndex;
/**
* Constructor of the panel.
*
* @param backendName
* the backend where the index will be created.
* @param relativeComponent
* the component relative to which the dialog containing this panel
* will be centered.
*/
{
super();
this.relativeComponent = relativeComponent;
createLayout();
}
public LocalizableMessage getTitle()
{
return INFO_CTRL_PANEL_NEW_INDEX_TITLE.get();
}
public Component getPreferredFocusComponent()
{
return attributes;
}
/**
* Updates the contents of the panel with the provided backend.
*
* @param backend
* the backend where the index will be created.
*/
{
}
{
final boolean[] repack = { false };
final boolean[] error = { false };
if (s != null)
{
schema = s;
{
{
{
}
{
}
else
{
}
}
}
if (!customAttrNames.isEmpty())
{
newElements.add(new CategorizedComboBoxElement(CUSTOM_ATTRIBUTES, CategorizedComboBoxElement.Type.CATEGORY));
{
}
}
if (!standardAttrNames.isEmpty())
{
newElements.add(new CategorizedComboBoxElement(STANDARD_ATTRIBUTES, CategorizedComboBoxElement.Type.CATEGORY));
{
}
}
}
else
{
updateErrorPane(errorPane, ERR_CTRL_PANEL_SCHEMA_NOT_FOUND_SUMMARY.get(), ColorAndFontConstants.errorTitleFont,
repack[0] = true;
error[0] = true;
}
{
public void run()
{
if (repack[0])
{
if (relativeComponent != null)
{
}
}
}
});
if (!error[0])
{
}
}
{
{
{
{
return true;
}
}
}
return false;
}
{
{
{
return b;
}
}
return null;
}
public void okClicked()
{
{
}
try
{
if (n < MIN_ENTRY_LIMIT || MAX_ENTRY_LIMIT < n)
{
}
}
catch (Throwable t)
{
}
if (!isSomethingSelected())
{
}
Utilities.createFrame(), Utilities.getParentDialog(this), INFO_CTRL_PANEL_NEW_INDEX_TITLE.get(), getInfo());
{
}
{
dlg.setVisible(true);
}
else
{
}
}
private boolean isSomethingSelected()
{
{
if (somethingSelected)
{
return true;
}
}
return false;
}
private String getAttributeName()
{
}
/** Creates the layout of the panel (but the contents are not populated here). */
private void createLayout()
{
createBasicLayout(this, gbc, false);
{
{
String n = getAttributeName();
if (n != null)
{
}
}
});
}
/** The task in charge of creating the index. */
private class NewIndexTask extends Task
{
private final String attributeName;
private final 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.
*/
{
indexTypes = getTypes();
}
{
}
{
return backendSet;
}
public LocalizableMessage getTaskDescription()
{
}
public boolean canLaunch(final Task taskToBeLaunched, final 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;
}
private void updateConfiguration() throws OpenDsException
{
boolean configHandlerUpdated = false;
try
{
if (!isServerRunning())
{
configHandlerUpdated = true;
getInfo().stopPooling();
if (getInfo().mustDeregisterConfig())
{
}
getInfo().setMustDeregisterConfig(true);
}
else
{
{
public void run()
{
}
});
}
{
public void run()
{
INFO_CTRL_PANEL_CREATING_NEW_INDEX_PROGRESS.get(attributeName), ColorAndFontConstants.progressFont));
}
});
if (isServerRunning())
{
}
else
{
}
{
public void run()
{
getProgressDialog().appendProgressHtml(Utilities.getProgressDone(ColorAndFontConstants.progressFont));
}
});
}
finally
{
if (configHandlerUpdated)
{
DirectoryServer.getInstance().initializeConfiguration(ConfigReader.configClassName, ConfigReader.configFile);
getInfo().startPooling();
}
}
}
{
final ManagementContext mCtx = LDAPManagementContext.createFromContext(JNDIDirContextAdaptor.adapt(ctx));
if (backend instanceof LocalDBBackendCfgClient)
{
return;
}
}
private void createBackendIndexOnline(final PluggableBackendCfgClient backend) throws OpenDsException
{
{
}
}
{
{
}
}
protected String getCommandLinePath()
{
return null;
}
{
return new ArrayList<>();
}
private String getConfigCommandLineName()
{
if (isServerRunning())
{
return getCommandLinePath("dsconfig");
}
return null;
}
public void runTask()
{
try
{
{
{
break;
}
}
}
catch (Throwable t)
{
lastException = t;
}
}
public void postOperation()
{
{
}
}
{
{
}
return args;
}
}
}