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 |
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.packageutils.Version; |
8 |
import org.gvsig.tools.service.spi.ProviderFactory; |
9 |
import org.gvsig.tools.script.ScriptManager; |
10 |
import org.gvsig.tools.util.FolderSet; |
11 |
|
12 |
/**
|
13 |
* There are two top level management roles within ScriptingFramework: logical
|
14 |
* and User's Interface (UI) management.
|
15 |
*
|
16 |
* This class is responsible of the logical role. It provides all the services
|
17 |
* to manage the information used in ScriptingFramework.
|
18 |
*/
|
19 |
public interface ScriptingManager extends ScriptManager { |
20 |
|
21 |
public static final String INSTALLER_PROVIDER_NAME = "Script"; |
22 |
public static final String INSTALLER_PROVIDER_DESCRIPTION = "Provider to install scripts"; |
23 |
|
24 |
public static final String PYTHON_LANGUAGE_NAME = "python"; |
25 |
// public static final String SCALA_LANGUAGE_NAME = "scala";
|
26 |
public static final String DEFAULT_ISOLATION_GROUP = "default"; |
27 |
|
28 |
public static final String UNIT_SCRIPT = "Script"; |
29 |
public static final String UNIT_DIALOG = "Dialog"; |
30 |
public static final String UNIT_FOLDER = "Folder"; |
31 |
public static final String UNIT_EXTERNALFILE = "ExternalFile"; |
32 |
|
33 |
public void setHomeFolder(File home); |
34 |
|
35 |
public File getHomeFolder(); |
36 |
|
37 |
public File getDataFolder(String id); |
38 |
|
39 |
public void registerDataFolder(ScriptingFolder folderScript, String id); |
40 |
|
41 |
public List<DataFolderFound> searchOldVersions(Version currentVersion, FolderSet folder); |
42 |
|
43 |
/**
|
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 |
public ScriptingUnit createUnit(String unitType, ScriptingFolder folder, String id); |
62 |
|
63 |
public ScriptingUnit createUnit(String unitType, ScriptingFolder folder, String id, String language); |
64 |
|
65 |
public List<String> getUnitTypes(); |
66 |
|
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 |
public ScriptingBaseScript getScript(File file); |
77 |
|
78 |
public ScriptingBaseScript getScript(String name); |
79 |
|
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 |
public ScriptingFolder getFolder(File file); |
89 |
|
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 |
|
101 |
|
102 |
/**
|
103 |
* Returns the path of the User's Folder
|
104 |
*
|
105 |
* @return a String with the path of the User's Folder
|
106 |
*/
|
107 |
// public String getRootUserFolder();
|
108 |
/**
|
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 |
public void registerSystemFolder(String name, File folder); |
116 |
|
117 |
public List<String> getSupportedLanguages(); |
118 |
|
119 |
public String getExtensionOfLanguage(String language); |
120 |
|
121 |
public String getEngineNameByLanguage(String langName); |
122 |
|
123 |
public Set<String> getEnginesIsolationGroups(); |
124 |
|
125 |
/**
|
126 |
* 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 |
*/
|
135 |
public boolean validateUnitId(ScriptingFolder folder, String id); |
136 |
|
137 |
/**
|
138 |
* 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 |
*/
|
145 |
public void put(String key, Object value); |
146 |
|
147 |
/**
|
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 |
|
156 |
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 |
|
177 |
/**
|
178 |
* Search the available engines and initialize the manager.
|
179 |
*/
|
180 |
public void loadEngines(); |
181 |
|
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 |
|
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 |
public Map getExtendedProperties(); |
234 |
|
235 |
public ScriptingFolder createLink(String name, File link, String targetPathName); |
236 |
|
237 |
public ScriptingFolder createLink(String name, ScriptingFolder link, String targetPathName); |
238 |
} |