View Javadoc

1   /*
2    *  Copyright (C) 2004  The Concord Consortium, Inc.,
3    *  10 Concord Crossing, Concord, MA 01741
4    *
5    *  Web Site: http://www.concord.org
6    *  Email: info@concord.org
7    *
8    *  This library is free software; you can redistribute it and/or
9    *  modify it under the terms of the GNU Lesser General Public
10   *  License as published by the Free Software Foundation; either
11   *  version 2.1 of the License, or (at your option) any later version.
12   *
13   *  This library is distributed in the hope that it will be useful,
14   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16   *  Lesser General Public License for more details.
17   *
18   *  You should have received a copy of the GNU Lesser General Public
19   *  License along with this library; if not, write to the Free Software
20   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21   *
22   */
23  package net.sf.sail.core.activity.model;
24  
25  import javax.script.ScriptContext;
26  import javax.script.ScriptEngine;
27  import javax.script.ScriptException;
28  
29  /**
30   * @author eburke
31   *
32   * The Script interface defines the methods for manipulating the script text.
33   * It is responsible for keeping track of the ScriptEngine and related data.
34   * It also provides an evaluate method to which containing classes can delegate.
35    */
36  public interface IScript
37  {
38      /**
39       * evaluate - evaluates the script text relative to the script engine
40       * assigned at creation time. Will compile the script if the engine
41       * is Compilable.
42       * @return
43       * @throws ScriptException
44       */
45      public Object evaluate()
46      throws ScriptException;
47  
48      /**
49       * getText 
50       * @return - the script text
51       */
52      public String getText();
53  
54      /**
55       * setText - set the script text string
56       * @param text - the script text
57       */
58      public void setText(String text);
59  
60      /**
61       * getScriptEngine
62       * @return - the ScriptEngine for this script, provided at Script creation
63       */
64      public ScriptEngine getScriptEngine();
65   
66      /**
67       * getScriptContext
68       * @return - the ScriptContext for this script. Determined by the
69       * ScriptEngine provided when the Script was created.
70       */
71      public ScriptContext getScriptContext();
72  }