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 @ 989

History | View | Annotate | Download (6.57 KB)

1
package org.gvsig.scripting;
2

    
3
import java.io.File;
4
import java.util.List;
5
import java.util.Map;
6
import java.util.Set;
7
import org.gvsig.tools.service.spi.ProviderFactory;
8
import org.gvsig.tools.script.ScriptManager;
9

    
10
/**
11
 * There are two top level management roles within ScriptingFramework: logical
12
 * and User's Interface (UI) management.
13
 *
14
 * This class is responsible of the logical role. It provides all the services
15
 * to manage the information used in ScriptingFramework.
16
 */
17
public interface ScriptingManager extends ScriptManager {
18

    
19
    public static final String INSTALLER_PROVIDER_NAME = "Script";
20
    public static final String INSTALLER_PROVIDER_DESCRIPTION = "Provider to install scripts";
21

    
22
    public static final String PYTHON_LANGUAGE_NAME = "python";
23
    public static final String SCALA_LANGUAGE_NAME = "scala";
24
    public static final String DEFAULT_ISOLATION_GROUP = "default";
25
    
26
    public static final String UNIT_SCRIPT = "Script";
27
    public static final String UNIT_DIALOG = "Dialog";
28
    public static final String UNIT_FOLDER = "Folder";
29
    public static final String UNIT_EXTERNALFILE = "ExternalFile";
30

    
31
    public void setHomeFolder(File home);
32

    
33
    public File getHomeFolder();
34

    
35
    public File getDataFolder(String id);
36
    
37
    /**
38
     * Returns the System's Folder
39
     *
40
     * @return a {@link ScriptingFolder} with the System's Folder.
41
     */
42
    public ScriptingFolder getSystemFolder();
43

    
44
    /**
45
     * Returns the User's Folder
46
     *
47
     * @return a {@link ScriptingFolder} with the User's Folder.
48
     */
49
    public ScriptingFolder getUserFolder();
50

    
51
    public List<ScriptingFolder> getAlternativeUserFolders();
52

    
53
    public void addAlternativeUserFolder(File f, String name, String description);
54

    
55
    public ScriptingUnit createUnit(String unitType, ScriptingFolder folder, String id);
56

    
57
    public ScriptingUnit createUnit(String unitType, ScriptingFolder folder, String id, String language);
58
    
59
    public List<String> getUnitTypes();
60

    
61
    /**
62
     * Returns the {@link ScriptingBaseScript} associated with the file
63
     * specified
64
     *
65
     * @param file File where is contained the {@link ScriptingBaseScript}'s
66
     * information
67
     *
68
     * @return {@link ScriptingBaseScript}
69
     */
70
    public ScriptingBaseScript getScript(File file);
71

    
72
    public ScriptingBaseScript getScript(String name);
73

    
74
    /**
75
     * Returns the {@link ScriptingFolder} associated with the file specified
76
     *
77
     * @param file File where is contained the {@link ScriptingFolder}'s
78
     * information
79
     *
80
     * @return {@link ScriptingFolder}
81
     */
82
    public ScriptingFolder getFolder(File file);
83

    
84
    /**
85
     * Returns the path of the User's Folder
86
     *
87
     * @return a String with the path of the User's Folder
88
     */
89
//    public String getRootUserFolder();
90
    /**
91
     * Registers a File System with {@link ScriptingUnit}s in the SystemFolder
92
     *
93
     * @param name String with the identificator name of the File System
94
     * registered
95
     * @param folder File with the root of the File System to register
96
     */
97
    public void registerSystemFolder(String name, File folder);
98

    
99
    public List<String> getSupportedLanguages();
100

    
101
    public String getExtensionOfLanguage(String language);
102

    
103
    public String getEngineNameByLanguage(String langName);
104
    
105
    public Set<String> getEnginesIsolationGroups();
106

    
107
    /**
108
     * Checks if an id is unique in a determinate folder
109
     *
110
     * @param folder {
111
     * @ScriptingFolder} with the directory to verify the id
112
     * @param id String with the id to validate
113
     *
114
     * @return true if there isn't another {@link ScriptingUnit} with the same
115
     * id, and false in the other case
116
     */
117
    public boolean validateUnitId(ScriptingFolder folder, String id);
118

    
119
    /**
120
     * Sets a key/value pair in the state of the ScriptingManager that may
121
     * either create a Java Language Binding to be used in the execution of
122
     * scripts
123
     *
124
     * @param key The name of named value to add
125
     * @param value The value of named value to add.
126
     */
127
    public void put(String key, Object value);
128

    
129
    /**
130
     * Retrieves a value set in the state of this ScriptingManager
131
     *
132
     * @param key The key whose value is to be returned
133
     *
134
     * @return an Object with the value corresponding to the key
135
     */
136
    public Object get(String key);
137

    
138
    public void addLibFolder(File lib);
139

    
140
    public File getRootUserFolder();
141
    
142
    public ProviderFactory getInstallerFactory();
143
    
144
    /**
145
     * Devuelbe la carpeta en la que se encuentran los paquetes
146
     * de la aplicacion.
147
     * 
148
     * @return 
149
     */
150
    public File getPackagesFolder();
151
    
152
    /**
153
     * Establece la carpeta en la que se encuentran los paquetes
154
     * de la aplicacion.
155
     * @param folder 
156
     */
157
    public void setPackagesFolder(File folder);
158
    
159
    /**
160
     * Search the available engines and initialize the manager.
161
     */
162
    public void loadEngines();
163
    
164
    public List<File> getLibFolders();
165
    
166
    /**
167
     * Return a map with the label and suffix of the library versions.
168
     * 
169
     * For each value of map, the value is the name of the version (a label) and
170
     * the key is the suffix for that version.
171
     * 
172
     * @return a map with suffix and labels of library versions. 
173
     */
174
    public Map<String,String> getLibFoldersVersions();
175
    
176
    /**
177
     * <p>
178
     * Returns a reference to an object (property) associated to this layer.</p>
179
     *
180
     * <p>
181
     * For example, you can attach a network definition to key "network" and
182
     * check
183
     * if a layer has a network loaded using
184
     * <i>getAssociatedObject("network")</i> and
185
     * that it's not null.</p>
186
     *
187
     * @param key the key associated to the property
188
     *
189
     * @return <code>null</code> if key is not found
190
     *
191
     * @see #getExtendedProperties()
192
     * @see #setProperty(Object, Object)
193
     */
194
    public Object getProperty(Object key);
195

    
196
    /**
197
     * Inserts an object as a property to this layer.
198
     *
199
     * @param key the key associated to the property
200
     * @param obj the property
201
     *
202
     * @see #getProperty(Object)
203
     * @see #getExtendedProperties()
204
     */
205
    public void setProperty(Object key, Object obj);
206

    
207
    /**
208
     * Returns a hash map with all new properties associated to this layer.
209
     *
210
     * @return hash table with the added properties
211
     *
212
     * @see #getProperty(Object)
213
     * @see #setProperty(Object, Object)
214
     */
215
    public Map getExtendedProperties();   
216
    
217
    public ScriptingFolder createLink(String name, File link, String targetPathName);
218

    
219
    public ScriptingFolder createLink(String name, ScriptingFolder link, String targetPathName);
220
}