1 /*
2 * Created on 2003-5-21 23:25:09
3 *
4 * To change the template for this generated file go to
5 * Window>Preferences>Java>Code Generation>Code and Comments
6 */
7 package com.cyclops.dbdigger;
8 import com.cyclops.dbdigger.schema.Database;
9 import com.cyclops.dbdigger.schema.Schema;
10 import com.cyclops.dbdigger.sqlcastor.SQLCastor;
11 /*** Core class for dbdigger project, use getInstance() to get DBDigger instance
12 * Each DBDigger instance stands for a physical database
13 *
14 * @author <a href="mailto:joeblack.guo@vtradex.com">joel guo</a>
15 * @since 2003-5-21 23:25:09
16 */
17 public class DBDigger {
18 /*** DEFAULT NAME */
19 public static final String DEFAULT_DBDIGGER = "default";
20 /*** Empty DBDigger object array */
21 public static final DBDigger[] EMPTY_ARRAY = new DBDigger[0];
22 /*** Get default dbdigger instance
23 * @return DBDigger instance
24 */
25 public static DBDigger getInstance() {
26 return getInstance(DEFAULT_DBDIGGER);
27 }
28 /*** Get DBDigger instance
29 * @param dbname name of dbdigger
30 * @return DBDigger instance
31 */
32 public static DBDigger getInstance(String dbname) {
33 return DBDiggerLoader.getInstance().getDBDigger(dbname);
34 }
35 /*** Get all DBDigger instances object
36 * @return Array of instances
37 */
38 public static DBDigger[] getInstances() {
39 return DBDiggerLoader.getInstance().getDBDiggers();
40 }
41 /*** Method getSchema() in class DBDigger
42 * @return Root schema instance
43 */
44 public static final Schema getSchema() {
45 return DBDiggerLoader.getInstance().getSchema();
46 }
47 private String name = DEFAULT_DBDIGGER;
48 private SQLCastor sqlCastor;
49 /*** Constructor method for class DBDigger
50 * @param aname Name of this dbdigger
51 */
52 public DBDigger(String aname) {
53 name = aname;
54 }
55 /*** Get database object of this dbdigger
56 * @return Database object
57 */
58 public Database getDatabase() {
59 return getSchema().getDatabase(getName());
60 }
61 /*** Method getName() in class DBDigger
62 * @return Name of this dbdigger
63 */
64 public String getName() {
65 return name;
66 }
67 /*** Method getSQLCastor() in class DBDigger
68 * @return SQLCastor of this dbdigger
69 */
70 public SQLCastor getSQLCastor() {
71 return sqlCastor;
72 }
73 /*** Method setSQLCastor()
74 * @param sqlc SQLCastor instance
75 */
76 public void setSQLCastor(SQLCastor sqlc) {
77 sqlCastor = sqlc;
78 }
79 }
This page was automatically generated by Maven