Source Code Cross Referenced for CachePlugin.java in  » Database-Client » squirrel-sql-2.6.5a » de » ixdb » squirrel_sql » plugins » cache » 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 » de.ixdb.squirrel_sql.plugins.cache 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package de.ixdb.squirrel_sql.plugins.cache;
002:
003:        import net.sourceforge.squirrel_sql.client.IApplication;
004:        import net.sourceforge.squirrel_sql.client.gui.session.SQLInternalFrame;
005:        import net.sourceforge.squirrel_sql.client.gui.session.ObjectTreeInternalFrame;
006:        import net.sourceforge.squirrel_sql.client.action.ActionCollection;
007:        import net.sourceforge.squirrel_sql.client.plugin.*;
008:        import net.sourceforge.squirrel_sql.client.preferences.IGlobalPreferencesPanel;
009:        import net.sourceforge.squirrel_sql.client.session.IObjectTreeAPI;
010:        import net.sourceforge.squirrel_sql.client.session.ISQLPanelAPI;
011:        import net.sourceforge.squirrel_sql.client.session.ISession;
012:        import net.sourceforge.squirrel_sql.fw.sql.DatabaseObjectType;
013:        import net.sourceforge.squirrel_sql.fw.util.log.ILogger;
014:        import net.sourceforge.squirrel_sql.fw.util.log.LoggerController;
015:
016:        import java.io.File;
017:        import java.io.IOException;
018:
019:        /**
020:         * The SQL Script plugin class.
021:         */
022:        public class CachePlugin extends DefaultSessionPlugin {
023:
024:            /** Logger for this class. */
025:            private static ILogger s_log = LoggerController
026:                    .createLogger(CachePlugin.class);
027:
028:            /** The app folder for this plugin. */
029:            private File _pluginAppFolder;
030:
031:            private PluginResources _resources;
032:
033:            /** Folder to store user settings in. */
034:            private File _userSettingsFolder;
035:
036:            /**
037:             * Return the internal name of this plugin.
038:             *
039:             * @return  the internal name of this plugin.
040:             */
041:            public String getInternalName() {
042:                return "cache";
043:            }
044:
045:            /**
046:             * Return the descriptive name of this plugin.
047:             *
048:             * @return  the descriptive name of this plugin.
049:             */
050:            public String getDescriptiveName() {
051:                return "Plugin for the Intersystems Cache DB";
052:            }
053:
054:            /**
055:             * Returns the current version of this plugin.
056:             *
057:             * @return  the current version of this plugin.
058:             */
059:            public String getVersion() {
060:                return "0.01";
061:            }
062:
063:            /**
064:             * Returns the authors name.
065:             *
066:             * @return  the authors name.
067:             */
068:            public String getAuthor() {
069:                return "Gerd Wagner";
070:            }
071:
072:            /**
073:             * Returns the name of the change log for the plugin. This should
074:             * be a text or HTML file residing in the <TT>getPluginAppSettingsFolder</TT>
075:             * directory.
076:             *
077:             * @return	the changelog file name or <TT>null</TT> if plugin doesn't have
078:             * 			a change log.
079:             */
080:            public String getChangeLogFileName() {
081:                return "changes.txt";
082:            }
083:
084:            /**
085:             * Returns the name of the Help file for the plugin. This should
086:             * be a text or HTML file residing in the <TT>getPluginAppSettingsFolder</TT>
087:             * directory.
088:             *
089:             * @return	the Help file name or <TT>null</TT> if plugin doesn't have
090:             * 			a help file.
091:             */
092:            public String getHelpFileName() {
093:                return "readme.txt";
094:            }
095:
096:            /**
097:             * Returns the name of the Licence file for the plugin. This should
098:             * be a text or HTML file residing in the <TT>getPluginAppSettingsFolder</TT>
099:             * directory.
100:             *
101:             * @return	the Licence file name or <TT>null</TT> if plugin doesn't have
102:             * 			a licence file.
103:             */
104:            public String getLicenceFileName() {
105:                return "licence.txt";
106:            }
107:
108:            /**
109:             * @return	Comma separated list of contributors.
110:             */
111:            public String getContributors() {
112:                return "Andreas Schneider";
113:            }
114:
115:            /**
116:             * Create preferences panel for the Global Preferences dialog.
117:             *
118:             * @return  Preferences panel.
119:             */
120:            public IGlobalPreferencesPanel[] getGlobalPreferencePanels() {
121:                return new IGlobalPreferencesPanel[0];
122:            }
123:
124:            /**
125:             * Initialize this plugin.
126:             */
127:            public synchronized void initialize() throws PluginException {
128:                super .initialize();
129:                IApplication app = getApplication();
130:
131:                PluginManager pmgr = app.getPluginManager();
132:
133:                // Folder within plugins folder that belongs to this
134:                // plugin.
135:                try {
136:                    _pluginAppFolder = getPluginAppSettingsFolder();
137:                } catch (IOException ex) {
138:                    throw new PluginException(ex);
139:                }
140:
141:                // Folder to store user settings.
142:                try {
143:                    _userSettingsFolder = getPluginUserSettingsFolder();
144:                } catch (IOException ex) {
145:                    throw new PluginException(ex);
146:                }
147:
148:                _resources = new CachePluginResources(
149:                        "de.ixdb.squirrel_sql.plugins.cache.cache", this );
150:
151:                // Load plugin preferences.
152:                ActionCollection coll = app.getActionCollection();
153:                coll.add(new ScriptViewAction(app, _resources, this ));
154:                coll.add(new ScriptFunctionAction(app, _resources, this ));
155:                coll.add(new ScriptCdlAction(app, _resources, this ));
156:                coll.add(new ShowNamespacesAction(app, _resources, this ));
157:                coll.add(new ShowQueryPlanAction(app, _resources, this ));
158:                coll.add(new ShowProcessesAction(app, _resources, this ));
159:
160:                //		coll.add(new ScriptProcedureAction(app, _resources, this, _userSettingsFolder));
161:                //		coll.add(new RefreshRepositoryAction(app, _resources, this, _userSettingsFolder));
162:            }
163:
164:            /**
165:             * Application is shutting down so save data.
166:             */
167:            public void unload() {
168:                super .unload();
169:            }
170:
171:            /**
172:             * Called when a session started. Add commands to popup menu
173:             * in object tree.
174:             *
175:             * @param   session	 The session that is starting.
176:             *
177:             * @return  <TT>true</TT> to indicate that this plugin is
178:             *		  applicable to passed session.
179:             */
180:            public PluginSessionCallback sessionStarted(ISession session) {
181:                try {
182:                    if (-1 != session.getSQLConnection().getConnection()
183:                            .getMetaData().getDriverName().toUpperCase()
184:                            .indexOf("CACHE")) {
185:                        ActionCollection coll = getApplication()
186:                                .getActionCollection();
187:                        IObjectTreeAPI otApi = session
188:                                .getSessionInternalFrame().getObjectTreeAPI();
189:                        otApi.addToPopup(DatabaseObjectType.VIEW, coll
190:                                .get(ScriptViewAction.class));
191:                        otApi.addToPopup(DatabaseObjectType.SESSION, coll
192:                                .get(ShowNamespacesAction.class));
193:                        otApi.addToPopup(DatabaseObjectType.SESSION, coll
194:                                .get(ShowProcessesAction.class));
195:                        otApi.addToPopup(DatabaseObjectType.PROCEDURE, coll
196:                                .get(ScriptFunctionAction.class));
197:                        otApi.addToPopup(DatabaseObjectType.PROCEDURE, coll
198:                                .get(ScriptCdlAction.class));
199:                        otApi.addToPopup(DatabaseObjectType.TABLE, coll
200:                                .get(ScriptCdlAction.class));
201:                        otApi.addToPopup(DatabaseObjectType.VIEW, coll
202:                                .get(ScriptCdlAction.class));
203:
204:                        ISQLPanelAPI sqlApi = session.getSessionInternalFrame()
205:                                .getSQLPanelAPI();
206:                        sqlApi.addToSQLEntryAreaMenu(coll
207:                                .get(ShowQueryPlanAction.class));
208:
209:                        session.addSeparatorToToolbar();
210:                        session.addToToolbar(coll
211:                                .get(ShowNamespacesAction.class));
212:                        session.addToToolbar(coll
213:                                .get(ShowProcessesAction.class));
214:                        session.addToToolbar(coll
215:                                .get(ShowQueryPlanAction.class));
216:                        session.getSessionInternalFrame().addToToolsPopUp(
217:                                "cachequeryplan",
218:                                coll.get(ShowQueryPlanAction.class));
219:
220:                        return new PluginSessionCallback() {
221:                            public void sqlInternalFrameOpened(
222:                                    SQLInternalFrame sqlInternalFrame,
223:                                    ISession sess) {
224:                                //plugin supports only Session main window
225:                            }
226:
227:                            public void objectTreeInternalFrameOpened(
228:                                    ObjectTreeInternalFrame objectTreeInternalFrame,
229:                                    ISession sess) {
230:                                //plugin supports only Session main window
231:                            }
232:                        };
233:                    } else {
234:                        return null;
235:                    }
236:                } catch (Exception e) {
237:                    s_log.error("Could not get driver name", e);
238:                    return null;
239:                }
240:            }
241:
242:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.