Source Code Cross Referenced for DefaultPlugin.java in  » Database-Client » squirrel-sql-2.6.5a » net » sourceforge » squirrel_sql » client » plugin » 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 » net.sourceforge.squirrel_sql.client.plugin 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package net.sourceforge.squirrel_sql.client.plugin;
002:
003:        /*
004:         * Copyright (C) 2001-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.io.File;
022:        import java.io.IOException;
023:
024:        import net.sourceforge.squirrel_sql.client.IApplication;
025:        import net.sourceforge.squirrel_sql.client.Version;
026:        import net.sourceforge.squirrel_sql.client.gui.db.aliasproperties.IAliasPropertiesPanelController;
027:        import net.sourceforge.squirrel_sql.client.gui.db.SQLAlias;
028:        import net.sourceforge.squirrel_sql.client.preferences.IGlobalPreferencesPanel;
029:        import net.sourceforge.squirrel_sql.client.preferences.INewSessionPropertiesPanel;
030:        import net.sourceforge.squirrel_sql.client.util.ApplicationFiles;
031:        import net.sourceforge.squirrel_sql.fw.util.StringManager;
032:        import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
033:
034:        public abstract class DefaultPlugin implements  IPlugin {
035:            /** Internationalized strings for this class. */
036:            private static final StringManager s_stringMgr = StringManagerFactory
037:                    .getStringManager(DefaultPlugin.class);
038:
039:            /** Current application API. */
040:            protected IApplication _app;
041:
042:            /**
043:             * Called on application startup before application started up.
044:             *
045:             * @param	app	 Application API.
046:             *
047:             * @throws	PluginException
048:             *			Thrown if an error occurs.
049:             */
050:            public void load(IApplication app) throws PluginException {
051:                if (app == null) {
052:                    throw new IllegalArgumentException(
053:                            "Null IApplication passed");
054:                }
055:                _app = app;
056:            }
057:
058:            /**
059:             * Called on application startup after application started.
060:             *
061:             * @throws	PluginException
062:             *			Thrown if an error occurs.
063:             */
064:            public void initialize() throws PluginException {
065:                // Empty method.
066:            }
067:
068:            /**
069:             * Called when app shutdown.
070:             *
071:             * @throws	PluginException
072:             *			Thrown if an error occurs.
073:             */
074:            public void unload() // throws PluginException
075:            {
076:                // TODO: Put throws clause back in
077:                // Empty method.
078:            }
079:
080:            /**
081:             * Returns a comma separated list of other contributors.
082:             *
083:             * @return	Contributors names.
084:             */
085:            public String getContributors() {
086:                return "";
087:            }
088:
089:            /**
090:             * Returns the home page for this plugin.
091:             *
092:             * @return	the home page for this plugin.
093:             */
094:            public String getWebSite() {
095:                return Version.getWebSite();
096:            }
097:
098:            /**
099:             * Returns the name of the Help file for the plugin. This should
100:             * be a text or HTML file residing in the <TT>getPluginAppSettingsFolder</TT>
101:             * directory.
102:             *
103:             * @return	the Help file name or <TT>null</TT> if plugin doesn't have
104:             * 			a help file.
105:             */
106:            public String getHelpFileName() {
107:                return null;
108:            }
109:
110:            /**
111:             * Returns the name of the change log for the plugin. This should
112:             * be a text or HTML file residing in the <TT>getPluginAppSettingsFolder</TT>
113:             * directory.
114:             *
115:             * @return	the changelog file name or <TT>null</TT> if plugin doesn't have
116:             * 			a change log.
117:             */
118:            public String getChangeLogFileName() {
119:                return null;
120:            }
121:
122:            /**
123:             * Returns the name of the licence file for the plugin. This should
124:             * be a text or HTML file residing in the <TT>getPluginAppSettingsFolder</TT>
125:             * directory.
126:             *
127:             * @return	the licence file name or <TT>null</TT> if plugin doesn't have
128:             * 			a change log.
129:             */
130:            public String getLicenceFileName() {
131:                return null;
132:            }
133:
134:            /**
135:             * Return the current application API.
136:             *
137:             * @return	The current application API.
138:             */
139:            public final IApplication getApplication() {
140:                return _app;
141:            }
142:
143:            /**
144:             * Return the folder with the Squirrel application folder
145:             * that belongs to this plugin. If it doesn't exist then
146:             * create it. This would normally be
147:             * <PRE>
148:             * &lt;squirrel_app&gt;/plugins/&lt;plugin_internal_name&gt;
149:             * </PRE>
150:             *
151:             * @return	Plugins application folder.
152:             *
153:             * @throws	IllegalStateException
154:             *			if plugin doesn't have an internal name.
155:             *
156:             * @throws	IOException
157:             * 			An error occured retrieving/creating the folder.
158:             */
159:            public synchronized File getPluginAppSettingsFolder()
160:                    throws IllegalStateException, IOException {
161:                final String internalName = getInternalName();
162:                if (internalName == null || internalName.trim().length() == 0) {
163:                    throw new IllegalStateException(
164:                            "IPlugin doesn't have a valid internal name");
165:                }
166:                final File pluginDir = new ApplicationFiles()
167:                        .getPluginsDirectory();
168:                final File file = new File(pluginDir, internalName);
169:                if (!file.exists()) {
170:                    file.mkdirs();
171:                }
172:
173:                if (!file.isDirectory()) {
174:                    throw new IOException(s_stringMgr.getString(
175:                            "DefaultPlugin.error.cannotcreate", file
176:                                    .getAbsolutePath()));
177:                }
178:
179:                return file;
180:            }
181:
182:            /**
183:             * Return the folder with the users home directory
184:             * that belongs to this plugin. If it doesn't exist then
185:             * create it. This would normally be
186:             * <PRE>
187:             * &lt;user_home&gt;/.squirrel-sql/plugins/&lt;plugin_internal_name&gt;
188:             * </PRE>
189:             *
190:             * @return	Plugins user folder.
191:             *
192:             * @throws	IllegalStateException
193:             *			if plugin doesn't have an internal name.
194:             *
195:             * @throws	IOException
196:             * 			An error occured retrieving/creating the folder.
197:             */
198:            public synchronized File getPluginUserSettingsFolder()
199:                    throws IllegalStateException, IOException {
200:                final String internalName = getInternalName();
201:                if (internalName == null || internalName.trim().length() == 0) {
202:                    throw new IllegalStateException(
203:                            "IPlugin doesn't have a valid internal name");
204:                }
205:                String name = new ApplicationFiles()
206:                        .getPluginsUserSettingsDirectory()
207:                        + File.separator + internalName + File.separator;
208:                File file = new File(name);
209:                if (!file.exists()) {
210:                    file.mkdirs();
211:                }
212:
213:                if (!file.isDirectory()) {
214:                    throw new IOException(s_stringMgr.getString(
215:                            "DefaultPlugin.error.cannotcreate", name));
216:                }
217:
218:                return file;
219:            }
220:
221:            /**
222:             * Create panels for the Global Preferences dialog.
223:             *
224:             * @return	<TT>null</TT> to indicate that this plugin doesn't require
225:             *			any panels in the Global Preferences Dialog.
226:             */
227:            public IGlobalPreferencesPanel[] getGlobalPreferencePanels() {
228:                return null;
229:            }
230:
231:            public IAliasPropertiesPanelController[] getAliasPropertiesPanelControllers(
232:                    SQLAlias alias) {
233:                return null;
234:            }
235:
236:            public void aliasCopied(SQLAlias source, SQLAlias target) {
237:            }
238:
239:            public void aliasRemoved(SQLAlias alias) {
240:            }
241:
242:            /**
243:             * Create panels for the New Session Properties dialog.
244:             *
245:             * @return	<TT>null</TT>to indicate that this plugin doesn't require
246:             *			any panels in the New Session Properties Dialog.
247:             */
248:            public INewSessionPropertiesPanel[] getNewSessionPropertiesPanels() {
249:                return null;
250:            }
251:
252:            /**
253:             * By default a plugin provieds no external services
254:             * @return
255:             */
256:            public Object getExternalService() {
257:                return null;
258:            }
259:
260:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.