Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.framework / org.gvsig.andami / src / main / java / org / gvsig / andami / PluginsManager.java @ 43328

History | View | Annotate | Download (8.58 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
    /**
70
     * Get the package info associated to the plugin of the extension.
71
     *
72
     * @param extension extension of the plugin
73
     * @return plugin package info
74
     */
75
    public PackageInfo getPackageInfo(Class<? extends IExtension> extension);
76

    
77
    /**
78
     * Get the package info associated to the plugin with the specified name.
79
     *
80
     * @param pluginName, name of the plugin
81
     * @return plugin package info
82
     */
83
    public PackageInfo getPackageInfo(String pluginName);
84

    
85
    /**
86
     * Get the package info associated to the application.
87
     *
88
     * @return application package info
89
     */
90
    public PackageInfo getPackageInfo();
91

    
92
    /**
93
     * Return the list of plugins loaded in the application
94
     *
95
     * @return list of plugins
96
     */
97
    public List<PluginServices> getPlugins();
98

    
99
    /**
100
     * Gets the instance of the extension whose class is provided.
101
     *
102
     * @param extension, class of the extension to retrieve
103
     *
104
     * @return The instance of the extension, or null if the instance does
105
     * not exist.
106
     */
107
    public IExtension getExtension(Class<? extends IExtension> extension);
108

    
109
    /**
110
     * Gets the instance of the extension whose class name is provided.
111
     *
112
     * @param extension, class name of the extension to retrieve
113
     *
114
     * @return The instance of the extension, or null if the instance does
115
     * not exist.
116
     */
117
    public IExtension getExtension(String extension);
118
    
119
    /**
120
     * Return an iterator over al extensions loaded in the application.
121
     *
122
     * @return iterator over extensions
123
     */
124
    public Iterator<IExtension> getExtensions();
125

    
126
    /**
127
     * Set an extension to control the visivility of all the extensions
128
     * of the application.
129
     *
130
     * @param extension
131
     */
132
    public void setExclusiveUIExtension(ExclusiveUIExtension extension);
133

    
134
    /**
135
     * Return the ExclusiveUIExtension installed in the application or
136
     * null.
137
     *
138
     * @return
139
     */
140
    public ExclusiveUIExtension getExclusiveUIExtension();
141

    
142
    /**
143
     * @deprecated use {@link #translate(String)}
144
     * @see {@link #translate(String)}
145
     */
146
    public String getText(Object obj, String msg);
147

    
148
    /**
149
     * Translate the message key to the current language used
150
     * in the application.
151
     *
152
     * @param msg key to translate
153
     * @return message traslated or the key
154
     */
155
    public String translate(String msg);
156

    
157
    /**
158
     * Returns the main application folder, where the application is installed.
159
     *
160
     * @return the main application folder
161
     */
162
    public File getApplicationFolder();
163

    
164
    /**
165
     * Returns the default folder with the installable package bundles.
166
     *
167
     * @return the default folder with the installable package bundles
168
     */
169
    public File getInstallFolder();
170

    
171
    /**
172
     * Returns the application folder in the home of user.
173
     *
174
     * @return the main application folder
175
     */
176
    public File getApplicationHomeFolder();
177

    
178

    
179
    /**
180
     * Returns the default folder where the internationalization files are installed.
181
     *
182
     * @return the default folder where the internationalization files are installed.
183
     */
184
    public File getApplicationI18nFolder();
185

    
186
    /**
187
     * Returns the plugins folder.
188
     *
189
     * @return the plugins folder
190
     * @deprecated use {@link #getPluginsFolders()}
191
     */
192
    public File getPluginsFolder();
193

    
194
    /**
195
     * Returns a list of folder on the plugins are instaleds.
196
     *
197
     * @return list of folders File of the plugins.
198
     */
199
    public List<File> getPluginsFolders();
200

    
201
    /**
202
     * @deprecated @see {@link #getPluginsFolders()}
203
     */
204
    public File getPluginsDirectory();
205

    
206
    /**
207
     * This method allows plugins register task to do before initializacion of
208
     * all gvSIG plugins.
209
     *
210
     * Task with higher priority value are executed after.
211
     *
212
     * @param name of the task
213
     * @param task runnable with the code of the task
214
     * @param in_event_thread, true if the task shoul run in the AWT event thread.
215
     * @param priority of the task.
216
     */
217
    public void addStartupTask(String name, Runnable task, boolean in_event_thread, int priority);
218

    
219
    /**
220
     * This method allows plugins register task to do after close the application.
221
     *
222
     * Task with higher priority value are executed after.
223
     *
224
     * @param name of the task
225
     * @param task runnable with the code of the task
226
     * @param in_event_thread, true if the task shoul run in the AWT event thread.
227
     * @param priority of the task.
228
     */
229
    public void addShutdownTask(String name, Runnable task, boolean in_event_thread, int priority);
230

    
231
    /**
232
     * This method executes registered task to run before the initialization of
233
     * all plugins.
234
     * The tasks are sorted according to the priority and executed in a separated
235
     * thread.
236
     *
237
     */
238
    public void executeStartupTasks();
239

    
240
    /**
241
     * This method executes registered task to run after the close of the application.
242
     * The tasks are sorted according to the priority and executed in a separated
243
     * thread.
244
     *
245
     */
246
    public void executeShutdownTasks();
247

    
248

    
249
    public FirewallConfiguration getFirewallConfiguration();
250

    
251
    public Version getApplicationVersion();
252

    
253
    /**
254
     * Return a list of unsaved data
255
     *
256
     * @return
257
     */
258
    public List<IUnsavedData> getUnsavedData();
259

    
260
    /**
261
     * Save the provided unsaved data as parameter
262
     *
263
     * @param unsavedData
264
     * @throws UnsavedDataException
265
     */
266
    public void saveUnsavedData(List<IUnsavedData> unsavedData) throws UnsavedDataException;
267

    
268
    /**
269
     * Gets the temporary folder of the plugins framework.
270
     *
271
     * @return the temp folder
272
     */
273
    public File getTempFolder();
274

    
275
    /**
276
     * Get the file name in the temporary folder of the plugins framework.
277
     * @param name
278
     * @return
279
     */
280
    public File getTempFile(String name);
281

    
282
    /**
283
     * Create a unique file name in the temporary folder of the plugins framework.
284
     *
285
     * @param name base name used for create the unique file name
286
     * @param sufix to add the the unique file name
287
     * @return
288
     */
289
    public File getTempFile(String name, String sufix);
290

    
291
    /**
292
     * Browses to a given URI
293
     * @param uri
294
     * @return
295
     */
296
    public boolean desktopBrowse(URI uri);
297

    
298
    /**
299
     * Open a given file
300
     * @param file
301
     * @return
302
     */
303
    public boolean desktopOpen(File file);
304

    
305

    
306
    public Arguments getArguments();
307
}