Source Code Cross Referenced for VirtualDatabase.java in  » Database-JDBC-Connection-Pool » sequoia-2.10.9 » org » continuent » sequoia » controller » virtualdatabase » management » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database JDBC Connection Pool » sequoia 2.10.9 » org.continuent.sequoia.controller.virtualdatabase.management 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Sequoia: Database clustering technology.
003:         * Copyright (C) 2005 Emic Networks.
004:         * Contact: sequoia@continuent.org
005:         * 
006:         * Licensed under the Apache License, Version 2.0 (the "License");
007:         * you may not use this file except in compliance with the License.
008:         * You may obtain a copy of the License at
009:         * 
010:         * http://www.apache.org/licenses/LICENSE-2.0
011:         * 
012:         * Unless required by applicable law or agreed to in writing, software
013:         * distributed under the License is distributed on an "AS IS" BASIS,
014:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015:         * See the License for the specific language governing permissions and
016:         * limitations under the License. 
017:         *
018:         * Initial developer(s): Jeff Mesnil.
019:         * Contributor(s): ______________________.
020:         */package org.continuent.sequoia.controller.virtualdatabase.management;
021:
022:        import java.sql.SQLException;
023:        import java.util.ArrayList;
024:        import java.util.List;
025:        import java.util.Map;
026:
027:        import javax.management.NotCompliantMBeanException;
028:        import javax.management.openmbean.TabularData;
029:
030:        import org.continuent.sequoia.common.exceptions.VirtualDatabaseException;
031:        import org.continuent.sequoia.common.i18n.Translate;
032:        import org.continuent.sequoia.common.jmx.management.DumpInfo;
033:        import org.continuent.sequoia.common.jmx.management.DumpInfoSupport;
034:        import org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean;
035:        import org.continuent.sequoia.common.jmx.monitoring.backend.BackendStatistics;
036:        import org.continuent.sequoia.common.log.Trace;
037:        import org.continuent.sequoia.common.xml.XmlComponent;
038:        import org.continuent.sequoia.common.xml.XmlTools;
039:        import org.continuent.sequoia.controller.core.ControllerConstants;
040:        import org.continuent.sequoia.controller.jmx.AbstractStandardMBean;
041:
042:        /**
043:         * This class defines a VirtualDatabaseMBean implementation. It delegates
044:         * management method call to a managed VirtualDatabase
045:         * 
046:         * @see org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase
047:         */
048:        public class VirtualDatabase extends AbstractStandardMBean implements 
049:                VirtualDatabaseMBean {
050:
051:            private org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase managedVirtualDatabase;
052:
053:            /* end user logger */
054:            static Trace endUserLogger = Trace
055:                    .getLogger("org.continuent.sequoia.enduser");
056:
057:            /**
058:             * Creates a new <code>VirtualDatabase</code> object from a managed
059:             * VirtualDatabase
060:             * 
061:             * @param managedVirtualDatabase the VirtualDatabase to manage
062:             * @throws NotCompliantMBeanException if this instance in not a compliant
063:             *           MBean
064:             */
065:            public VirtualDatabase(
066:                    org.continuent.sequoia.controller.virtualdatabase.VirtualDatabase managedVirtualDatabase)
067:                    throws NotCompliantMBeanException {
068:                super (VirtualDatabaseMBean.class);
069:                this .managedVirtualDatabase = managedVirtualDatabase;
070:            }
071:
072:            /**
073:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#initializeFromBackend(java.lang.String,
074:             *      boolean)
075:             */
076:            public void initializeFromBackend(String databaseBackendName,
077:                    boolean force) throws VirtualDatabaseException {
078:                try {
079:                    endUserLogger.info(Translate.get(
080:                            "virtualdatabase.initializing", new String[] {
081:                                    this .getVirtualDatabaseName(),
082:                                    databaseBackendName }));
083:                    managedVirtualDatabase.initializeFromBackend(
084:                            databaseBackendName, force);
085:                    endUserLogger.info(Translate.get(
086:                            "virtualdatabase.initialize.success", new String[] {
087:                                    this .getVirtualDatabaseName(),
088:                                    databaseBackendName }));
089:                } catch (VirtualDatabaseException e) {
090:                    endUserLogger.error(Translate.get(
091:                            "virtualdatabase.initialize.failed", new String[] {
092:                                    this .getVirtualDatabaseName(),
093:                                    e.getMessage() }));
094:                    throw e;
095:                }
096:            }
097:
098:            /**
099:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#initializeFromBackend(java.lang.String)
100:             */
101:            public void initializeFromBackend(String databaseBackendName)
102:                    throws VirtualDatabaseException {
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 databaseBackendName)
110:                    throws VirtualDatabaseException {
111:                try {
112:                    endUserLogger.info(Translate.get(
113:                            "virtualdatabase.force.enabling", new String[] {
114:                                    this .getVirtualDatabaseName(),
115:                                    databaseBackendName }));
116:                    managedVirtualDatabase
117:                            .forceEnableBackend(databaseBackendName);
118:                    endUserLogger.info(Translate.get(
119:                            "virtualdatabase.force.enable.success",
120:                            new String[] { this .getVirtualDatabaseName(),
121:                                    databaseBackendName }));
122:                } catch (VirtualDatabaseException e) {
123:                    endUserLogger.error(Translate.get(
124:                            "virtualdatabase.force.enable.failed",
125:                            new String[] { this .getVirtualDatabaseName(),
126:                                    databaseBackendName, e.getMessage() }));
127:                    throw e;
128:                }
129:            }
130:
131:            /**
132:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#enableBackendFromCheckpoint(java.lang.String)
133:             */
134:            public void enableBackendFromCheckpoint(String backendName)
135:                    throws VirtualDatabaseException {
136:                try {
137:                    endUserLogger.info(Translate.get(
138:                            "virtualdatabase.enabling.from.checkpoint",
139:                            new String[] { this .getVirtualDatabaseName(),
140:                                    backendName }));
141:                    managedVirtualDatabase
142:                            .enableBackendFromCheckpoint(backendName);
143:                    endUserLogger.info(Translate.get(
144:                            "virtualdatabase.enable.from.checkpoint.success",
145:                            new String[] { this .getVirtualDatabaseName(),
146:                                    backendName }));
147:                } catch (VirtualDatabaseException e) {
148:                    endUserLogger.error(Translate.get(
149:                            "virtualdatabase.enable.from.checkpoint.failed",
150:                            new String[] { this .getVirtualDatabaseName(),
151:                                    backendName, e.getMessage() }));
152:                    throw e;
153:                }
154:            }
155:
156:            /**
157:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#forceDisableBackend(java.lang.String)
158:             */
159:            public void forceDisableBackend(String databaseBackendName)
160:                    throws VirtualDatabaseException {
161:                try {
162:                    endUserLogger.info(Translate.get(
163:                            "virtualdatabase.force.disabling", new String[] {
164:                                    this .getVirtualDatabaseName(),
165:                                    databaseBackendName }));
166:                    managedVirtualDatabase
167:                            .forceDisableBackend(databaseBackendName);
168:                    endUserLogger.info(Translate.get(
169:                            "virtualdatabase.force.disable.success",
170:                            new String[] { this .getVirtualDatabaseName(),
171:                                    databaseBackendName }));
172:                } catch (VirtualDatabaseException e) {
173:                    endUserLogger.error(Translate.get(
174:                            "virtualdatabase.force.disable.failed",
175:                            new String[] { this .getVirtualDatabaseName(),
176:                                    databaseBackendName, e.getMessage() }));
177:                    throw e;
178:                }
179:            }
180:
181:            /**
182:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#disableBackendWithCheckpoint(java.lang.String)
183:             */
184:            public void disableBackendWithCheckpoint(String databaseBackendName)
185:                    throws VirtualDatabaseException {
186:                try {
187:                    endUserLogger.info(Translate.get(
188:                            "virtualdatabase.disabling.with.checkpoint",
189:                            new String[] { this .getVirtualDatabaseName(),
190:                                    databaseBackendName }));
191:                    managedVirtualDatabase
192:                            .disableBackendWithCheckpoint(databaseBackendName);
193:                    endUserLogger.info(Translate.get(
194:                            "virtualdatabase.disable.with.checkpoint.success",
195:                            new String[] { this .getVirtualDatabaseName(),
196:                                    databaseBackendName }));
197:                } catch (VirtualDatabaseException e) {
198:                    endUserLogger.error(Translate.get(
199:                            "virtualdatabase.disable.with.checkpoint.failed",
200:                            new String[] { this .getVirtualDatabaseName(),
201:                                    databaseBackendName, e.getMessage() }));
202:                    throw e;
203:                }
204:            }
205:
206:            /**
207:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#getAllBackendNames()
208:             */
209:            public List getAllBackendNames() throws VirtualDatabaseException {
210:                return managedVirtualDatabase.getAllBackendNames();
211:            }
212:
213:            /**
214:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#replicateBackend(java.lang.String,
215:             *      java.lang.String, java.util.Map)
216:             */
217:            public void replicateBackend(String backendName,
218:                    String newBackendName, Map parameters)
219:                    throws VirtualDatabaseException {
220:                try {
221:                    endUserLogger.info(Translate.get(
222:                            "virtualdatabase.replicating.backend",
223:                            new String[] { this .getVirtualDatabaseName(),
224:                                    backendName }));
225:                    managedVirtualDatabase.replicateBackend(backendName,
226:                            newBackendName, parameters);
227:                    endUserLogger.info(Translate.get(
228:                            "virtualdatabase.replicate.backend.success",
229:                            new String[] { this .getVirtualDatabaseName(),
230:                                    backendName }));
231:                } catch (VirtualDatabaseException e) {
232:                    endUserLogger.error(Translate.get(
233:                            "virtualdatabase.replicate.backend.failed",
234:                            new String[] { this .getVirtualDatabaseName(),
235:                                    backendName, e.getMessage() }));
236:                    throw e;
237:                }
238:            }
239:
240:            /**
241:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#transferBackend(java.lang.String,
242:             *      java.lang.String)
243:             */
244:            public void transferBackend(String backend,
245:                    String controllerDestination)
246:                    throws VirtualDatabaseException {
247:                try {
248:                    endUserLogger.info(Translate.get(
249:                            "virtualdatabase.transferring.backend",
250:                            new String[] { backend,
251:                                    this .getVirtualDatabaseName(),
252:                                    controllerDestination }));
253:                    managedVirtualDatabase.transferBackend(backend,
254:                            controllerDestination);
255:                    endUserLogger.info(Translate.get(
256:                            "virtualdatabase.transfer.backend.success",
257:                            new String[] { backend,
258:                                    this .getVirtualDatabaseName(),
259:                                    controllerDestination }));
260:                } catch (VirtualDatabaseException e) {
261:                    endUserLogger.error(Translate.get(
262:                            "virtualdatabase.transfer.backend.failed",
263:                            new String[] { backend,
264:                                    this .getVirtualDatabaseName(),
265:                                    controllerDestination, e.getMessage() }));
266:                    throw e;
267:                }
268:            }
269:
270:            /**
271:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#copyLogFromCheckpoint(java.lang.String,
272:             *      java.lang.String)
273:             */
274:            public void copyLogFromCheckpoint(String dumpName,
275:                    String controllerName) throws VirtualDatabaseException {
276:                try {
277:                    endUserLogger.info(Translate.get(
278:                            "virtualdatabase.copying.log.fromCheckpoint",
279:                            new String[] { this .getVirtualDatabaseName(),
280:                                    dumpName }));
281:                    managedVirtualDatabase.copyLogFromCheckpoint(dumpName,
282:                            controllerName);
283:                    endUserLogger.info(Translate.get(
284:                            "virtualdatabase.copy.log.fromCheckpoint.success",
285:                            new String[] { this .getVirtualDatabaseName(),
286:                                    dumpName }));
287:                } catch (VirtualDatabaseException e) {
288:                    endUserLogger.error(Translate.get(
289:                            "virtualdatabase.copy.log.fromCheckpoint.failed",
290:                            new String[] { this .getVirtualDatabaseName(),
291:                                    dumpName, e.getMessage() }));
292:                    throw e;
293:                }
294:            }
295:
296:            /**
297:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#deleteLogUpToCheckpoint(java.lang.String)
298:             */
299:            public void deleteLogUpToCheckpoint(String checkpointName)
300:                    throws VirtualDatabaseException {
301:                try {
302:                    endUserLogger.info(Translate.get(
303:                            "virtualdatabase.deleting.log.upToCheckpoint",
304:                            new String[] { this .getVirtualDatabaseName(),
305:                                    checkpointName }));
306:                    managedVirtualDatabase
307:                            .deleteLogUpToCheckpoint(checkpointName);
308:                    endUserLogger
309:                            .info(Translate
310:                                    .get(
311:                                            "virtualdatabase.delete.log.upToCheckpoint.success",
312:                                            new String[] {
313:                                                    this 
314:                                                            .getVirtualDatabaseName(),
315:                                                    checkpointName }));
316:                } catch (VirtualDatabaseException e) {
317:                    endUserLogger.error(Translate.get(
318:                            "virtualdatabase.delete.log.upToCheckpoint.failed",
319:                            new String[] { this .getVirtualDatabaseName(),
320:                                    checkpointName, e.getMessage() }));
321:                    throw e;
322:                }
323:            }
324:
325:            /**
326:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#setBackendLastKnownCheckpoint(java.lang.String,
327:             *      java.lang.String)
328:             */
329:            public void setBackendLastKnownCheckpoint(String backendName,
330:                    String checkpoint) throws VirtualDatabaseException {
331:                try {
332:                    endUserLogger.info(Translate.get(
333:                            "virtualdatabase.setting.lastKnownCheckpoint",
334:                            new String[] { this .getVirtualDatabaseName(),
335:                                    checkpoint, backendName }));
336:                    managedVirtualDatabase.setBackendLastKnownCheckpoint(
337:                            backendName, checkpoint);
338:                    endUserLogger.info(Translate.get(
339:                            "virtualdatabase.set.lastKnownCheckpoint.success",
340:                            new String[] { this .getVirtualDatabaseName(),
341:                                    checkpoint, backendName }));
342:                } catch (VirtualDatabaseException e) {
343:                    endUserLogger.error(Translate.get(
344:                            "virtualdatabase.set.lastKnownCheckpoint.failed",
345:                            new String[] { this .getVirtualDatabaseName(),
346:                                    checkpoint, backendName, e.getMessage() }));
347:                    throw e;
348:                }
349:            }
350:
351:            /**
352:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#getBackuperNames()
353:             */
354:            public String[] getBackuperNames() {
355:                return managedVirtualDatabase.getBackuperNames();
356:            }
357:
358:            /**
359:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#getDumpFormatForBackuper(java.lang.String)
360:             */
361:            public String getDumpFormatForBackuper(String backuperName) {
362:                return managedVirtualDatabase
363:                        .getDumpFormatForBackuper(backuperName);
364:            }
365:
366:            /**
367:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#backupBackend(java.lang.String,
368:             *      java.lang.String, java.lang.String, java.lang.String,
369:             *      java.lang.String, java.lang.String, java.util.ArrayList)
370:             */
371:            public void backupBackend(String backendName, String login,
372:                    String password, String dumpName, String backuperName,
373:                    String path, ArrayList tables)
374:                    throws VirtualDatabaseException {
375:                try {
376:                    endUserLogger.info(Translate.get(
377:                            "virtualdatabase.backuping.backend", new String[] {
378:                                    this .getVirtualDatabaseName(), backendName,
379:                                    dumpName }));
380:                    managedVirtualDatabase.backupBackend(backendName, login,
381:                            password, dumpName, backuperName, path, true,
382:                            tables);
383:                    endUserLogger.info(Translate.get(
384:                            "virtualdatabase.backup.backend.success",
385:                            new String[] { this .getVirtualDatabaseName(),
386:                                    backendName, dumpName }));
387:                } catch (VirtualDatabaseException e) {
388:                    endUserLogger.error(Translate.get(
389:                            "virtualdatabase.backup.backend.failed",
390:                            new String[] { this .getVirtualDatabaseName(),
391:                                    backendName, e.getMessage() }));
392:                    throw e;
393:                }
394:            }
395:
396:            /**
397:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#backupBackend(java.lang.String,
398:             *      java.lang.String, java.lang.String, java.lang.String,
399:             *      java.lang.String, java.lang.String, boolean, java.util.ArrayList)
400:             */
401:            public void backupBackend(String backendName, String login,
402:                    String password, String dumpName, String backuperName,
403:                    String path, boolean force, ArrayList tables)
404:                    throws VirtualDatabaseException {
405:                try {
406:                    endUserLogger.info(Translate.get(
407:                            "virtualdatabase.backuping.backend", new String[] {
408:                                    this .getVirtualDatabaseName(), backendName,
409:                                    dumpName }));
410:                    managedVirtualDatabase.backupBackend(backendName, login,
411:                            password, dumpName, backuperName, path, force,
412:                            tables);
413:                    endUserLogger.info(Translate.get(
414:                            "virtualdatabase.backup.backend.success",
415:                            new String[] { this .getVirtualDatabaseName(),
416:                                    backendName, dumpName }));
417:                } catch (VirtualDatabaseException e) {
418:                    endUserLogger.error(Translate.get(
419:                            "virtualdatabase.backup.backend.failed",
420:                            new String[] { this .getVirtualDatabaseName(),
421:                                    backendName, e.getMessage() }));
422:                    throw e;
423:                }
424:            }
425:
426:            /**
427:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#getAvailableDumps()
428:             */
429:            public DumpInfo[] getAvailableDumps()
430:                    throws VirtualDatabaseException {
431:                return managedVirtualDatabase.getAvailableDumps();
432:            }
433:
434:            /**
435:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#getDumps()
436:             */
437:            public TabularData getDumps() throws Exception {
438:                TabularData ret = DumpInfoSupport.newTabularData();
439:                DumpInfo info[] = getAvailableDumps();
440:                for (int i = 0; i < info.length; i++)
441:                    ret.put(DumpInfoSupport.newCompositeData(info[i]));
442:                return ret;
443:            }
444:
445:            /**
446:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#updateDumpPath(java.lang.String,
447:             *      java.lang.String)
448:             */
449:            public void updateDumpPath(String dumpName, String newPath)
450:                    throws VirtualDatabaseException {
451:                try {
452:                    endUserLogger.info(Translate.get(
453:                            "virtualdatabase.updating.dump.path", new String[] {
454:                                    this .getVirtualDatabaseName(), dumpName,
455:                                    newPath }));
456:                    managedVirtualDatabase.updateDumpPath(dumpName, newPath);
457:                    endUserLogger.info(Translate.get(
458:                            "virtualdatabase.update.dump.path.success",
459:                            new String[] { this .getVirtualDatabaseName(),
460:                                    dumpName, newPath }));
461:                } catch (VirtualDatabaseException e) {
462:                    endUserLogger.error(Translate.get(
463:                            "virtualdatabase.update.dump.path.failed",
464:                            new String[] { this .getVirtualDatabaseName(),
465:                                    dumpName, e.getMessage() }));
466:                    throw e;
467:                }
468:            }
469:
470:            /**
471:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#deleteDump(java.lang.String,
472:             *      boolean)
473:             */
474:            public void deleteDump(String dumpName, boolean keepsFile)
475:                    throws VirtualDatabaseException {
476:                try {
477:                    endUserLogger.info(Translate.get(
478:                            "virtualdatabase.deleting.dump", new String[] {
479:                                    this .getVirtualDatabaseName(), dumpName }));
480:                    managedVirtualDatabase.deleteDump(dumpName, keepsFile);
481:                    endUserLogger.info(Translate.get(
482:                            "virtualdatabase.delete.dump.success",
483:                            new String[] { this .getVirtualDatabaseName(),
484:                                    dumpName }));
485:                } catch (VirtualDatabaseException e) {
486:                    endUserLogger.error(Translate.get(
487:                            "virtualdatabase.delete.dump.failed", new String[] {
488:                                    this .getVirtualDatabaseName(), dumpName,
489:                                    e.getMessage() }));
490:                    throw e;
491:                }
492:            }
493:
494:            /**
495:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#restoreDumpOnBackend(java.lang.String,
496:             *      java.lang.String, java.lang.String, java.lang.String,
497:             *      java.util.ArrayList)
498:             */
499:            public void restoreDumpOnBackend(String databaseBackendName,
500:                    String login, String password, String dumpName,
501:                    ArrayList tables) throws VirtualDatabaseException {
502:                try {
503:                    endUserLogger.info(Translate.get(
504:                            "virtualdatabase.restoring.dump", new String[] {
505:                                    this .getVirtualDatabaseName(), dumpName,
506:                                    databaseBackendName }));
507:                    managedVirtualDatabase.restoreDumpOnBackend(
508:                            databaseBackendName, login, password, dumpName,
509:                            tables);
510:                    endUserLogger.info(Translate.get(
511:                            "virtualdatabase.restore.dump.success",
512:                            new String[] { this .getVirtualDatabaseName(),
513:                                    dumpName, databaseBackendName }));
514:                } catch (VirtualDatabaseException e) {
515:                    endUserLogger.error(Translate.get(
516:                            "virtualdatabase.restore.dump.failed",
517:                            new String[] { this .getVirtualDatabaseName(),
518:                                    dumpName, e.getMessage() }));
519:                    throw e;
520:                }
521:            }
522:
523:            /**
524:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#transferDump(java.lang.String,
525:             *      java.lang.String, boolean)
526:             */
527:            public void transferDump(String dumpName,
528:                    String remoteControllerName, boolean noCopy)
529:                    throws VirtualDatabaseException {
530:                try {
531:                    endUserLogger.info(Translate.get(
532:                            "virtualdatabase.transferring.dump", new String[] {
533:                                    dumpName, this .getVirtualDatabaseName(),
534:                                    remoteControllerName }));
535:                    managedVirtualDatabase.transferDump(dumpName,
536:                            remoteControllerName, noCopy);
537:                    endUserLogger.info(Translate.get(
538:                            "virtualdatabase.transfer.dump.success",
539:                            new String[] { dumpName,
540:                                    this .getVirtualDatabaseName(),
541:                                    remoteControllerName }));
542:                } catch (VirtualDatabaseException e) {
543:                    endUserLogger.error(Translate.get(
544:                            "virtualdatabase.transfer.dump.failed",
545:                            new String[] { dumpName,
546:                                    this .getVirtualDatabaseName(),
547:                                    e.getMessage() }));
548:                    throw e;
549:                }
550:            }
551:
552:            /**
553:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#getBackendInformation(java.lang.String)
554:             */
555:            public String getBackendInformation(String backendName)
556:                    throws VirtualDatabaseException {
557:                return managedVirtualDatabase
558:                        .getBackendInformation(backendName);
559:            }
560:
561:            /**
562:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#getBackendSchema(java.lang.String)
563:             */
564:            public String getBackendSchema(String backendName)
565:                    throws VirtualDatabaseException {
566:                return managedVirtualDatabase.getBackendSchema(backendName);
567:            }
568:
569:            /**
570:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#getXml()
571:             */
572:            public String getXml() {
573:                StringBuffer xml = new StringBuffer();
574:                xml.append(XmlComponent.XML_VERSION);
575:                xml.append("<"
576:                        + ControllerConstants.VIRTUAL_DATABASE_XML_ROOT_ELEMENT
577:                        + ">\n");
578:                xml.append(managedVirtualDatabase.getXml());
579:                xml.append("\n</"
580:                        + ControllerConstants.VIRTUAL_DATABASE_XML_ROOT_ELEMENT
581:                        + ">");
582:                try {
583:                    String prettyXml = XmlTools.prettyXml(xml.toString());
584:                    // ugly hack to insert the doctype which has been stripped
585:                    // when prettyfying the xml
586:                    prettyXml = XmlTools.insertDoctype(prettyXml,
587:                            ControllerConstants.VIRTUAL_DATABASE_DOCTYPE);
588:                    return prettyXml;
589:                } catch (Exception e) {
590:                    return "XML unavailable for Virtual Database "
591:                            + getVirtualDatabaseName();
592:                }
593:            }
594:
595:            /**
596:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#checkAdminAuthentication(java.lang.String,
597:             *      java.lang.String)
598:             */
599:            public boolean checkAdminAuthentication(String adminLogin,
600:                    String adminPassword) throws VirtualDatabaseException {
601:                return managedVirtualDatabase.checkAdminAuthentication(
602:                        adminLogin, adminPassword);
603:            }
604:
605:            /**
606:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#getVirtualDatabaseName()
607:             */
608:            public String getVirtualDatabaseName() {
609:                return managedVirtualDatabase.getVirtualDatabaseName();
610:            }
611:
612:            /**
613:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#hasRecoveryLog()
614:             */
615:            public boolean hasRecoveryLog() {
616:                return managedVirtualDatabase.hasRecoveryLog();
617:            }
618:
619:            /**
620:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#hasResultCache()
621:             */
622:            public boolean hasResultCache() {
623:                return managedVirtualDatabase.hasResultCache();
624:            }
625:
626:            /**
627:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#isDistributed()
628:             */
629:            public boolean isDistributed() {
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:                managedVirtualDatabase.shutdown(level);
638:            }
639:
640:            /**
641:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#getOwningController()
642:             */
643:            public String getOwningController() {
644:                return managedVirtualDatabase.viewOwningController();
645:            }
646:
647:            /**
648:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#getBackendStatistics(java.lang.String)
649:             */
650:            public BackendStatistics getBackendStatistics(String backendName)
651:                    throws Exception {
652:                return managedVirtualDatabase.getBackendStatistics(backendName);
653:            }
654:
655:            /**
656:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#getControllers()
657:             */
658:            public String[] getControllers() {
659:                return managedVirtualDatabase.viewControllerList();
660:            }
661:
662:            /**
663:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#getCurrentNbOfThreads()
664:             */
665:            public int getCurrentNbOfThreads() {
666:                return managedVirtualDatabase.getCurrentNbOfThreads();
667:            }
668:
669:            /**
670:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#setMonitoringToActive(boolean)
671:             */
672:            public void setMonitoringToActive(boolean active)
673:                    throws VirtualDatabaseException {
674:                managedVirtualDatabase.setMonitoringToActive(active);
675:            }
676:
677:            /**
678:             * @see org.continuent.sequoia.controller.jmx.AbstractStandardMBean#getAssociatedString()
679:             */
680:            public String getAssociatedString() {
681:                return "virtualdatabase"; //$NON-NLS-1$
682:            }
683:
684:            /**
685:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#abort(long,
686:             *      boolean, boolean)
687:             */
688:            public void abort(long transactionId, boolean logAbort,
689:                    boolean forceAbort) throws SQLException {
690:                managedVirtualDatabase.abort(transactionId, logAbort,
691:                        forceAbort);
692:            }
693:
694:            /**
695:             * @see org.continuent.sequoia.common.jmx.mbeans.VirtualDatabaseMBean#closePersistentConnection(java.lang.String,
696:             *      long)
697:             */
698:            public void closePersistentConnection(String login,
699:                    long persistentConnectionId) {
700:                managedVirtualDatabase.closePersistentConnection(login,
701:                        persistentConnectionId);
702:            }
703:
704:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.