svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.framework / org.gvsig.andami / src / main / java / org / gvsig / andami / PluginsManager.java @ 44093
History | View | Annotate | Download (8.64 KB)
1 | 40559 | jjdelcerro | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | *
|
||
4 | * Copyright (C) 2007-2013 gvSIG Association.
|
||
5 | *
|
||
6 | * This program is free software; you can redistribute it and/or
|
||
7 | * modify it under the terms of the GNU General Public License
|
||
8 | * as published by the Free Software Foundation; either version 3
|
||
9 | * of the License, or (at your option) any later version.
|
||
10 | *
|
||
11 | * This program is distributed in the hope that it will be useful,
|
||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
13 | 41284 | jjdelcerro | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 | 40559 | jjdelcerro | * GNU General Public License for more details.
|
15 | *
|
||
16 | * You should have received a copy of the GNU General Public License
|
||
17 | * along with this program; if not, write to the Free Software
|
||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||
19 | 41284 | jjdelcerro | * MA 02110-1301, USA.
|
20 | 40559 | jjdelcerro | *
|
21 | * For any additional information, do not hesitate to contact us
|
||
22 | * at info AT gvsig.com, or visit our website www.gvsig.com.
|
||
23 | */
|
||
24 | 40435 | jjdelcerro | package org.gvsig.andami; |
25 | |||
26 | import java.io.File; |
||
27 | 42959 | dmartinezizquierdo | import java.net.URI; |
28 | 40435 | jjdelcerro | import java.util.Iterator; |
29 | import java.util.List; |
||
30 | 42622 | jjdelcerro | import static org.gvsig.andami.Launcher.appName; |
31 | 42200 | fdiaz | |
32 | 41387 | jjdelcerro | import org.gvsig.andami.firewall.FirewallConfiguration; |
33 | 42200 | fdiaz | import org.gvsig.andami.impl.UnsavedDataException; |
34 | 40435 | jjdelcerro | import org.gvsig.andami.plugins.ExclusiveUIExtension; |
35 | import org.gvsig.andami.plugins.IExtension; |
||
36 | 42200 | fdiaz | import org.gvsig.andami.plugins.status.IUnsavedData; |
37 | 40435 | jjdelcerro | import org.gvsig.installer.lib.api.PackageInfo; |
38 | 41736 | jjdelcerro | import org.gvsig.installer.lib.api.Version; |
39 | 40435 | jjdelcerro | |
40 | public interface PluginsManager { |
||
41 | 41284 | jjdelcerro | |
42 | 42622 | jjdelcerro | public String getApplicationName(); |
43 | 42959 | dmartinezizquierdo | |
44 | 40435 | jjdelcerro | /**
|
45 | 41284 | jjdelcerro | * Return the associated pluginServices to the extension class passed as
|
46 | * parameter.
|
||
47 | *
|
||
48 | 40435 | jjdelcerro | * @param extension
|
49 | 40893 | jjdelcerro | * @return plugin services
|
50 | 40435 | jjdelcerro | */
|
51 | 41280 | jjdelcerro | public PluginServices getPlugin(Class<? extends IExtension> extension); |
52 | 41284 | jjdelcerro | |
53 | 40893 | jjdelcerro | /**
|
54 | 41280 | jjdelcerro | * Return the associated pluginServices to the object passed as parameter.
|
55 | 41284 | jjdelcerro | *
|
56 | 41280 | jjdelcerro | * @param object
|
57 | * @return plugin services
|
||
58 | */
|
||
59 | public PluginServices getPlugin(Object obj); |
||
60 | |||
61 | /**
|
||
62 | 40893 | jjdelcerro | * Return the associated pluginServices to the extension plugin.
|
63 | 41284 | jjdelcerro | *
|
64 | 40893 | jjdelcerro | * @param pluginName, name of the plugin
|
65 | * @return plugin services
|
||
66 | 41284 | jjdelcerro | */
|
67 | 41280 | jjdelcerro | public PluginServices getPlugin(String pluginName); |
68 | 40893 | jjdelcerro | |
69 | 43666 | jjdelcerro | public File getPluginHomeFolder(String pluginName); |
70 | |||
71 | 40893 | jjdelcerro | /**
|
72 | 41284 | jjdelcerro | * Get the package info associated to the plugin of the extension.
|
73 | *
|
||
74 | * @param extension extension of the plugin
|
||
75 | * @return plugin package info
|
||
76 | */
|
||
77 | public PackageInfo getPackageInfo(Class<? extends IExtension> extension); |
||
78 | |||
79 | /**
|
||
80 | * Get the package info associated to the plugin with the specified name.
|
||
81 | *
|
||
82 | * @param pluginName, name of the plugin
|
||
83 | * @return plugin package info
|
||
84 | */
|
||
85 | public PackageInfo getPackageInfo(String pluginName); |
||
86 | |||
87 | /**
|
||
88 | * Get the package info associated to the application.
|
||
89 | *
|
||
90 | * @return application package info
|
||
91 | */
|
||
92 | public PackageInfo getPackageInfo();
|
||
93 | |||
94 | /**
|
||
95 | * Return the list of plugins loaded in the application
|
||
96 | *
|
||
97 | * @return list of plugins
|
||
98 | */
|
||
99 | public List<PluginServices> getPlugins(); |
||
100 | |||
101 | /**
|
||
102 | 40893 | jjdelcerro | * Gets the instance of the extension whose class is provided.
|
103 | 41284 | jjdelcerro | *
|
104 | 40893 | jjdelcerro | * @param extension, class of the extension to retrieve
|
105 | 41284 | jjdelcerro | *
|
106 | 40893 | jjdelcerro | * @return The instance of the extension, or null if the instance does
|
107 | 41284 | jjdelcerro | * not exist.
|
108 | 40893 | jjdelcerro | */
|
109 | 41284 | jjdelcerro | public IExtension getExtension(Class<? extends IExtension> extension); |
110 | 40435 | jjdelcerro | |
111 | 41284 | jjdelcerro | /**
|
112 | 43110 | jjdelcerro | * Gets the instance of the extension whose class name is provided.
|
113 | *
|
||
114 | * @param extension, class name of the extension to retrieve
|
||
115 | *
|
||
116 | * @return The instance of the extension, or null if the instance does
|
||
117 | * not exist.
|
||
118 | */
|
||
119 | public IExtension getExtension(String extension); |
||
120 | |||
121 | /**
|
||
122 | 41284 | jjdelcerro | * Return an iterator over al extensions loaded in the application.
|
123 | *
|
||
124 | * @return iterator over extensions
|
||
125 | */
|
||
126 | public Iterator<IExtension> getExtensions(); |
||
127 | |||
128 | /**
|
||
129 | * Set an extension to control the visivility of all the extensions
|
||
130 | * of the application.
|
||
131 | *
|
||
132 | * @param extension
|
||
133 | */
|
||
134 | public void setExclusiveUIExtension(ExclusiveUIExtension extension); |
||
135 | |||
136 | /**
|
||
137 | * Return the ExclusiveUIExtension installed in the application or
|
||
138 | * null.
|
||
139 | *
|
||
140 | * @return
|
||
141 | */
|
||
142 | public ExclusiveUIExtension getExclusiveUIExtension();
|
||
143 | |||
144 | /**
|
||
145 | * @deprecated use {@link #translate(String)}
|
||
146 | * @see {@link #translate(String)}
|
||
147 | */
|
||
148 | 40893 | jjdelcerro | public String getText(Object obj, String msg); |
149 | |||
150 | 40435 | jjdelcerro | /**
|
151 | 40893 | jjdelcerro | * Translate the message key to the current language used
|
152 | * in the application.
|
||
153 | 41284 | jjdelcerro | *
|
154 | 40893 | jjdelcerro | * @param msg key to translate
|
155 | 41284 | jjdelcerro | * @return message traslated or the key
|
156 | 40435 | jjdelcerro | */
|
157 | 40893 | jjdelcerro | public String translate(String msg); |
158 | 41284 | jjdelcerro | |
159 | 40435 | jjdelcerro | /**
|
160 | * Returns the main application folder, where the application is installed.
|
||
161 | 41284 | jjdelcerro | *
|
162 | 40435 | jjdelcerro | * @return the main application folder
|
163 | */
|
||
164 | public File getApplicationFolder(); |
||
165 | |||
166 | /**
|
||
167 | 40893 | jjdelcerro | * Returns the default folder with the installable package bundles.
|
168 | 41284 | jjdelcerro | *
|
169 | 40893 | jjdelcerro | * @return the default folder with the installable package bundles
|
170 | */
|
||
171 | public File getInstallFolder(); |
||
172 | |||
173 | /**
|
||
174 | 40435 | jjdelcerro | * Returns the application folder in the home of user.
|
175 | 41284 | jjdelcerro | *
|
176 | 40435 | jjdelcerro | * @return the main application folder
|
177 | */
|
||
178 | public File getApplicationHomeFolder(); |
||
179 | |||
180 | 41284 | jjdelcerro | |
181 | 40435 | jjdelcerro | /**
|
182 | 41284 | jjdelcerro | * Returns the default folder where the internationalization files are installed.
|
183 | *
|
||
184 | * @return the default folder where the internationalization files are installed.
|
||
185 | */
|
||
186 | public File getApplicationI18nFolder(); |
||
187 | 42200 | fdiaz | |
188 | 41284 | jjdelcerro | /**
|
189 | 40435 | jjdelcerro | * Returns the plugins folder.
|
190 | 41284 | jjdelcerro | *
|
191 | 40435 | jjdelcerro | * @return the plugins folder
|
192 | 41071 | jjdelcerro | * @deprecated use {@link #getPluginsFolders()}
|
193 | 40435 | jjdelcerro | */
|
194 | public File getPluginsFolder(); |
||
195 | 41284 | jjdelcerro | |
196 | 41071 | jjdelcerro | /**
|
197 | * Returns a list of folder on the plugins are instaleds.
|
||
198 | 41284 | jjdelcerro | *
|
199 | 41071 | jjdelcerro | * @return list of folders File of the plugins.
|
200 | */
|
||
201 | public List<File> getPluginsFolders(); |
||
202 | 40435 | jjdelcerro | |
203 | /**
|
||
204 | 41071 | jjdelcerro | * @deprecated @see {@link #getPluginsFolders()}
|
205 | 40435 | jjdelcerro | */
|
206 | 41284 | jjdelcerro | public File getPluginsDirectory(); |
207 | 40893 | jjdelcerro | |
208 | 41284 | jjdelcerro | /**
|
209 | 41311 | jjdelcerro | * This method allows plugins register task to do before initializacion of
|
210 | * all gvSIG plugins.
|
||
211 | 41284 | jjdelcerro | *
|
212 | 41312 | jjdelcerro | * Task with higher priority value are executed after.
|
213 | 42200 | fdiaz | *
|
214 | 41312 | jjdelcerro | * @param name of the task
|
215 | * @param task runnable with the code of the task
|
||
216 | * @param in_event_thread, true if the task shoul run in the AWT event thread.
|
||
217 | * @param priority of the task.
|
||
218 | 41284 | jjdelcerro | */
|
219 | 41312 | jjdelcerro | public void addStartupTask(String name, Runnable task, boolean in_event_thread, int priority); |
220 | 41284 | jjdelcerro | |
221 | 41312 | jjdelcerro | /**
|
222 | * This method allows plugins register task to do after close the application.
|
||
223 | *
|
||
224 | * Task with higher priority value are executed after.
|
||
225 | 42200 | fdiaz | *
|
226 | 41312 | jjdelcerro | * @param name of the task
|
227 | * @param task runnable with the code of the task
|
||
228 | * @param in_event_thread, true if the task shoul run in the AWT event thread.
|
||
229 | * @param priority of the task.
|
||
230 | */
|
||
231 | public void addShutdownTask(String name, Runnable task, boolean in_event_thread, int priority); |
||
232 | 41311 | jjdelcerro | |
233 | 41284 | jjdelcerro | /**
|
234 | 41312 | jjdelcerro | * This method executes registered task to run before the initialization of
|
235 | 41311 | jjdelcerro | * all plugins.
|
236 | * The tasks are sorted according to the priority and executed in a separated
|
||
237 | * thread.
|
||
238 | 41284 | jjdelcerro | *
|
239 | */
|
||
240 | 41312 | jjdelcerro | public void executeStartupTasks(); |
241 | 41284 | jjdelcerro | |
242 | 41312 | jjdelcerro | /**
|
243 | * This method executes registered task to run after the close of the application.
|
||
244 | * The tasks are sorted according to the priority and executed in a separated
|
||
245 | * thread.
|
||
246 | *
|
||
247 | */
|
||
248 | public void executeShutdownTasks(); |
||
249 | 41311 | jjdelcerro | |
250 | 42200 | fdiaz | |
251 | 41387 | jjdelcerro | public FirewallConfiguration getFirewallConfiguration();
|
252 | 41736 | jjdelcerro | |
253 | public Version getApplicationVersion();
|
||
254 | 42200 | fdiaz | |
255 | /**
|
||
256 | * Return a list of unsaved data
|
||
257 | *
|
||
258 | * @return
|
||
259 | */
|
||
260 | public List<IUnsavedData> getUnsavedData(); |
||
261 | |||
262 | /**
|
||
263 | * Save the provided unsaved data as parameter
|
||
264 | *
|
||
265 | * @param unsavedData
|
||
266 | * @throws UnsavedDataException
|
||
267 | */
|
||
268 | public void saveUnsavedData(List<IUnsavedData> unsavedData) throws UnsavedDataException; |
||
269 | |||
270 | 42791 | jjdelcerro | /**
|
271 | * Gets the temporary folder of the plugins framework.
|
||
272 | 42959 | dmartinezizquierdo | *
|
273 | * @return the temp folder
|
||
274 | 42791 | jjdelcerro | */
|
275 | public File getTempFolder(); |
||
276 | 42959 | dmartinezizquierdo | |
277 | 42791 | jjdelcerro | /**
|
278 | * Get the file name in the temporary folder of the plugins framework.
|
||
279 | * @param name
|
||
280 | 42959 | dmartinezizquierdo | * @return
|
281 | 42791 | jjdelcerro | */
|
282 | public File getTempFile(String name); |
||
283 | 42959 | dmartinezizquierdo | |
284 | 42791 | jjdelcerro | /**
|
285 | * Create a unique file name in the temporary folder of the plugins framework.
|
||
286 | 42959 | dmartinezizquierdo | *
|
287 | * @param name base name used for create the unique file name
|
||
288 | 42791 | jjdelcerro | * @param sufix to add the the unique file name
|
289 | 42959 | dmartinezizquierdo | * @return
|
290 | 42791 | jjdelcerro | */
|
291 | public File getTempFile(String name, String sufix); |
||
292 | 42959 | dmartinezizquierdo | |
293 | /**
|
||
294 | * Browses to a given URI
|
||
295 | * @param uri
|
||
296 | * @return
|
||
297 | */
|
||
298 | public boolean desktopBrowse(URI uri); |
||
299 | |||
300 | /**
|
||
301 | * Open a given file
|
||
302 | * @param file
|
||
303 | * @return
|
||
304 | */
|
||
305 | public boolean desktopOpen(File file); |
||
306 | |||
307 | |||
308 | 43328 | jjdelcerro | public Arguments getArguments();
|
309 | 40435 | jjdelcerro | } |