Statistics
| Revision:

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

History | View | Annotate | Download (6.76 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
import java.util.Locale;
30

    
31
import org.gvsig.andami.plugins.ExclusiveUIExtension;
32
import org.gvsig.andami.plugins.IExtension;
33
import org.gvsig.installer.lib.api.PackageInfo;
34

    
35
public interface PluginsManager {
36

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

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

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

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

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

    
78
    /**
79
     * Get the package info associated to the application.
80
     *
81
     * @return application package info
82
     */
83
    public PackageInfo getPackageInfo();
84

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

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

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

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

    
117
    /**
118
     * Return the ExclusiveUIExtension installed in the application or
119
     * null.
120
     *
121
     * @return
122
     */
123
    public ExclusiveUIExtension getExclusiveUIExtension();
124

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

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

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

    
147
    /**
148
     * Returns the default folder with the installable package bundles.
149
     *
150
     * @return the default folder with the installable package bundles
151
     */
152
    public File getInstallFolder();
153

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

    
161

    
162
    /**
163
     * Returns the default folder where the internationalization files are installed.
164
     *
165
     * @return the default folder where the internationalization files are installed.
166
     */
167
    public File getApplicationI18nFolder();
168
    
169
    /**
170
     * Returns the plugins folder.
171
     *
172
     * @return the plugins folder
173
     * @deprecated use {@link #getPluginsFolders()}
174
     */
175
    public File getPluginsFolder();
176

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

    
184
    /**
185
     * @deprecated @see {@link #getPluginsFolders()}
186
     */
187
    public File getPluginsDirectory();
188

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

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

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

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

    
231
    public Locale getCurrentLocale();
232
    
233
    public void setCurrentLocale(Locale locale);
234
}