Source Code Cross Referenced for UIControllerForQueries.java in  » Database-Client » DBBrowser » org » dbbrowser » ui » 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 Client » DBBrowser » org.dbbrowser.ui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.dbbrowser.ui;
002:
003:        import java.sql.Connection;
004:        import java.sql.SQLException;
005:        import java.util.List;
006:        import org.dbbrowser.db.engine.exception.DBEngineException;
007:        import org.dbbrowser.db.engine.model.DBTable;
008:        import org.dbbrowser.db.engine.model.View;
009:        import org.dbbrowser.db.engine.model.filter.Filter;
010:        import org.dbbrowser.db.engine.queryengine.DBQueryEngine;
011:        import org.dbbrowser.db.engine.queryengine.MsSQLDBQueryEngine;
012:        import org.dbbrowser.db.engine.queryengine.MySQLDBQueryEngine;
013:        import org.dbbrowser.db.engine.queryengine.Oracle9iDBQueryEngine;
014:        import org.dbbrowser.drivermanager.ConnectionInfo;
015:        import org.dbbrowser.drivermanager.DBBrowserDriverManager;
016:        import org.dbbrowser.drivermanager.DriverManagerException;
017:
018:        /**
019:         * Controller for the UI layer.  Delegates to other classes
020:         * @author amangat
021:         *
022:         */
023:        public class UIControllerForQueries {
024:            public static final String ORACLE_DBMS = "Oracle";
025:            public static final String MYSQL_DBMS = "MySQL";
026:            public static final String MSSQL_DBMS = "MS-SQL";
027:
028:            public static final long version = 1l;
029:            private ConnectionInfo connectionInfo = null;
030:            private DBQueryEngine dbQueryEngine = null;
031:
032:            /**
033:             * Connects to the database using the supplied connection info.  DirverManager caches the connection.  Start a DBQueryEngine
034:             * @param connectionInfo
035:             * @param masterPassword
036:             * @author amangat
037:             */
038:            public void setup(ConnectionInfo connectionInfo,
039:                    String masterPassword) throws DriverManagerException,
040:                    DBEngineException {
041:                this .connectionInfo = connectionInfo;
042:                Connection connection = DBBrowserDriverManager.getInstance()
043:                        .getConnection(connectionInfo, masterPassword);
044:
045:                if (ORACLE_DBMS.equals(connectionInfo.getDBMSType())) {
046:                    try {
047:                        this .dbQueryEngine = new Oracle9iDBQueryEngine(
048:                                connection.createStatement());
049:                    } catch (SQLException exc) {
050:                        throw new DBEngineException(exc.getMessage());
051:                    }
052:                }
053:
054:                if (MYSQL_DBMS.equals(connectionInfo.getDBMSType())) {
055:                    try {
056:                        this .dbQueryEngine = new MySQLDBQueryEngine(connection
057:                                .createStatement());
058:                    } catch (SQLException exc) {
059:                        throw new DBEngineException(exc.getMessage());
060:                    }
061:                }
062:
063:                if (MSSQL_DBMS.equals(connectionInfo.getDBMSType())) {
064:                    try {
065:                        this .dbQueryEngine = new MsSQLDBQueryEngine(connection
066:                                .createStatement());
067:                    } catch (SQLException exc) {
068:                        throw new DBEngineException(exc.getMessage());
069:                    }
070:                }
071:            }
072:
073:            /**
074:             * Return the connection info representing the connection
075:             * @return
076:             */
077:            public ConnectionInfo getConnectionInfo() {
078:                return this .connectionInfo;
079:            }
080:
081:            /**
082:             * Returns a list of table spaces in the Database.  It is empty if there are no table spaces for the database.  
083:             * @return - a list of Strings
084:             * @throws DBEngineException
085:             */
086:            public List listSchemas() throws DBEngineException {
087:                return this .dbQueryEngine.listSchemas();
088:            }
089:
090:            /**
091:             * Lists the indexes in the schema
092:             * @return
093:             * @throws DBEngineException
094:             */
095:            public DBTable listIndexes() throws DBEngineException {
096:                return this .dbQueryEngine.listIndexes();
097:            }
098:
099:            /**
100:             * Lists the constraints in the schema
101:             * @return
102:             * @throws DBEngineException
103:             */
104:            public DBTable listConstraints() throws DBEngineException {
105:                return this .dbQueryEngine.listConstraints();
106:            }
107:
108:            /**
109:             * Returns a list of views accessible to the user.  It is empty if there are no views for the user.
110:             * @return - a list of View objects
111:             * @throws DBEngineException
112:             */
113:            public List listViews() throws DBEngineException {
114:                return this .dbQueryEngine.listViews();
115:            }
116:
117:            /**
118:             * Returns the SQL used to create a view
119:             * @return - a String
120:             * @throws DBEngineException
121:             */
122:            public String getSQLForView(View view) throws DBEngineException {
123:                return this .dbQueryEngine.getSQLForView(view);
124:            }
125:
126:            /**
127:             * Returns a list of tables in the table space
128:             * @param schemaName
129:             * @return - a list of Strings
130:             * @throws DBEngineException
131:             */
132:            public List listTablesInSchema(String schemaName)
133:                    throws DBEngineException {
134:                return this .dbQueryEngine.listTablesInSchema(schemaName);
135:            }
136:
137:            /**
138:             * Returns a list of columns in the table
139:             * @param schemaName
140:             * @param tableName
141:             * @return - a list of ColumnInfo objects
142:             * @throws DBEngineException
143:             */
144:            public List listColumnsInATable(String schemaName, String tableName)
145:                    throws DBEngineException {
146:                return this .dbQueryEngine.listColumnsInATable(schemaName,
147:                        tableName);
148:            }
149:
150:            /**
151:             * Get all the data in a table
152:             * @param schemaName
153:             * @param tableName
154:             * @return
155:             * @throws DBEngineException
156:             */
157:            public DBTable getAllDataInATable(String schemaName,
158:                    String tableName, Integer offset,
159:                    Integer numberOfRowsToReturn) throws DBEngineException {
160:                return this .dbQueryEngine.getAllDataInATable(schemaName,
161:                        tableName, offset, numberOfRowsToReturn);
162:            }
163:
164:            /**
165:             * Get all the data in a table
166:             * @param schemaName
167:             * @param tableName
168:             * @return
169:             * @throws DBEngineException
170:             */
171:            public DBTable getFilteredDataInATable(String schemaName,
172:                    String tableName, Filter filter) throws DBEngineException {
173:                return this .dbQueryEngine.getFilteredDataInATable(schemaName,
174:                        tableName, filter);
175:            }
176:
177:            /**
178:             * Lists the sequence in an Oracle database.  For other databases, throws an UnsupportedOperationException
179:             * @return - results as a dbtable
180:             * @throws DBEngineException
181:             */
182:            public DBTable listSequences() throws DBEngineException {
183:                //Only oracle has sequences
184:                if (!ORACLE_DBMS.equals(connectionInfo.getDBMSType())) {
185:                    throw new UnsupportedOperationException(
186:                            "*** MySQL does not support sequences.  Sequences cant be listed for MySQL - UIController.listSequences ***");
187:                }
188:
189:                //If it is oracle dbms, list sequences
190:                Oracle9iDBQueryEngine oracle9iDBQueryEngine = (Oracle9iDBQueryEngine) this.dbQueryEngine;
191:                return oracle9iDBQueryEngine.listSequences();
192:            }
193:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.