KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > continuent > sequoia > controller > virtualdatabase > management > VirtualDatabase


1 /**
2  * Sequoia: Database clustering technology.
3  * Copyright (C) 2005 Emic Networks.
4  * Contact: sequoia@continuent.org
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * Initial developer(s): Jeff Mesnil.
19  * Contributor(s): ______________________.
20  */

21
22 package org.continuent.sequoia.controller.virtualdatabase.management;
23
24 import java.util.ArrayList JavaDoc;
25 import java.util.List JavaDoc;
26 import java.util.Map JavaDoc;
27
28 import javax.management.NotCompliantMBeanException JavaDoc;
29
30 import org.continuent.sequoia.common.exceptions.VirtualDatabaseException;
31 import org.continuent.sequoia.common.i18n.Translate;
32 import org.continuent.sequoia.common.jmx.management.DumpInfo;
33 import org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean;
34 import org.continuent.sequoia.common.jmx.monitoring.backend.BackendStatistics;
35 import org.continuent.sequoia.common.log.Trace;
36 import org.continuent.sequoia.common.xml.XmlComponent;
37 import org.continuent.sequoia.common.xml.XmlTools;
38 import org.continuent.sequoia.controller.core.ControllerConstants;
39 import org.continuent.sequoia.controller.jmx.AbstractStandardMBean;
40
41 /**
42  * This class defines a VirtualDatabaseMBean implementation. It delegates
43  * management method call to a managed VirtualDatabase
44  *
45  * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase
46  */

