KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > continuent > sequoia > controller > sql > schema > DynamicDatabaseSchema


1 /**
2  * Sequoia: Database clustering technology.
3  * Copyright (C) 2006 Continuent, Inc.
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): Emmanuel Cecchet.
19  * Contributor(s): ______________________.
20  */

21
22 package org.continuent.sequoia.controller.sql.schema;
23
24 import org.continuent.sequoia.common.xml.DatabasesXmlTags;
25 import org.continuent.sequoia.common.xml.XmlComponent;
26
27 /**
28  * This class defines a DynamicDatabaseSchema that holds the DatabaseSchema
29  * options to dynamically fetch the schema.
30  *
31  * @author <a HREF="mailto:emmanuel.cecchet@continuent.com">Emmanuel Cecchet</a>
32  * @version 1.0
33  */

34 public class DynamicDatabaseSchema implements XmlComponent
35 {
36   /** true if the application uses stored procedures */
37   private boolean useStoredProcedures;
38   /** true if the application uses views */
39   private boolean useViews;
40   /** true if we must gather system tables */
41   private boolean gatherSystemTables;
42   /** schema name to fetch if we only work in a single schema */
43   private String JavaDoc schemaName;
44
45   /**
46    * Creates a new <code>DynamicDatabaseSchema</code> object
47    *
48    * @param useStoredProcedures true if the application uses stored procedures
49    * @param useViews true if the application uses views
50    * @param gatherSystemTables should we gather system tables
51    * @param schemaName schema pattern to look for (reduce the scope of gathering
52    * if not null)
53    */

54   public DynamicDatabaseSchema(boolean useStoredProcedures, boolean useViews,
55       boolean gatherSystemTables, String JavaDoc schemaName)
56   {
57     this.useStoredProcedures = useStoredProcedures;
58     this.useViews = useViews;
59     this.gatherSystemTables = gatherSystemTables;
60     this.schemaName = schemaName;
61   }
62
63   /**
64    * Returns the schemaName value.
65    *
66    * @return Returns the schemaName.
67    */

68   public final String JavaDoc getSchemaName()
69   {
70     return schemaName;
71   }
72
73   /**
74    * Returns the gatherSystemTables value.
75    *
76    * @return Returns the gatherSystemTables.
77    */

78   public final boolean gatherSystemTables()
79   {
80     return gatherSystemTables;
81   }
82
83   /**
84    * Returns true if table columns are used internally in the controller
85    *
86    * @return true if columns are used
87    */

88   public boolean useColumns()
89   {
90     // For future use
91
return false;
92   }
93
94   /**
95    * Returns the useStoredProcedures value. isU
96    *
97    * @return Returns the useStoredProcedures.
98    */

99   public final boolean useStoredProcedures()
100   {
101     return useStoredProcedures;
102   }
103
104   /**
105    * Returns the usesViews value.
106    *
107    * @return Returns the usesViews.
108    */

109   public final boolean useViews()
110   {
111     return useViews;
112   }
113
114   /**
115    * Get xml information about this schema.
116    *
117    * @return xml formatted information on this database schema.
118    */

119   public String JavaDoc getXml()
120   {
121     StringBuffer JavaDoc info = new StringBuffer JavaDoc();
122     info.append("<" + DatabasesXmlTags.ELT_DatabaseSchema + " "
123         + DatabasesXmlTags.ATT_useStoredProcedures + "=\""
124         + useStoredProcedures + "\" " + DatabasesXmlTags.ATT_gatherSystemTables
125         + "=\"" + gatherSystemTables + "\" " + DatabasesXmlTags.ATT_schemaName
126         + "=\"" + schemaName + "\" " + " />");
127     return info.toString();
128   }
129
130 }
131
Popular Tags