Source Code Cross Referenced for ConnectionNode.java in  » IDE-Netbeans » db » org » netbeans » modules » db » explorer » nodes » 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 » IDE Netbeans » db » org.netbeans.modules.db.explorer.nodes 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:
042:        package org.netbeans.modules.db.explorer.nodes;
043:
044:        import java.awt.datatransfer.Transferable;
045:        import java.beans.PropertyChangeEvent;
046:        import java.beans.PropertyChangeListener;
047:        import java.io.IOException;
048:        import java.sql.Connection;
049:        import java.sql.DatabaseMetaData;
050:        import org.netbeans.api.db.explorer.DatabaseMetaDataTransfer;
051:        import org.netbeans.modules.db.explorer.ConnectionList;
052:        import org.netbeans.modules.db.explorer.DatabaseConnection;
053:        import org.netbeans.modules.db.explorer.DatabaseMetaDataTransferAccessor;
054:        import org.netbeans.modules.db.explorer.infos.ConnectionNodeInfo;
055:
056:        import org.openide.util.NbBundle;
057:        import org.openide.nodes.Node;
058:        import org.openide.nodes.PropertySupport;
059:        import org.openide.nodes.Sheet;
060:        import org.openide.util.RequestProcessor;
061:
062:        import org.netbeans.lib.ddl.adaptors.DefaultAdaptor;
063:        import org.netbeans.modules.db.explorer.DatabaseNodeChildren;
064:        import org.netbeans.modules.db.explorer.infos.DatabaseNodeInfo;
065:        import org.openide.util.datatransfer.ExTransferable;
066:
067:        /**
068:         * Node representing open or closed connection to database.
069:         */
070:
071:        public class ConnectionNode extends DatabaseNode {
072:
073:            private boolean createPropSupport = true;
074:
075:            public void setInfo(DatabaseNodeInfo nodeinfo) {
076:                super .setInfo(nodeinfo);
077:                DatabaseNodeInfo info = getInfo();
078:
079:                setName(info.getName());
080:
081:                info.put(DefaultAdaptor.PROP_MIXEDCASE_IDENTIFIERS,
082:                        Boolean.FALSE);
083:                info.put(DefaultAdaptor.PROP_MIXEDCASE_QUOTED_IDENTIFIERS,
084:                        Boolean.FALSE);
085:                info.put(DefaultAdaptor.PROP_ALTER_ADD, Boolean.FALSE);
086:                info.put(DefaultAdaptor.PROP_ALTER_DROP, Boolean.FALSE);
087:                info.put(DefaultAdaptor.PROP_CONVERT, Boolean.FALSE);
088:                info.put(DefaultAdaptor.PROP_TABLE_CORRELATION_NAMES,
089:                        Boolean.FALSE);
090:                info.put(DefaultAdaptor.PROP_TABLE_CORRELATION_NAMES,
091:                        Boolean.FALSE);
092:                info.put(DefaultAdaptor.PROP_EXPRESSIONS_IN_ORDERBY,
093:                        Boolean.FALSE);
094:                info.put(DefaultAdaptor.PROP_ORDER_BY_UNRELATED, Boolean.FALSE);
095:                info.put(DefaultAdaptor.PROP_GROUP_BY, Boolean.FALSE);
096:                info.put(DefaultAdaptor.PROP_UNRELATED_GROUP_BY, Boolean.FALSE);
097:                info.put(DefaultAdaptor.PROP_BEYOND_GROUP_BY, Boolean.FALSE);
098:                info.put(DefaultAdaptor.PROP_ESCAPE_LIKE, Boolean.FALSE);
099:                info.put(DefaultAdaptor.PROP_MULTIPLE_RS, Boolean.FALSE);
100:                info.put(DefaultAdaptor.PROP_MULTIPLE_TRANSACTIONS,
101:                        Boolean.FALSE);
102:                info.put(DefaultAdaptor.PROP_NON_NULL_COLUMNSS, Boolean.FALSE);
103:                info
104:                        .put(DefaultAdaptor.PROP_MINUMUM_SQL_GRAMMAR,
105:                                Boolean.FALSE);
106:                info.put(DefaultAdaptor.PROP_CORE_SQL_GRAMMAR, Boolean.FALSE);
107:                info.put(DefaultAdaptor.PROP_EXTENDED_SQL_GRAMMAR,
108:                        Boolean.FALSE);
109:                info.put(DefaultAdaptor.PROP_ANSI_SQL_GRAMMAR, Boolean.FALSE);
110:                info.put(DefaultAdaptor.PROP_INTERMEDIATE_SQL_GRAMMAR,
111:                        Boolean.FALSE);
112:                info.put(DefaultAdaptor.PROP_FULL_SQL_GRAMMAR, Boolean.FALSE);
113:                info.put(DefaultAdaptor.PROP_INTEGRITY_ENHANCEMENT,
114:                        Boolean.FALSE);
115:                info.put(DefaultAdaptor.PROP_OUTER_JOINS, Boolean.FALSE);
116:                info.put(DefaultAdaptor.PROP_FULL_OUTER_JOINS, Boolean.FALSE);
117:                info
118:                        .put(DefaultAdaptor.PROP_LIMITED_OUTER_JOINS,
119:                                Boolean.FALSE);
120:                info.put(DefaultAdaptor.PROP_SCHEMAS_IN_DML, Boolean.FALSE);
121:                info.put(DefaultAdaptor.PROP_SCHEMAS_IN_PROCEDURE_CALL,
122:                        Boolean.FALSE);
123:                info.put(DefaultAdaptor.PROP_SCHEMAS_IN_TABLE_DEFINITION,
124:                        Boolean.FALSE);
125:                info.put(DefaultAdaptor.PROP_SCHEMAS_IN_INDEX, Boolean.FALSE);
126:                info.put(DefaultAdaptor.PROP_SCHEMAS_IN_PRIVILEGE_DEFINITION,
127:                        Boolean.FALSE);
128:                info.put(DefaultAdaptor.PROP_CATALOGS_IN_DML, Boolean.FALSE);
129:                info.put(DefaultAdaptor.PROP_CATALOGS_IN_PROCEDURE_CALL,
130:                        Boolean.FALSE);
131:                info.put(DefaultAdaptor.PROP_CATALOGS_IN_TABLE_DEFINITION,
132:                        Boolean.FALSE);
133:                info.put(DefaultAdaptor.PROP_CATALOGS_IN_INDEX, Boolean.FALSE);
134:                info.put(DefaultAdaptor.PROP_CATALOGS_IN_PRIVILEGE_DEFINITION,
135:                        Boolean.FALSE);
136:                info.put(DefaultAdaptor.PROP_POSITIONED_DELETE, Boolean.FALSE);
137:                info.put(DefaultAdaptor.PROP_POSITIONED_UPDATE, Boolean.FALSE);
138:                info.put(DefaultAdaptor.PROP_SELECT_FOR_UPDATE, Boolean.FALSE);
139:                info.put(DefaultAdaptor.PROP_STORED_PROCEDURES, Boolean.FALSE);
140:                info.put(DefaultAdaptor.PROP_SUBQUERY_IN_COMPARSIONS,
141:                        Boolean.FALSE);
142:                info.put(DefaultAdaptor.PROP_SUBQUERY_IN_EXISTS, Boolean.FALSE);
143:                info.put(DefaultAdaptor.PROP_SUBQUERY_IN_INS, Boolean.FALSE);
144:                info.put(DefaultAdaptor.PROP_SUBQUERY_IN_QUANTIFIEDS,
145:                        Boolean.FALSE);
146:                info.put(DefaultAdaptor.PROP_CORRELATED_SUBQUERIES,
147:                        Boolean.FALSE);
148:                info.put(DefaultAdaptor.PROP_UNION, Boolean.FALSE);
149:                info.put(DefaultAdaptor.PROP_UNION_ALL, Boolean.FALSE);
150:                info.put(DefaultAdaptor.PROP_OPEN_CURSORS_ACROSS_COMMIT,
151:                        Boolean.FALSE);
152:                info.put(DefaultAdaptor.PROP_OPEN_CURSORS_ACROSS_ROLLBACK,
153:                        Boolean.FALSE);
154:                info.put(DefaultAdaptor.PROP_OPEN_STATEMENTS_ACROSS_COMMIT,
155:                        Boolean.FALSE);
156:                info.put(DefaultAdaptor.PROP_OPEN_STATEMENTS_ACROSS_ROLLBACK,
157:                        Boolean.FALSE);
158:                info.put(DefaultAdaptor.PROP_TRANSACTIONS, Boolean.FALSE);
159:                info.put(DefaultAdaptor.PROP_DDL_AND_DML_TRANSACTIONS,
160:                        Boolean.FALSE);
161:                info.put(DefaultAdaptor.PROP_DML_TRANSACTIONS_ONLY,
162:                        Boolean.FALSE);
163:                info.put(DefaultAdaptor.PROP_BATCH_UPDATES, Boolean.FALSE);
164:                info.put(DefaultAdaptor.PROP_CATALOG_AT_START, Boolean.FALSE);
165:                info.put(DefaultAdaptor.PROP_COLUMN_ALIASING, Boolean.FALSE);
166:                info.put(DefaultAdaptor.PROP_DDL_CAUSES_COMMIT, Boolean.FALSE);
167:                info.put(DefaultAdaptor.PROP_DDL_IGNORED_IN_TRANSACTIONS,
168:                        Boolean.FALSE);
169:                info.put(DefaultAdaptor.PROP_DIFF_TABLE_CORRELATION_NAMES,
170:                        Boolean.FALSE);
171:                info.put(DefaultAdaptor.PROP_LOCAL_FILES, Boolean.FALSE);
172:                info.put(DefaultAdaptor.PROP_FILE_PER_TABLE, Boolean.FALSE);
173:                info.put(DefaultAdaptor.PROP_ROWSIZE_INCLUDING_BLOBS,
174:                        Boolean.FALSE);
175:                info.put(DefaultAdaptor.PROP_NULL_PLUS_NULL_IS_NULL,
176:                        Boolean.FALSE);
177:                info.put(DefaultAdaptor.PROP_PROCEDURES_ARE_CALLABLE,
178:                        Boolean.FALSE);
179:                info.put(DefaultAdaptor.PROP_TABLES_ARE_SELECTABLE,
180:                        Boolean.FALSE);
181:
182:                info.put(DefaultAdaptor.PROP_READONLY,
183:                        info.isReadOnly() ? Boolean.TRUE : Boolean.FALSE);
184:
185:                info.addConnectionListener(new PropertyChangeListener() {
186:                    public void propertyChange(PropertyChangeEvent evt) {
187:                        if (evt.getPropertyName().equals(
188:                                DatabaseNodeInfo.DATABASE))
189:                            setConnectionName();
190:                        if (evt.getPropertyName().equals(
191:                                DatabaseNodeInfo.SCHEMA))
192:                            setConnectionName();
193:                        if (evt.getPropertyName().equals(DatabaseNodeInfo.USER))
194:                            setConnectionName();
195:                        if (evt.getPropertyName().equals(
196:                                DatabaseNodeInfo.CONNECTION)) {
197:                            update((Connection) evt.getNewValue());
198:                            firePropertyChange(null, null, null);
199:                        }
200:                    }
201:                });
202:
203:                getCookieSet().add(this );
204:            }
205:
206:            private void setConnectionName() {
207:                String displayName = getInfo().getDatabaseConnection()
208:                        .getName();
209:                setDisplayName(displayName);
210:            }
211:
212:            private boolean createPropSupport() {
213:                return createPropSupport;
214:            }
215:
216:            private void setPropSupport(boolean value) {
217:                createPropSupport = value;
218:            }
219:
220:            private void update(Connection connection) {
221:                final boolean connecting = (connection != null);
222:                RequestProcessor.getDefault().post(new Runnable() {
223:                    public void run() {
224:                        DatabaseNodeChildren children = (DatabaseNodeChildren) getChildren();
225:                        DatabaseNodeInfo info = getInfo();
226:
227:                        setIconBase((String) info
228:                                .get(connecting ? "activeiconbase" : "iconbase")); //NOI18N
229:                        setConnectionName();
230:                        Sheet.Set set = getSheet().get(Sheet.PROPERTIES);
231:
232:                        try {
233:                            if (createPropSupport()) {
234:                                Node.Property dbprop = set
235:                                        .get(DatabaseNodeInfo.DATABASE);
236:                                PropertySupport newdbprop = createPropertySupport(
237:                                        dbprop.getName(),
238:                                        dbprop.getValueType(), dbprop
239:                                                .getDisplayName(), dbprop
240:                                                .getShortDescription(), info,
241:                                        !connecting);
242:                                set.put(newdbprop);
243:                                firePropertyChange("db", dbprop, newdbprop); //NOI18N
244:
245:                                Node.Property drvprop = set
246:                                        .get(DatabaseNodeInfo.DRIVER);
247:                                PropertySupport newdrvprop = createPropertySupport(
248:                                        drvprop.getName(), drvprop
249:                                                .getValueType(), drvprop
250:                                                .getDisplayName(), drvprop
251:                                                .getShortDescription(), info,
252:                                        !connecting);
253:                                set.put(newdrvprop);
254:                                firePropertyChange("driver", drvprop,
255:                                        newdrvprop); //NOI18N
256:
257:                                Node.Property schemaprop = set
258:                                        .get(DatabaseNodeInfo.SCHEMA);
259:                                PropertySupport newschemaprop = createPropertySupport(
260:                                        schemaprop.getName(), schemaprop
261:                                                .getValueType(), schemaprop
262:                                                .getDisplayName(), schemaprop
263:                                                .getShortDescription(), info,
264:                                        !connecting);
265:                                set.put(newschemaprop);
266:                                firePropertyChange("schema", schemaprop,
267:                                        newschemaprop); //NOI18N
268:
269:                                Node.Property usrprop = set
270:                                        .get(DatabaseNodeInfo.USER);
271:                                PropertySupport newusrprop = createPropertySupport(
272:                                        usrprop.getName(), usrprop
273:                                                .getValueType(), usrprop
274:                                                .getDisplayName(), usrprop
275:                                                .getShortDescription(), info,
276:                                        !connecting);
277:                                set.put(newusrprop);
278:                                firePropertyChange("user", usrprop, newusrprop); //NOI18N
279:
280:                                Node.Property rememberprop = set
281:                                        .get(DatabaseNodeInfo.REMEMBER_PWD);
282:                                PropertySupport newrememberprop = createPropertySupport(
283:                                        rememberprop.getName(), rememberprop
284:                                                .getValueType(), rememberprop
285:                                                .getDisplayName(), rememberprop
286:                                                .getShortDescription(), info,
287:                                        connecting);
288:                                set.put(newrememberprop);
289:                                firePropertyChange("rememberpwd", rememberprop,
290:                                        newrememberprop); //NOI18N
291:
292:                                setPropSupport(false);
293:                            } else {
294:                                Node.Property dbprop = set
295:                                        .get(DatabaseNodeInfo.DATABASE);
296:                                set.put(dbprop);
297:                                firePropertyChange("db", null, dbprop); //NOI18N
298:
299:                                Node.Property drvprop = set
300:                                        .get(DatabaseNodeInfo.DRIVER);
301:                                firePropertyChange("driver", null, drvprop); //NOI18N
302:
303:                                Node.Property schemaprop = set
304:                                        .get(DatabaseNodeInfo.SCHEMA);
305:                                firePropertyChange("schema", null, schemaprop); //NOI18N
306:
307:                                Node.Property usrprop = set
308:                                        .get(DatabaseNodeInfo.USER);
309:                                firePropertyChange("user", null, usrprop); //NOI18N
310:
311:                                Node.Property rememberprop = set
312:                                        .get(DatabaseNodeInfo.REMEMBER_PWD);
313:                                firePropertyChange("rememberpwd", null,
314:                                        rememberprop); //NOI18N
315:                            }
316:
317:                            if (!connecting) {
318:                                children.remove(children.getNodes());
319:                                getInfo().getChildren().clear();
320:                            } else {
321:                                DatabaseMetaData dmd = info.getSpecification()
322:                                        .getMetaData();
323:
324:                                try {
325:                                    info.put(DefaultAdaptor.PROP_PRODUCTNAME,
326:                                            dmd.getDatabaseProductName());
327:
328:                                    info
329:                                            .put(
330:                                                    DefaultAdaptor.PROP_MIXEDCASE_IDENTIFIERS,
331:                                                    dmd
332:                                                            .supportsMixedCaseIdentifiers() ? Boolean.TRUE
333:                                                            : Boolean.FALSE);
334:                                    info
335:                                            .put(
336:                                                    DefaultAdaptor.PROP_MIXEDCASE_QUOTED_IDENTIFIERS,
337:                                                    dmd
338:                                                            .supportsMixedCaseQuotedIdentifiers() ? Boolean.TRUE
339:                                                            : Boolean.FALSE);
340:                                    info
341:                                            .put(
342:                                                    DefaultAdaptor.PROP_ALTER_ADD,
343:                                                    dmd
344:                                                            .supportsAlterTableWithAddColumn() ? Boolean.TRUE
345:                                                            : Boolean.FALSE);
346:                                    info
347:                                            .put(
348:                                                    DefaultAdaptor.PROP_ALTER_DROP,
349:                                                    dmd
350:                                                            .supportsAlterTableWithDropColumn() ? Boolean.TRUE
351:                                                            : Boolean.FALSE);
352:                                    info.put(DefaultAdaptor.PROP_CONVERT, dmd
353:                                            .supportsConvert() ? Boolean.TRUE
354:                                            : Boolean.FALSE);
355:                                    info
356:                                            .put(
357:                                                    DefaultAdaptor.PROP_TABLE_CORRELATION_NAMES,
358:                                                    dmd
359:                                                            .supportsTableCorrelationNames() ? Boolean.TRUE
360:                                                            : Boolean.FALSE);
361:                                    info
362:                                            .put(
363:                                                    DefaultAdaptor.PROP_TABLE_CORRELATION_NAMES,
364:                                                    dmd
365:                                                            .supportsDifferentTableCorrelationNames() ? Boolean.TRUE
366:                                                            : Boolean.FALSE);
367:                                    info
368:                                            .put(
369:                                                    DefaultAdaptor.PROP_EXPRESSIONS_IN_ORDERBY,
370:                                                    dmd
371:                                                            .supportsExpressionsInOrderBy() ? Boolean.TRUE
372:                                                            : Boolean.FALSE);
373:                                    info
374:                                            .put(
375:                                                    DefaultAdaptor.PROP_ORDER_BY_UNRELATED,
376:                                                    dmd
377:                                                            .supportsOrderByUnrelated() ? Boolean.TRUE
378:                                                            : Boolean.FALSE);
379:                                    info.put(DefaultAdaptor.PROP_GROUP_BY, dmd
380:                                            .supportsGroupBy() ? Boolean.TRUE
381:                                            : Boolean.FALSE);
382:                                    info
383:                                            .put(
384:                                                    DefaultAdaptor.PROP_UNRELATED_GROUP_BY,
385:                                                    dmd
386:                                                            .supportsGroupByUnrelated() ? Boolean.TRUE
387:                                                            : Boolean.FALSE);
388:                                    info
389:                                            .put(
390:                                                    DefaultAdaptor.PROP_BEYOND_GROUP_BY,
391:                                                    dmd
392:                                                            .supportsGroupByBeyondSelect() ? Boolean.TRUE
393:                                                            : Boolean.FALSE);
394:                                    info
395:                                            .put(
396:                                                    DefaultAdaptor.PROP_ESCAPE_LIKE,
397:                                                    dmd
398:                                                            .supportsLikeEscapeClause() ? Boolean.TRUE
399:                                                            : Boolean.FALSE);
400:                                    info
401:                                            .put(
402:                                                    DefaultAdaptor.PROP_MULTIPLE_RS,
403:                                                    dmd
404:                                                            .supportsMultipleResultSets() ? Boolean.TRUE
405:                                                            : Boolean.FALSE);
406:                                    info
407:                                            .put(
408:                                                    DefaultAdaptor.PROP_MULTIPLE_TRANSACTIONS,
409:                                                    dmd
410:                                                            .supportsMultipleTransactions() ? Boolean.TRUE
411:                                                            : Boolean.FALSE);
412:                                    info
413:                                            .put(
414:                                                    DefaultAdaptor.PROP_NON_NULL_COLUMNSS,
415:                                                    dmd
416:                                                            .supportsNonNullableColumns() ? Boolean.TRUE
417:                                                            : Boolean.FALSE);
418:                                    info
419:                                            .put(
420:                                                    DefaultAdaptor.PROP_MINUMUM_SQL_GRAMMAR,
421:                                                    dmd
422:                                                            .supportsMinimumSQLGrammar() ? Boolean.TRUE
423:                                                            : Boolean.FALSE);
424:                                    info
425:                                            .put(
426:                                                    DefaultAdaptor.PROP_CORE_SQL_GRAMMAR,
427:                                                    dmd
428:                                                            .supportsCoreSQLGrammar() ? Boolean.TRUE
429:                                                            : Boolean.FALSE);
430:                                    info
431:                                            .put(
432:                                                    DefaultAdaptor.PROP_EXTENDED_SQL_GRAMMAR,
433:                                                    dmd
434:                                                            .supportsExtendedSQLGrammar() ? Boolean.TRUE
435:                                                            : Boolean.FALSE);
436:                                    info
437:                                            .put(
438:                                                    DefaultAdaptor.PROP_ANSI_SQL_GRAMMAR,
439:                                                    dmd
440:                                                            .supportsANSI92EntryLevelSQL() ? Boolean.TRUE
441:                                                            : Boolean.FALSE);
442:                                    info
443:                                            .put(
444:                                                    DefaultAdaptor.PROP_INTERMEDIATE_SQL_GRAMMAR,
445:                                                    dmd
446:                                                            .supportsANSI92IntermediateSQL() ? Boolean.TRUE
447:                                                            : Boolean.FALSE);
448:                                    info
449:                                            .put(
450:                                                    DefaultAdaptor.PROP_FULL_SQL_GRAMMAR,
451:                                                    dmd.supportsANSI92FullSQL() ? Boolean.TRUE
452:                                                            : Boolean.FALSE);
453:                                    info
454:                                            .put(
455:                                                    DefaultAdaptor.PROP_INTEGRITY_ENHANCEMENT,
456:                                                    dmd
457:                                                            .supportsIntegrityEnhancementFacility() ? Boolean.TRUE
458:                                                            : Boolean.FALSE);
459:                                    info
460:                                            .put(
461:                                                    DefaultAdaptor.PROP_OUTER_JOINS,
462:                                                    dmd.supportsOuterJoins() ? Boolean.TRUE
463:                                                            : Boolean.FALSE);
464:                                    info
465:                                            .put(
466:                                                    DefaultAdaptor.PROP_FULL_OUTER_JOINS,
467:                                                    dmd
468:                                                            .supportsFullOuterJoins() ? Boolean.TRUE
469:                                                            : Boolean.FALSE);
470:                                    info
471:                                            .put(
472:                                                    DefaultAdaptor.PROP_LIMITED_OUTER_JOINS,
473:                                                    dmd
474:                                                            .supportsLimitedOuterJoins() ? Boolean.TRUE
475:                                                            : Boolean.FALSE);
476:                                    info
477:                                            .put(
478:                                                    DefaultAdaptor.PROP_SCHEMAS_IN_DML,
479:                                                    dmd
480:                                                            .supportsSchemasInDataManipulation() ? Boolean.TRUE
481:                                                            : Boolean.FALSE);
482:                                    info
483:                                            .put(
484:                                                    DefaultAdaptor.PROP_SCHEMAS_IN_PROCEDURE_CALL,
485:                                                    dmd
486:                                                            .supportsSchemasInProcedureCalls() ? Boolean.TRUE
487:                                                            : Boolean.FALSE);
488:                                    info
489:                                            .put(
490:                                                    DefaultAdaptor.PROP_SCHEMAS_IN_TABLE_DEFINITION,
491:                                                    dmd
492:                                                            .supportsSchemasInTableDefinitions() ? Boolean.TRUE
493:                                                            : Boolean.FALSE);
494:                                    info
495:                                            .put(
496:                                                    DefaultAdaptor.PROP_SCHEMAS_IN_INDEX,
497:                                                    dmd
498:                                                            .supportsSchemasInIndexDefinitions() ? Boolean.TRUE
499:                                                            : Boolean.FALSE);
500:                                    info
501:                                            .put(
502:                                                    DefaultAdaptor.PROP_SCHEMAS_IN_PRIVILEGE_DEFINITION,
503:                                                    dmd
504:                                                            .supportsSchemasInPrivilegeDefinitions() ? Boolean.TRUE
505:                                                            : Boolean.FALSE);
506:                                    info
507:                                            .put(
508:                                                    DefaultAdaptor.PROP_CATALOGS_IN_DML,
509:                                                    dmd
510:                                                            .supportsCatalogsInDataManipulation() ? Boolean.TRUE
511:                                                            : Boolean.FALSE);
512:                                    info
513:                                            .put(
514:                                                    DefaultAdaptor.PROP_CATALOGS_IN_PROCEDURE_CALL,
515:                                                    dmd
516:                                                            .supportsCatalogsInProcedureCalls() ? Boolean.TRUE
517:                                                            : Boolean.FALSE);
518:                                    info
519:                                            .put(
520:                                                    DefaultAdaptor.PROP_CATALOGS_IN_TABLE_DEFINITION,
521:                                                    dmd
522:                                                            .supportsCatalogsInTableDefinitions() ? Boolean.TRUE
523:                                                            : Boolean.FALSE);
524:                                    info
525:                                            .put(
526:                                                    DefaultAdaptor.PROP_CATALOGS_IN_INDEX,
527:                                                    dmd
528:                                                            .supportsCatalogsInIndexDefinitions() ? Boolean.TRUE
529:                                                            : Boolean.FALSE);
530:                                    info
531:                                            .put(
532:                                                    DefaultAdaptor.PROP_CATALOGS_IN_PRIVILEGE_DEFINITION,
533:                                                    dmd
534:                                                            .supportsCatalogsInPrivilegeDefinitions() ? Boolean.TRUE
535:                                                            : Boolean.FALSE);
536:                                    info
537:                                            .put(
538:                                                    DefaultAdaptor.PROP_POSITIONED_DELETE,
539:                                                    dmd
540:                                                            .supportsPositionedDelete() ? Boolean.TRUE
541:                                                            : Boolean.FALSE);
542:                                    info
543:                                            .put(
544:                                                    DefaultAdaptor.PROP_POSITIONED_UPDATE,
545:                                                    dmd
546:                                                            .supportsPositionedUpdate() ? Boolean.TRUE
547:                                                            : Boolean.FALSE);
548:                                    info
549:                                            .put(
550:                                                    DefaultAdaptor.PROP_SELECT_FOR_UPDATE,
551:                                                    dmd
552:                                                            .supportsSelectForUpdate() ? Boolean.TRUE
553:                                                            : Boolean.FALSE);
554:                                    info
555:                                            .put(
556:                                                    DefaultAdaptor.PROP_STORED_PROCEDURES,
557:                                                    dmd
558:                                                            .supportsStoredProcedures() ? Boolean.TRUE
559:                                                            : Boolean.FALSE);
560:                                    info
561:                                            .put(
562:                                                    DefaultAdaptor.PROP_SUBQUERY_IN_COMPARSIONS,
563:                                                    dmd
564:                                                            .supportsSubqueriesInComparisons() ? Boolean.TRUE
565:                                                            : Boolean.FALSE);
566:                                    info
567:                                            .put(
568:                                                    DefaultAdaptor.PROP_SUBQUERY_IN_EXISTS,
569:                                                    dmd
570:                                                            .supportsSubqueriesInExists() ? Boolean.TRUE
571:                                                            : Boolean.FALSE);
572:                                    info
573:                                            .put(
574:                                                    DefaultAdaptor.PROP_SUBQUERY_IN_INS,
575:                                                    dmd
576:                                                            .supportsSubqueriesInIns() ? Boolean.TRUE
577:                                                            : Boolean.FALSE);
578:                                    info
579:                                            .put(
580:                                                    DefaultAdaptor.PROP_SUBQUERY_IN_QUANTIFIEDS,
581:                                                    dmd
582:                                                            .supportsSubqueriesInQuantifieds() ? Boolean.TRUE
583:                                                            : Boolean.FALSE);
584:                                    info
585:                                            .put(
586:                                                    DefaultAdaptor.PROP_CORRELATED_SUBQUERIES,
587:                                                    dmd
588:                                                            .supportsCorrelatedSubqueries() ? Boolean.TRUE
589:                                                            : Boolean.FALSE);
590:                                    info.put(DefaultAdaptor.PROP_UNION, dmd
591:                                            .supportsUnion() ? Boolean.TRUE
592:                                            : Boolean.FALSE);
593:                                    info.put(DefaultAdaptor.PROP_UNION_ALL, dmd
594:                                            .supportsUnionAll() ? Boolean.TRUE
595:                                            : Boolean.FALSE);
596:                                    info
597:                                            .put(
598:                                                    DefaultAdaptor.PROP_OPEN_CURSORS_ACROSS_COMMIT,
599:                                                    dmd
600:                                                            .supportsOpenCursorsAcrossCommit() ? Boolean.TRUE
601:                                                            : Boolean.FALSE);
602:                                    info
603:                                            .put(
604:                                                    DefaultAdaptor.PROP_OPEN_CURSORS_ACROSS_ROLLBACK,
605:                                                    dmd
606:                                                            .supportsOpenCursorsAcrossRollback() ? Boolean.TRUE
607:                                                            : Boolean.FALSE);
608:                                    info
609:                                            .put(
610:                                                    DefaultAdaptor.PROP_OPEN_STATEMENTS_ACROSS_COMMIT,
611:                                                    dmd
612:                                                            .supportsOpenStatementsAcrossCommit() ? Boolean.TRUE
613:                                                            : Boolean.FALSE);
614:                                    info
615:                                            .put(
616:                                                    DefaultAdaptor.PROP_OPEN_STATEMENTS_ACROSS_ROLLBACK,
617:                                                    dmd
618:                                                            .supportsOpenStatementsAcrossRollback() ? Boolean.TRUE
619:                                                            : Boolean.FALSE);
620:                                    info
621:                                            .put(
622:                                                    DefaultAdaptor.PROP_TRANSACTIONS,
623:                                                    dmd.supportsTransactions() ? Boolean.TRUE
624:                                                            : Boolean.FALSE);
625:                                    info
626:                                            .put(
627:                                                    DefaultAdaptor.PROP_DDL_AND_DML_TRANSACTIONS,
628:                                                    dmd
629:                                                            .supportsDataDefinitionAndDataManipulationTransactions() ? Boolean.TRUE
630:                                                            : Boolean.FALSE);
631:                                    info
632:                                            .put(
633:                                                    DefaultAdaptor.PROP_DML_TRANSACTIONS_ONLY,
634:                                                    dmd
635:                                                            .supportsDataManipulationTransactionsOnly() ? Boolean.TRUE
636:                                                            : Boolean.FALSE);
637:                                    info
638:                                            .put(
639:                                                    DefaultAdaptor.PROP_BATCH_UPDATES,
640:                                                    dmd.supportsBatchUpdates() ? Boolean.TRUE
641:                                                            : Boolean.FALSE);
642:                                    info
643:                                            .put(
644:                                                    DefaultAdaptor.PROP_CATALOG_AT_START,
645:                                                    dmd.isCatalogAtStart() ? Boolean.TRUE
646:                                                            : Boolean.FALSE);
647:                                    info
648:                                            .put(
649:                                                    DefaultAdaptor.PROP_COLUMN_ALIASING,
650:                                                    dmd
651:                                                            .supportsColumnAliasing() ? Boolean.TRUE
652:                                                            : Boolean.FALSE);
653:                                    info
654:                                            .put(
655:                                                    DefaultAdaptor.PROP_DDL_CAUSES_COMMIT,
656:                                                    dmd
657:                                                            .dataDefinitionCausesTransactionCommit() ? Boolean.TRUE
658:                                                            : Boolean.FALSE);
659:                                    info
660:                                            .put(
661:                                                    DefaultAdaptor.PROP_DDL_IGNORED_IN_TRANSACTIONS,
662:                                                    dmd
663:                                                            .dataDefinitionIgnoredInTransactions() ? Boolean.TRUE
664:                                                            : Boolean.FALSE);
665:                                    info
666:                                            .put(
667:                                                    DefaultAdaptor.PROP_DIFF_TABLE_CORRELATION_NAMES,
668:                                                    dmd
669:                                                            .supportsDifferentTableCorrelationNames() ? Boolean.TRUE
670:                                                            : Boolean.FALSE);
671:                                    info.put(DefaultAdaptor.PROP_LOCAL_FILES,
672:                                            dmd.usesLocalFiles() ? Boolean.TRUE
673:                                                    : Boolean.FALSE);
674:                                    info
675:                                            .put(
676:                                                    DefaultAdaptor.PROP_FILE_PER_TABLE,
677:                                                    dmd.usesLocalFilePerTable() ? Boolean.TRUE
678:                                                            : Boolean.FALSE);
679:                                    info
680:                                            .put(
681:                                                    DefaultAdaptor.PROP_ROWSIZE_INCLUDING_BLOBS,
682:                                                    dmd
683:                                                            .doesMaxRowSizeIncludeBlobs() ? Boolean.TRUE
684:                                                            : Boolean.FALSE);
685:                                    info
686:                                            .put(
687:                                                    DefaultAdaptor.PROP_NULL_PLUS_NULL_IS_NULL,
688:                                                    dmd.nullPlusNonNullIsNull() ? Boolean.TRUE
689:                                                            : Boolean.FALSE);
690:                                    info
691:                                            .put(
692:                                                    DefaultAdaptor.PROP_PROCEDURES_ARE_CALLABLE,
693:                                                    dmd
694:                                                            .allProceduresAreCallable() ? Boolean.TRUE
695:                                                            : Boolean.FALSE);
696:                                    info
697:                                            .put(
698:                                                    DefaultAdaptor.PROP_TABLES_ARE_SELECTABLE,
699:                                                    dmd
700:                                                            .allTablesAreSelectable() ? Boolean.TRUE
701:                                                            : Boolean.FALSE);
702:
703:                                    info
704:                                            .put(
705:                                                    DefaultAdaptor.PROP_MAX_BINARY_LITERAL_LENGTH,
706:                                                    new Integer(
707:                                                            dmd
708:                                                                    .getMaxBinaryLiteralLength()));
709:                                    info
710:                                            .put(
711:                                                    DefaultAdaptor.PROP_MAX_CHAR_LITERAL_LENGTH,
712:                                                    new Integer(
713:                                                            dmd
714:                                                                    .getMaxCharLiteralLength()));
715:                                    info
716:                                            .put(
717:                                                    DefaultAdaptor.PROP_MAX_COLUMN_NAME_LENGTH,
718:                                                    new Integer(
719:                                                            dmd
720:                                                                    .getMaxColumnNameLength()));
721:                                    info
722:                                            .put(
723:                                                    DefaultAdaptor.PROP_MAX_COLUMNS_IN_GROUPBY,
724:                                                    new Integer(
725:                                                            dmd
726:                                                                    .getMaxColumnsInGroupBy()));
727:                                    info
728:                                            .put(
729:                                                    DefaultAdaptor.PROP_MAX_COLUMNS_IN_INDEX,
730:                                                    new Integer(
731:                                                            dmd
732:                                                                    .getMaxColumnsInIndex()));
733:                                    info
734:                                            .put(
735:                                                    DefaultAdaptor.PROP_MAX_COLUMNS_IN_ORDERBY,
736:                                                    new Integer(
737:                                                            dmd
738:                                                                    .getMaxColumnsInOrderBy()));
739:                                    info
740:                                            .put(
741:                                                    DefaultAdaptor.PROP_MAX_COLUMNS_IN_SELECT,
742:                                                    new Integer(
743:                                                            dmd
744:                                                                    .getMaxColumnsInSelect()));
745:                                    info
746:                                            .put(
747:                                                    DefaultAdaptor.PROP_MAX_COLUMNS_IN_TABLE,
748:                                                    new Integer(
749:                                                            dmd
750:                                                                    .getMaxColumnsInTable()));
751:                                    info
752:                                            .put(
753:                                                    DefaultAdaptor.PROP_MAX_CONNECTIONS,
754:                                                    new Integer(
755:                                                            dmd
756:                                                                    .getMaxConnections()));
757:                                    info
758:                                            .put(
759:                                                    DefaultAdaptor.PROP_MAX_CURSORNAME_LENGTH,
760:                                                    new Integer(
761:                                                            dmd
762:                                                                    .getMaxCursorNameLength()));
763:                                    info
764:                                            .put(
765:                                                    DefaultAdaptor.PROP_MAX_INDEX_LENGTH,
766:                                                    new Integer(
767:                                                            dmd
768:                                                                    .getMaxIndexLength()));
769:                                    info
770:                                            .put(
771:                                                    DefaultAdaptor.PROP_MAX_SCHEMA_NAME,
772:                                                    new Integer(
773:                                                            dmd
774:                                                                    .getMaxSchemaNameLength()));
775:                                    info
776:                                            .put(
777:                                                    DefaultAdaptor.PROP_MAX_PROCEDURE_NAME,
778:                                                    new Integer(
779:                                                            dmd
780:                                                                    .getMaxProcedureNameLength()));
781:                                    info
782:                                            .put(
783:                                                    DefaultAdaptor.PROP_MAX_CATALOG_NAME,
784:                                                    new Integer(
785:                                                            dmd
786:                                                                    .getMaxCatalogNameLength()));
787:                                    info.put(DefaultAdaptor.PROP_MAX_ROW_SIZE,
788:                                            new Integer(dmd.getMaxRowSize()));
789:                                    info
790:                                            .put(
791:                                                    DefaultAdaptor.PROP_MAX_STATEMENT_LENGTH,
792:                                                    new Integer(
793:                                                            dmd
794:                                                                    .getMaxStatementLength()));
795:                                    info
796:                                            .put(
797:                                                    DefaultAdaptor.PROP_MAX_STATEMENTS,
798:                                                    new Integer(dmd
799:                                                            .getMaxStatements()));
800:                                    info
801:                                            .put(
802:                                                    DefaultAdaptor.PROP_MAX_TABLENAME_LENGTH,
803:                                                    new Integer(
804:                                                            dmd
805:                                                                    .getMaxTableNameLength()));
806:                                    info
807:                                            .put(
808:                                                    DefaultAdaptor.PROP_MAX_TABLES_IN_SELECT,
809:                                                    new Integer(
810:                                                            dmd
811:                                                                    .getMaxTablesInSelect()));
812:                                    info.put(DefaultAdaptor.PROP_MAX_USERNAME,
813:                                            new Integer(dmd
814:                                                    .getMaxUserNameLength()));
815:                                    info
816:                                            .put(
817:                                                    DefaultAdaptor.PROP_DEFAULT_ISOLATION,
818:                                                    new Integer(
819:                                                            dmd
820:                                                                    .getDefaultTransactionIsolation()));
821:
822:                                    info.put(DefaultAdaptor.PROP_URL, dmd
823:                                            .getURL());
824:                                    info.put(DefaultAdaptor.PROP_USERNAME, dmd
825:                                            .getUserName());
826:                                    info.put(
827:                                            DefaultAdaptor.PROP_PRODUCTVERSION,
828:                                            dmd.getDatabaseProductVersion());
829:                                    info.put(DefaultAdaptor.PROP_DRIVERNAME,
830:                                            dmd.getDriverName());
831:                                    info.put(
832:                                            DefaultAdaptor.PROP_DRIVER_VERSION,
833:                                            dmd.getDriverVersion());
834:                                    info
835:                                            .put(
836:                                                    DefaultAdaptor.PROP_DRIVER_MAJOR_VERSION,
837:                                                    new Integer(
838:                                                            dmd
839:                                                                    .getDriverMajorVersion()));
840:                                    info
841:                                            .put(
842:                                                    DefaultAdaptor.PROP_DRIVER_MINOR_VERSION,
843:                                                    new Integer(
844:                                                            dmd
845:                                                                    .getDriverMinorVersion()));
846:                                    info
847:                                            .put(
848:                                                    DefaultAdaptor.PROP_IDENTIFIER_QUOTE,
849:                                                    dmd
850:                                                            .getIdentifierQuoteString());
851:                                    info.put(DefaultAdaptor.PROP_SQL_KEYWORDS,
852:                                            dmd.getSQLKeywords());
853:
854:                                    info
855:                                            .put(
856:                                                    DefaultAdaptor.PROP_NUMERIC_FUNCTIONS,
857:                                                    dmd.getNumericFunctions());
858:                                    info
859:                                            .put(
860:                                                    DefaultAdaptor.PROP_STRING_FUNCTIONS,
861:                                                    dmd.getStringFunctions());
862:                                    info
863:                                            .put(
864:                                                    DefaultAdaptor.PROP_SYSTEM_FUNCTIONS,
865:                                                    dmd.getSystemFunctions());
866:                                    info.put(
867:                                            DefaultAdaptor.PROP_TIME_FUNCTIONS,
868:                                            dmd.getTimeDateFunctions());
869:                                    info.put(DefaultAdaptor.PROP_STRING_ESCAPE,
870:                                            dmd.getSearchStringEscape());
871:                                    info
872:                                            .put(
873:                                                    DefaultAdaptor.PROP_EXTRA_CHARACTERS,
874:                                                    dmd
875:                                                            .getExtraNameCharacters());
876:                                    info.put(DefaultAdaptor.PROP_SCHEMA_TERM,
877:                                            dmd.getSchemaTerm());
878:                                    info.put(
879:                                            DefaultAdaptor.PROP_PROCEDURE_TERM,
880:                                            dmd.getProcedureTerm());
881:                                    info.put(DefaultAdaptor.PROP_CATALOG_TERM,
882:                                            dmd.getCatalogTerm());
883:                                    info
884:                                            .put(
885:                                                    DefaultAdaptor.PROP_CATALOGS_SEPARATOR,
886:                                                    dmd.getCatalogSeparator());
887:                                } catch (Exception ex) {
888:                                    //ex.printStackTrace();
889:                                }
890:
891:                                // Create subnodes
892:
893:                                DatabaseNodeInfo innernfo;
894:                                innernfo = DatabaseNodeInfo.createNodeInfo(
895:                                        info, DatabaseNode.TABLELIST);
896:                                children.createSubnode(innernfo, true);
897:                                innernfo = DatabaseNodeInfo.createNodeInfo(
898:                                        info, DatabaseNode.VIEWLIST);
899:                                children.createSubnode(innernfo, true);
900:                                innernfo = DatabaseNodeInfo.createNodeInfo(
901:                                        info, DatabaseNode.PROCEDURELIST);
902:                                children.createSubnode(innernfo, true);
903:                            }
904:                        } catch (Exception e) {
905:                            //e.printStackTrace();
906:                        }
907:
908:                    }
909:                }, 0);
910:            }
911:
912:            /**
913:             * Can be destroyed only if connection is closed.
914:             */
915:            public boolean canDestroy() {
916:                return !getInfo().isConnected();
917:            }
918:
919:            public String getShortDescription() {
920:                return NbBundle.getBundle(
921:                        "org.netbeans.modules.db.resources.Bundle").getString(
922:                        "ND_Connection"); //NOI18N
923:            }
924:
925:            public Transferable clipboardCopy() throws IOException {
926:                ExTransferable result = ExTransferable.create(super 
927:                        .clipboardCopy());
928:                ConnectionNodeInfo cni = (ConnectionNodeInfo) getInfo()
929:                        .getParent(DatabaseNode.CONNECTION);
930:                final DatabaseConnection dbconn = ConnectionList.getDefault()
931:                        .getConnection(cni.getDatabaseConnection());
932:                result.put(new ExTransferable.Single(
933:                        DatabaseMetaDataTransfer.CONNECTION_FLAVOR) {
934:                    protected Object getData() {
935:                        return DatabaseMetaDataTransferAccessor.DEFAULT
936:                                .createConnectionData(dbconn
937:                                        .getDatabaseConnection(), dbconn
938:                                        .findJDBCDriver());
939:                    }
940:                });
941:                return result;
942:            }
943:
944:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.