RestorePanel.java revision d25372dc8e65a9ed019a88fdf659ca61313f1b31
/*
* 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
* 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
* trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 Sun Microsystems, Inc.
*/
/**
* The panel that appears when the user wants to restore from a backup.
*
*/
public class RestorePanel extends BackupListPanel
implements BackupCreatedListener
{
private static final long serialVersionUID = -205585323128518051L;
private ListSelectionListener listener;
/**
* Constructor of the panel.
*
*/
public RestorePanel()
{
super();
createLayout();
}
/**
* {@inheritDoc}
*/
{
return INFO_CTRL_PANEL_RESTORE_PANEL_TITLE.get();
}
/**
* {@inheritDoc}
*/
{
boolean refreshList = false;
{
refreshList = true;
}
else
{
f = f.getParentFile();
if (f != null)
{
}
}
if (refreshList && isVisible())
{
// If not visible the list will be refreshed next time the dialog is
// opened.
{
public void run()
{
refreshList();
}
});
}
}
/**
* {@inheritDoc}
*/
{
info.addBackupCreatedListener(this);
}
/**
* {@inheritDoc}
*/
public void toBeDisplayed(boolean visible)
{
if (visible)
{
}
}
/**
* {@inheritDoc}
*/
{
super.configurationChanged(ev);
}
/**
* {@inheritDoc}
*/
protected void verifyBackupClicked()
{
// Launch the task in another progress dialog.
Utilities.getParentDialog(this),
getInfo());
{
}
{
null,
dlg);
dlg.setVisible(true);
}
else
{
}
}
/**
* Creates the layout of the panel (but the contents are not populated here).
*/
private void createLayout()
{
super.createLayout(gbc);
listener = new ListSelectionListener()
{
{
}
};
}
/**
* {@inheritDoc}
*/
protected void checkOKButtonEnable()
{
}
/**
* {@inheritDoc}
*/
public void okClicked()
{
if (!selected)
{
{
}
else
{
}
}
{
{
}
// Ask for confirmation
boolean confirmed = true;
{
}
{
null,
progressDialog.setVisible(true);
}
}
{
}
}
/**
* {@inheritDoc}
*/
public void cancelClicked()
{
super.cancelClicked();
}
/**
* The task in charge of restoring or verifying the backup.
*
*/
protected class RestoreTask extends Task
{
private boolean verify;
/**
* The constructor of the task.
* @param info the control panel info.
* @param dlg the progress dialog that shows the progress of the task.
* @param verify whether this is an actual restore or a verify of the
* backup.
*/
boolean verify)
{
{
if (!backend.isConfigBackend())
{
}
}
}
/**
* {@inheritDoc}
*/
{
}
/**
* {@inheritDoc}
*/
public Message getTaskDescription()
{
if (verify)
{
}
else
{
}
}
/**
* {@inheritDoc}
*/
{
boolean canLaunch = true;
{
// All the operations are incompatible if they apply to this
// backend.
{
canLaunch = false;
}
}
return canLaunch;
}
/**
* {@inheritDoc}
*/
public void runTask()
{
try
{
if (isServerRunning())
{
}
else
{
}
if (returnCode != 0)
{
}
else
{
if (!verify)
{
{
}
}
}
}
catch (Throwable t)
{
lastException = t;
}
}
/**
* {@inheritDoc}
*/
{
return backendSet;
}
/**
* {@inheritDoc}
*/
{
if (verify)
{
}
if (isServerRunning())
{
}
return args;
}
/**
* {@inheritDoc}
*/
protected String getCommandLinePath()
{
return getCommandLinePath("restore");
}
};
}