1
/** BEGIN COPYRIGHT BLOCK
2
* Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
3
* Copyright (C) 2005 Red Hat, Inc.
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation version 2 of the License.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
* END COPYRIGHT BLOCK **/
20
package com.netscape.admin.dirserv.task;
22
import java.util.Hashtable;
23
import javax.swing.JFrame;
24
import com.netscape.management.client.IPage;
25
import com.netscape.management.client.console.ConsoleInfo;
26
import com.netscape.admin.dirserv.panel.BackupPanel;
27
import com.netscape.admin.dirserv.panel.SimpleDialog;
28
import com.netscape.admin.dirserv.DSUtil;
29
import com.netscape.admin.dirserv.IDSModel;
30
import com.netscape.admin.dirserv.ExportImportProgressDialog;
31
import com.netscape.management.client.util.Debug;
32
import com.netscape.management.client.TaskObject;
33
import com.netscape.management.client.util.ModalDialogUtil;
34
import com.netscape.admin.dirserv.panel.SimpleDialog;
35
import netscape.ldap.*;
38
* Netscape Admin Server 4.0 task for backing up the directory server.
43
* @see com.netscape.admin.dirserv.DSAdmin
44
* @see com.netscape.admin.dirserv.task.CGITask
46
public class Backup extends TaskObject {
48
* Constructor for the Start Directory Task
52
setName(DSUtil._resource.getString("dirtask","Backup"));
53
setDescription(DSUtil._resource.getString(
54
"dirtask","backup-description"));
58
* Send an http request to the server and then popup a dialog if the
59
* operation is successful.
61
* @param viewInstance The calling page
62
* @param cmd Command to execute
65
public boolean run(IPage viewInstance) {
70
public boolean run(IPage viewInstance, String cmd) {
75
private void backup(IPage viewInstance) {
76
/* Do it as a dialog */
77
JFrame frame = viewInstance.getFramework().getJFrame();
79
(IDSModel)getConsoleInfo().get( "dsresmodel" );
81
BackupPanel child = new BackupPanel( model );
82
SimpleDialog dlg = new SimpleDialog( frame,
88
dlg.setComponent( child );
89
dlg.setDefaultButton( SimpleDialog.OK );
90
ModalDialogUtil.setWindowLocation(dlg);
91
dlg.getAccessibleContext().setAccessibleDescription(DSUtil._resource.getString(
92
"dirtask","backup-description"));
97
String fileName = child.getFilename();
99
String databaseType = LDBM_DATABASE;
101
Hashtable attributes = new Hashtable();
102
attributes.put(LDAPBackup.ARCHIVE_DIR, new LDAPAttribute(LDAPBackup.ARCHIVE_DIR, fileName));
103
attributes.put(LDAPBackup.DATABASE_TYPE, new LDAPAttribute(LDAPBackup.DATABASE_TYPE, databaseType));
105
LDAPBackup task = new LDAPBackup(model, attributes);
108
final String LDBM_DATABASE = "ldbm database";