47 public class VirtualDatabase extends AbstractStandardMBean
48     implements
49       VirtualDatabaseMBean
50 {
51
52   private org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase managedVirtualDatabase;
53
54   /* end user logger */
55   static Trace endUserLogger = Trace
56                                                                                               .getLogger("org.continuent.sequoia.enduser");
57
58   /**
59    * Creates a new <code>VirtualDatabase</code> object from a managed
60    * VirtualDatabase
61    *
62    * @param managedVirtualDatabase the VirtualDatabase to manage
63    * @throws NotCompliantMBeanException if this instance in not a compliant
64    * MBean
65    */

66   public VirtualDatabase(
67       org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase managedVirtualDatabase)
68       throws NotCompliantMBeanException JavaDoc
69   {
70     super(VirtualDatabaseMBean.class);
71     this.managedVirtualDatabase = managedVirtualDatabase;
72   }
73
74   /**
75    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#initializeFromBackend(java.lang.String,
76    * boolean)
77    */

78   public void initializeFromBackend(String JavaDoc databaseBackendName, boolean force)
79       throws VirtualDatabaseException
80   {
81     try
82     {
83       endUserLogger.info(Translate.get("virtualdatabase.initializing",
84           new String JavaDoc[]{this.getVirtualDatabaseName(), databaseBackendName}));
85       managedVirtualDatabase.initializeFromBackend(databaseBackendName, force);
86       endUserLogger.info(Translate.get("virtualdatabase.initialize.success",
87           new String JavaDoc[]{this.getVirtualDatabaseName(), databaseBackendName}));
88     }
89     catch (VirtualDatabaseException e)
90     {
91       endUserLogger.error(Translate.get("virtualdatabase.initialize.failed",
92           new String JavaDoc[]{this.getVirtualDatabaseName(), e.getMessage()}));
93       throw e;
94     }
95   }
96
97   /**
98    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#initializeFromBackend(java.lang.String)
99    */

100   public void initializeFromBackend(String JavaDoc databaseBackendName)
101       throws VirtualDatabaseException
102   {
103       initializeFromBackend(databaseBackendName, false);
104   }
105   
106   /**
107    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#forceEnableBackend(java.lang.String)
108    */

109   public void forceEnableBackend(String JavaDoc databaseBackendName)
110       throws VirtualDatabaseException
111   {
112     try
113     {
114       endUserLogger.info(Translate.get("virtualdatabase.force.enabling",
115           new String JavaDoc[]{this.getVirtualDatabaseName(), databaseBackendName}));
116       managedVirtualDatabase.forceEnableBackend(databaseBackendName);
117       endUserLogger.info(Translate.get("virtualdatabase.force.enable.success",
118           new String JavaDoc[]{this.getVirtualDatabaseName(), databaseBackendName}));
119     }
120     catch (VirtualDatabaseException e)
121     {
122       endUserLogger.error(Translate.get("virtualdatabase.force.enable.failed",
123           new String JavaDoc[]{this.getVirtualDatabaseName(), databaseBackendName,
124               e.getMessage()}));
125       throw e;
126     }
127   }
128
129   /**
130    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#enableBackendFromCheckpoint(java.lang.String)
131    */

132   public void enableBackendFromCheckpoint(String JavaDoc backendName)
133       throws VirtualDatabaseException
134   {
135     try
136     {
137       endUserLogger.info(Translate.get(
138           "virtualdatabase.enabling.from.checkpoint", new String JavaDoc[]{
139               this.getVirtualDatabaseName(), backendName}));
140       managedVirtualDatabase.enableBackendFromCheckpoint(backendName);
141       endUserLogger.info(Translate.get(
142           "virtualdatabase.enable.from.checkpoint.success", new String JavaDoc[]{
143               this.getVirtualDatabaseName(), backendName}));
144     }
145     catch (VirtualDatabaseException e)
146     {
147       endUserLogger.error(Translate.get(
148           "virtualdatabase.enable.from.checkpoint.failed", new String JavaDoc[]{
149               this.getVirtualDatabaseName(), backendName, e.getMessage()}));
150       throw e;
151     }
152   }
153
154   /**
155    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#forceDisableBackend(java.lang.String)
156    */

157   public void forceDisableBackend(String JavaDoc databaseBackendName)
158       throws VirtualDatabaseException
159   {
160     try
161     {
162       endUserLogger.info(Translate.get("virtualdatabase.force.disabling",
163           new String JavaDoc[]{this.getVirtualDatabaseName(), databaseBackendName}));
164       managedVirtualDatabase.forceDisableBackend(databaseBackendName);
165       endUserLogger.info(Translate.get("virtualdatabase.force.disable.success",
166           new String JavaDoc[]{this.getVirtualDatabaseName(), databaseBackendName}));
167     }
168     catch (VirtualDatabaseException e)
169     {
170       endUserLogger.error(Translate.get("virtualdatabase.force.disable.failed",
171           new String JavaDoc[]{this.getVirtualDatabaseName(), databaseBackendName,
172               e.getMessage()}));
173       throw e;
174     }
175   }
176
177   /**
178    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#disableBackendWithCheckpoint(java.lang.String)
179    */

180   public void disableBackendWithCheckpoint(String JavaDoc databaseBackendName)
181       throws VirtualDatabaseException
182   {
183     try
184     {
185       endUserLogger.info(Translate.get(
186           "virtualdatabase.disabling.with.checkpoint", new String JavaDoc[]{
187               this.getVirtualDatabaseName(), databaseBackendName}));
188       managedVirtualDatabase.disableBackendWithCheckpoint(databaseBackendName);
189       endUserLogger.info(Translate.get(
190           "virtualdatabase.disable.with.checkpoint.success", new String JavaDoc[]{
191               this.getVirtualDatabaseName(), databaseBackendName}));
192     }
193     catch (VirtualDatabaseException e)
194     {
195       endUserLogger.error(Translate.get(
196           "virtualdatabase.disable.with.checkpoint.failed", new String JavaDoc[]{
197               this.getVirtualDatabaseName(), databaseBackendName,
198               e.getMessage()}));
199       throw e;
200     }
201   }
202
203   /**
204    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#getAllBackendNames()
205    */

206   public List JavaDoc getAllBackendNames() throws VirtualDatabaseException
207   {
208     return managedVirtualDatabase.getAllBackendNames();
209   }
210
211   /**
212    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#replicateBackend(java.lang.String,
213    * java.lang.String, java.util.Map)
214    */

215   public void replicateBackend(String JavaDoc backendName, String JavaDoc newBackendName,
216       Map JavaDoc parameters) throws VirtualDatabaseException
217   {
218     try
219     {
220       endUserLogger.info(Translate.get("virtualdatabase.replicating.backend",
221           new String JavaDoc[]{this.getVirtualDatabaseName(), backendName}));
222       managedVirtualDatabase.replicateBackend(backendName, newBackendName,
223           parameters);
224       endUserLogger.info(Translate.get(
225           "virtualdatabase.replicate.backend.success", new String JavaDoc[]{
226               this.getVirtualDatabaseName(), backendName}));
227     }
228     catch (VirtualDatabaseException e)
229     {
230       endUserLogger.error(Translate.get(
231           "virtualdatabase.replicate.backend.failed", new String JavaDoc[]{
232               this.getVirtualDatabaseName(), backendName, e.getMessage()}));
233       throw e;
234     }
235   }
236
237   /**
238    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#transferBackend(java.lang.String,
239    * java.lang.String)
240    */

241   public void transferBackend(String JavaDoc backend, String JavaDoc controllerDestination)
242       throws VirtualDatabaseException
243   {
244     try
245     {
246       endUserLogger.info(Translate.get("virtualdatabase.transferring.backend",
247           new String JavaDoc[]{backend, this.getVirtualDatabaseName(),
248               controllerDestination}));
249       managedVirtualDatabase.transferBackend(backend, controllerDestination);
250       endUserLogger.info(Translate.get(
251           "virtualdatabase.transfer.backend.success", new String JavaDoc[]{backend,
252               this.getVirtualDatabaseName(), controllerDestination}));
253     }
254     catch (VirtualDatabaseException e)
255     {
256       endUserLogger.error(Translate.get(
257           "virtualdatabase.transfer.backend.failed", new String JavaDoc[]{backend,
258               this.getVirtualDatabaseName(), controllerDestination,
259               e.getMessage()}));
260       throw e;
261     }
262   }
263
264   /**
265    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#copyLogFromCheckpoint(java.lang.String,
266    * java.lang.String)
267    */

268   public void copyLogFromCheckpoint(String JavaDoc dumpName, String JavaDoc controllerName)
269       throws VirtualDatabaseException
270   {
271     try
272     {
273       endUserLogger.info(Translate.get(
274           "virtualdatabase.copying.log.fromCheckpoint", new String JavaDoc[]{
275               this.getVirtualDatabaseName(), dumpName}));
276       managedVirtualDatabase.copyLogFromCheckpoint(dumpName, controllerName);
277       endUserLogger.info(Translate.get(
278           "virtualdatabase.copy.log.fromCheckpoint.success", new String JavaDoc[]{
279               this.getVirtualDatabaseName(), dumpName}));
280     }
281     catch (VirtualDatabaseException e)
282     {
283       endUserLogger.error(Translate.get(
284           "virtualdatabase.copy.log.fromCheckpoint.failed", new String JavaDoc[]{
285               this.getVirtualDatabaseName(), dumpName, e.getMessage()}));
286       throw e;
287     }
288   }
289
290   /**
291    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#deleteLogUpToCheckpoint(java.lang.String)
292    */

293   public void deleteLogUpToCheckpoint(String JavaDoc checkpointName)
294       throws VirtualDatabaseException
295   {
296     try
297     {
298       endUserLogger.info(Translate.get(
299           "virtualdatabase.deleting.log.upToCheckpoint", new String JavaDoc[]{
300               this.getVirtualDatabaseName(), checkpointName}));
301       managedVirtualDatabase.deleteLogUpToCheckpoint(checkpointName);
302       endUserLogger.info(Translate.get(
303           "virtualdatabase.delete.log.upToCheckpoint.success", new String JavaDoc[]{
304               this.getVirtualDatabaseName(), checkpointName}));
305     }
306     catch (VirtualDatabaseException e)
307     {
308       endUserLogger.error(Translate.get(
309           "virtualdatabase.delete.log.upToCheckpoint.failed", new String JavaDoc[]{
310               this.getVirtualDatabaseName(), checkpointName, e.getMessage()}));
311       throw e;
312     }
313   }
314
315   /**
316    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#setBackendLastKnownCheckpoint(java.lang.String,
317    * java.lang.String)
318    */

319   public void setBackendLastKnownCheckpoint(String JavaDoc backendName,
320       String JavaDoc checkpoint) throws VirtualDatabaseException
321   {
322     try
323     {
324       endUserLogger.info(Translate.get(
325           "virtualdatabase.setting.lastKnownCheckpoint", new String JavaDoc[]{
326               this.getVirtualDatabaseName(), checkpoint, backendName}));
327       managedVirtualDatabase.setBackendLastKnownCheckpoint(backendName,
328           checkpoint);
329       endUserLogger.info(Translate.get(
330           "virtualdatabase.set.lastKnownCheckpoint.success", new String JavaDoc[]{
331               this.getVirtualDatabaseName(), checkpoint, backendName}));
332     }
333     catch (VirtualDatabaseException e)
334     {
335       endUserLogger.error(Translate.get(
336           "virtualdatabase.set.lastKnownCheckpoint.failed", new String JavaDoc[]{
337               this.getVirtualDatabaseName(), checkpoint, backendName,
338               e.getMessage()}));
339       throw e;
340     }
341   }
342
343   /**
344    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#getBackuperNames()
345    */

346   public String JavaDoc[] getBackuperNames()
347   {
348     return managedVirtualDatabase.getBackuperNames();
349   }
350
351   /**
352    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#getDumpFormatForBackuper(java.lang.String)
353    */

354   public String JavaDoc getDumpFormatForBackuper(String JavaDoc backuperName)
355   {
356     return managedVirtualDatabase.getDumpFormatForBackuper(backuperName);
357   }
358
359   /**
360    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#backupBackend(java.lang.String,
361    * java.lang.String, java.lang.String, java.lang.String,
362    * java.lang.String, java.lang.String, java.util.ArrayList)
363    */

364   public void backupBackend(String JavaDoc backendName, String JavaDoc login, String JavaDoc password,
365       String JavaDoc dumpName, String JavaDoc backuperName, String JavaDoc path, ArrayList JavaDoc tables)
366       throws VirtualDatabaseException
367   {
368     try
369     {
370       endUserLogger.info(Translate.get("virtualdatabase.backuping.backend",
371           new String JavaDoc[]{this.getVirtualDatabaseName(), backendName, dumpName}));
372       managedVirtualDatabase.backupBackend(backendName, login, password,
373           dumpName, backuperName, path, true, tables);
374       endUserLogger.info(Translate.get(
375           "virtualdatabase.backup.backend.success", new String JavaDoc[]{
376               this.getVirtualDatabaseName(), backendName, dumpName}));
377     }
378     catch (VirtualDatabaseException e)
379     {
380       endUserLogger.error(Translate.get(
381           "virtualdatabase.backup.backend.failed", new String JavaDoc[]{
382               this.getVirtualDatabaseName(), backendName, e.getMessage()}));
383       throw e;
384     }
385   }
386
387   /**
388    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#backupBackend(java.lang.String,
389    * java.lang.String, java.lang.String, java.lang.String,
390    * java.lang.String, java.lang.String, boolean, java.util.ArrayList)
391    */

392   public void backupBackend(String JavaDoc backendName, String JavaDoc login, String JavaDoc password,
393       String JavaDoc dumpName, String JavaDoc backuperName, String JavaDoc path, boolean force,
394       ArrayList JavaDoc tables) throws VirtualDatabaseException
395   {
396     try
397     {
398       endUserLogger.info(Translate.get("virtualdatabase.backuping.backend",
399           new String JavaDoc[]{this.getVirtualDatabaseName(), backendName, dumpName}));
400       managedVirtualDatabase.backupBackend(backendName, login, password,
401           dumpName, backuperName, path, force, tables);
402       endUserLogger.info(Translate.get(
403           "virtualdatabase.backup.backend.success", new String JavaDoc[]{
404               this.getVirtualDatabaseName(), backendName, dumpName}));
405     }
406     catch (VirtualDatabaseException e)
407     {
408       endUserLogger.error(Translate.get(
409           "virtualdatabase.backup.backend.failed", new String JavaDoc[]{
410               this.getVirtualDatabaseName(), backendName, e.getMessage()}));
411       throw e;
412     }
413   }
414
415   /**
416    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#getAvailableDumps()
417    */

418   public DumpInfo[] getAvailableDumps() throws VirtualDatabaseException
419   {
420     return managedVirtualDatabase.getAvailableDumps();
421   }
422
423   /**
424    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#updateDumpPath(java.lang.String,
425    * java.lang.String)
426    */

427   public void updateDumpPath(String JavaDoc dumpName, String JavaDoc newPath)
428       throws VirtualDatabaseException
429   {
430     try
431     {
432       endUserLogger.info(Translate.get("virtualdatabase.updating.dump.path",
433           new String JavaDoc[]{this.getVirtualDatabaseName(), dumpName, newPath}));
434       managedVirtualDatabase.updateDumpPath(dumpName, newPath);
435       endUserLogger.info(Translate.get(
436           "virtualdatabase.update.dump.path.success", new String JavaDoc[]{
437               this.getVirtualDatabaseName(), dumpName, newPath}));
438     }
439     catch (VirtualDatabaseException e)
440     {
441       endUserLogger.error(Translate.get(
442           "virtualdatabase.update.dump.path.failed", new String JavaDoc[]{
443               this.getVirtualDatabaseName(), dumpName, e.getMessage()}));
444       throw e;
445     }
446   }
447
448   /**
449    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#deleteDump(java.lang.String,
450    * boolean)
451    */

452   public void deleteDump(String JavaDoc dumpName, boolean keepsFile)
453       throws VirtualDatabaseException
454   {
455     try
456     {
457       endUserLogger.info(Translate.get("virtualdatabase.deleting.dump",
458           new String JavaDoc[]{this.getVirtualDatabaseName(), dumpName}));
459       managedVirtualDatabase.deleteDump(dumpName, keepsFile);
460       endUserLogger.info(Translate.get("virtualdatabase.delete.dump.success",
461           new String JavaDoc[]{this.getVirtualDatabaseName(), dumpName}));
462     }
463     catch (VirtualDatabaseException e)
464     {
465       endUserLogger.error(Translate
466           .get("virtualdatabase.delete.dump.failed", new String JavaDoc[]{
467               this.getVirtualDatabaseName(), dumpName, e.getMessage()}));
468       throw e;
469     }
470   }
471
472   /**
473    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#renameDump(java.lang.String,
474    * java.lang.String)
475    */

476   public void renameDump(String JavaDoc oldDumpName, String JavaDoc newDumpName)
477       throws VirtualDatabaseException
478   {
479     try
480     {
481       endUserLogger.info(Translate
482           .get("virtualdatabase.renaming.dump", new String JavaDoc[]{
483               this.getVirtualDatabaseName(), oldDumpName, newDumpName}));
484       managedVirtualDatabase.renameDump(oldDumpName, newDumpName);
485       endUserLogger.info(Translate
486           .get("virtualdatabase.rename.dump.success", new String JavaDoc[]{
487               this.getVirtualDatabaseName(), oldDumpName, newDumpName}));
488     }
489     catch (VirtualDatabaseException e)
490     {
491       endUserLogger.error(Translate.get("virtualdatabase.rename.dump.failed",
492           new String JavaDoc[]{this.getVirtualDatabaseName(), oldDumpName, newDumpName,
493               e.getMessage()}));
494       throw e;
495     }
496   }
497
498   /**
499    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#restoreDumpOnBackend(java.lang.String,
500    * java.lang.String, java.lang.String, java.lang.String,
501    * java.util.ArrayList)
502    */

503   public void restoreDumpOnBackend(String JavaDoc databaseBackendName, String JavaDoc login,
504       String JavaDoc password, String JavaDoc dumpName, ArrayList JavaDoc tables)
505       throws VirtualDatabaseException
506   {
507     try
508     {
509       endUserLogger.info(Translate.get("virtualdatabase.restoring.dump",
510           new String JavaDoc[]{this.getVirtualDatabaseName(), dumpName,
511               databaseBackendName}));
512       managedVirtualDatabase.restoreDumpOnBackend(databaseBackendName, login,
513           password, dumpName, tables);
514       endUserLogger.info(Translate.get("virtualdatabase.restore.dump.success",
515           new String JavaDoc[]{this.getVirtualDatabaseName(), dumpName,
516               databaseBackendName}));
517     }
518     catch (VirtualDatabaseException e)
519     {
520       endUserLogger.error(Translate
521           .get("virtualdatabase.restore.dump.failed", new String JavaDoc[]{
522               this.getVirtualDatabaseName(), dumpName, e.getMessage()}));
523       throw e;
524     }
525   }
526
527   /**
528    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#transferDump(java.lang.String,
529    * java.lang.String, boolean)
530    */

531   public void transferDump(String JavaDoc dumpName, String JavaDoc remoteControllerName,
532       boolean noCopy) throws VirtualDatabaseException
533   {
534     try
535     {
536       endUserLogger.info(Translate.get("virtualdatabase.transferring.dump",
537           new String JavaDoc[]{dumpName, this.getVirtualDatabaseName(),
538               remoteControllerName}));
539       managedVirtualDatabase.transferDump(dumpName, remoteControllerName,
540           noCopy);
541       endUserLogger.info(Translate.get("virtualdatabase.transfer.dump.success",
542           new String JavaDoc[]{dumpName, this.getVirtualDatabaseName(),
543               remoteControllerName}));
544     }
545     catch (VirtualDatabaseException e)
546     {
547       endUserLogger.error(Translate
548           .get("virtualdatabase.transfer.dump.failed", new String JavaDoc[]{dumpName,
549               this.getVirtualDatabaseName(), e.getMessage()}));
550       throw e;
551     }
552   }
553
554   /**
555    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#getBackendInformation(java.lang.String)
556    */

557   public String JavaDoc getBackendInformation(String JavaDoc backendName)
558       throws VirtualDatabaseException
559   {
560     return managedVirtualDatabase.getBackendInformation(backendName);
561   }
562
563   /**
564    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#getXml()
565    */

566   public String JavaDoc getXml()
567   {
568     StringBuffer JavaDoc xml = new StringBuffer JavaDoc();
569     xml.append(XmlComponent.XML_VERSION);
570     xml.append("<" + ControllerConstants.VIRTUAL_DATABASE_XML_ROOT_ELEMENT
571         + ">\n");
572     xml.append(managedVirtualDatabase.getXml());
573     xml.append("\n</" + ControllerConstants.VIRTUAL_DATABASE_XML_ROOT_ELEMENT
574         + ">");
575     try
576     {
577       String JavaDoc prettyXml = XmlTools.prettyXml(xml.toString());
578       // ugly hack to insert the doctype which has been stripped
579
// when prettyfying the xml
580
prettyXml = XmlTools.insertDoctype(prettyXml,
581           ControllerConstants.VIRTUAL_DATABASE_DOCTYPE);
582       return prettyXml;
583     }
584     catch (Exception JavaDoc e)
585     {
586       return "XML unavailable for Virtual Database " + getVirtualDatabaseName();
587     }
588   }
589
590   /**
591    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#checkAdminAuthentication(java.lang.String,
592    * java.lang.String)
593    */

594   public boolean checkAdminAuthentication(String JavaDoc adminLogin,
595       String JavaDoc adminPassword) throws VirtualDatabaseException
596   {
597     return managedVirtualDatabase.checkAdminAuthentication(adminLogin,
598         adminPassword);
599   }
600
601   /**
602    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#getVirtualDatabaseName()
603    */

604   public String JavaDoc getVirtualDatabaseName()
605   {
606     return managedVirtualDatabase.getVirtualDatabaseName();
607   }
608
609   /**
610    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#hasRecoveryLog()
611    */

612   public boolean hasRecoveryLog()
613   {
614     return managedVirtualDatabase.hasRecoveryLog();
615   }
616
617   /**
618    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#hasResultCache()
619    */

620   public boolean hasResultCache()
621   {
622     return managedVirtualDatabase.hasResultCache();
623   }
624
625   /**
626    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#isDistributed()
627    */

628   public boolean isDistributed()
629   {
630     return managedVirtualDatabase.isDistributed();
631   }
632
633   /**
634    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#shutdown(int)
635    */

636   public void shutdown(int level) throws VirtualDatabaseException
637   {
638     managedVirtualDatabase.shutdown(level);
639   }
640
641   /**
642    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#viewOwningController()
643    */

644   public String JavaDoc viewOwningController()
645   {
646     return managedVirtualDatabase.viewOwningController();
647   }
648
649   /**
650    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#getBackendStatistics(java.lang.String)
651    */

652   public BackendStatistics getBackendStatistics(String JavaDoc backendName)
653       throws Exception JavaDoc
654   {
655     return managedVirtualDatabase.getBackendStatistics(backendName);
656   }
657
658   /**
659    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#viewControllerList()
660    */

661   public String JavaDoc[] viewControllerList()
662   {
663     return managedVirtualDatabase.viewControllerList();
664   }
665
666   /**
667    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#getCurrentNbOfThreads()
668    */

669   public int getCurrentNbOfThreads()
670   {
671     return managedVirtualDatabase.getCurrentNbOfThreads();
672   }
673
674   /**
675    * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#setMonitoringToActive(boolean)
676    */

677   public void setMonitoringToActive(boolean active)
678       throws VirtualDatabaseException
679   {
680     managedVirtualDatabase.setMonitoringToActive(active);
681   }
682
683   /**
684    * @see org.continuent.sequoia.controller.jmx.AbstractStandardMBean#getAssociatedString()
685    */

686   public String JavaDoc getAssociatedString()
687   {
688     return "virtualdatabase"; //$NON-NLS-1$
689
}
690 }
691
Popular Tags