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 / ScriptingBaseScript.java @ 724

History | View | Annotate | Download (2 KB)

1
package org.gvsig.scripting;
2

    
3
import java.io.File;
4
import java.io.Writer;
5

    
6
import org.gvsig.tools.observer.WeakReferencingObservable;
7

    
8
/**
9
 * <p>
10
 * Interface that represents Scripting elements.</p>
11
 *
12
 * @see ScriptingUnit
13
 *
14
 * @see ScriptingScript
15
 * @see ScriptingDialog
16
 * @see ScriptingProject
17
 */
18
public interface ScriptingBaseScript extends ScriptingUnit, WeakReferencingObservable {
19

    
20
    public static final int ISOLATION_LOW = 0;
21
    public static final int ISOLATION_HIGH = 10;
22
    
23
    /**
24
     * Check if the script execution is enabled.
25
     *
26
     * @return if the script is enabled.
27
     */
28
    public boolean isEnabled();
29

    
30
    /**
31
     * Enable or disable the sript execution.
32
     *
33
     * @param enabled
34
     */
35
    public void setEnabled(boolean enabled);
36

    
37
    /**
38
     * Executes the code of a ScriptBaseScript.
39
     *
40
     * @return
41
     */
42
    public Object run();
43

    
44
    /**
45
     * Executes the code of a ScriptBaseScript.
46
     *
47
     * @param args Contains the input parameters to run the ScriptBaseScript.
48
     * @return
49
     */
50
    public Object run(Object args[]);
51

    
52
    /**
53
     * Executes the code of a ScriptBaseScript in a separated thread
54
     *
55
     * @param args Contains the input parameters to run the ScriptBaseScript.
56
     */
57
    public void runAsTask(Object args[]);
58

    
59
    public void compile() throws ScriptingRunningException;
60

    
61
    public void put(String name, Object value);
62

    
63
    /**
64
     * Return a resource File that is beside this script.
65
     *
66
     * @param filename
67
     * @return the file which is beside this script
68
     */
69
    public File getResource(String filename);
70

    
71
    public File getScriptFile();
72
  
73
    public String getLibrarySuffix();
74

    
75
    public void setLibrarySuffix(String librarySuffix);    
76
    
77
    public void addStdoutWriter(Writer out);
78
    
79
    public void addStderrWriter(Writer err);
80
    
81
    public void removeStdoutWriter(Writer out);
82
    
83
    public void removeStderrWriter(Writer err);
84
    
85
    public void setIsolation(int isolation);
86
    
87
    public int getIsolation();
88
}