1 /*
2 * Created on 2003-5-21 23:17:54
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.schema;
8 import com.cyclops.dbdigger.schema.torque.TorqueTable;
9 import com.cyclops.dbdigger.util.ArrayMap;
10 /***
11 *
12 * @author <a href="mailto:joeblack.guo@vtradex.com">joel guo</a>
13 * @since 2003-5-21 23:17:54
14 */
15 public class DefaultDatabase implements Database {
16 private String description;
17 private String name = Schema.DEFAULT_DATABASE_NAME;
18 private Schema schema;
19 private ArrayMap tables = new ArrayMap();
20 /*** Method addTable() in class DefaultDatabase
21 * @param table Table object to add
22 */
23 public void addTable(Table table) {
24 tables.put(table.getName(), table);
25 if (table instanceof TorqueTable) {
26 ((TorqueTable) table).setDatabase(this);
27 }
28 }
29 /*** Override method getDescription() of super class
30 * @see com.cyclops.digger.schema.Database#getDescription()
31 */
32 public String getDescription() {
33 return description;
34 }
35 /*** Override method getName() in super class
36 * @see com.cyclops.digger.schema.Database#getName()
37 */
38 public String getName() {
39 return name;
40 }
41 /*** Override method getSchema() in super class
42 * @see com.cyclops.digger.schema.Database#getSchema()
43 */
44 public Schema getSchema() {
45 return schema;
46 }
47 /*** Override method getTable() in super class
48 * @see com.cyclops.digger.schema.Database#getTable(java.lang.String)
49 */
50 public Table getTable(String tableName) {
51 return (Table) tables.get(tableName);
52 }
53 /*** Override method getTables() in super class
54 * @see com.cyclops.digger.schema.Database#getTables()
55 */
56 public Table[] getTables() {
57 return (Table[]) tables.values().toArray(Table.EMPTY_ARRAY);
58 }
59 /*** Method setDescription()
60 * @param string Description of this database
61 */
62 public void setDescription(String string) {
63 description = string;
64 }
65 /*** Method setName() in class DefaultDatabase
66 * @param string Name of this database
67 */
68 public void setName(String string) {
69 name = string;
70 }
71 /*** Method setSchema() in class DefaultDatabase
72 * @param aschema Schema of this database
73 */
74 public void setSchema(Schema aschema) {
75 schema = aschema;
76 }
77 }
This page was automatically generated by Maven