Statistics
| Revision:

gvsig-scripting / org.gvsig.scripting / trunk / org.gvsig.scripting / org.gvsig.scripting.lib / org.gvsig.scripting.lib.api / src / main / java / org / gvsig / scripting / ScriptingManager.java @ 1084

History | View | Annotate | Download (7.12 KB)

1 164 jobacas
package org.gvsig.scripting;
2
3
import java.io.File;
4 172 jobacas
import java.util.List;
5 669 jjdelcerro
import java.util.Map;
6 799 jjdelcerro
import java.util.Set;
7 1084 jjdelcerro
import org.gvsig.tools.packageutils.Version;
8 468 jjdelcerro
import org.gvsig.tools.service.spi.ProviderFactory;
9 630 jjdelcerro
import org.gvsig.tools.script.ScriptManager;
10 1084 jjdelcerro
import org.gvsig.tools.util.FolderSet;
11 164 jobacas
12
/**
13 468 jjdelcerro
 * There are two top level management roles within ScriptingFramework: logical
14
 * and User's Interface (UI) management.
15 164 jobacas
 *
16 468 jjdelcerro
 * This class is responsible of the logical role. It provides all the services
17
 * to manage the information used in ScriptingFramework.
18 164 jobacas
 */
19 630 jjdelcerro
public interface ScriptingManager extends ScriptManager {
20 407 jjdelcerro
21
    public static final String INSTALLER_PROVIDER_NAME = "Script";
22
    public static final String INSTALLER_PROVIDER_DESCRIPTION = "Provider to install scripts";
23
24 814 jjdelcerro
    public static final String PYTHON_LANGUAGE_NAME = "python";
25 1023 jjdelcerro
//    public static final String SCALA_LANGUAGE_NAME = "scala";
26 814 jjdelcerro
    public static final String DEFAULT_ISOLATION_GROUP = "default";
27
28 468 jjdelcerro
    public static final String UNIT_SCRIPT = "Script";
29
    public static final String UNIT_DIALOG = "Dialog";
30
    public static final String UNIT_FOLDER = "Folder";
31 702 jjdelcerro
    public static final String UNIT_EXTERNALFILE = "ExternalFile";
32 468 jjdelcerro
33
    public void setHomeFolder(File home);
34
35
    public File getHomeFolder();
36
37 975 jjdelcerro
    public File getDataFolder(String id);
38
39 1084 jjdelcerro
    public void registerDataFolder(ScriptingFolder folderScript, String id);
40
41
    public List<DataFolderFound> searchOldVersions(Version currentVersion, FolderSet folder);
42
43 468 jjdelcerro
    /**
44
     * Returns the System's Folder
45
     *
46
     * @return a {@link ScriptingFolder} with the System's Folder.
47
     */
48
    public ScriptingFolder getSystemFolder();
49
50
    /**
51
     * Returns the User's Folder
52
     *
53
     * @return a {@link ScriptingFolder} with the User's Folder.
54
     */
55
    public ScriptingFolder getUserFolder();
56
57
    public List<ScriptingFolder> getAlternativeUserFolders();
58
59
    public void addAlternativeUserFolder(File f, String name, String description);
60
61 172 jobacas
    public ScriptingUnit createUnit(String unitType, ScriptingFolder folder, String id);
62 441 jjdelcerro
63
    public ScriptingUnit createUnit(String unitType, ScriptingFolder folder, String id, String language);
64 630 jjdelcerro
65 172 jobacas
    public List<String> getUnitTypes();
66 468 jjdelcerro
67
    /**
68
     * Returns the {@link ScriptingBaseScript} associated with the file
69
     * specified
70
     *
71
     * @param file File where is contained the {@link ScriptingBaseScript}'s
72
     * information
73
     *
74
     * @return {@link ScriptingBaseScript}
75
     */
76 164 jobacas
    public ScriptingBaseScript getScript(File file);
77 172 jobacas
78 361 jjdelcerro
    public ScriptingBaseScript getScript(String name);
79 468 jjdelcerro
80
    /**
81
     * Returns the {@link ScriptingFolder} associated with the file specified
82
     *
83
     * @param file File where is contained the {@link ScriptingFolder}'s
84
     * information
85
     *
86
     * @return {@link ScriptingFolder}
87
     */
88 164 jobacas
    public ScriptingFolder getFolder(File file);
89 1084 jjdelcerro
90
    /**
91
     * Return the {@link ScriptingUnit} associated with the path specified.
92
     *
93
     * the path should start with "User" or "System".
94
     *
95
     * @param pathName
96
     *
97
     * @return the required {@link ScriptingUnit}
98
     */
99
    public ScriptingUnit getUnit(String pathName);
100 468 jjdelcerro
101 1084 jjdelcerro
102 468 jjdelcerro
    /**
103
     * Returns the path of the User's Folder
104
     *
105
     * @return a String with the path of the User's Folder
106
     */
107 301 jjdelcerro
//    public String getRootUserFolder();
108 468 jjdelcerro
    /**
109
     * Registers a File System with {@link ScriptingUnit}s in the SystemFolder
110
     *
111
     * @param name String with the identificator name of the File System
112
     * registered
113
     * @param folder File with the root of the File System to register
114
     */
115 164 jobacas
    public void registerSystemFolder(String name, File folder);
116 212 cordinyana
117 468 jjdelcerro
    public List<String> getSupportedLanguages();
118
119
    public String getExtensionOfLanguage(String language);
120
121
    public String getEngineNameByLanguage(String langName);
122 799 jjdelcerro
123
    public Set<String> getEnginesIsolationGroups();
124 468 jjdelcerro
125 212 cordinyana
    /**
126 468 jjdelcerro
     * Checks if an id is unique in a determinate folder
127
     *
128
     * @param folder {
129
     * @ScriptingFolder} with the directory to verify the id
130
     * @param id String with the id to validate
131
     *
132
     * @return true if there isn't another {@link ScriptingUnit} with the same
133
     * id, and false in the other case
134 212 cordinyana
     */
135 468 jjdelcerro
    public boolean validateUnitId(ScriptingFolder folder, String id);
136 212 cordinyana
137
    /**
138 468 jjdelcerro
     * Sets a key/value pair in the state of the ScriptingManager that may
139
     * either create a Java Language Binding to be used in the execution of
140
     * scripts
141
     *
142
     * @param key The name of named value to add
143
     * @param value The value of named value to add.
144 212 cordinyana
     */
145 468 jjdelcerro
    public void put(String key, Object value);
146 164 jobacas
147 468 jjdelcerro
    /**
148
     * Retrieves a value set in the state of this ScriptingManager
149
     *
150
     * @param key The key whose value is to be returned
151
     *
152
     * @return an Object with the value corresponding to the key
153
     */
154
    public Object get(String key);
155 301 jjdelcerro
156 468 jjdelcerro
    public void addLibFolder(File lib);
157
158
    public File getRootUserFolder();
159
160
    public ProviderFactory getInstallerFactory();
161
162
    /**
163
     * Devuelbe la carpeta en la que se encuentran los paquetes
164
     * de la aplicacion.
165
     *
166
     * @return
167
     */
168
    public File getPackagesFolder();
169
170
    /**
171
     * Establece la carpeta en la que se encuentran los paquetes
172
     * de la aplicacion.
173
     * @param folder
174
     */
175
    public void setPackagesFolder(File folder);
176 583 jjdelcerro
177
    /**
178 799 jjdelcerro
     * Search the available engines and initialize the manager.
179 583 jjdelcerro
     */
180
    public void loadEngines();
181 669 jjdelcerro
182
    public List<File> getLibFolders();
183
184
    /**
185
     * Return a map with the label and suffix of the library versions.
186
     *
187
     * For each value of map, the value is the name of the version (a label) and
188
     * the key is the suffix for that version.
189
     *
190
     * @return a map with suffix and labels of library versions.
191
     */
192
    public Map<String,String> getLibFoldersVersions();
193 724 jjdelcerro
194
    /**
195
     * <p>
196
     * Returns a reference to an object (property) associated to this layer.</p>
197
     *
198
     * <p>
199
     * For example, you can attach a network definition to key "network" and
200
     * check
201
     * if a layer has a network loaded using
202
     * <i>getAssociatedObject("network")</i> and
203
     * that it's not null.</p>
204
     *
205
     * @param key the key associated to the property
206
     *
207
     * @return <code>null</code> if key is not found
208
     *
209
     * @see #getExtendedProperties()
210
     * @see #setProperty(Object, Object)
211
     */
212
    public Object getProperty(Object key);
213
214
    /**
215
     * Inserts an object as a property to this layer.
216
     *
217
     * @param key the key associated to the property
218
     * @param obj the property
219
     *
220
     * @see #getProperty(Object)
221
     * @see #getExtendedProperties()
222
     */
223
    public void setProperty(Object key, Object obj);
224
225
    /**
226
     * Returns a hash map with all new properties associated to this layer.
227
     *
228
     * @return hash table with the added properties
229
     *
230
     * @see #getProperty(Object)
231
     * @see #setProperty(Object, Object)
232
     */
233 986 jjdelcerro
    public Map getExtendedProperties();
234 989 jjdelcerro
235
    public ScriptingFolder createLink(String name, File link, String targetPathName);
236
237
    public ScriptingFolder createLink(String name, ScriptingFolder link, String targetPathName);
238 164 jobacas
}