KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > cjdbc > console > gui > threads > task > BackupBackendTask


1 /**
2  * C-JDBC: Clustered JDBC.
3  * Copyright (C) 2002-2004 French National Institute For Research In Computer
4  * Science And Control (INRIA).
5  * Contact: c-jdbc@objectweb.org
6  *
7  * This library is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as published by the
9  * Free Software Foundation; either version 2.1 of the License, or any later
10  * version.
11  *
12  * This library is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15  * for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this library; if not, write to the Free Software Foundation,
19  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
20  *
21  * Initial developer(s): Nicolas Modrzyk
22  * Contributor(s): ______________________.
23  */

24
25 package org.objectweb.cjdbc.console.gui.threads.task;
26
27 import org.objectweb.cjdbc.common.jmx.mbeans.VirtualDatabaseMBean;
28 import org.objectweb.cjdbc.console.gui.CjdbcGui;
29 import org.objectweb.cjdbc.console.gui.constants.GuiConstants;
30 import org.objectweb.cjdbc.console.gui.objects.BackendObject;
31
32 /**
33  * This class defines a BackupBackendTask
34  *
35  * @author <a HREF="mailto:Nicolas.Modrzyk@inria.fr">Nicolas Modrzyk </a>
36  * @version 1.0
37  */

38 public class BackupBackendTask implements Runnable JavaDoc
39 {
40
41   private VirtualDatabaseMBean database;
42   private BackendObject bob;
43   private String JavaDoc dumpName;
44   private CjdbcGui gui;
45
46   /**
47    * Creates a new <code>BackupBackendTask</code> object
48    *
49    * @param gui the main frame
50    * @param database the jmx client
51    * @param bob the backend reference
52    * @param dumpName the dump name
53    */

54   public BackupBackendTask(CjdbcGui gui, VirtualDatabaseMBean database,
55       BackendObject bob, String JavaDoc dumpName)
56   {
57     this.database = database;
58     this.dumpName = dumpName;
59     this.bob = bob;
60     this.gui = gui;
61   }
62
63   /**
64    * @see java.lang.Runnable#run()
65    */

66   public void run()
67   {
68     String JavaDoc backendName = bob.getName();
69     gui.actionChangeBackendState(bob, GuiConstants.BACKEND_STATE_BACKUP);
70
71     gui.appendDebugText("Backing up backend:" + backendName);
72
73     try
74     {
75       // FIXME: We don't gather the necessary parameters for a backup
76
database.backupBackend(backendName, null, null, dumpName, null, null,
77           null);
78       gui.appendDebugText("Backup of backend:" + backendName + " completed");
79     }
80     catch (Exception JavaDoc e)
81     {
82       gui.appendDebugText("Backup of backend:" + backendName + " failed", e);
83     }
84     /*
85      * gui.actionChangeBackendState(bob, GuiConstants.BACKEND_STATE_RECOVERY);
86      * gui.appendDebugText("Enabling backend:" + backendName); try {
87      * database.enableBackendFromCheckpoint(backendName, dumpName);
88      * gui.appendDebugText("Backend:" + backendName + " enabled"); } catch
89      * (Exception e) { gui .appendDebugText("Backend:" + backendName + " could
90      * not be enabled", e); }
91      */

92     gui.paintBackendPane();
93   }
94
95 }
Popular Tags