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

History | View | Annotate | Download (6.5 KB)

1
package org.gvsig.scripting;
2

    
3
import java.io.File;
4
import java.util.List;
5
import java.util.Map;
6

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

    
17
    public static final String INSTALLER_PROVIDER_NAME = "Script";
18
    public static final String INSTALLER_PROVIDER_DESCRIPTION = "Provider to install scripts";
19

    
20
        
21
        public static final String UNIT_SCRIPT = "Script";
22
        public static final String UNIT_DIALOG = "Dialog";
23
        public static final String UNIT_PROJECT = "Project";
24
        public static final String UNIT_FOLDER = "Folder";
25
        
26
        
27
        public void setHomeFolder(File home);
28
        
29
        public File getHomeFolder();
30
        
31
        /**
32
         * Returns the System's Folder
33
         * 
34
         * @return a {@link ScriptingFolder} with the System's Folder.
35
         */
36
        public ScriptingFolder getSystemFolder();
37
        
38
        /**
39
         * Returns the User's Folder
40
         * 
41
         * @return a {@link ScriptingFolder} with the User's Folder.
42
         */
43
        public ScriptingFolder getUserFolder();
44
        
45
        public List<ScriptingFolder> getAlternativeUserFolders();
46
        
47
        public void addAlternativeUserFolder(File f,String name, String description);
48
        
49
        /**
50
         * Sets a new path to the User's Folder
51
         * 
52
         * @param path a String with the new path to the User's Folder
53
         */
54
//        public void setRootUserFolder(String path);
55
        
56
        /**
57
         * Creates a new instance of {@link ScriptingScript} named as the id and in the directory specified
58
         * 
59
         * @param folder {@link ScriptingFolder} with the destiny directory information
60
         * @param id String with the identificator of the {@link ScriptingScript} created
61
         * 
62
         * @return the new {@link ScriptingScript}
63
         * @deprecated see {@link #createUnit(String, ScriptingFolder, String)}
64
         */
65
        @Deprecated
66
    public ScriptingScript createScript(ScriptingFolder folder, String id);
67
        
68
        /**
69
         * Creates a new instance of {@link ScriptingProject} named as the id and in the directory specified
70
         * 
71
         * @param folder {@link ScriptingFolder} with the destiny directory information
72
         * @param id String with the identificator of the {@link ScriptingProject} created
73
         * 
74
         * @return the new {@link ScriptingProject}
75
         * @deprecated see {@link #createUnit(String, ScriptingFolder, String)}
76
         */
77
        @Deprecated
78
    public ScriptingProject createProject(ScriptingFolder folder, String id);
79
        
80
        /**
81
         * Creates a new instance of {@link ScriptingDialog} named as the id and in the directory specified
82
         * 
83
         * @param folder {@link ScriptingFolder} with the destiny directory information
84
         * @param id String with the identificator of the {@link ScriptingDialog} created
85
         * 
86
         * @return the new {@link ScriptingDialog}
87
         * @deprecated see {@link #createUnit(String, ScriptingFolder, String)}
88
         */
89
        @Deprecated
90
    public ScriptingDialog createDialog(ScriptingFolder folder, String id);
91
        
92
        /**
93
         * Creates a new instance of {@link ScriptingFolder} named as the id and in the directory specified
94
         * 
95
         * @param folder {@link ScriptingFolder} with the destiny directory information
96
         * @param id String with the identificator of the {@link ScriptingFolder} created
97
         * 
98
         * @return the new {@link ScriptingFolder}
99
         * @deprecated see {@link #createUnit(String, ScriptingFolder, String)}
100
         */
101
        @Deprecated
102
    public ScriptingFolder createFolder(ScriptingFolder folder, String id);
103
        
104
    public ScriptingUnit createUnit(String unitType, ScriptingFolder folder, String id);
105

    
106
    public ScriptingUnit createUnit(String unitType, ScriptingFolder folder, String id, String language);
107
    
108
    public List<String> getUnitTypes();
109
    
110
        /**
111
         * Returns the {@link ScriptingBaseScript} associated with the file specified
112
         * 
113
         * @param file File where is contained the {@link ScriptingBaseScript}'s information
114
         * 
115
         * @return {@link ScriptingBaseScript}
116
         */
117
    public ScriptingBaseScript getScript(File file);
118

    
119
    public ScriptingBaseScript getScript(String name);
120
        /**
121
         * Returns the {@link ScriptingFolder} associated with the file specified
122
         * 
123
         * @param file File where is contained the {@link ScriptingFolder}'s information
124
         * 
125
         * @return {@link ScriptingFolder}
126
         */
127
    public ScriptingFolder getFolder(File file);
128
    
129
        /**
130
         * Returns the path of the User's Folder
131
         * 
132
         * @return a String with the path of the User's Folder 
133
         */
134
//    public String getRootUserFolder();
135
    
136
        /**
137
         * Registers a File System with {@link ScriptingUnit}s in the SystemFolder
138
         * 
139
         * @param name String with the identificator name of the File System registered
140
         * @param folder File with the root of the File System to register
141
         */
142
    public void registerSystemFolder(String name, File folder);
143

    
144
    /**
145
     * Gets all the supported Language by their extensions associated with each
146
     * one.
147
     * 
148
     * @return a Map with the pairs <key,value> where the key is a String with
149
     *         the extension and the value is the Language associated
150
     */
151
    public Map<String, String> getSupportedLanguagesByExtension();
152

    
153
    /**
154
     * Gets all the supported Language and the extensions associated with each
155
     * one.
156
     * 
157
     * @return a Map with the pairs <key,value> where the key is a String with
158
     *         the Language and the value is the extension associated
159
     */
160
        public Map<String, String> getExtensionsByLanguages();
161
        
162
        /**
163
         * Checks if an id is unique in a determinate folder
164
         * 
165
         * @param folder {@ScriptingFolder} with the directory to verify the id
166
         * @param id String with the id to validate
167
         * 
168
         * @return true if there isn't another {@link ScriptingUnit} with the same id, and false in the other case
169
         */
170
        public boolean validateUnitId(ScriptingFolder folder, String id);
171
        
172

    
173
        /**
174
         * Sets a key/value pair in the state of the ScriptingManager that may
175
         * either create a Java Language Binding to be used in the 
176
         * execution of scripts
177
         * 
178
         * @param key The name of named value to add
179
         * @param value The value of named value to add. 
180
         */
181
        public void put(String key, Object value);
182
        
183
        /**
184
         * Retrieves a value set in the state of this ScriptingManager
185
         * 
186
         * @param key The key whose value is to be returned 
187
         * 
188
         * @return an Object with the value corresponding to the key
189
         */
190
        public Object get(String key);
191
        
192
        /**
193
         * Gets the Help manager 
194
         * 
195
         * @return a {@link ScriptingHelpManager}
196
         * 
197
         * @see ScriptingHelpManager
198
         */
199
        public ScriptingHelpManager getHelpManager();
200

    
201
        public void addLibFolder(File lib);
202

    
203
        public File getRootUserFolder();        
204
}