Source Code Cross Referenced for GeneratorParentExpander.java in  » Database-Client » squirrel-sql-2.6.5a » org » firebirdsql » squirrel » exp » 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 » squirrel sql 2.6.5a » org.firebirdsql.squirrel.exp 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.firebirdsql.squirrel.exp;
002:
003:        /*
004:         * Copyright (C) 2002 Colin Bell
005:         * colbell@users.sourceforge.net
006:         *
007:         * This library is free software; you can redistribute it and/or
008:         * modify it under the terms of the GNU Lesser General Public
009:         * License as published by the Free Software Foundation; either
010:         * version 2.1 of the License, or (at your option) any later version.
011:         *
012:         * This library is distributed in the hope that it will be useful,
013:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015:         * Lesser General Public License for more details.
016:         *
017:         * You should have received a copy of the GNU Lesser General Public
018:         * License along with this library; if not, write to the Free Software
019:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
020:         */
021:        import java.sql.PreparedStatement;
022:        import java.sql.ResultSet;
023:        import java.sql.SQLException;
024:        import java.util.ArrayList;
025:        import java.util.List;
026:
027:        import org.firebirdsql.squirrel.FirebirdPlugin;
028:
029:        import net.sourceforge.squirrel_sql.fw.sql.DatabaseObjectInfo;
030:        import net.sourceforge.squirrel_sql.fw.sql.DatabaseObjectType;
031:        import net.sourceforge.squirrel_sql.fw.sql.IDatabaseObjectInfo;
032:        import net.sourceforge.squirrel_sql.fw.sql.ISQLConnection;
033:        import net.sourceforge.squirrel_sql.fw.sql.SQLDatabaseMetaData;
034:        import net.sourceforge.squirrel_sql.fw.util.log.ILogger;
035:        import net.sourceforge.squirrel_sql.fw.util.log.LoggerController;
036:
037:        import net.sourceforge.squirrel_sql.client.session.ISession;
038:        import net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.INodeExpander;
039:        import net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.ObjectTreeNode;
040:
041:        /**
042:         * This class handles the expanding of the "Sequence Group" node. It will give a
043:         * list of all the Sequences available in the schema.
044:         * 
045:         * @author <A HREF="mailto:colbell@users.sourceforge.net">Colin Bell </A>
046:         */
047:        public class GeneratorParentExpander implements  INodeExpander {
048:
049:            /** SQL used to load info about sequences. */
050:            private static final String SQL = "select cast(rdb$generator_name as varchar(31)) as rdb$generator_name"
051:                    + " from rdb$generators where rdb$system_flag is null";
052:
053:            /** Logger for this class. */
054:            @SuppressWarnings("unused")
055:            private static final ILogger s_log = LoggerController
056:                    .createLogger(GeneratorParentExpander.class);
057:
058:            /** The plugin. */
059:            @SuppressWarnings("unused")
060:            private final FirebirdPlugin _plugin;
061:
062:            /**
063:             * Ctor.
064:             * 
065:             * @throws IllegalArgumentException
066:             *             Thrown if <TT>null</TT> <TT>OraclePlugin</TT> passed.
067:             */
068:            GeneratorParentExpander(FirebirdPlugin plugin) {
069:                super ();
070:                if (plugin == null) {
071:                    throw new IllegalArgumentException("FirebirdPlugin == null");
072:                }
073:
074:                _plugin = plugin;
075:            }
076:
077:            /**
078:             * Create the child nodes for the passed parent node and return them. Note
079:             * that this method should <B>not </B> actually add the child nodes to the
080:             * parent node as this is taken care of in the caller.
081:             * 
082:             * @param session
083:             *            Current session.
084:             * @param node
085:             *            Node to be expanded.
086:             * 
087:             * @return A list of <TT>ObjectTreeNode</TT> objects representing the
088:             *         child nodes for the passed node.
089:             */
090:            public List<ObjectTreeNode> createChildren(ISession session,
091:                    ObjectTreeNode parentNode) throws SQLException {
092:                final List<ObjectTreeNode> childNodes = new ArrayList<ObjectTreeNode>();
093:                final IDatabaseObjectInfo parentDbinfo = parentNode
094:                        .getDatabaseObjectInfo();
095:                final ISQLConnection conn = session.getSQLConnection();
096:                final SQLDatabaseMetaData md = session.getSQLConnection()
097:                        .getSQLMetaData();
098:                final String catalogName = parentDbinfo.getCatalogName();
099:                final String schemaName = parentDbinfo.getSchemaName();
100:
101:                PreparedStatement pstmt = conn.prepareStatement(SQL);
102:                try {
103:                    ResultSet rs = pstmt.executeQuery();
104:                    while (rs.next()) {
105:                        IDatabaseObjectInfo si = new DatabaseObjectInfo(
106:                                catalogName, schemaName, rs.getString(1),
107:                                DatabaseObjectType.SEQUENCE, md);
108:                        childNodes.add(new ObjectTreeNode(session, si));
109:                    }
110:                } finally {
111:                    pstmt.close();
112:                }
113:                return childNodes;
114:            }
115:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.