Revision 468 org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.lib/org.gvsig.scripting.lib.api/src/main/java/org/gvsig/scripting/ScriptingManager.java

View differences:

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

  
7 8
/**
8
 * There are two top level management roles within ScriptingFramework: logical and User's Interface (UI) management.
9
 * There are two top level management roles within ScriptingFramework: logical
10
 * and User's Interface (UI) management.
9 11
 *
10
 * This class is responsible of the logical role. It provides all the services to manage the information used in ScriptingFramework. 
12
 * This class is responsible of the logical role. It provides all the services
13
 * to manage the information used in ScriptingFramework.
11 14
 *
12 15
 * @see ScriptingUIManager
13 16
 * @see ScriptingHelpManager
......
17 20
    public static final String INSTALLER_PROVIDER_NAME = "Script";
18 21
    public static final String INSTALLER_PROVIDER_DESCRIPTION = "Provider to install scripts";
19 22

  
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
	
23
    public static final String UNIT_SCRIPT = "Script";
24
    public static final String UNIT_DIALOG = "Dialog";
25
    public static final String UNIT_FOLDER = "Folder";
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

  
104 49
    public ScriptingUnit createUnit(String unitType, ScriptingFolder folder, String id);
105 50

  
106 51
    public ScriptingUnit createUnit(String unitType, ScriptingFolder folder, String id, String language);
107
    
52

  
108 53
    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
	 */
54

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

  
119 66
    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
	 */
67

  
68
    /**
69
     * Returns the {@link ScriptingFolder} associated with the file specified
70
     *
71
     * @param file File where is contained the {@link ScriptingFolder}'s
72
     * information
73
     *
74
     * @return {@link ScriptingFolder}
75
     */
127 76
    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
	 */
77

  
78
    /**
79
     * Returns the path of the User's Folder
80
     *
81
     * @return a String with the path of the User's Folder
82
     */
134 83
//    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
	 */
84
    /**
85
     * Registers a File System with {@link ScriptingUnit}s in the SystemFolder
86
     *
87
     * @param name String with the identificator name of the File System
88
     * registered
89
     * @param folder File with the root of the File System to register
90
     */
142 91
    public void registerSystemFolder(String name, File folder);
143 92

  
93
    public List<String> getSupportedLanguages();
94

  
95
    public String getExtensionOfLanguage(String language);
96

  
97
    public String getEngineNameByLanguage(String langName);
98

  
144 99
    /**
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
100
     * Checks if an id is unique in a determinate folder
101
     *
102
     * @param folder {
103
     * @ScriptingFolder} with the directory to verify the id
104
     * @param id String with the id to validate
105
     *
106
     * @return true if there isn't another {@link ScriptingUnit} with the same
107
     * id, and false in the other case
150 108
     */
151
    public Map<String, String> getSupportedLanguagesByExtension();
109
    public boolean validateUnitId(ScriptingFolder folder, String id);
152 110

  
153 111
    /**
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
112
     * Sets a key/value pair in the state of the ScriptingManager that may
113
     * either create a Java Language Binding to be used in the execution of
114
     * scripts
115
     *
116
     * @param key The name of named value to add
117
     * @param value The value of named value to add.
159 118
     */
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
	
119
    public void put(String key, Object value);
172 120

  
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();
121
    /**
122
     * Retrieves a value set in the state of this ScriptingManager
123
     *
124
     * @param key The key whose value is to be returned
125
     *
126
     * @return an Object with the value corresponding to the key
127
     */
128
    public Object get(String key);
200 129

  
201
	public void addLibFolder(File lib);
130
    /**
131
     * Gets the Help manager
132
     *
133
     * @return a {@link ScriptingHelpManager}
134
     *
135
     * @see ScriptingHelpManager
136
     */
137
    public ScriptingHelpManager getHelpManager();
202 138

  
203
	public File getRootUserFolder();	
139
    public void addLibFolder(File lib);
140

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

Also available in: Unified diff