KickJava   Java API By Example, From Geeks To Geeks.

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


1 /**
2  * C-JDBC: Clustered JDBC.
3  * Copyright (C) 2002-2005 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): Emmanuel Cecchet.
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 JmxTaskThread
34  *
35  * @author <a HREF="mailto:Nicolas.Modrzyk@inria.fr">Nicolas Modrzyk </a>
36  * @author <a HREF="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet </a>
37  * @version 1.0
38  */

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

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

67   public void run()
68   {
69     gui.actionChangeBackendState(bob, GuiConstants.BACKEND_STATE_RESTORE);
70
71     try
72     {
73       // FIXME: We don't gather the necessary parameters for a backup
74
database.restoreDumpOnBackend(bob.getName(), null, null, dumpName, null);
75     }
76     catch (Exception JavaDoc e)
77     {
78       gui.appendDebugText("Failed to enable backend:" + bob.getName(), e);
79     }
80     gui.publicActionLoadBackendsList(database.getVirtualDatabaseName());
81   }
82
83 }
Popular Tags