Statistics
| Revision:

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

History | View | Annotate | Download (6.65 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.plugins.ExclusiveUIExtension;
31
import org.gvsig.andami.plugins.IExtension;
32
import org.gvsig.installer.lib.api.PackageInfo;
33

    
34
public interface PluginsManager {
35

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
160

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

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

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

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

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

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

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

    
230
}