BackupPanel.java revision c73e8d55f04419c98b9a4d977aafeff39539f0ce
/*
* 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-2009 Sun Microsystems, Inc.
*/
/**
* The panel that appears when the user clicks on 'Backup...'.
*
*/
public class BackupPanel extends BackupListPanel
{
private static final long serialVersionUID = -1626301350756394814L;
private JCheckBox allBackends;
private JTextField backupID;
private JTextField parentBackupID;
private JRadioButton fullBackup;
private JRadioButton incrementalBackup;
private JCheckBox compressData;
private JCheckBox encryptData;
private JCheckBox generateMessageDigest;
private JCheckBox signMessageDigest;
private JLabel lNoBackendsFound;
private JLabel lBackupType;
private JLabel lBackupOptions;
private ChangeListener changeListener;
private boolean backupIDInitialized = false;
private ScheduleSummaryPanel schedulePanel;
/**
* Default constructor.
*
*/
public BackupPanel()
{
super();
createLayout();
}
/**
* {@inheritDoc}
*/
{
return INFO_CTRL_PANEL_BACKUP_TITLE.get();
}
/**
* {@inheritDoc}
*/
public Component getPreferredFocusComponent()
{
return backupID;
}
/**
* {@inheritDoc}
*/
protected void verifyBackupClicked()
{
// Nothing to do: the button is not visible.
}
/**
* Creates the layout of the panel (but the contents are not populated here).
*
*/
private void createLayout()
{
lNoBackendsFound.setVisible(false);
fullBackup.setSelected(true);
super.createLayout(gbc);
verifyBackup.setVisible(false);
compressData.setSelected(false);
encryptData.setSelected(false);
generateMessageDigest.setSelected(false);
changeListener = new ChangeListener()
{
/**
* {@inheritDoc}
*/
{
}
};
}
/**
* {@inheritDoc}
*/
{
{
/**
* {@inheritDoc}
*/
public void run()
{
{
}
else
{
}
}
});
super.configurationChanged(ev);
}
/**
* {@inheritDoc}
*/
public void okClicked()
{
backupIDInitialized = false;
if (!allBackends.isSelected())
{
if (backendName == null)
{
}
}
else
{
{
}
}
{
}
else if (isLocal())
{
if (f.isFile())
{
}
else if (!f.exists())
{
}
}
{
}
{
if (f.isFile())
{
f.getAbsolutePath()));
}
}
if (incrementalBackup.isSelected())
{
if (isLocal())
{
(getSelectedBackup() != null);
if (!selected)
{
}
}
else
{
{
}
}
}
// Check that there is not a backup with the provided ID
final JComponent[] components =
{
};
setEnabledOK(false);
setEnabledCancel(false);
{
components[i].setEnabled(false);
}
{
/**
* {@inheritDoc}
*/
{
// Open the backup directory and make sure it is valid.
try
{
}
catch (Throwable t)
{
// Check the subdirectories
if (f.isDirectory())
{
{
if (children[i].isDirectory())
{
try
{
children[i].getAbsolutePath());
}
{
{
}
}
}
}
}
}
{
{
{
/**
* {@inheritDoc}
*/
public void run()
{
}
});
break;
}
}
return null;
}
/**
* {@inheritDoc}
*/
Throwable t)
{
{
components[i].setEnabled(true);
}
setEnabledOK(true);
setEnabledCancel(true);
{
{
}
{
if (allBackends.isSelected())
{
}
else
{
}
null,
progressDialog.setVisible(true);
}
}
{
}
}
};
{
}
else
{
}
}
private ScheduleType getSchedule()
{
return schedulePanel.getSchedule();
}
/**
* {@inheritDoc}
*/
public void cancelClicked()
{
super.cancelClicked();
}
/**
* {@inheritDoc}
*/
public void toBeDisplayed(boolean visible)
{
super.toBeDisplayed(visible);
if (visible && !backupIDInitialized)
{
}
if (!visible)
{
backupIDInitialized = false;
}
}
/**
* Initialize the backup ID field with a value.
*
*/
private void initializeBackupID()
{
}
/**
* Class that launches the backup.
*
*/
protected class BackupTask extends Task
{
/**
* The constructor of the task.
* @param info the control panel info.
* @param dlg the progress dialog that shows the progress of the task.
*/
{
if (!allBackends.isSelected())
{
}
else
{
for (BackendDescriptor backend :
{
if (!backend.isConfigBackend())
{
}
}
}
if (incrementalBackup.isSelected())
{
if (isLocal())
{
}
else
{
}
}
else
{
}
}
/**
* {@inheritDoc}
*/
{
}
/**
* {@inheritDoc}
*/
public Message getTaskDescription()
{
}
/**
* {@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
{
new BackupDescriptor(
new Date(),
}
}
catch (Throwable t)
{
lastException = t;
}
}
/**
* {@inheritDoc}
*/
{
return backendSet;
}
/**
* {@inheritDoc}
*/
{
if (allBackends.isSelected())
{
}
else
{
}
if (incrementalBackup.isSelected())
{
if (isLocal())
{
}
else
{
}
}
if (compressData.isSelected())
{
}
if (encryptData.isSelected())
{
}
if (generateMessageDigest.isSelected())
{
if (signMessageDigest.isSelected())
{
}
}
if (isServerRunning())
{
}
return args;
}
/**
* {@inheritDoc}
*/
protected String getCommandLinePath()
{
return getCommandLinePath("backup");
}
};
}