Source Code Cross Referenced for SelectDatabasePanel.java in  » IDE-Netbeans » etl.project » org » netbeans » modules » mashup » db » ui » wizard » 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 » etl.project » org.netbeans.modules.mashup.db.ui.wizard 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.netbeans.modules.mashup.db.ui.wizard;
002:
003:        import java.awt.Component;
004:        import java.sql.Connection;
005:        import java.sql.SQLException;
006:        import java.util.HashMap;
007:
008:        import net.java.hulp.i18n.Logger;
009:        import org.netbeans.modules.etl.logger.Localizer;
010:        import org.netbeans.modules.etl.logger.LogUtil;
011:        import org.netbeans.modules.mashup.db.model.FlatfileDBConnectionDefinition;
012:        import org.netbeans.modules.mashup.db.model.FlatfileDBTable;
013:        import org.netbeans.modules.mashup.db.model.FlatfileDatabaseModel;
014:        import org.netbeans.modules.mashup.db.model.FlatfileDefinition;
015:        import org.netbeans.modules.mashup.db.model.impl.FlatfileDBConnectionDefinitionImpl;
016:        import org.netbeans.modules.mashup.db.model.impl.FlatfileDatabaseModelImpl;
017:        import org.netbeans.modules.mashup.tables.wizard.MashupTableWizardIterator;
018:        import org.openide.ErrorManager;
019:        import org.openide.WizardDescriptor;
020:        import org.openide.util.HelpCtx;
021:
022:        public class SelectDatabasePanel extends AbstractWizardPanel {
023:            private static transient final Logger mLogger = LogUtil
024:                    .getLogger(SelectDatabasePanel.class.getName());
025:            private static transient final Localizer mLoc = Localizer.get();
026:            /**
027:             * The visual component that displays this panel. If you need to access the
028:             * component from this class, just use getComponent().
029:             */
030:            private SelectDatabaseVisualPanel component;
031:
032:            // Get the visual component for the panel. In this template, the component
033:            // is kept separate. This can be more efficient: if the wizard is created
034:            // but never displayed, or not all panels are displayed, it is better to
035:            // create only those which really need to be visible.
036:            public Component getComponent() {
037:                if (component == null) {
038:                    component = new SelectDatabaseVisualPanel(this );
039:                }
040:                return component;
041:            }
042:
043:            public HelpCtx getHelp() {
044:                return HelpCtx.DEFAULT_HELP;
045:            }
046:
047:            public boolean isValid() {
048:                return someCondition();
049:            }
050:
051:            // You can use a settings object to keep track of state. Normally the
052:            // settings object will be the WizardDescriptor, so you can use
053:            // WizardDescriptor.getProperty & putProperty to store information entered
054:            // by the user.
055:            public void readSettings(Object settings) {
056:                if (settings instanceof  WizardDescriptor) {
057:                    WizardDescriptor wd = (WizardDescriptor) settings;
058:                    Connection conn = (Connection) wd
059:                            .getProperty(MashupTableWizardIterator.CONNECTION);
060:                    if (conn != null) {
061:                        try {
062:                            conn.createStatement().execute("shutdown");
063:                            conn.close();
064:                        } catch (SQLException ex) {
065:                            //ignore
066:                        }
067:                    }
068:                    wd.putProperty(MashupTableWizardIterator.CONNECTION, null);
069:                }
070:            }
071:
072:            public void storeSettings(Object settings) {
073:                if (settings instanceof  WizardDescriptor) {
074:                    WizardDescriptor wd = (WizardDescriptor) settings;
075:                    SelectDatabaseVisualPanel panel = (SelectDatabaseVisualPanel) getComponent();
076:                    String database = panel.getSelectedDatabase();
077:                    if (database != null) {
078:                        database = database.trim();
079:                        int end = database.indexOf(":", "jdbc.axiondb:"
080:                                .length());
081:                        if (end == -1) {
082:                            end = database.trim().length();
083:                        }
084:                        String dbName = database.substring("jdbc:axiondb:"
085:                                .length(), end);
086:                        wd.putProperty("url", database);
087:
088:                        FlatfileDatabaseModel model = (FlatfileDatabaseModel) wd
089:                                .getProperty(MashupTableWizardIterator.PROP_FLATFILEDBMODEL);
090:                        if (model == null) {
091:                            FlatfileDBConnectionDefinition def = new FlatfileDBConnectionDefinitionImpl(
092:                                    dbName);
093:                            def.setConnectionURL(database);
094:                            model = new FlatfileDatabaseModelImpl(database, def);
095:                            model.setConnectionName(dbName);
096:                            model.setDescription(dbName);
097:                            FlatfileDefinition ffDefn;
098:                            try {
099:                                ffDefn = new FlatfileDefinition(dbName);
100:                                ffDefn.setInstanceName(dbName);
101:                                ffDefn.setFlatfileDatabaseModel(model);
102:                            } catch (Exception ex) {
103:                                ErrorManager.getDefault().log(
104:                                        ErrorManager.ERROR, ex.getMessage());
105:                                ErrorManager.getDefault().notify(
106:                                        ErrorManager.ERROR, ex);
107:
108:                            }
109:                            wd
110:                                    .putProperty(
111:                                            MashupTableWizardIterator.PROP_FLATFILEDBMODEL,
112:                                            model);
113:                            wd.putProperty(MashupTableWizardIterator.TABLE_MAP,
114:                                    new HashMap<String, FlatfileDBTable>());
115:                        }
116:                    } else {
117:                        ErrorManager.getDefault().log(
118:                                "Create the database before adding tables.");
119:                    }
120:                }
121:            }
122:
123:            private boolean someCondition() {
124:                SelectDatabaseVisualPanel panel = (SelectDatabaseVisualPanel) getComponent();
125:                String dbUrl = panel.getSelectedDatabase();
126:                if (dbUrl == null) {
127:                    return false;
128:                } else if (panel.isPopulated()) {
129:                    return true;
130:                }
131:                return true;
132:            }
133:
134:            public String getStepLabel() {
135:                String nbBundle1 = mLoc.t("PRSR001: Select Database");
136:                return Localizer.parse(nbBundle1);
137:            }
138:
139:            public String getTitle() {
140:                return "Select Database";
141:            }
142:        }
ww_w__.__j___a__va2__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.