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

History | View | Annotate | Download (4.77 KB)

1
package org.gvsig.scripting;
2

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

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

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

    
23
    public static final String HELP_INSTALLER_PROVIDER_NAME = "ScriptHelp";
24
    public static final String HELP_INSTALLER_PROVIDER_DESCRIPTION = "Provider to install scripting help";
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

    
30
    public void setHomeFolder(File home);
31

    
32
    public File getHomeFolder();
33

    
34
    /**
35
     * Returns the System's Folder
36
     *
37
     * @return a {@link ScriptingFolder} with the System's Folder.
38
     */
39
    public ScriptingFolder getSystemFolder();
40

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

    
48
    public List<ScriptingFolder> getAlternativeUserFolders();
49

    
50
    public void addAlternativeUserFolder(File f, String name, String description);
51

    
52
    public ScriptingUnit createUnit(String unitType, ScriptingFolder folder, String id);
53

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

    
56
    public List<String> getUnitTypes();
57

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

    
69
    public ScriptingBaseScript getScript(String name);
70

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

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

    
96
    public List<String> getSupportedLanguages();
97

    
98
    public String getExtensionOfLanguage(String language);
99

    
100
    public String getEngineNameByLanguage(String langName);
101

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

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

    
124
    /**
125
     * Retrieves a value set in the state of this ScriptingManager
126
     *
127
     * @param key The key whose value is to be returned
128
     *
129
     * @return an Object with the value corresponding to the key
130
     */
131
    public Object get(String key);
132

    
133
    /**
134
     * Gets the Help manager
135
     *
136
     * @return a {@link ScriptingHelpManager}
137
     *
138
     * @see ScriptingHelpManager
139
     */
140
    public ScriptingHelpManager getHelpManager();
141

    
142
    public void addLibFolder(File lib);
143

    
144
    public File getRootUserFolder();
145
    
146
    public ProviderFactory getInstallerFactory();
147
    
148
    public ProviderFactory getHelpInstallerFactory();
149
    
150
    /**
151
     * Devuelbe la carpeta en la que se encuentran los paquetes
152
     * de la aplicacion.
153
     * 
154
     * @return 
155
     */
156
    public File getPackagesFolder();
157
    
158
    /**
159
     * Establece la carpeta en la que se encuentran los paquetes
160
     * de la aplicacion.
161
     * @param folder 
162
     */
163
    public void setPackagesFolder(File folder);
164
}