Statistics
| Revision:

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

History | View | Annotate | Download (7.29 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.util.Iterator;
28
import java.util.List;
29

    
30
import org.gvsig.andami.firewall.FirewallConfiguration;
31
import org.gvsig.andami.impl.UnsavedDataException;
32
import org.gvsig.andami.plugins.ExclusiveUIExtension;
33
import org.gvsig.andami.plugins.IExtension;
34
import org.gvsig.andami.plugins.status.IUnsavedData;
35
import org.gvsig.installer.lib.api.PackageInfo;
36
import org.gvsig.installer.lib.api.Version;
37

    
38
public interface PluginsManager {
39

    
40
    /**
41
     * Return the associated pluginServices to the extension class passed as
42
     * parameter.
43
     *
44
     * @param extension
45
     * @return plugin services
46
     */
47
    public PluginServices getPlugin(Class<? extends IExtension> extension);
48

    
49
    /**
50
     * Return the associated pluginServices to the object passed as parameter.
51
     *
52
     * @param object
53
     * @return plugin services
54
     */
55
    public PluginServices getPlugin(Object obj);
56

    
57
    /**
58
     * Return the associated pluginServices to the extension plugin.
59
     *
60
     * @param pluginName, name of the plugin
61
     * @return plugin services
62
     */
63
    public PluginServices getPlugin(String pluginName);
64

    
65
    /**
66
     * Get the package info associated to the plugin of the extension.
67
     *
68
     * @param extension extension of the plugin
69
     * @return plugin package info
70
     */
71
    public PackageInfo getPackageInfo(Class<? extends IExtension> extension);
72

    
73
    /**
74
     * Get the package info associated to the plugin with the specified name.
75
     *
76
     * @param pluginName, name of the plugin
77
     * @return plugin package info
78
     */
79
    public PackageInfo getPackageInfo(String pluginName);
80

    
81
    /**
82
     * Get the package info associated to the application.
83
     *
84
     * @return application package info
85
     */
86
    public PackageInfo getPackageInfo();
87

    
88
    /**
89
     * Return the list of plugins loaded in the application
90
     *
91
     * @return list of plugins
92
     */
93
    public List<PluginServices> getPlugins();
94

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

    
105
    /**
106
     * Return an iterator over al extensions loaded in the application.
107
     *
108
     * @return iterator over extensions
109
     */
110
    public Iterator<IExtension> getExtensions();
111

    
112
    /**
113
     * Set an extension to control the visivility of all the extensions
114
     * of the application.
115
     *
116
     * @param extension
117
     */
118
    public void setExclusiveUIExtension(ExclusiveUIExtension extension);
119

    
120
    /**
121
     * Return the ExclusiveUIExtension installed in the application or
122
     * null.
123
     *
124
     * @return
125
     */
126
    public ExclusiveUIExtension getExclusiveUIExtension();
127

    
128
    /**
129
     * @deprecated use {@link #translate(String)}
130
     * @see {@link #translate(String)}
131
     */
132
    public String getText(Object obj, String msg);
133

    
134
    /**
135
     * Translate the message key to the current language used
136
     * in the application.
137
     *
138
     * @param msg key to translate
139
     * @return message traslated or the key
140
     */
141
    public String translate(String msg);
142

    
143
    /**
144
     * Returns the main application folder, where the application is installed.
145
     *
146
     * @return the main application folder
147
     */
148
    public File getApplicationFolder();
149

    
150
    /**
151
     * Returns the default folder with the installable package bundles.
152
     *
153
     * @return the default folder with the installable package bundles
154
     */
155
    public File getInstallFolder();
156

    
157
    /**
158
     * Returns the application folder in the home of user.
159
     *
160
     * @return the main application folder
161
     */
162
    public File getApplicationHomeFolder();
163

    
164

    
165
    /**
166
     * Returns the default folder where the internationalization files are installed.
167
     *
168
     * @return the default folder where the internationalization files are installed.
169
     */
170
    public File getApplicationI18nFolder();
171

    
172
    /**
173
     * Returns the plugins folder.
174
     *
175
     * @return the plugins folder
176
     * @deprecated use {@link #getPluginsFolders()}
177
     */
178
    public File getPluginsFolder();
179

    
180
    /**
181
     * Returns a list of folder on the plugins are instaleds.
182
     *
183
     * @return list of folders File of the plugins.
184
     */
185
    public List<File> getPluginsFolders();
186

    
187
    /**
188
     * @deprecated @see {@link #getPluginsFolders()}
189
     */
190
    public File getPluginsDirectory();
191

    
192
    /**
193
     * This method allows plugins register task to do before initializacion of
194
     * all gvSIG plugins.
195
     *
196
     * Task with higher priority value are executed after.
197
     *
198
     * @param name of the task
199
     * @param task runnable with the code of the task
200
     * @param in_event_thread, true if the task shoul run in the AWT event thread.
201
     * @param priority of the task.
202
     */
203
    public void addStartupTask(String name, Runnable task, boolean in_event_thread, int priority);
204

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

    
217
    /**
218
     * This method executes registered task to run before the initialization of
219
     * all plugins.
220
     * The tasks are sorted according to the priority and executed in a separated
221
     * thread.
222
     *
223
     */
224
    public void executeStartupTasks();
225

    
226
    /**
227
     * This method executes registered task to run after the close of the application.
228
     * The tasks are sorted according to the priority and executed in a separated
229
     * thread.
230
     *
231
     */
232
    public void executeShutdownTasks();
233

    
234

    
235
    public FirewallConfiguration getFirewallConfiguration();
236

    
237
    public Version getApplicationVersion();
238

    
239
    /**
240
     * Return a list of unsaved data
241
     *
242
     * @return
243
     */
244
    public List<IUnsavedData> getUnsavedData();
245

    
246
    /**
247
     * Save the provided unsaved data as parameter
248
     *
249
     * @param unsavedData
250
     * @throws UnsavedDataException
251
     */
252
    public void saveUnsavedData(List<IUnsavedData> unsavedData) throws UnsavedDataException;
253

    
254
}