Source Code Cross Referenced for DBMetaCatalogNode.java in  » Database-ORM » db-ojb » org » apache » ojb » tools » mapping » reversedb2 » dbmetatreemodel » 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 ORM » db ojb » org.apache.ojb.tools.mapping.reversedb2.dbmetatreemodel 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.apache.ojb.tools.mapping.reversedb2.dbmetatreemodel;
002:
003:        /* Copyright 2002-2005 The Apache Software Foundation
004:         *
005:         * Licensed under the Apache License, Version 2.0 (the "License");
006:         * you may not use this file except in compliance with the License.
007:         * You may obtain a copy of the License at
008:         *
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:
018:        /**
019:         * This node represents a catalog of the database. Its children are DBMetaSchemaNode
020:         * objects.
021:         *
022:         * @author <a href="mailto:bfl@florianbruckner.com">Florian Bruckner</a> 
023:         * @version $Id: DBMetaCatalogNode.java,v 1.1.2.1 2005/12/21 22:32:42 tomdz Exp $
024:         */
025:        public class DBMetaCatalogNode extends ReverseDbTreeNode implements 
026:                java.io.Serializable {
027:            static final long serialVersionUID = -2455228985120104948L;
028:            /** Attribute key for the accessing the catalog name */
029:            public static final String ATT_CATALOG_NAME = "Catalog Name";
030:
031:            /** Creates a new instance of DBMetaCatalogNode.
032:             * @param pdbMeta DatabaseMetaData implementation where this node gets its data from.
033:             * @param pdbMetaTreeModel The TreeModel this node is associated to.
034:             * @param prootNode The parent node for this node.
035:             * @param pstrCatalogName The name of the catalog this node is representing. Some databases do not supports
036:             * catalogs, therefore null values are allowed for this parameter
037:             */
038:            public DBMetaCatalogNode(java.sql.DatabaseMetaData pdbMeta,
039:                    DatabaseMetaDataTreeModel pdbMetaTreeModel,
040:                    DBMetaRootNode prootNode, String pstrCatalogName) {
041:                super (pdbMeta, pdbMetaTreeModel, prootNode);
042:                this .setAttribute(ATT_CATALOG_NAME, pstrCatalogName);
043:            }
044:
045:            /**
046:             * @see ReverseDbTreeNode#isLeaf()
047:             */
048:            public boolean isLeaf() {
049:                return false;
050:            }
051:
052:            /**
053:             * @see ReverseDbTreeNode#getAllowsChildren()
054:             */
055:            public boolean getAllowsChildren() {
056:                return false;
057:            }
058:
059:            /**
060:             * Convenience access method for the catalog name. Accesses the
061:             * attributes HashMap to retrieve the value.
062:             */
063:            public String getCatalogName() {
064:                return (String) this .getAttribute(ATT_CATALOG_NAME);
065:            }
066:
067:            /**
068:             * If the catalog name is specified, returns the catalog name, 
069:             * otherwise a constant string indicating that the catalog name
070:             * is emtpy (which is legal for some databases, e.g. Oracle)
071:             * @see Object#toString()
072:             */
073:            public String toString() {
074:                if (this .getAttribute(ATT_CATALOG_NAME) != null)
075:                    return this .getAttribute(ATT_CATALOG_NAME).toString();
076:                else
077:                    return "catalog not specified";
078:            }
079:
080:            public Class getPropertyEditorClass() {
081:                return org.apache.ojb.tools.mapping.reversedb2.propertyEditors.JPnlPropertyEditorDBMetaCatalog.class;
082:            }
083:
084:            /**
085:             * Loads the schemas associated to this catalog.
086:             */
087:            protected boolean _load() {
088:                java.sql.ResultSet rs = null;
089:                try {
090:
091:                    // This synchronization is necessary for Oracle JDBC drivers 8.1.7, 9.0.1, 9.2.0.1
092:                    // The documentation says synchronization is done within the driver, but they
093:                    // must have overlooked something. Without the lock we'd get mysterious error
094:                    // messages.            
095:                    synchronized (getDbMeta()) {
096:
097:                        getDbMetaTreeModel().setStatusBarMessage(
098:                                "Reading schemas for catalog "
099:                                        + this .getAttribute(ATT_CATALOG_NAME));
100:                        rs = getDbMeta().getSchemas();
101:                        final java.util.ArrayList alNew = new java.util.ArrayList();
102:                        int count = 0;
103:                        while (rs.next()) {
104:                            getDbMetaTreeModel().setStatusBarMessage(
105:                                    "Creating schema " + getCatalogName() + "."
106:                                            + rs.getString("TABLE_SCHEM"));
107:                            alNew.add(new DBMetaSchemaNode(getDbMeta(),
108:                                    getDbMetaTreeModel(),
109:                                    DBMetaCatalogNode.this , rs
110:                                            .getString("TABLE_SCHEM")));
111:                            count++;
112:                        }
113:                        if (count == 0)
114:                            alNew.add(new DBMetaSchemaNode(getDbMeta(),
115:                                    getDbMetaTreeModel(),
116:                                    DBMetaCatalogNode.this , null));
117:                        alChildren = alNew;
118:                        javax.swing.SwingUtilities.invokeLater(new Runnable() {
119:                            public void run() {
120:                                getDbMetaTreeModel().nodeStructureChanged(
121:                                        DBMetaCatalogNode.this );
122:                            }
123:                        });
124:                        rs.close();
125:                    }
126:                } catch (java.sql.SQLException sqlEx) {
127:                    getDbMetaTreeModel().reportSqlError(
128:                            "Error retrieving schemas", sqlEx);
129:                    try {
130:                        if (rs != null)
131:                            rs.close();
132:                    } catch (java.sql.SQLException sqlEx2) {
133:                        this .getDbMetaTreeModel().reportSqlError(
134:                                "Error retrieving schemas", sqlEx2);
135:                    }
136:                    return false;
137:                }
138:                return true;
139:            }
140:
141:        }
w_w__w_.___ja___va__2__s___.___c_o__m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.