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 |
/**
|
---|---|
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 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* 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 |
* MA 02110-1301, USA.
|
20 |
*
|
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 |
package org.gvsig.andami; |
25 |
|
26 |
import java.io.File; |
27 |
import java.net.URI; |
28 |
import java.util.Iterator; |
29 |
import java.util.List; |
30 |
import static org.gvsig.andami.Launcher.appName; |
31 |
|
32 |
import org.gvsig.andami.firewall.FirewallConfiguration; |
33 |
import org.gvsig.andami.impl.UnsavedDataException; |
34 |
import org.gvsig.andami.plugins.ExclusiveUIExtension; |
35 |
import org.gvsig.andami.plugins.IExtension; |
36 |
import org.gvsig.andami.plugins.status.IUnsavedData; |
37 |
import org.gvsig.installer.lib.api.PackageInfo; |
38 |
import org.gvsig.installer.lib.api.Version; |
39 |
|
40 |
public interface PluginsManager { |
41 |
|
42 |
public String getApplicationName(); |
43 |
|
44 |
/**
|
45 |
* Return the associated pluginServices to the extension class passed as
|
46 |
* parameter.
|
47 |
*
|
48 |
* @param extension
|
49 |
* @return plugin services
|
50 |
*/
|
51 |
public PluginServices getPlugin(Class<? extends IExtension> extension); |
52 |
|
53 |
/**
|
54 |
* Return the associated pluginServices to the object passed as parameter.
|
55 |
*
|
56 |
* @param object
|
57 |
* @return plugin services
|
58 |
*/
|
59 |
public PluginServices getPlugin(Object obj); |
60 |
|
61 |
/**
|
62 |
* Return the associated pluginServices to the extension plugin.
|
63 |
*
|
64 |
* @param pluginName, name of the plugin
|
65 |
* @return plugin services
|
66 |
*/
|
67 |
public PluginServices getPlugin(String pluginName); |
68 |
|
69 |
public File getPluginHomeFolder(String pluginName); |
70 |
|
71 |
/**
|
72 |
* 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 |
* Gets the instance of the extension whose class is provided.
|
103 |
*
|
104 |
* @param extension, class of the extension to retrieve
|
105 |
*
|
106 |
* @return The instance of the extension, or null if the instance does
|
107 |
* not exist.
|
108 |
*/
|
109 |
public IExtension getExtension(Class<? extends IExtension> extension); |
110 |
|
111 |
/**
|
112 |
* 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 |
* 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 |
public String getText(Object obj, String msg); |
149 |
|
150 |
/**
|
151 |
* Translate the message key to the current language used
|
152 |
* in the application.
|
153 |
*
|
154 |
* @param msg key to translate
|
155 |
* @return message traslated or the key
|
156 |
*/
|
157 |
public String translate(String msg); |
158 |
|
159 |
/**
|
160 |
* Returns the main application folder, where the application is installed.
|
161 |
*
|
162 |
* @return the main application folder
|
163 |
*/
|
164 |
public File getApplicationFolder(); |
165 |
|
166 |
/**
|
167 |
* Returns the default folder with the installable package bundles.
|
168 |
*
|
169 |
* @return the default folder with the installable package bundles
|
170 |
*/
|
171 |
public File getInstallFolder(); |
172 |
|
173 |
/**
|
174 |
* Returns the application folder in the home of user.
|
175 |
*
|
176 |
* @return the main application folder
|
177 |
*/
|
178 |
public File getApplicationHomeFolder(); |
179 |
|
180 |
|
181 |
/**
|
182 |
* 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 |
|
188 |
/**
|
189 |
* Returns the plugins folder.
|
190 |
*
|
191 |
* @return the plugins folder
|
192 |
* @deprecated use {@link #getPluginsFolders()}
|
193 |
*/
|
194 |
public File getPluginsFolder(); |
195 |
|
196 |
/**
|
197 |
* Returns a list of folder on the plugins are instaleds.
|
198 |
*
|
199 |
* @return list of folders File of the plugins.
|
200 |
*/
|
201 |
public List<File> getPluginsFolders(); |
202 |
|
203 |
/**
|
204 |
* @deprecated @see {@link #getPluginsFolders()}
|
205 |
*/
|
206 |
public File getPluginsDirectory(); |
207 |
|
208 |
/**
|
209 |
* This method allows plugins register task to do before initializacion of
|
210 |
* all gvSIG plugins.
|
211 |
*
|
212 |
* Task with higher priority value are executed after.
|
213 |
*
|
214 |
* @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 |
*/
|
219 |
public void addStartupTask(String name, Runnable task, boolean in_event_thread, int priority); |
220 |
|
221 |
/**
|
222 |
* This method allows plugins register task to do after close the application.
|
223 |
*
|
224 |
* Task with higher priority value are executed after.
|
225 |
*
|
226 |
* @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 |
|
233 |
/**
|
234 |
* This method executes registered task to run before the initialization of
|
235 |
* all plugins.
|
236 |
* The tasks are sorted according to the priority and executed in a separated
|
237 |
* thread.
|
238 |
*
|
239 |
*/
|
240 |
public void executeStartupTasks(); |
241 |
|
242 |
/**
|
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 |
|
250 |
|
251 |
public FirewallConfiguration getFirewallConfiguration();
|
252 |
|
253 |
public Version getApplicationVersion();
|
254 |
|
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 |
/**
|
271 |
* Gets the temporary folder of the plugins framework.
|
272 |
*
|
273 |
* @return the temp folder
|
274 |
*/
|
275 |
public File getTempFolder(); |
276 |
|
277 |
/**
|
278 |
* Get the file name in the temporary folder of the plugins framework.
|
279 |
* @param name
|
280 |
* @return
|
281 |
*/
|
282 |
public File getTempFile(String name); |
283 |
|
284 |
/**
|
285 |
* Create a unique file name in the temporary folder of the plugins framework.
|
286 |
*
|
287 |
* @param name base name used for create the unique file name
|
288 |
* @param sufix to add the the unique file name
|
289 |
* @return
|
290 |
*/
|
291 |
public File getTempFile(String name, String sufix); |
292 |
|
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 |
public Arguments getArguments();
|
309 |
} |