1   /*
2    *  Resource.java
3    *
4    *  Copyright (c) 1998-2005, The University of Sheffield.
5    *
6    *  This file is part of GATE (see http://gate.ac.uk/), and is free
7    *  software, licenced under the GNU Library General Public License,
8    *  Version 2, June 1991 (in the distribution as file licence.html,
9    *  and also available at http://gate.ac.uk/gate/licence.html).
10   *
11   *  Hamish Cunningham, 11/Feb/2000
12   *
13   *  $Id: Resource.java,v 1.15 2005/01/11 13:51:30 ian Exp $
14   */
15  
16  package gate;
17  
18  import java.io.Serializable;
19  
20  import gate.creole.ResourceInstantiationException;
21  import gate.util.FeatureBearer;
22  import gate.util.NameBearer;
23  
24  /** Models all sorts of resources.
25    */
26  public interface Resource extends FeatureBearer, NameBearer, Serializable
27  {
28    /** Initialise this resource, and return it. */
29    public Resource init() throws ResourceInstantiationException;
30  
31    /** Clears the internal data of the resource, when it gets released **/
32    public void cleanup();
33  
34  
35    //Parameters utility methods
36    /**
37     * Gets the value of a parameter of this resource.
38     * @param paramaterName the name of the parameter
39     * @return the current value of the parameter
40     */
41    public Object getParameterValue(String paramaterName)
42                  throws ResourceInstantiationException;
43  
44    /**
45     * Sets the value for a specified parameter.
46     *
47     * @param paramaterName the name for the parameteer
48     * @param parameterValue the value the parameter will receive
49     */
50    public void setParameterValue(String paramaterName, Object parameterValue)
51                throws ResourceInstantiationException;
52  
53    /**
54     * Sets the values for more parameters in one step.
55     *
56     * @param parameters a {@link FeatureMap} that has parameter names as keys and
57     * parameter values as values.
58     */
59    public void setParameterValues(FeatureMap parameters)
60                throws ResourceInstantiationException;
61  
62  } // interface Resource
63